Index: Makefile.in
===================================================================
--- Makefile.in	(revision 24526)
+++ Makefile.in	(working copy)
@@ -306,6 +306,7 @@ endif
 ifneq ($(UCLIBC_SUSV3_LEGACY),y)
 	# Remove timeb.h since the LEGACY ftime() was disabled upon request
 	$(RM) $(PREFIX)$(DEVEL_PREFIX)include/sys/timeb.h
+	$(RM) $(PREFIX)$(DEVEL_PREFIX)include/ucontext.h
 endif
 ifneq ($(UCLIBC_HAS_EPOLL),y)
 	# Remove epoll.h since epoll_*() were disabled upon request
Index: libm/Makefile.in
===================================================================
--- libm/Makefile.in	(revision 24526)
+++ libm/Makefile.in	(working copy)
@@ -69,13 +69,16 @@ libm_CSRC := \
 	s_tanh.c s_trunc.c w_acos.c w_acosh.c w_asin.c w_atan2.c w_atanh.c \
 	w_cabs.c w_cosh.c w_drem.c w_exp.c w_fmod.c w_gamma.c \
 	w_hypot.c w_j0.c w_j1.c w_jn.c w_lgamma.c w_lgamma_r.c \
-	w_log.c w_log2.c w_log10.c w_pow.c w_remainder.c w_scalb.c w_sinh.c \
+	w_log.c w_log2.c w_log10.c w_pow.c w_remainder.c w_sinh.c \
 	w_sqrt.c nan.c carg.c s_llrint.c \
 	s_fpclassify.c s_fpclassifyf.c s_signbit.c s_signbitf.c \
 	s_isnan.c s_isnanf.c s_isinf.c s_isinff.c s_finitef.c \
 	s_fdim.c s_fma.c s_fmax.c s_fmin.c s_nearbyint.c \
 	s_remquo.c s_scalbln.c w_exp2.c w_tgamma.c
 # REMOVED: w_gamma_r.c
+ifeq ($(UCLIBC_SUSV3_LEGACY),y)
+libm_CSRC += w_scalb.c
+endif
 FL_MOBJ := \
 	acosf.o acoshf.o asinf.o asinhf.o atan2f.o atanf.o atanhf.o cbrtf.o \
 	ceilf.o copysignf.o cosf.o coshf.o erfcf.o erff.o exp2f.o expf.o \
Index: extra/Configs/Config.in
===================================================================
--- extra/Configs/Config.in	(revision 24526)
+++ extra/Configs/Config.in	(working copy)
@@ -511,10 +511,19 @@ config COMPAT_ATEXIT
 config UCLIBC_SUSV3_LEGACY
 	bool "Enable SuSv3 LEGACY functions"
 	default n
+	#vfork,
 	help
 	  Enable this option if you want to have SuSv3 LEGACY functions
 	  in the library, else they are replaced by SuSv3 proposed macros.
-	  Currently applies to bcopy/bzero/bcmp/index/rindex/ftime.
+	  Currently applies to:
+
+	  bcmp, bcopy, bzero, index, rindex, ftime,
+	  bsd_signal, (ecvt), (fcvt), gcvt, (getcontext),
+	  gethostbyaddr, gethostbyname, (getwd), h_errno, (makecontext),
+	  mktemp, (pthread_attr_getstackaddr), (pthread_attr_setstackaddr),
+	  scalb, (setcontext), (swapcontext), ualarm, usleep,
+	  wcswcs.
+
 	  WARNING! ABI incompatibility.
 
 config UCLIBC_SUSV3_LEGACY_MACROS
@@ -525,6 +534,27 @@ config UCLIBC_SUSV3_LEGACY_MACROS
 	  Currently applies to bcopy/bzero/bcmp/index/rindex et al.
 	  WARNING! ABI incompatibility.
 
+config UCLIBC_SUSV4_LEGACY
+	bool "Enable SuSv4 LEGACY or obsolescent functions"
+	default n
+	help
+	  Enable this option if you want to have SuSv4 LEGACY functions
+	  and macros in the library.
+	  Currently applies to:
+
+	  - XSI functions:
+	    _longjmp, _setjmp, _tolower, _toupper, ftw, getitimer,
+	    gettimeofday, isascii, pthread_getconcurrency,
+	    pthread_setconcurrency, setitimer, setpgrp, sighold,
+	    sigignore, sigpause, sigrelse, sigset, siginterrupt,
+	    tempnam, toascii, ulimit.
+
+	  - Base functions:
+	    asctime, asctime_r, ctime, ctime_r, gets, rand_r,
+	    tmpnam, utime.
+
+	  WARNING! ABI incompatibility.
+
 config UCLIBC_HAS_STUBS
 	bool "Provide stubs for unavailable functionality"
 	default n
Index: include/tgmath.h
===================================================================
--- include/tgmath.h	(revision 24526)
+++ include/tgmath.h	(working copy)
@@ -376,6 +376,7 @@
 /* Return the remainder of integer divison X / Y with infinite precision.  */
 #define remainder(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, remainder)
 
+#if defined __UCLIBC_SUSV3_LEGACY__
 /* Return X times (2 to the Nth power).  */
 #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
 # define scalb(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, scalb)
@@ -387,6 +388,7 @@
 /* Return X times (2 to the Nth power).  */
 #define scalbln(Val1, Val2) \
      __TGMATH_BINARY_FIRST_REAL_ONLY (Val1, Val2, scalbln)
+#endif /* UCLIBC_SUSV3_LEGACY */
 
 /* Return the binary exponent of X, which must be nonzero.  */
 #define ilogb(Val) __TGMATH_UNARY_REAL_ONLY (Val, ilogb)
Index: include/stdlib.h
===================================================================
--- include/stdlib.h	(revision 24526)
+++ include/stdlib.h	(working copy)
@@ -598,11 +598,13 @@ extern int clearenv (void) __THROW;
 
 
 #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
+# if defined __UCLIBC_SUSV3_LEGACY__
 /* 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.
    Returns TEMPLATE, or a null pointer if it cannot get a unique file name.  */
 extern char *mktemp (char *__template) __THROW __nonnull ((1)) __wur;
+# endif
 
 /* Generate a unique temporary file name from TEMPLATE.
    The last six characters of TEMPLATE must be "XXXXXX";
Index: include/wchar.h
===================================================================
--- include/wchar.h	(revision 24526)
+++ include/wchar.h	(working copy)
@@ -275,7 +275,7 @@ extern size_t wcslen (__const wchar_t *_
 libc_hidden_proto(wcslen)
 __END_NAMESPACE_C99
 
-#ifdef __USE_XOPEN
+#if defined __USE_XOPEN && defined __UCLIBC_SUSV3_LEGACY__
 /* Another name for `wcsstr' from XPG4.  */
 extern wchar_t *wcswcs (__const wchar_t *__haystack, __const wchar_t *__needle)
      __THROW __attribute_pure__;
Index: include/unistd.h
===================================================================
--- include/unistd.h	(revision 24526)
+++ include/unistd.h	(working copy)
@@ -410,7 +410,8 @@ libc_hidden_proto(alarm)
 extern unsigned int sleep (unsigned int __seconds);
 libc_hidden_proto(sleep)
 
-#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
+#if (defined __USE_BSD || defined __USE_XOPEN_EXTENDED) \
+	&& defined __UCLIBC_SUSV3_LEGACY__
 /* Set an alarm to go off (generating a SIGALRM signal) in VALUE
    microseconds.  If INTERVAL is nonzero, when the alarm goes off, the
    timer is reset to go off every INTERVAL microseconds thereafter.
Index: include/signal.h
===================================================================
--- include/signal.h	(revision 24526)
+++ include/signal.h	(working copy)
@@ -128,7 +128,7 @@ extern __sighandler_t __REDIRECT_NTH (si
 #endif
 __END_NAMESPACE_STD
 
-#ifdef __USE_XOPEN
+#if defined __USE_XOPEN && defined __UCLIBC_SUSV3_LEGACY__
 /* The X/Open definition of `signal' conflicts with the BSD version.
    So they defined another function `bsd_signal'.  */
 extern __sighandler_t bsd_signal (int __sig, __sighandler_t __handler)
Index: include/ctype.h
===================================================================
--- include/ctype.h	(revision 24526)
+++ include/ctype.h	(working copy)
@@ -202,7 +202,8 @@ __END_NAMESPACE_C99
 extern int isctype (int __c, int __mask) __THROW;
 #endif
 
-#if defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN
+#if (defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN) \
+	&& defined __UCLIBC_SUSV4_LEGACY__
 
 /* Return nonzero iff C is in the ASCII set
    (i.e., is no more than 7 bits wide).  */
Index: libc/stdlib/Makefile.in
===================================================================
--- libc/stdlib/Makefile.in	(revision 24526)
+++ libc/stdlib/Makefile.in	(working copy)
@@ -10,7 +10,7 @@ include $(top_srcdir)libc/stdlib/malloc-
 include $(top_srcdir)libc/stdlib/malloc-standard/Makefile.in
 
 CSRC := \
-	abort.c getenv.c mkdtemp.c mktemp.c realpath.c mkstemp.c \
+	abort.c getenv.c mkdtemp.c realpath.c mkstemp.c \
 	rand.c random.c random_r.c setenv.c system.c div.c ldiv.c lldiv.c \
 	getpt.c drand48-iter.c jrand48.c \
 	jrand48_r.c lrand48.c lrand48_r.c mrand48.c mrand48_r.c nrand48.c \
@@ -31,7 +31,7 @@ endif
 ifeq ($(UCLIBC_HAS_FLOATS),y)
 CSRC += drand48.c drand48_r.c erand48.c erand48_r.c
 ifeq ($(UCLIBC_SUSV3_LEGACY),y)
-CSRC += gcvt.c
+CSRC += gcvt.c mktemp.c
 endif
 endif
 
Index: libc/string/strstr.c
===================================================================
--- libc/string/strstr.c	(revision 24526)
+++ libc/string/strstr.c	(working copy)
@@ -39,6 +39,6 @@ Wchar *Wstrstr(const Wchar *s1, const Wc
 }
 #ifndef WANT_WIDE
 libc_hidden_def(strstr)
-#else
+#elif defined __UCLIBC_SUSV3_LEGACY__
 strong_alias(wcsstr,wcswcs)
 #endif
Index: libc/unistd/Makefile.in
===================================================================
--- libc/unistd/Makefile.in	(revision 24526)
+++ libc/unistd/Makefile.in	(working copy)
@@ -33,6 +33,10 @@ else
 CSRC := $(filter-out getsubopt.c,$(CSRC))
 endif
 
+ifneq ($(UCLIBC_SUSV3_LEGACY),y)
+CSRC := $(filter-out ualarm.c usleep.c,$(CSRC))
+endif
+
 ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y)
 CSRC := $(filter-out sleep.c,$(CSRC))
 endif
Index: libc/sysdeps/linux/common/bits/mathcalls.h
===================================================================
--- libc/sysdeps/linux/common/bits/mathcalls.h	(revision 24526)
+++ libc/sysdeps/linux/common/bits/mathcalls.h	(working copy)
@@ -358,7 +358,8 @@ __MATHCALLI (fma,, (_Mdouble_ __x, _Mdou
 __END_NAMESPACE_C99
 #endif
 
-#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
+#if (defined __USE_MISC || defined __USE_XOPEN_EXTENDED) \
+	&& defined __UCLIBC_SUSV3_LEGACY__
 /* Return X times (2 to the Nth power).  */
 __MATHCALL (scalb,, (_Mdouble_ __x, _Mdouble_ __n));
 #endif
Index: libc/misc/ctype/Makefile.in
===================================================================
--- libc/misc/ctype/Makefile.in	(revision 24526)
+++ libc/misc/ctype/Makefile.in	(working copy)
@@ -7,11 +7,13 @@
 
 # multi source ctype.c
 COM_SRC := \
-	isalnum.c isalpha.c isascii.c iscntrl.c isdigit.c \
+	isalnum.c isalpha.c iscntrl.c isdigit.c \
 	isgraph.c islower.c isprint.c ispunct.c isspace.c \
-	isupper.c isxdigit.c toascii.c tolower.c toupper.c \
+	isupper.c isxdigit.c tolower.c toupper.c \
 	isblank.c
-
+ifeq ($(UCLIBC_SUSV4_LEGACY),y)
+COM_SRC += isascii.c toascii.c
+endif
 CSRC := $(COM_SRC)
 
 ifeq ($(UCLIBC_HAS_CTYPE_TABLES),y)
Index: libc/signal/Makefile.in
===================================================================
--- libc/signal/Makefile.in	(revision 24526)
+++ libc/signal/Makefile.in	(working copy)
@@ -7,7 +7,7 @@
 
 CSRC :=	allocrtsig.c killpg.c raise.c sigaction.c sigaddset.c sigandset.c \
 	sigblock.c sigdelset.c sigempty.c sigfillset.c siggetmask.c \
-	sigintr.c sigisempty.c sigismem.c sigjmp.c signal.c \
+	sigisempty.c sigismem.c sigjmp.c signal.c \
 	sigorset.c sigpause.c sigsetmask.c sigsetops.c sigwait.c
 ifeq ($(UCLIBC_HAS_OBSOLETE_BSD_SIGNAL),y)
 CSRC += sighold.c sigignore.c sigrelse.c sigset.c
@@ -15,6 +15,9 @@ endif
 ifeq ($(UCLIBC_HAS_OBSOLETE_SYSV_SIGNAL),y)
 CSRC += sysv_signal.c
 endif
+ifeq ($(UCLIBC_SUSV4_LEGACY),y)
+CSRC += sigintr.c
+endif
 
 ifneq ($(strip $(ARCH_OBJS)),)
 CSRC := $(filter-out $(notdir $(ARCH_OBJS:.o=.c)),$(CSRC))
Index: libc/signal/signal.c
===================================================================
--- libc/signal/signal.c	(revision 24526)
+++ libc/signal/signal.c	(working copy)
@@ -22,15 +22,12 @@
 #include <signal.h>
 #include <string.h>	/* For the real memset prototype.  */
 
-/* libc_hidden_proto(sigaction) */
-
 sigset_t _sigintr attribute_hidden;		/* Set by siginterrupt.  */
 
 /* Set the handler for the signal SIG to HANDLER,
    returning the old handler, or SIG_ERR on error.  */
-extern __typeof(bsd_signal) __bsd_signal;
-attribute_hidden __sighandler_t
-__bsd_signal (int sig, __sighandler_t handler)
+__sighandler_t
+signal (int sig, __sighandler_t handler)
 {
   struct sigaction act, oact;
 
@@ -51,7 +48,7 @@ __bsd_signal (int sig, __sighandler_t ha
 
   return oact.sa_handler;
 }
-strong_alias(__bsd_signal,bsd_signal)
-/* libc_hidden_proto(signal) */
-strong_alias(__bsd_signal,signal)
 libc_hidden_def(signal)
+#ifdef __UCLIBC_SUSV3_LEGACY__
+strong_alias(signal,bsd_signal)
+#endif
Index: libc/signal/sigintr.c
===================================================================
--- libc/signal/sigintr.c	(revision 24526)
+++ libc/signal/sigintr.c	(working copy)
@@ -26,7 +26,7 @@
    (causing them to fail with EINTR); if INTERRUPT is zero, make system
    calls be restarted after signal SIG.  */
 #ifdef SA_RESTART
-extern sigset_t _sigintr attribute_hidden;	/* Defined in signal.c.  */
+extern sigset_t _sigintr attribute_hidden;	/* Defined in _sigintr.c.  */
 #endif
 
 int siginterrupt (int sig, int interrupt)
Index: libpthread/linuxthreads.old/sysdeps/pthread/pthread.h
===================================================================
--- libpthread/linuxthreads.old/sysdeps/pthread/pthread.h	(revision 24526)
+++ libpthread/linuxthreads.old/sysdeps/pthread/pthread.h	(working copy)
@@ -252,6 +252,7 @@ extern int pthread_attr_getguardsize (__
      __THROW;
 #endif
 
+#if 0 /* uClibc: deprecated stuff disabled. def __UCLIBC_SUSV3_LEGACY__ */
 /* Set the starting address of the stack of the thread to be created.
    Depending on whether the stack grows up or down the value must either
    be higher or lower than all the address in the memory block.  The
@@ -263,6 +264,7 @@ extern int pthread_attr_setstackaddr (pt
 extern int pthread_attr_getstackaddr (__const pthread_attr_t *__restrict
 				      __attr, void **__restrict __stackaddr)
      __THROW;
+#endif
 
 #ifdef __USE_XOPEN2K
 /* The following two interfaces are intended to replace the last two.  They
Index: libpthread/linuxthreads.old/attr.c
===================================================================
--- libpthread/linuxthreads.old/attr.c	(revision 24526)
+++ libpthread/linuxthreads.old/attr.c	(working copy)
@@ -209,6 +209,7 @@ int __pthread_attr_setstackaddr(pthread_
 }
 weak_alias (__pthread_attr_setstackaddr, pthread_attr_setstackaddr)
 
+#if 0 /* uClibc: deprecated stuff disabled */
 int __pthread_attr_getstackaddr(const pthread_attr_t *attr, void **stackaddr)
 {
   /* XXX This function has a stupid definition.  The standard specifies
@@ -229,6 +230,7 @@ int __pthread_attr_setstacksize(pthread_
   return 0;
 }
 weak_alias (__pthread_attr_setstacksize, pthread_attr_setstacksize)
+#endif
 
 int __pthread_attr_getstacksize(const pthread_attr_t *attr, size_t *stacksize)
 {
Index: libpthread/linuxthreads/sysdeps/pthread/pthread.h
===================================================================
--- libpthread/linuxthreads/sysdeps/pthread/pthread.h	(revision 24526)
+++ libpthread/linuxthreads/sysdeps/pthread/pthread.h	(working copy)
@@ -252,6 +252,7 @@ extern int pthread_attr_getguardsize (__
      __THROW;
 #endif
 
+#if 0 /* uClibc: deprecated stuff disabled. def __UCLIBC_SUSV3_LEGACY__ */
 /* Set the starting address of the stack of the thread to be created.
    Depending on whether the stack grows up or down the value must either
    be higher or lower than all the address in the memory block.  The
@@ -263,6 +264,7 @@ extern int pthread_attr_setstackaddr (pt
 extern int pthread_attr_getstackaddr (__const pthread_attr_t *__restrict
 				      __attr, void **__restrict __stackaddr)
      __THROW;
+#endif
 
 #ifdef __USE_XOPEN2K
 /* The following two interfaces are intended to replace the last two.  They
