diff -Naur newlib-1.18.0.orig/newlib/ChangeLog.rtems newlib-1.18.0/newlib/ChangeLog.rtems
--- newlib-1.18.0.orig/newlib/ChangeLog.rtems	1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.18.0/newlib/ChangeLog.rtems	2010-11-26 09:40:30.733683426 +0100
@@ -0,0 +1,295 @@
+2010-11-26  Ralf Corsépius <ralf.corsepius@rtems.org>
+
+	* libm/complex/cargf.c: Use crealf instead of creal.
+	* libm/complex/Makefile.in: Regenerate.
+	* libm/complex/catan.c, libm/complex/ctan.c: Include <float.h>.
+	Use DBL_MAX for MAXNUM.
+	* libm/complex/catanf.c, libm/complex/ctanf.c: Include <float.h>.
+	Use FLT_MAX for MAXNUMF.
+	* libm/complex/*: Merge-in newlib-CVS.
+
+2010-10-09  Ralf Corsépius <ralf.corsepius@rtems.org>
+
+	* libm/complex/cacos.c: Reorder function calls to work around ICE
+	in arm/thumb-gcc.
+
+2010-10-08  Ralf Corsépius <ralf.corsepius@rtems.org>
+
+	* libm/complex/complex.tex: Add stub.
+
+2010-10-08  Corinna Vinschen  <corinna@vinschen.de>
+
+	* libm/math/w_cabs.c: Delete.
+	* libm/math/wf_cabs.c: Delete.
+	* libm/math/Makefile.am (src): Remove w_cabs.c.
+	(fsrc): Remove wf_cabs.c.
+	* libm/math/Makefile.in: Regenerate.
+
+2010-10-08  Marco Atzeri  <marco_atzeri@yahoo.it>
+
+	* libc/include/complex.h: New complex header.
+	* libm/common/fdlibm.h: Added ifdef _COMPLEX_H.
+	* libm/complex/*: New complex functions imported from NetBSD.
+	* libm/Makefile.am: Added complex subdir.
+	* libm/Makefile.in: Regenerate.
+	* libm/configure.in: Added complex subdir.
+	* libm/configure: Regenerate.
+
+2010-10-05  Eric Blake  <eblake@redhat.com>
+
+	memmem, strstr, strcasestr: fix bug with long periodic needle
+    	* lib/str-two-way.h (two_way_long_needle): Avoid bug with long
+	periodic needle having false positive.
+
+2010-09-21  Craig Howland <howland@LGSInnovations.com>
+
+	* libc/string/memcpy.c: Do not assign size_t parameter to int.
+	Use parameter directly, instead.
+	* libc/string/memccpy.c:  Likewise.
+	* libc/string/mempcpy.c:  Likewise.
+	* libc/string/memmove.c:  Likewise.
+
+2010-09-04  	Joel Sherrill <joel@OARcorp.com>
+
+	* include/pthread.h: Add pthread_attr_setstack, pthread_attr_getstack,
+	pthread_attr_getguardsize, pthread_attr_setguardsize.
+	* sys/types.h (pthread_attr_t): Add guardsize.
+
+2010-08-24  Sebastian Huber <sebastian.huber@embedded-brains.de>
+
+	* libc/posix/opendir.c: Added missing memory free.
+
+2010-08-10	Ralf Corsépius <ralf.corsepius@rtems.org>
+
+	PR 1475/newlib:
+	* libc/include/stdint.h: Fall back to compute SIZE_MAX based on
+	__SIZEOF_SIZE_T__ and __CHAR_BIT__ if available.
+
+2010-08-04	Ralf Corsépius <ralf.corsepius@rtems.org>
+
+	* libc/string/strcat.c: 
+	Include <stdint.h>. Use uintptr_t instead of long in ALIGNED.
+	* libc/string/strchr.c, libc/string/strcmp.c, libc/string/strncmp.c:
+	Include <stdint.h>. Use uintptr_t instead of long in UNALIGNED.
+	* libc/include/sys/unistd.h: Activate decls for 
+	getsid, setegid, seteuid.
+
+2010-07-08	Ralf Corsépius <ralf.corsepius@rtems.org>
+
+	* configure.host: Add -D_COMPILING_NEWLIB to newlib_cflags.
+	* libc/string/index.c, libc/string/rindex.c: Include <string.h>.
+	* libc/stdlib/putenv_r.c: Include <strings.h>
+
+2010-07-06  Corinna Vinschen  <corinna@vinschen.de>
+
+	* libc/posix/rewinddir.c (rewinddir): Remove incorrect cast to off_t.
+	* libc/sys/rtems/sys/dirent.h (_seekdir): Add prototype.
+	* libc/sys/linux/sys/dirent.h (_seekdir): Fix prototype to use long
+	rather than off_t.
+
+2010-06-17	Ralf Corsépius <ralf.corsepius@rtems.org>
+
+	* libc/sys/rtems/machine/_types.h: Special case for sparc64.
+
+2010-04-23	Ralf Corsépius <ralf.corsepius@rtems.org>
+
+	* libc/sys/rtems/machine/_types.h: Add _mode_t.
+	* libc/include/sys/types.h: Derive mode_t from  _mode_t.
+
+2010-04-02	Ralf Corsépius <ralf.corsepius@rtems.org>
+
+	* libc/include/sched.h, libc/include/sys/sched.h:
+	Adopt newlib-cvs's versions.
+
+2010-03-25	Ralf Corsépius <ralf.corsepius@rtems.org>
+
+	* libc/include/strings.h: New (split-out from string.h).
+	* libc/include/string.h: Remove bcmp, bcopy, bzero, ffs, index, rindex,
+	strcasecmp, strncasecmp (Moved to strings.h).
+	Remove strcmpi, stricmp, strncmpi, strnicmp.
+	* libc/misc/ffs.c: Use <strings.h> instead of <string.h>.
+	* libc/string/bcmp.c: Use <strings.h> instead of <string.h>.
+	* libc/string/bzero.c: Use <strings.h> instead of <string.h>.
+	* libc/string/rindex.c: Use <strings.h> instead of <string.h>.
+	* libc/string/strcasecmp.c: Use <strings.h> instead of <string.h>.
+	* libc/string/strcasecmp.c: Use <strings.h> instead of <string.h>.
+
+2010-03-23	Ralf Corsépius <ralf.corsepius@rtems.org>
+
+	* libc/sys/rtems/machine/_types.h: Add i386 to 64bit off_t targets.
+
+2010-03-10	Ralf Corsépius <ralf.corsepius@rtems.org>
+
+	* libc/posix/telldir.c: Adopt newlib-cvs's telldir.c
+
+2010-02-10	Ralf Corsépius <ralf.corsepius@rtems.org>
+
+	* libc/sys/rtems/machine/_types.h: Use __int64_t for _off_t, fpos_t for 
+	selected targets.
+
+2010-02-05	Ralf Corsépius <ralf.corsepius@rtems.org>
+
+	* libc/posix/telldir.c: Remove bogus nested prototype of lseek().
+
+2010-01-11  Sebastian Huber <sebastian.huber@embedded-brains.de>
+
+	* libc/posix/telldir.c (_cleanupdir): Fixed usage of freed memory.
+
+2009-12-18	Ralf Corsépius <ralf.corsepius@rtems.org>
+
+	* libc/search/db_local.h:
+	Use __uint32_t instead of u_int (prototype mismatches).
+	* libc/search/extern.h (__buf_init): 
+	Use __uint32_t instead of int (16 bit target portability).
+	* libc/search/hash_buf.c: Use ptrdiff_t instead of __uint32_t,
+	use __uint32_t instead of int (16 bit target portability).
+	* libc/search/hash.h: Use __uint32_it instead of int
+	(16 bit target portability).
+	* libm/common/modfl.c: Add cast to (double*) to avoid GCC warning.
+	* libm/common/sf_llrint.c, libm/common/sf_round.c: Add explicit 
+	casts to __uint32_t to avoid overflows on implicit casts.
+
+2009-12-18	Ralf Corsépius <ralf.corsepius@rtems.org>
+
+	Merger with newlib-1.18.0.
+
+2009-10-29	Ralf Corsépius <ralf.corsepius@rtems.org>
+
+	* libc/sys/rtems/machine/_types.h: Rework.
+	* libc/sys/rtems/machine/stdint.h: Remove.
+	* libc/include/inttypes.h: 
+	Rework logic to determine PRI*PTR.
+	Prefer long64 over longlong64.
+	* libc/include/machine/_default_types.h: 
+	Sync logic for __int32 with stdint.h (Prefer long over int).
+	* libc/include/stdint.h:
+	Remove __SPU__ hack.
+	Prefer int for int16_t (sync with _default_types.h).
+	Rework intptr_t determination.
+
+2009-10-28	Ralf Corsépius <ralf.corsepius@rtems.org>
+
+	* libc/sys/rtems/machine/_types.h: New.
+	Add custom time for _ssize_t.
+	* libc/stdlib/assert.c: Sync with newlib-CVS.
+	* configure.host: Add -DHAVE_ASSERT_FUNC to newlib_cflags.
+
+2009-10-27	Ralf Corsépius <ralf.corsepius@rtems.org>
+
+	* libc/include/sys/pthread.h: 
+	Add pthread_atfork (Mandated by IEEE Std 1003.1-2008).
+	Add pthread_rwlock_unlock (Formerly missing)
+
+2009-10-26	Ralf Corsépius <ralf.corsepius@rtems.org>
+
+	* libc/include/sys/signal.h: Sync with newlib-CVS.
+
+2009-10-09	Ralf Corsépius <ralf.corsepius@rtems.org>
+
+	* libc/include/sys/signal.h: Use pid_t as 1st arg to kill()
+	(mandated by POSIX).
+
+2009-09-22	Ralf Corsépius <ralf.corsepius@rtems.org>
+
+	* libc/sys/rtems/sys/queue.h: Update copyright (from FreeBSD).
+	Remove CIRCLEQ_*.
+	* libc/search/hcreate.c: Don't include sys/queue.h.
+
+2009-09-18  Christopher Faylor  <me+cygwin@cgf.cx>
+
+	* libc/include/sys/unistd.h: Declare getpagesize as returning
+	POSIX-mandated int.
+
+2009-09-16	Ralf Corsépius <ralf.corsepius@rtems.org>
+
+	* libc/sys/rtems/crt0.c: Use while(1) in _exit stub to silence GCC "noreturn"
+	warning.
+
+2009-09-15	Ralf Corsépius <ralf.corsepius@rtems.org>
+
+	* libc/include/stdlib.h: Add posix_memalign.
+
+2009-09-11	Ralf Corsépius <ralf.corsepius@rtems.org>
+
+	* configure.host (m32c): Remove -D_ABORT_PROVIDED.
+
+2009-09-10	Ralf Corsépius <ralf.corsepius@rtems.org>
+
+	* configure.host: Add -D_NO_POPEN.
+	* libc/sys/rtems/crt0.c: Don't provide waitpid unless used.
+
+2009-09-09	Ralf Corsépius <ralf.corsepius@rtems.org>
+
+	* configure.host: Add -D_NO_WORDEXP.
+
+2009-09-06	Ralf Corsépius <ralf.corsepius@rtems.org>
+
+	* libc/sys/rtems/crt0.c: Add issetugid.
+
+2009-09-02	Ralf Corsépius <ralf.corsepius@rtems.org>
+
+	* libc/sys/rtems/crt0.c: Rework. Introduce macro RTEMS_STUB.
+
+2009-07-27	Ralf Corsépius <ralf.corsepius@rtems.org>
+
+	* libc/sys/rtems/crt0.c: Add _isatty_r.
+
+2009-07-06	Joel Sherrill <joel.sherrill@oarcorp.com>
+
+	* libc/include/sys/features.h: Define _UNIX98_THREAD_MUTEX_ATTRIBUTES.
+
+2009-05-05	Ralf Corsépius <ralf.corsepius@rtems.org>
+
+	* configure.host: Remove -DMISSING_SYSCALL_NAMES.
+
+2009-03-11	Ralf Corsépius <ralf.corsepius@rtems.org>
+
+	* libc/stdlib/assert.c: Don't build __assert_func.
+	* libc/sys/rtems/crt0.c: Add __assert_func.
+
+2009-03-09	Ralf Corsépius <ralf.corsepius@rtems.org>
+
+	* libc/machine/powerpc/times.c: Remove.
+	* libc/machine/powerpc/Makefile.am: Remove times.c.
+	* libc/machine/powerpc/Makefile.in: Regenerate.
+
+2009-02-24	Ralf Corsépius <ralf.corsepius@rtems.org>
+
+	* libc/unix/ttyname.c: Sync with newlib-cvs.
+	* configure.host: Add -DHAVE_BLKSIZE to newlib_cflags.
+
+2009-02-22	Ralf Corsépius <ralf.corsepius@rtems.org>
+
+	* libc/sys/rtems/machine/stdint.h: Add __lm32__.
+	* libc/machine/lm32/configure.in: Set AC_CONFIG_SRC to setjmp.S.
+	* libc/machine/lm32/configure: Regenerate.
+
+2009-02-20	Ralf Corsépius <ralf.corsepius@rtems.org>
+
+	* libc/unix/Makefile.in: Regenerate.
+
+2009-02-20  Craig Howland <howland@LGSInnovations.com> on behalf of
+	Sebastian Huber <sebastian.huber@embedded-brains.de>
+
+	* libc/unix/ttyname.c:  Remove ttyname_r() (to a new file to avoid
+	coupling ttyname_r() and ttyname() due to the latter's large buffer).
+	* libc/unix/ttyname_r.c:  New file to hold ttyname_r(), previously in
+	ttyname.c.
+	* libc/unix/ttyname.h:  New file (common size definition for the 2
+	ttyname*c files that are now split).
+	* libc/unix/Makefile.am (ELIX_2_SOURCES):  Add ttyname_r.c.
+
+2009-02-16	Ralf Corsépius <ralf.corsepius@rtems.org>
+
+	* libc/sys/rtems/sys/param.h:
+	Update copyright notice from FreeBSD.
+	Remove HZ.
+	Add #include <sys/priority.h>
+	Remove priority handling (moved to sys/priority.h).
+	Remove CLBYTES (Unused, abandoned in BSD).
+
+2009-02-06	Ralf Corsépius <ralf.corsepius@rtems.org>
+
+	* libc/include/sched.h:
+	Remove (collides with RTEMS's schedul.h).
+
diff -Naur newlib-1.18.0.orig/newlib/configure.host newlib-1.18.0/newlib/configure.host
--- newlib-1.18.0.orig/newlib/configure.host	2009-12-10 18:12:11.000000000 +0100
+++ newlib-1.18.0/newlib/configure.host	2010-11-26 09:40:30.735683825 +0100
@@ -556,6 +556,7 @@
   *-*-rtems*)
 	default_newlib_io_long_long="yes"
 	default_newlib_io_c99_formats="yes"
+	newlib_cflags="${newlib_cflags} -D_COMPILING_NEWLIB"
 	newlib_cflags="${newlib_cflags} -DMALLOC_PROVIDED -DEXIT_PROVIDED -DSIGNAL_PROVIDED -DREENTRANT_SYSCALLS_PROVIDED -DHAVE_NANOSLEEP -DHAVE_BLKSIZE -DHAVE_FCNTL -DHAVE_ASSERT_FUNC"
         # turn off unsupported items in posix directory 
 	newlib_cflags="${newlib_cflags} -D_NO_GETLOGIN -D_NO_GETPWENT -D_NO_GETUT -D_NO_GETPASS -D_NO_SIGSET -D_NO_WORDEXP -D_NO_POPEN"
diff -Naur newlib-1.18.0.orig/newlib/libc/include/complex.h newlib-1.18.0/newlib/libc/include/complex.h
--- newlib-1.18.0.orig/newlib/libc/include/complex.h	1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.18.0/newlib/libc/include/complex.h	2010-11-26 09:40:30.735683825 +0100
@@ -0,0 +1,124 @@
+/* $NetBSD: complex.h,v 1.3 2010/09/15 16:11:30 christos Exp $ */
+
+/*
+ * Written by Matthias Drochner.
+ * Public domain.
+ */
+
+#ifndef	_COMPLEX_H
+#define	_COMPLEX_H
+
+#define complex _Complex
+#define _Complex_I 1.0fi
+#define I _Complex_I
+
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+
+/* 7.3.5 Trigonometric functions */
+/* 7.3.5.1 The cacos functions */
+double complex cacos(double complex);
+float complex cacosf(float complex);
+
+/* 7.3.5.2 The casin functions */
+double complex casin(double complex);
+float complex casinf(float complex);
+
+/* 7.3.5.1 The catan functions */
+double complex catan(double complex);
+float complex catanf(float complex);
+
+/* 7.3.5.1 The ccos functions */
+double complex ccos(double complex);
+float complex ccosf(float complex);
+
+/* 7.3.5.1 The csin functions */
+double complex csin(double complex);
+float complex csinf(float complex);
+
+/* 7.3.5.1 The ctan functions */
+double complex ctan(double complex);
+float complex ctanf(float complex);
+
+/* 7.3.6 Hyperbolic functions */
+/* 7.3.6.1 The cacosh functions */
+double complex cacosh(double complex);
+float complex cacoshf(float complex);
+
+/* 7.3.6.2 The casinh functions */
+double complex casinh(double complex);
+float complex casinhf(float complex);
+
+/* 7.3.6.3 The catanh functions */
+double complex catanh(double complex);
+float complex catanhf(float complex);
+
+/* 7.3.6.4 The ccosh functions */
+double complex ccosh(double complex);
+float complex ccoshf(float complex);
+
+/* 7.3.6.5 The csinh functions */
+double complex csinh(double complex);
+float complex csinhf(float complex);
+
+/* 7.3.6.6 The ctanh functions */
+double complex ctanh(double complex);
+float complex ctanhf(float complex);
+
+/* 7.3.7 Exponential and logarithmic functions */
+/* 7.3.7.1 The cexp functions */
+double complex cexp(double complex);
+float complex cexpf(float complex);
+
+/* 7.3.7.2 The clog functions */
+double complex clog(double complex);
+float complex clogf(float complex);
+
+/* 7.3.8 Power and absolute-value functions */
+/* 7.3.8.1 The cabs functions */
+/*#ifndef __LIBM0_SOURCE__
+/* avoid conflict with historical cabs(struct complex) */
+/* double cabs(double complex) __RENAME(__c99_cabs);
+   float cabsf(float complex) __RENAME(__c99_cabsf);
+   #endif
+*/
+double cabs(double complex) ;
+float cabsf(float complex) ;
+
+/* 7.3.8.2 The cpow functions */
+double complex cpow(double complex, double complex);
+float complex cpowf(float complex, float complex);
+
+/* 7.3.8.3 The csqrt functions */
+double complex csqrt(double complex);
+float complex csqrtf(float complex);
+
+/* 7.3.9 Manipulation functions */
+/* 7.3.9.1 The carg functions */ 
+double carg(double complex);
+float cargf(float complex);
+
+/* 7.3.9.2 The cimag functions */
+double cimag(double complex);
+float cimagf(float complex);
+/*long double cimagl(long double complex); */
+
+/* 7.3.9.3 The conj functions */
+double complex conj(double complex);
+float complex conjf(float complex);
+/*long double complex conjl(long double complex); */
+
+/* 7.3.9.4 The cproj functions */
+double complex cproj(double complex);
+float complex cprojf(float complex);
+/*long double complex cprojl(long double complex); */
+
+/* 7.3.9.5 The creal functions */
+double creal(double complex);
+float crealf(float complex);
+/*long double creall(long double complex); */
+
+__END_DECLS
+
+#endif	/* ! _COMPLEX_H */
diff -Naur newlib-1.18.0.orig/newlib/libc/include/inttypes.h newlib-1.18.0/newlib/libc/include/inttypes.h
--- newlib-1.18.0.orig/newlib/libc/include/inttypes.h	2009-01-19 23:02:06.000000000 +0100
+++ newlib-1.18.0/newlib/libc/include/inttypes.h	2010-11-26 09:40:30.735683825 +0100
@@ -242,6 +242,20 @@
 #define SCNxMAX		__SCNMAX(x)
 
 /* ptr types */
+#if INTPTR_MAX == INT64_MAX
+#define __PRIPTR(x) __PRI64(x)
+#define __SCNPTR(x) __SCN64(x)
+#elif INTPTR_MAX == INT32_MAX
+#define __PRIPTR(x) __PRI32(x)
+#define __SCNPTR(x) __SCN32(x)
+#elif INTPTR_MAX == INT16_MAX
+#define __PRIPTR(x) __PRI16(x)
+#define __SCNPTR(x) __SCN16(x)
+#else
+#error cannot determine PRI*PTR
+#endif
+
+#if 0
 #if __have_long64
 #define __PRIPTR(x) __STRINGIFY(l##x)
 #define __SCNPTR(x) __STRINGIFY(l##x)
@@ -252,6 +266,7 @@
 #define __PRIPTR(x) __STRINGIFY(x)
 #define __SCNPTR(x) __STRINGIFY(x)
 #endif
+#endif
 
 #define PRIdPTR		__PRIPTR(d)
 #define PRIiPTR		__PRIPTR(i)
diff -Naur newlib-1.18.0.orig/newlib/libc/include/machine/_default_types.h newlib-1.18.0/newlib/libc/include/machine/_default_types.h
--- newlib-1.18.0.orig/newlib/libc/include/machine/_default_types.h	2008-06-12 00:14:54.000000000 +0200
+++ newlib-1.18.0/newlib/libc/include/machine/_default_types.h	2010-11-26 09:40:30.735683825 +0100
@@ -54,14 +54,14 @@
 #endif
 #endif
 
-#if __EXP(INT_MAX) == 0x7fffffffL
-typedef signed int __int32_t;
-typedef unsigned int __uint32_t;
-#define ___int32_t_defined 1
-#elif __EXP(LONG_MAX) == 0x7fffffffL
+#if __EXP(LONG_MAX) == 0x7fffffffL
 typedef signed long __int32_t;
 typedef unsigned long __uint32_t;
 #define ___int32_t_defined 1
+#elif __EXP(INT_MAX) == 0x7fffffffL
+typedef signed int __int32_t;
+typedef unsigned int __uint32_t;
+#define ___int32_t_defined 1
 #elif __EXP(SHRT_MAX) == 0x7fffffffL
 typedef signed short __int32_t;
 typedef unsigned short __uint32_t;
diff -Naur newlib-1.18.0.orig/newlib/libc/include/pthread.h newlib-1.18.0/newlib/libc/include/pthread.h
--- newlib-1.18.0.orig/newlib/libc/include/pthread.h	2009-12-17 20:22:23.000000000 +0100
+++ newlib-1.18.0/newlib/libc/include/pthread.h	2010-11-26 09:40:30.735683825 +0100
@@ -2,7 +2,7 @@
  *
  *  Written by Joel Sherrill <joel@OARcorp.com>.
  *
- *  COPYRIGHT (c) 1989-2000.
+ *  COPYRIGHT (c) 1989-2010.
  *  On-Line Applications Research Corporation (OAR).
  *
  *  Permission to use, copy, modify, and distribute this software for any
@@ -185,10 +185,14 @@
 
 int	_EXFUN(pthread_attr_init, (pthread_attr_t *__attr));
 int	_EXFUN(pthread_attr_destroy, (pthread_attr_t *__attr));
+int	_EXFUN(pthread_attr_setstack, (pthread_attr_t *attr,
+	void *__stackaddr, size_t __stacksize));
+int	_EXFUN(pthread_attr_getstack, (_CONST pthread_attr_t *attr,
+	void **__stackaddr, size_t *__stacksize));
 int	_EXFUN(pthread_attr_getstacksize,
 	(_CONST pthread_attr_t *__attr, size_t *__stacksize));
 int	_EXFUN(pthread_attr_setstacksize,
-	(pthread_attr_t *__attr, size_t stacksize));
+	(pthread_attr_t *__attr, size_t __stacksize));
 int	_EXFUN(pthread_attr_getstackaddr,
 	(_CONST pthread_attr_t *__attr, void **__stackaddr));
 int	_EXFUN(pthread_attr_setstackaddr,
@@ -197,6 +201,10 @@
 	(_CONST pthread_attr_t *__attr, int *__detachstate));
 int	_EXFUN(pthread_attr_setdetachstate,
 	(pthread_attr_t *__attr, int __detachstate));
+int	_EXFUN(pthread_attr_getguardsize,
+	(_CONST pthread_attr_t *__attr, size_t *__guardsize));
+int	_EXFUN(pthread_attr_setguardsize,
+	(pthread_attr_t *__attr, size_t __guardsize));
 
 /* Thread Creation, P1003.1c/Draft 10, p. 144 */
 
diff -Naur newlib-1.18.0.orig/newlib/libc/include/sched.h newlib-1.18.0/newlib/libc/include/sched.h
--- newlib-1.18.0.orig/newlib/libc/include/sched.h	2007-09-21 23:02:15.000000000 +0200
+++ newlib-1.18.0/newlib/libc/include/sched.h	2010-11-26 09:40:30.736684018 +0100
@@ -1,11 +1,94 @@
+/*
+ *  Written by Joel Sherrill <joel@OARcorp.com>.
+ *
+ *  COPYRIGHT (c) 1989-2010.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  Permission to use, copy, modify, and distribute this software for any
+ *  purpose without fee is hereby granted, provided that this entire notice
+ *  is included in all copies of any software which is or includes a copy
+ *  or modification of this software.
+ *
+ *  THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
+ *  WARRANTY.  IN PARTICULAR,  THE AUTHOR MAKES NO REPRESENTATION
+ *  OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY OF THIS
+ *  SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
+ *
+ *  $Id: sched.h,v 1.2 2010/04/01 18:33:33 jjohnstn Exp $
+ */
+
 #ifndef _SCHED_H_
 #define _SCHED_H_
 
+#include <sys/types.h>
+#include <sys/sched.h>
+
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-#include <sys/sched.h>
+#if defined(_POSIX_PRIORITY_SCHEDULING)
+/*
+ *  XBD 13 - Set Scheduling Parameters, P1003.1b-2008, p. 1803
+ */
+int sched_setparam(
+  pid_t                     __pid,
+  const struct sched_param *__param
+);
+
+/*
+ *  XBD 13 - Set Scheduling Parameters, P1003.1b-2008, p. 1800
+ */
+int sched_getparam(
+  pid_t                     __pid,
+  struct sched_param       *__param
+);
+
+/*
+ *  XBD 13 - Set Scheduling Policy and Scheduling Parameters,
+ *         P1003.1b-2008, p. 1805
+ */
+int sched_setscheduler(
+  pid_t                     __pid,
+  int                       __policy,
+  const struct sched_param *__param
+);
+
+/*
+ *  XBD 13 - Get Scheduling Policy, P1003.1b-2008, p. 1801
+ */
+int sched_getscheduler(
+  pid_t                     __pid
+);
+
+/*
+ *  XBD 13 - Get Scheduling Parameter Limits, P1003.1b-2008, p. 1799
+ */
+int sched_get_priority_max(
+  int __policy
+);
+
+int sched_get_priority_min(
+  int  __policy
+);
+
+/*
+ *  XBD 13 - Get Scheduling Parameter Limits, P1003.1b-2008, p. 1802
+ */
+int sched_rr_get_interval(
+  pid_t             __pid,
+  struct timespec  *__interval
+);
+#endif /* _POSIX_PRIORITY_SCHEDULING */
+
+#if defined(_POSIX_THREADS) || defined(_POSIX_PRIORITY_SCHEDULING)
+
+/*
+ *  XBD 13 - Yield Processor, P1003.1b-2008, p. 1807
+ */
+int sched_yield( void );
+
+#endif /* _POSIX_THREADS or _POSIX_PRIORITY_SCHEDULING */
 
 #ifdef __cplusplus
 }
diff -Naur newlib-1.18.0.orig/newlib/libc/include/stdint.h newlib-1.18.0/newlib/libc/include/stdint.h
--- newlib-1.18.0.orig/newlib/libc/include/stdint.h	2009-04-24 23:55:07.000000000 +0200
+++ newlib-1.18.0/newlib/libc/include/stdint.h	2010-11-26 09:40:30.736684018 +0100
@@ -33,7 +33,7 @@
 /* Check if "long" is 64bit or 32bit wide */
 #if __STDINT_EXP(LONG_MAX) > 0x7fffffff
 #define __have_long64 1
-#elif __STDINT_EXP(LONG_MAX) == 0x7fffffff && !defined(__SPU__)
+#elif __STDINT_EXP(LONG_MAX) == 0x7fffffff
 #define __have_long32 1
 #endif
 
@@ -49,14 +49,14 @@
 #define __int_least8_t_defined 1
 #endif
 
-#if __STDINT_EXP(SHRT_MAX) == 0x7fff
-typedef signed short int16_t;
-typedef unsigned short uint16_t;
-#define __int16_t_defined 1
-#elif __STDINT_EXP(INT_MAX) == 0x7fff
+#if __STDINT_EXP(INT_MAX) == 0x7fff
 typedef signed int int16_t;
 typedef unsigned int uint16_t;
 #define __int16_t_defined 1
+#elif __STDINT_EXP(SHRT_MAX) == 0x7fff
+typedef signed short int16_t;
+typedef unsigned short uint16_t;
+#define __int16_t_defined 1
 #elif __STDINT_EXP(SCHAR_MAX) == 0x7fff
 typedef signed char int16_t;
 typedef unsigned char uint16_t;
@@ -239,6 +239,29 @@
  * GCC doesn't provide an appropriate macro for [u]intptr_t
  * For now, use __PTRDIFF_TYPE__
  */
+#if defined(__SIZEOF_POINTER__)
+#if __SIZEOF_POINTER__ == 8
+  typedef int64_t intptr_t;
+  typedef uint64_t uintptr_t;
+#define INTPTR_MAX INT64_MAX
+#define INTPTR_MIN INT64_MIN
+#define UINTPTR_MAX UINT64_MAX
+#elif __SIZEOF_POINTER__ == 4
+  typedef int32_t intptr_t;
+  typedef uint32_t uintptr_t;
+#define INTPTR_MAX INT32_MAX
+#define INTPTR_MIN INT32_MIN
+#define UINTPTR_MAX UINT32_MAX
+#elif __SIZEOF_POINTER__ == 2
+  typedef int16_t intptr_t;
+  typedef uint16_t uintptr_t;
+#define INTPTR_MAX INT16_MAX
+#define INTPTR_MIN INT16_MIN
+#define UINTPTR_MAX UINT16_MAX
+#else
+#error cannot determine intptr_t
+#endif
+#else
 #if defined(__PTRDIFF_TYPE__)
 typedef signed __PTRDIFF_TYPE__ intptr_t;
 typedef unsigned __PTRDIFF_TYPE__ uintptr_t;
@@ -260,6 +283,7 @@
 #define INTPTR_MIN (-__STDINT_EXP(LONG_MAX) - 1)
 #define UINTPTR_MAX (__STDINT_EXP(LONG_MAX) * 2UL + 1)
 #endif
+#endif
 
 /* Limits of Specified-Width Integer Types */
 
@@ -408,6 +432,8 @@
 /* This must match size_t in stddef.h, currently long unsigned int */
 #ifdef __SIZE_MAX__
 #define SIZE_MAX __SIZE_MAX__
+#elif defined(__SIZEOF_SIZE_T__) && defined(__CHAR_BIT__)
+#define SIZE_MAX (__SIZEOF_SIZE_T__ * __CHAR_BIT__)
 #else
 #define SIZE_MAX (__STDINT_EXP(LONG_MAX) * 2UL + 1)
 #endif
diff -Naur newlib-1.18.0.orig/newlib/libc/include/string.h newlib-1.18.0/newlib/libc/include/string.h
--- newlib-1.18.0.orig/newlib/libc/include/string.h	2008-06-18 17:27:27.000000000 +0200
+++ newlib-1.18.0/newlib/libc/include/string.h	2010-11-26 09:40:30.736684018 +0100
@@ -49,18 +49,11 @@
 #ifndef __STRICT_ANSI__
 char 	*_EXFUN(strtok_r,(char *, const char *, char **));
 
-int	 _EXFUN(bcmp,(const void *, const void *, size_t));
-void	 _EXFUN(bcopy,(const void *, void *, size_t));
-void	 _EXFUN(bzero,(void *, size_t));
-int	 _EXFUN(ffs,(int));
-char 	*_EXFUN(index,(const char *, int));
 _PTR	 _EXFUN(memccpy,(_PTR, const _PTR, int, size_t));
 _PTR	 _EXFUN(mempcpy,(_PTR, const _PTR, size_t));
 _PTR	 _EXFUN(memmem, (const _PTR, size_t, const _PTR, size_t));
-char 	*_EXFUN(rindex,(const char *, int));
 char 	*_EXFUN(stpcpy,(char *, const char *));
 char 	*_EXFUN(stpncpy,(char *, const char *, size_t));
-int	 _EXFUN(strcasecmp,(const char *, const char *));
 char	*_EXFUN(strcasestr,(const char *, const char *));
 char 	*_EXFUN(strdup,(const char *));
 char 	*_EXFUN(_strdup_r,(struct _reent *, const char *));
@@ -69,7 +62,6 @@
 char 	*_EXFUN(strerror_r,(int, char *, size_t));
 size_t	 _EXFUN(strlcat,(char *, const char *, size_t));
 size_t	 _EXFUN(strlcpy,(char *, const char *, size_t));
-int	 _EXFUN(strncasecmp,(const char *, const char *, size_t));
 size_t	 _EXFUN(strnlen,(const char *, size_t));
 char 	*_EXFUN(strsep,(char **, const char *));
 char	*_EXFUN(strlwr,(char *));
@@ -81,20 +73,6 @@
 int     _EXFUN(strtosigno, (const char *__name));
 #endif
 
-/* These function names are used on Windows and perhaps other systems.  */
-#ifndef strcmpi
-#define strcmpi strcasecmp
-#endif
-#ifndef stricmp
-#define stricmp strcasecmp
-#endif
-#ifndef strncmpi
-#define strncmpi strncasecmp
-#endif
-#ifndef strnicmp
-#define strnicmp strncasecmp
-#endif
-
 #endif /* ! __STRICT_ANSI__ */
 
 #include <sys/string.h>
diff -Naur newlib-1.18.0.orig/newlib/libc/include/strings.h newlib-1.18.0/newlib/libc/include/strings.h
--- newlib-1.18.0.orig/newlib/libc/include/strings.h	1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.18.0/newlib/libc/include/strings.h	2010-11-26 09:40:30.736684018 +0100
@@ -0,0 +1,44 @@
+/*
+ * strings.h
+ *
+ * Definitions for string operations.
+ */
+
+#ifndef _STRINGS_H_
+#define _STRINGS_H_
+
+#include "_ansi.h"
+#include <sys/reent.h>
+
+#include <sys/types.h> /* for size_t */
+#include <locale.h> /* for locale_t */
+
+_BEGIN_STD_C
+
+#ifndef __STRICT_ANSI__
+/* 
+ * Marked LEGACY in Open Group Base Specifications Issue 6/IEEE Std 1003.1-2004
+ * Removed from Open Group Base Specifications Issue 7/IEEE Std 1003.1-2008
+ */
+int	 _EXFUN(bcmp,(const void *, const void *, size_t));
+void	 _EXFUN(bcopy,(const void *, void *, size_t));
+void	 _EXFUN(bzero,(void *, size_t));
+char 	*_EXFUN(index,(const char *, int));
+char 	*_EXFUN(rindex,(const char *, int));
+#endif /* ! __STRICT_ANSI__ */
+
+int	 _EXFUN(ffs,(int));
+int	 _EXFUN(strcasecmp,(const char *, const char *));
+#if 0
+/* Not implemented */
+int	 _EXFUN(strcasecmp_l,(const char *, const char *, locale_t));
+#endif
+int	 _EXFUN(strncasecmp,(const char *, const char *, size_t));
+#if 0
+/* Not implemented */
+int	 _EXFUN(strncasecmp_l,(const char *, const char *, size_t, locale_t));
+#endif
+
+_END_STD_C
+
+#endif /* _STRINGS_H_ */
diff -Naur newlib-1.18.0.orig/newlib/libc/include/sys/sched.h newlib-1.18.0/newlib/libc/include/sys/sched.h
--- newlib-1.18.0.orig/newlib/libc/include/sys/sched.h	2002-06-20 21:51:24.000000000 +0200
+++ newlib-1.18.0/newlib/libc/include/sys/sched.h	2010-11-26 09:40:30.737684219 +0100
@@ -1,7 +1,7 @@
 /*
  *  Written by Joel Sherrill <joel@OARcorp.com>.
  *
- *  COPYRIGHT (c) 1989-2000.
+ *  COPYRIGHT (c) 1989-2010.
  *  On-Line Applications Research Corporation (OAR).
  *
  *  Permission to use, copy, modify, and distribute this software for any
@@ -14,51 +14,53 @@
  *  OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY OF THIS
  *  SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
  *
- *  $Id: sched.h,v 1.2 2002/06/20 19:51:24 fitzsim Exp $
+ *  $Id: sched.h,v 1.3 2010/04/01 18:33:37 jjohnstn Exp $
  */
 
 
-#ifndef __POSIX_SYS_SCHEDULING_h
-#define __POSIX_SYS_SCHEDULING_h
+#ifndef _SYS_SCHED_H_
+#define _SYS_SCHED_H_
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-#include <sys/unistd.h>
-
-#include <sys/types.h>
-#include <sys/time.h>
-
-/* Scheduling Policies, P1003.1b-1993, p. 250
-   NOTE:  SCHED_SPORADIC added by P1003.4b/D8, p. 34.  */
-
+/* Scheduling Policies */
+/* Open Group Specifications Issue 6 */
+#if defined(__CYGWIN__)
+#define SCHED_OTHER    3
+#else
 #define SCHED_OTHER    0
+#endif
+
 #define SCHED_FIFO     1
 #define SCHED_RR       2
 
 #if defined(_POSIX_SPORADIC_SERVER)
-#define SCHED_SPORADIC 3 
+#define SCHED_SPORADIC 4
 #endif
 
-/* Scheduling Parameters, P1003.1b-1993, p. 249
-   NOTE:  Fields whose name begins with "ss_" added by P1003.4b/D8, p. 33.  */
+/* Scheduling Parameters */
+/* Open Group Specifications Issue 6 */
 
 struct sched_param {
   int sched_priority;           /* Process execution scheduling priority */
 
-#if defined(_POSIX_SPORADIC_SERVER)
-  int ss_low_priority;          /* Low scheduling priority for sporadic */
+#if defined(_POSIX_SPORADIC_SERVER) || defined(_POSIX_THREAD_SPORADIC_SERVER)
+  int sched_ss_low_priority;    /* Low scheduling priority for sporadic */
                                 /*   server */
-  struct timespec ss_replenish_period; 
+  struct timespec sched_ss_repl_period;
                                 /* Replenishment period for sporadic server */
-  struct timespec ss_initial_budget;   /* Initial budget for sporadic server */
+  struct timespec sched_ss_init_budget;
+                               /* Initial budget for sporadic server */
+  int sched_ss_max_repl;       /* Maximum pending replenishments for */
+                               /* sporadic server */
 #endif
 };
 
 #ifdef __cplusplus
 }
-#endif 
+#endif
 
 #endif
 /* end of include file */
diff -Naur newlib-1.18.0.orig/newlib/libc/include/sys/types.h newlib-1.18.0/newlib/libc/include/sys/types.h
--- newlib-1.18.0.orig/newlib/libc/include/sys/types.h	2009-09-28 18:42:21.000000000 +0200
+++ newlib-1.18.0/newlib/libc/include/sys/types.h	2010-11-26 09:40:30.737684219 +0100
@@ -176,7 +176,11 @@
 #endif
 typedef _ssize_t ssize_t;
 
-#ifndef __CYGWIN__
+#if defined(__rtems__)
+typedef _mode_t mode_t;
+#endif
+
+#if !defined(__CYGWIN__) && !defined(__rtems__)
 #ifdef __MS_types__
 typedef	char *	addr_t;
 typedef int mode_t;
@@ -349,6 +353,7 @@
   int inheritsched;
   int schedpolicy;
   struct sched_param schedparam;
+  size_t guardsize;
 #endif /* !defined(__XMK__) */
 
   /* P1003.4b/D8, p. 54 adds cputime_clock_allowed attribute.  */
diff -Naur newlib-1.18.0.orig/newlib/libc/include/sys/unistd.h newlib-1.18.0/newlib/libc/include/sys/unistd.h
--- newlib-1.18.0.orig/newlib/libc/include/sys/unistd.h	2009-12-17 20:43:43.000000000 +0100
+++ newlib-1.18.0/newlib/libc/include/sys/unistd.h	2010-11-26 09:40:30.737684219 +0100
@@ -93,7 +93,7 @@
 pid_t   _EXFUN(getpgrp, (void ));
 pid_t   _EXFUN(getpid, (void ));
 pid_t   _EXFUN(getppid, (void ));
-#ifdef __CYGWIN__
+#if defined(__CYGWIN__) || defined(__rtems__)
 pid_t   _EXFUN(getsid, (pid_t));
 #endif
 #if !defined(__INSIDE_CYGWIN__)
@@ -142,7 +142,7 @@
 #endif
 void *  _EXFUN(sbrk,  (ptrdiff_t __incr));
 #if !defined(__INSIDE_CYGWIN__)
-#if defined(__CYGWIN__)
+#if defined(__CYGWIN__) || defined(__rtems__)
 int     _EXFUN(setegid, (gid_t __gid ));
 int     _EXFUN(seteuid, (uid_t __uid ));
 #endif
diff -Naur newlib-1.18.0.orig/newlib/libc/machine/powerpc/Makefile.am newlib-1.18.0/newlib/libc/machine/powerpc/Makefile.am
--- newlib-1.18.0.orig/newlib/libc/machine/powerpc/Makefile.am	2007-05-24 19:33:35.000000000 +0200
+++ newlib-1.18.0/newlib/libc/machine/powerpc/Makefile.am	2010-11-26 09:40:30.737684219 +0100
@@ -10,7 +10,7 @@
 
 AM_CFLAGS = -I $(srcdir)/../../stdio -I $(srcdir)/../../stdlib
 
-lib_a_SOURCES = setjmp.S times.c
+lib_a_SOURCES = setjmp.S
 lib_a_CCASFLAGS=$(AM_CCASFLAGS)
 lib_a_CFLAGS=$(AM_CFLAGS)
 lib_a_LIBADD = @extra_objs@
diff -Naur newlib-1.18.0.orig/newlib/libc/machine/powerpc/Makefile.in newlib-1.18.0/newlib/libc/machine/powerpc/Makefile.in
--- newlib-1.18.0.orig/newlib/libc/machine/powerpc/Makefile.in	2009-10-21 00:44:03.000000000 +0200
+++ newlib-1.18.0/newlib/libc/machine/powerpc/Makefile.in	2010-11-26 09:40:30.738684420 +0100
@@ -51,7 +51,7 @@
 LIBRARIES = $(noinst_LIBRARIES)
 ARFLAGS = cru
 lib_a_AR = $(AR) $(ARFLAGS)
-am_lib_a_OBJECTS = lib_a-setjmp.$(OBJEXT) lib_a-times.$(OBJEXT)
+am_lib_a_OBJECTS = lib_a-setjmp.$(OBJEXT)
 lib_a_OBJECTS = $(am_lib_a_OBJECTS)
 DEFAULT_INCLUDES = -I.@am__isrc@
 depcomp =
@@ -173,7 +173,7 @@
 AM_CCASFLAGS = $(INCLUDES)
 noinst_LIBRARIES = lib.a
 AM_CFLAGS = -I $(srcdir)/../../stdio -I $(srcdir)/../../stdlib
-lib_a_SOURCES = setjmp.S times.c
+lib_a_SOURCES = setjmp.S
 lib_a_CCASFLAGS = $(AM_CCASFLAGS)
 lib_a_CFLAGS = $(AM_CFLAGS)
 lib_a_LIBADD = @extra_objs@
@@ -184,7 +184,7 @@
 all: all-am
 
 .SUFFIXES:
-.SUFFIXES: .S .c .o .obj
+.SUFFIXES: .S .o .obj
 am--refresh:
 	@:
 $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
@@ -245,18 +245,6 @@
 lib_a-setjmp.obj: setjmp.S
 	$(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-setjmp.obj `if test -f 'setjmp.S'; then $(CYGPATH_W) 'setjmp.S'; else $(CYGPATH_W) '$(srcdir)/setjmp.S'; fi`
 
-.c.o:
-	$(COMPILE) -c $<
-
-.c.obj:
-	$(COMPILE) -c `$(CYGPATH_W) '$<'`
-
-lib_a-times.o: times.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-times.o `test -f 'times.c' || echo '$(srcdir)/'`times.c
-
-lib_a-times.obj: times.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-times.obj `if test -f 'times.c'; then $(CYGPATH_W) 'times.c'; else $(CYGPATH_W) '$(srcdir)/times.c'; fi`
-
 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
 	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
diff -Naur newlib-1.18.0.orig/newlib/libc/machine/powerpc/times.c newlib-1.18.0/newlib/libc/machine/powerpc/times.c
--- newlib-1.18.0.orig/newlib/libc/machine/powerpc/times.c	2002-07-22 22:26:51.000000000 +0200
+++ newlib-1.18.0/newlib/libc/machine/powerpc/times.c	1970-01-01 01:00:00.000000000 +0100
@@ -1,36 +0,0 @@
-/* Time support routines for PowerPC.
- *
- * Written by Aldy Hernandez.
- */
-
-#include <_ansi.h>
-#include <reent.h>
-#include <sys/time.h>
-#include <sys/times.h>
-#include <sys/resource.h>
-
-clock_t
-times (struct tms *tp)
-{
-  struct rusage usage;
-  union {
-    struct rusage r;
-    /* Newlib's rusage has only 2 fields.  We need to make room for
-       when we call the system's rusage.  This should be enough.  */
-    int filler[32];
-  } host_ru;
-
-  getrusage (RUSAGE_SELF, (void *)&host_ru);
-
-  if (tp)
-    {
-      tp->tms_utime = host_ru.r.ru_utime.tv_sec * 1000
-	+ host_ru.r.ru_utime.tv_usec;
-      tp->tms_stime = host_ru.r.ru_stime.tv_sec * 1000
-	+ host_ru.r.ru_stime.tv_usec;
-      tp->tms_cutime = 0;	/* user time, children */
-      tp->tms_cstime = 0;	/* system time, children */
-    }
-
-  return tp->tms_utime;
-}
diff -Naur newlib-1.18.0.orig/newlib/libc/misc/ffs.c newlib-1.18.0/newlib/libc/misc/ffs.c
--- newlib-1.18.0.orig/newlib/libc/misc/ffs.c	2003-06-06 21:57:51.000000000 +0200
+++ newlib-1.18.0/newlib/libc/misc/ffs.c	2010-11-26 09:40:30.741685018 +0100
@@ -24,7 +24,7 @@
 
 No supporting OS subroutines are required.  */
 
-#include <_ansi.h>
+#include <strings.h>
 
 int
 _DEFUN(ffs, (word),
diff -Naur newlib-1.18.0.orig/newlib/libc/posix/opendir.c newlib-1.18.0/newlib/libc/posix/opendir.c
--- newlib-1.18.0.orig/newlib/libc/posix/opendir.c	2003-06-06 21:57:51.000000000 +0200
+++ newlib-1.18.0/newlib/libc/posix/opendir.c	2010-11-26 09:40:30.741685018 +0100
@@ -74,6 +74,7 @@
 	dirp->dd_len = 512;
 
 	if (dirp->dd_buf == NULL) {
+		free(dirp);
 		close (fd);
 		return NULL;
 	}
diff -Naur newlib-1.18.0.orig/newlib/libc/posix/rewinddir.c newlib-1.18.0/newlib/libc/posix/rewinddir.c
--- newlib-1.18.0.orig/newlib/libc/posix/rewinddir.c	2003-06-06 21:57:51.000000000 +0200
+++ newlib-1.18.0/newlib/libc/posix/rewinddir.c	2010-11-26 09:40:30.741685018 +0100
@@ -48,7 +48,7 @@
 #ifdef HAVE_DD_LOCK
 	__lock_acquire_recursive(dirp->dd_lock);
 #endif
-	_seekdir((dirp), (off_t)0);
+	_seekdir((dirp), 0L);
 #ifdef HAVE_DD_LOCK
 	__lock_release_recursive(dirp->dd_lock);
 #endif
diff -Naur newlib-1.18.0.orig/newlib/libc/posix/telldir.c newlib-1.18.0/newlib/libc/posix/telldir.c
--- newlib-1.18.0.orig/newlib/libc/posix/telldir.c	2008-11-27 22:01:40.000000000 +0100
+++ newlib-1.18.0/newlib/libc/posix/telldir.c	2010-11-26 09:40:30.742685209 +0100
@@ -67,7 +67,7 @@
 #define	NDIRHASH	32	/* Num of hash lists, must be a power of 2 */
 #define	LOCHASH(i)	((i)&(NDIRHASH-1))
 
-static long	dd_loccnt;	/* Index of entry for sequential readdir's */
+static long	dd_loccnt = 1;	/* Index of entry for sequential readdir's */
 static struct	ddloc *dd_hash[NDIRHASH];   /* Hash list heads for ddlocs */
 __LOCK_INIT(static, dd_hash_lock);
 
@@ -119,40 +119,46 @@
 	register struct ddloc *lp;
 	register struct ddloc **prevlp;
 	struct dirent *dp;
-	extern long lseek();
 
 #ifdef HAVE_DD_LOCK
 	__lock_acquire(dd_hash_lock);
 #endif
-	prevlp = &dd_hash[LOCHASH(loc)];
-	lp = *prevlp;
-	while (lp != NULL) {
-		if (lp->loc_index == loc)
-			break;
-		prevlp = &lp->loc_next;
-		lp = lp->loc_next;
-	}
-	if (lp == NULL) {
+	if (loc != 0) {
+		prevlp = &dd_hash[LOCHASH(loc)];
+		lp = *prevlp;
+		while (lp != NULL) {
+			if (lp->loc_index == loc)
+				break;
+			prevlp = &lp->loc_next;
+			lp = lp->loc_next;
+		}
+		if (lp == NULL) {
 #ifdef HAVE_DD_LOCK
-		__lock_release(dd_hash_lock);
+			__lock_release(dd_hash_lock);
 #endif
-		return;
-	}
-	if (lp->loc_loc == dirp->dd_loc && lp->loc_seek == dirp->dd_seek)
-		goto found;
-	(void) lseek(dirp->dd_fd, lp->loc_seek, 0);
-	dirp->dd_seek = lp->loc_seek;
-	dirp->dd_loc = 0;
-	while (dirp->dd_loc < lp->loc_loc) {
-		dp = readdir(dirp);
-		if (dp == NULL)
-			break;
-	}
+			return;
+		}
+		if (lp->loc_loc == dirp->dd_loc && lp->loc_seek == dirp->dd_seek)
+			goto found;
+		(void) lseek(dirp->dd_fd, lp->loc_seek, 0);
+		dirp->dd_seek = lp->loc_seek;
+		dirp->dd_loc = 0;
+		while (dirp->dd_loc < lp->loc_loc) {
+			dp = readdir(dirp);
+			if (dp == NULL)
+				break;
+		}
 found:
 #ifdef SINGLEUSE
-	*prevlp = lp->loc_next;
-	free((caddr_t)lp);
+		*prevlp = lp->loc_next;
+		free((caddr_t)lp);
 #endif
+	} else {
+		// loc 0 means rewinding
+		(void) lseek(dirp->dd_fd, 0, 0);
+		dirp->dd_seek = 0;
+		dirp->dd_loc = 0;
+	}
 #ifdef HAVE_DD_LOCK
 	__lock_release(dd_hash_lock);
 #endif
@@ -169,26 +175,26 @@
 	__lock_acquire(dd_hash_lock);
 #endif
 	for (i = 0; i < NDIRHASH; ++i) {
+		struct ddloc head;
 		register struct ddloc *lp;
 		register struct ddloc *prevlp;
+
 		lp = dd_hash[i];
-		while (lp != NULL && lp->loc_dirp == dirp) {
-			dd_hash[i] = lp->loc_next;
-			prevlp = lp;
-			free((caddr_t)lp);
-			lp = prevlp->loc_next;
-		}
-		prevlp = lp;
+		head.loc_next = lp;
+		prevlp = &head;
 		while (lp != NULL) {
-			lp = lp->loc_next;
-			if (lp != NULL && lp->loc_dirp == dirp) {
-				prevlp->loc_next = lp->loc_next;
+			struct ddloc *nextlp;
+
+			nextlp = lp->loc_next;
+			if (lp->loc_dirp == dirp) {
+				prevlp->loc_next = nextlp;
 				free((caddr_t)lp);
-				lp = prevlp;
 			}
 			else
 				prevlp = lp;
+			lp = nextlp;
 		}
+		dd_hash[i] = head.loc_next;
 	}
 #ifdef HAVE_DD_LOCK
 	__lock_release(dd_hash_lock);
diff -Naur newlib-1.18.0.orig/newlib/libc/search/db_local.h newlib-1.18.0/newlib/libc/search/db_local.h
--- newlib-1.18.0.orig/newlib/libc/search/db_local.h	2002-06-25 01:05:08.000000000 +0200
+++ newlib-1.18.0/newlib/libc/search/db_local.h	2010-11-26 09:40:30.742685209 +0100
@@ -102,11 +102,11 @@
 typedef struct __db {
 	DBTYPE type;			/* Underlying db type. */
 	int (*close)(struct __db *);
-	int (*del)(const struct __db *, const DBT *, u_int);
-	int (*get)(const struct __db *, const DBT *, DBT *, u_int);
-	int (*put)(const struct __db *, DBT *, const DBT *, u_int);
-	int (*seq)(const struct __db *, DBT *, DBT *, u_int);
-	int (*sync)(const struct __db *, u_int);
+	int (*del)(const struct __db *, const DBT *, __uint32_t);
+	int (*get)(const struct __db *, const DBT *, DBT *, __uint32_t);
+	int (*put)(const struct __db *, DBT *, const DBT *, __uint32_t);
+	int (*seq)(const struct __db *, DBT *, DBT *, __uint32_t);
+	int (*sync)(const struct __db *, __uint32_t);
 	void *internal;			/* Access method private. */
 	int (*fd)(const struct __db *);
 } DB;
diff -Naur newlib-1.18.0.orig/newlib/libc/search/extern.h newlib-1.18.0/newlib/libc/search/extern.h
--- newlib-1.18.0.orig/newlib/libc/search/extern.h	2002-06-20 21:51:31.000000000 +0200
+++ newlib-1.18.0/newlib/libc/search/extern.h	2010-11-26 09:40:30.742685209 +0100
@@ -43,7 +43,7 @@
 int	 __big_split(HTAB *, BUFHEAD *, BUFHEAD *, BUFHEAD *,
 		int, __uint32_t, SPLIT_RETURN *);
 int	 __buf_free(HTAB *, int, int);
-void	 __buf_init(HTAB *, int);
+void	 __buf_init(HTAB *, __uint32_t);
 __uint32_t	 __call_hash(HTAB *, char *, int);
 int	 __delpair(HTAB *, BUFHEAD *, int);
 int	 __expand_table(HTAB *);
diff -Naur newlib-1.18.0.orig/newlib/libc/search/hash_buf.c newlib-1.18.0/newlib/libc/search/hash_buf.c
--- newlib-1.18.0.orig/newlib/libc/search/hash_buf.c	2004-05-26 19:57:10.000000000 +0200
+++ newlib-1.18.0/newlib/libc/search/hash_buf.c	2010-11-26 09:40:30.743685395 +0100
@@ -118,7 +118,7 @@
 	int newpage;	/* If prev_bp set, indicates a new overflow page. */
 {
 	BUFHEAD *bp;
-	__uint32_t is_disk_mask;
+	ptrdiff_t is_disk_mask;
 	int is_disk, segment_ndx;
 	SEGMENT segp;
 
@@ -298,7 +298,7 @@
 extern void
 __buf_init(hashp, nbytes)
 	HTAB *hashp;
-	int nbytes;
+	__uint32_t nbytes;
 {
 	BUFHEAD *bfp;
 	int npages;
diff -Naur newlib-1.18.0.orig/newlib/libc/search/hash.h newlib-1.18.0/newlib/libc/search/hash.h
--- newlib-1.18.0.orig/newlib/libc/search/hash.h	2008-07-02 20:38:45.000000000 +0200
+++ newlib-1.18.0/newlib/libc/search/hash.h	2010-11-26 09:40:30.742685209 +0100
@@ -82,7 +82,7 @@
 
 /* Hash Table Information */
 typedef struct hashhdr {		/* Disk resident portion */
-	int		magic;		/* Magic NO for hash tables */
+	__uint32_t	magic;		/* Magic NO for hash tables */
 	int		version;	/* Version ID */
 	__uint32_t	lorder;		/* Byte Order */
 	int		bsize;		/* Bucket/Page Size */
@@ -97,7 +97,7 @@
 	int		high_mask;	/* Mask to modulo into entire table */
 	int		low_mask;	/* Mask to modulo into lower half of 
 					 * table */
-	int		ffactor;	/* Fill factor */
+	__uint32_t	ffactor;	/* Fill factor */
 	int		nkeys;		/* Number of keys in hash table */
 	int		hdrpages;	/* Size of table header */
 	int		h_charkey;	/* value of hash(CHARKEY) */
diff -Naur newlib-1.18.0.orig/newlib/libc/stdlib/putenv_r.c newlib-1.18.0/newlib/libc/stdlib/putenv_r.c
--- newlib-1.18.0.orig/newlib/libc/stdlib/putenv_r.c	2004-11-24 23:34:14.000000000 +0100
+++ newlib-1.18.0/newlib/libc/stdlib/putenv_r.c	2010-11-26 09:40:30.743685395 +0100
@@ -24,6 +24,7 @@
 #include <reent.h>
 #include <stdlib.h>
 #include <string.h>
+#include <strings.h>
 
 #include "envlock.h"
 
diff -Naur newlib-1.18.0.orig/newlib/libc/string/bcmp.c newlib-1.18.0/newlib/libc/string/bcmp.c
--- newlib-1.18.0.orig/newlib/libc/string/bcmp.c	2005-10-28 23:21:07.000000000 +0200
+++ newlib-1.18.0/newlib/libc/string/bcmp.c	2010-11-26 09:40:30.743685395 +0100
@@ -6,11 +6,11 @@
 	bcmp
 
 ANSI_SYNOPSIS
-	#include <string.h>
+	#include <strings.h>
 	int bcmp(const void *<[s1]>, const void *<[s2]>, size_t <[n]>);
 
 TRAD_SYNOPSIS
-	#include <string.h>
+	#include <strings.h>
 	int bcmp(<[s1]>, <[s2]>, <[n]>)
 	const void *<[s1]>;
 	const void *<[s2]>;
@@ -35,7 +35,7 @@
 	bcmp ansi pure
 */
 
-#include <string.h>
+#include <strings.h>
 
 int
 _DEFUN (bcmp, (m1, m2, n),
diff -Naur newlib-1.18.0.orig/newlib/libc/string/bcopy.c newlib-1.18.0/newlib/libc/string/bcopy.c
--- newlib-1.18.0.orig/newlib/libc/string/bcopy.c	2002-05-23 20:46:04.000000000 +0200
+++ newlib-1.18.0/newlib/libc/string/bcopy.c	2010-11-26 09:40:30.743685395 +0100
@@ -3,7 +3,7 @@
 	<<bcopy>>---copy memory regions
 
 ANSI_SYNOPSIS
-	#include <string.h>
+	#include <strings.h>
 	void bcopy(const void *<[in]>, void *<[out]>, size_t <[n]>);
 
 TRAD_SYNOPSIS
@@ -26,7 +26,7 @@
 	bcopy - pure
 */
 
-#include <string.h>
+#include <strings.h>
 
 void
 _DEFUN (bcopy, (b1, b2, length),
diff -Naur newlib-1.18.0.orig/newlib/libc/string/bzero.c newlib-1.18.0/newlib/libc/string/bzero.c
--- newlib-1.18.0.orig/newlib/libc/string/bzero.c	2002-05-23 20:46:04.000000000 +0200
+++ newlib-1.18.0/newlib/libc/string/bzero.c	2010-11-26 09:40:30.743685395 +0100
@@ -6,11 +6,11 @@
 	bzero
 
 ANSI_SYNOPSIS
-	#include <string.h>
+	#include <strings.h>
 	void bzero(void *<[b]>, size_t <[length]>);
 
 TRAD_SYNOPSIS
-	#include <string.h>
+	#include <strings.h>
 	void bzero(<[b]>, <[length]>)
 	void *<[b]>;
 	size_t <[length]>;
@@ -30,7 +30,7 @@
 <<bzero>> requires no supporting OS subroutines.
 */
 
-#include <string.h>
+#include <strings.h>
 
 _VOID
 _DEFUN (bzero, (b, length),
diff -Naur newlib-1.18.0.orig/newlib/libc/string/index.c newlib-1.18.0/newlib/libc/string/index.c
--- newlib-1.18.0.orig/newlib/libc/string/index.c	2000-02-17 20:39:48.000000000 +0100
+++ newlib-1.18.0/newlib/libc/string/index.c	2010-11-26 09:40:30.744685573 +0100
@@ -10,7 +10,7 @@
 	char * index(const char *<[string]>, int <[c]>);
 
 TRAD_SYNOPSIS
-	#include <string.h>
+	#include <strings.h>
 	char * index(<[string]>, <[c]>);
 	char *<[string]>;
 	int *<[c]>;
@@ -33,7 +33,8 @@
 	index - pure
 */
 
-#include <string.h>
+#include <strings.h>
+#include <string.h> /* strchr */
 
 char *
 _DEFUN (index, (s, c),
diff -Naur newlib-1.18.0.orig/newlib/libc/string/memccpy.c newlib-1.18.0/newlib/libc/string/memccpy.c
--- newlib-1.18.0.orig/newlib/libc/string/memccpy.c	2002-07-23 23:38:00.000000000 +0200
+++ newlib-1.18.0/newlib/libc/string/memccpy.c	2010-11-26 09:40:30.745685752 +0100
@@ -92,12 +92,11 @@
   _CONST char *src = src0;
   long *aligned_dst;
   _CONST long *aligned_src;
-  int   len =  len0;
   char endchar = endchar0 & 0xff;
 
   /* If the size is small, or either SRC or DST is unaligned,
      then punt into the byte copy loop.  This should be rare.  */
-  if (!TOO_SMALL(len) && !UNALIGNED (src, dst))
+  if (!TOO_SMALL(len0) && !UNALIGNED (src, dst))
     {
       int i;
       unsigned long mask = 0;
@@ -116,14 +115,14 @@
 
 
       /* Copy one long word at a time if possible.  */
-      while (len >= LITTLEBLOCKSIZE)
+      while (len0 >= LITTLEBLOCKSIZE)
         {
           unsigned long buffer = (unsigned long)(*aligned_src);
           buffer ^=  mask;
           if (DETECTNULL (buffer))
             break; /* endchar is found, go byte by byte from here */
           *aligned_dst++ = *aligned_src++;
-          len -= LITTLEBLOCKSIZE;
+          len0 -= LITTLEBLOCKSIZE;
         }
 
        /* Pick up any residual with a byte copier.  */
@@ -131,7 +130,7 @@
       src = (char*)aligned_src;
     }
 
-  while (len--)
+  while (len0--)
     {
       if ((*dst++ = *src++) == endchar)
         {
diff -Naur newlib-1.18.0.orig/newlib/libc/string/memcpy.c newlib-1.18.0/newlib/libc/string/memcpy.c
--- newlib-1.18.0.orig/newlib/libc/string/memcpy.c	2008-12-11 18:27:56.000000000 +0100
+++ newlib-1.18.0/newlib/libc/string/memcpy.c	2010-11-26 09:40:30.745685752 +0100
@@ -72,30 +72,29 @@
   _CONST char *src = src0;
   long *aligned_dst;
   _CONST long *aligned_src;
-  int   len =  len0;
 
   /* If the size is small, or either SRC or DST is unaligned,
      then punt into the byte copy loop.  This should be rare.  */
-  if (!TOO_SMALL(len) && !UNALIGNED (src, dst))
+  if (!TOO_SMALL(len0) && !UNALIGNED (src, dst))
     {
       aligned_dst = (long*)dst;
       aligned_src = (long*)src;
 
       /* Copy 4X long words at a time if possible.  */
-      while (len >= BIGBLOCKSIZE)
+      while (len0 >= BIGBLOCKSIZE)
         {
           *aligned_dst++ = *aligned_src++;
           *aligned_dst++ = *aligned_src++;
           *aligned_dst++ = *aligned_src++;
           *aligned_dst++ = *aligned_src++;
-          len -= BIGBLOCKSIZE;
+          len0 -= BIGBLOCKSIZE;
         }
 
       /* Copy one long word at a time if possible.  */
-      while (len >= LITTLEBLOCKSIZE)
+      while (len0 >= LITTLEBLOCKSIZE)
         {
           *aligned_dst++ = *aligned_src++;
-          len -= LITTLEBLOCKSIZE;
+          len0 -= LITTLEBLOCKSIZE;
         }
 
        /* Pick up any residual with a byte copier.  */
@@ -103,7 +102,7 @@
       src = (char*)aligned_src;
     }
 
-  while (len--)
+  while (len0--)
     *dst++ = *src++;
 
   return dst0;
diff -Naur newlib-1.18.0.orig/newlib/libc/string/memmove.c newlib-1.18.0/newlib/libc/string/memmove.c
--- newlib-1.18.0.orig/newlib/libc/string/memmove.c	2000-02-17 20:39:48.000000000 +0100
+++ newlib-1.18.0/newlib/libc/string/memmove.c	2010-11-26 09:40:30.745685752 +0100
@@ -88,14 +88,13 @@
   _CONST char *src = src_void;
   long *aligned_dst;
   _CONST long *aligned_src;
-  int   len =  length;
 
-  if (src < dst && dst < src + len)
+  if (src < dst && dst < src + length)
     {
       /* Destructive overlap...have to copy backwards */
-      src += len;
-      dst += len;
-      while (len--)
+      src += length;
+      dst += length;
+      while (length--)
 	{
 	  *--dst = *--src;
 	}
@@ -105,26 +104,26 @@
       /* Use optimizing algorithm for a non-destructive copy to closely 
          match memcpy. If the size is small or either SRC or DST is unaligned,
          then punt into the byte copy loop.  This should be rare.  */
-      if (!TOO_SMALL(len) && !UNALIGNED (src, dst))
+      if (!TOO_SMALL(length) && !UNALIGNED (src, dst))
         {
           aligned_dst = (long*)dst;
           aligned_src = (long*)src;
 
           /* Copy 4X long words at a time if possible.  */
-          while (len >= BIGBLOCKSIZE)
+          while (length >= BIGBLOCKSIZE)
             {
               *aligned_dst++ = *aligned_src++;
               *aligned_dst++ = *aligned_src++;
               *aligned_dst++ = *aligned_src++;
               *aligned_dst++ = *aligned_src++;
-              len -= BIGBLOCKSIZE;
+              length -= BIGBLOCKSIZE;
             }
 
           /* Copy one long word at a time if possible.  */
-          while (len >= LITTLEBLOCKSIZE)
+          while (length >= LITTLEBLOCKSIZE)
             {
               *aligned_dst++ = *aligned_src++;
-              len -= LITTLEBLOCKSIZE;
+              length -= LITTLEBLOCKSIZE;
             }
 
           /* Pick up any residual with a byte copier.  */
@@ -132,7 +131,7 @@
           src = (char*)aligned_src;
         }
 
-      while (len--)
+      while (length--)
         {
           *dst++ = *src++;
         }
diff -Naur newlib-1.18.0.orig/newlib/libc/string/mempcpy.c newlib-1.18.0/newlib/libc/string/mempcpy.c
--- newlib-1.18.0.orig/newlib/libc/string/mempcpy.c	2002-07-23 23:38:00.000000000 +0200
+++ newlib-1.18.0/newlib/libc/string/mempcpy.c	2010-11-26 09:40:30.745685752 +0100
@@ -69,30 +69,29 @@
   _CONST char *src = src0;
   long *aligned_dst;
   _CONST long *aligned_src;
-  int   len =  len0;
 
   /* If the size is small, or either SRC or DST is unaligned,
      then punt into the byte copy loop.  This should be rare.  */
-  if (!TOO_SMALL(len) && !UNALIGNED (src, dst))
+  if (!TOO_SMALL(len0) && !UNALIGNED (src, dst))
     {
       aligned_dst = (long*)dst;
       aligned_src = (long*)src;
 
       /* Copy 4X long words at a time if possible.  */
-      while (len >= BIGBLOCKSIZE)
+      while (len0 >= BIGBLOCKSIZE)
         {
           *aligned_dst++ = *aligned_src++;
           *aligned_dst++ = *aligned_src++;
           *aligned_dst++ = *aligned_src++;
           *aligned_dst++ = *aligned_src++;
-          len -= BIGBLOCKSIZE;
+          len0 -= BIGBLOCKSIZE;
         }
 
       /* Copy one long word at a time if possible.  */
-      while (len >= LITTLEBLOCKSIZE)
+      while (len0 >= LITTLEBLOCKSIZE)
         {
           *aligned_dst++ = *aligned_src++;
-          len -= LITTLEBLOCKSIZE;
+          len0 -= LITTLEBLOCKSIZE;
         }
 
        /* Pick up any residual with a byte copier.  */
@@ -100,7 +99,7 @@
       src = (char*)aligned_src;
     }
 
-  while (len--)
+  while (len0--)
     *dst++ = *src++;
 
   return dst;
diff -Naur newlib-1.18.0.orig/newlib/libc/string/rindex.c newlib-1.18.0/newlib/libc/string/rindex.c
--- newlib-1.18.0.orig/newlib/libc/string/rindex.c	2000-02-17 20:39:48.000000000 +0100
+++ newlib-1.18.0/newlib/libc/string/rindex.c	2010-11-26 09:40:30.745685752 +0100
@@ -10,7 +10,7 @@
 	char * rindex(const char *<[string]>, int <[c]>);
 
 TRAD_SYNOPSIS
-	#include <string.h>
+	#include <strings.h>
 	char * rindex(<[string]>, <[c]>);
 	char *<[string]>;
 	int *<[c]>;
@@ -33,7 +33,8 @@
 	rindex - pure
 */
 
-#include <string.h>
+#include <strings.h>
+#include <string.h> /* strchr */
 
 char *
 _DEFUN (rindex, (s, c),
diff -Naur newlib-1.18.0.orig/newlib/libc/string/strcasecmp.c newlib-1.18.0/newlib/libc/string/strcasecmp.c
--- newlib-1.18.0.orig/newlib/libc/string/strcasecmp.c	2009-04-23 20:11:22.000000000 +0200
+++ newlib-1.18.0/newlib/libc/string/strcasecmp.c	2010-11-26 09:40:30.746685930 +0100
@@ -38,7 +38,7 @@
 	strcasecmp
 */
 
-#include <string.h>
+#include <strings.h>
 #include <ctype.h>
 
 int
diff -Naur newlib-1.18.0.orig/newlib/libc/string/strcat.c newlib-1.18.0/newlib/libc/string/strcat.c
--- newlib-1.18.0.orig/newlib/libc/string/strcat.c	2000-02-17 20:39:48.000000000 +0100
+++ newlib-1.18.0/newlib/libc/string/strcat.c	2010-11-26 09:40:30.746685930 +0100
@@ -33,12 +33,13 @@
 	strcat ansi pure
 */
 
+#include <stdint.h>
 #include <string.h>
 #include <limits.h>
 
 /* Nonzero if X is aligned on a "long" boundary.  */
 #define ALIGNED(X) \
-  (((long)X & (sizeof (long) - 1)) == 0)
+  (((uintptr_t)X & (sizeof (long) - 1)) == 0)
 
 #if LONG_MAX == 2147483647L
 #define DETECTNULL(X) (((X) - 0x01010101) & ~(X) & 0x80808080)
diff -Naur newlib-1.18.0.orig/newlib/libc/string/strchr.c newlib-1.18.0/newlib/libc/string/strchr.c
--- newlib-1.18.0.orig/newlib/libc/string/strchr.c	2008-05-22 04:31:46.000000000 +0200
+++ newlib-1.18.0/newlib/libc/string/strchr.c	2010-11-26 09:40:30.746685930 +0100
@@ -33,11 +33,12 @@
 	strchr ansi pure
 */
 
+#include <stdint.h>
 #include <string.h>
 #include <limits.h>
 
 /* Nonzero if X is not aligned on a "long" boundary.  */
-#define UNALIGNED(X) ((long)X & (sizeof (long) - 1))
+#define UNALIGNED(X) ((uintptr_t)X & (sizeof (long) - 1))
 
 /* How many bytes are loaded each iteration of the word copy loop.  */
 #define LBLOCKSIZE (sizeof (long))
diff -Naur newlib-1.18.0.orig/newlib/libc/string/strcmp.c newlib-1.18.0/newlib/libc/string/strcmp.c
--- newlib-1.18.0.orig/newlib/libc/string/strcmp.c	2000-02-17 20:39:48.000000000 +0100
+++ newlib-1.18.0/newlib/libc/string/strcmp.c	2010-11-26 09:40:30.746685930 +0100
@@ -35,12 +35,13 @@
 	strcmp ansi pure
 */
 
+#include <stdint.h>
 #include <string.h>
 #include <limits.h>
 
 /* Nonzero if either X or Y is not aligned on a "long" boundary.  */
 #define UNALIGNED(X, Y) \
-  (((long)X & (sizeof (long) - 1)) | ((long)Y & (sizeof (long) - 1)))
+  (((uintptr_t)X & (sizeof (long) - 1)) | ((uintptr_t)Y & (sizeof (long) - 1)))
 
 /* DETECTNULL returns nonzero if (long)X contains a NULL byte. */
 #if LONG_MAX == 2147483647L
diff -Naur newlib-1.18.0.orig/newlib/libc/string/strncasecmp.c newlib-1.18.0/newlib/libc/string/strncasecmp.c
--- newlib-1.18.0.orig/newlib/libc/string/strncasecmp.c	2009-04-23 20:11:22.000000000 +0200
+++ newlib-1.18.0/newlib/libc/string/strncasecmp.c	2010-11-26 09:40:30.746685930 +0100
@@ -6,11 +6,11 @@
 	strncasecmp
 
 ANSI_SYNOPSIS
-	#include <string.h>
+	#include <strings.h>
 	int strncasecmp(const char *<[a]>, const char * <[b]>, size_t <[length]>);
 
 TRAD_SYNOPSIS
-	#include <string.h>
+	#include <strings.h>
 	int strncasecmp(<[a]>, <[b]>, <[length]>)
 	char *<[a]>;
 	char *<[b]>;
@@ -40,7 +40,7 @@
 	strncasecmp
 */
 
-#include <string.h>
+#include <strings.h>
 #include <ctype.h>
 
 int 
diff -Naur newlib-1.18.0.orig/newlib/libc/string/strncmp.c newlib-1.18.0/newlib/libc/string/strncmp.c
--- newlib-1.18.0.orig/newlib/libc/string/strncmp.c	2000-02-17 20:39:48.000000000 +0100
+++ newlib-1.18.0/newlib/libc/string/strncmp.c	2010-11-26 09:40:30.747686111 +0100
@@ -36,12 +36,13 @@
 	strncmp ansi pure
 */
 
+#include <stdint.h>
 #include <string.h>
 #include <limits.h>
 
 /* Nonzero if either X or Y is not aligned on a "long" boundary.  */
 #define UNALIGNED(X, Y) \
-  (((long)X & (sizeof (long) - 1)) | ((long)Y & (sizeof (long) - 1)))
+  (((uintptr_t)X & (sizeof (long) - 1)) | ((uintptr_t)Y & (sizeof (long) - 1)))
 
 /* DETECTNULL returns nonzero if (long)X contains a NULL byte. */
 #if LONG_MAX == 2147483647L
diff -Naur newlib-1.18.0.orig/newlib/libc/string/str-two-way.h newlib-1.18.0/newlib/libc/string/str-two-way.h
--- newlib-1.18.0.orig/newlib/libc/string/str-two-way.h	2008-10-02 22:12:34.000000000 +0200
+++ newlib-1.18.0/newlib/libc/string/str-two-way.h	2010-11-26 09:40:30.746685930 +0100
@@ -1,5 +1,5 @@
 /* Byte-wise substring search, using the Two-Way algorithm.
- * Copyright (C) 2008 Eric Blake
+ * Copyright (C) 2008, 2010 Eric Blake
  * Permission to use, copy, modify, and distribute this software
  * is freely granted, provided that this notice is preserved.
  */
@@ -335,8 +335,8 @@
 		     a byte out of place, there can be no match until
 		     after the mismatch.  */
 		  shift = needle_len - period;
-		  memory = 0;
 		}
+		memory = 0;
 	      j += shift;
 	      continue;
 	    }
diff -Naur newlib-1.18.0.orig/newlib/libc/sys/linux/sys/dirent.h newlib-1.18.0/newlib/libc/sys/linux/sys/dirent.h
--- newlib-1.18.0.orig/newlib/libc/sys/linux/sys/dirent.h	2008-11-19 21:55:52.000000000 +0100
+++ newlib-1.18.0/newlib/libc/sys/linux/sys/dirent.h	2010-11-26 09:40:30.747686111 +0100
@@ -40,7 +40,7 @@
 int closedir(DIR *);
 
 /* internal prototype */
-void _seekdir(DIR *dir,off_t offset);
+void _seekdir(DIR *dir, long offset);
 DIR *_opendir(const char *);
 
 #ifndef _POSIX_SOURCE
diff -Naur newlib-1.18.0.orig/newlib/libc/sys/rtems/machine/_types.h newlib-1.18.0/newlib/libc/sys/rtems/machine/_types.h
--- newlib-1.18.0.orig/newlib/libc/sys/rtems/machine/_types.h	2009-12-17 17:10:41.000000000 +0100
+++ newlib-1.18.0/newlib/libc/sys/rtems/machine/_types.h	2010-11-26 09:40:30.747686111 +0100
@@ -20,6 +20,9 @@
 typedef long signed int _ssize_t;
 #endif
 #define __ssize_t_defined 1
+#elif defined(__sparc__) && defined(__LP64__)
+typedef long signed int _ssize_t;
+#define __ssize_t_defined 1
 #elif defined(__AVR__) || defined(__lm32__) || defined(__m32c__) || defined(__mips__) || defined(__PPC__) || defined(__sparc__) || defined(__sh__)
 typedef signed int _ssize_t;
 #define __ssize_t_defined 1
@@ -31,4 +34,25 @@
 
 typedef __int32_t blksize_t;
 typedef __int32_t blkcnt_t;
+
+/* EXPERIMENTAL: Use 64bit types */
+#if defined(__arm__) || defined(__i386__) || defined(__m68k__) || defined(__mips__) || defined(__PPC__) || defined(__sparc__)
+/* Use 64bit types */
+typedef __int64_t _off_t;
+#define __off_t_defined 1
+
+typedef __int64_t _fpos_t;
+#define __fpos_t_defined 1
+#else
+/* Use 32bit types */
+typedef __int32_t _off_t;
+#define __off_t_defined 1
+
+typedef __int32_t _fpos_t;
+#define __fpos_t_defined 1
+#endif
+
+typedef __uint32_t _mode_t;
+#define __mode_t_defined 1
+
 #endif
diff -Naur newlib-1.18.0.orig/newlib/libc/sys/rtems/sys/dirent.h newlib-1.18.0/newlib/libc/sys/rtems/sys/dirent.h
--- newlib-1.18.0.orig/newlib/libc/sys/rtems/sys/dirent.h	2004-01-08 20:25:21.000000000 +0100
+++ newlib-1.18.0/newlib/libc/sys/rtems/sys/dirent.h	2010-11-26 09:40:30.747686111 +0100
@@ -31,6 +31,10 @@
 void seekdir(DIR *dir, long loc);
 long telldir(DIR *dir);
 
+#ifdef _COMPILING_NEWLIB
+void _seekdir(DIR *dir, long offset);
+#endif
+
 #include <sys/types.h>
 
 #include <limits.h>
diff -Naur newlib-1.18.0.orig/newlib/libm/common/fdlibm.h newlib-1.18.0/newlib/libm/common/fdlibm.h
--- newlib-1.18.0.orig/newlib/libm/common/fdlibm.h	2009-11-17 23:35:46.000000000 +0100
+++ newlib-1.18.0/newlib/libm/common/fdlibm.h	2010-11-26 09:40:30.748686295 +0100
@@ -361,3 +361,44 @@
   sf_u.word = (i);						\
   (d) = sf_u.value;						\
 } while (0)
+
+/* Macros to avoid undefined behaviour that can arise if the amount
+   of a shift is exactly equal to the size of the shifted operand.  */
+
+#define SAFE_LEFT_SHIFT(op,amt)					\
+  (((amt) < 8 * sizeof(op)) ? ((op) << (amt)) : 0)
+
+#define SAFE_RIGHT_SHIFT(op,amt)				\
+  (((amt) < 8 * sizeof(op)) ? ((op) >> (amt)) : 0)
+
+#ifdef  _COMPLEX_H
+
+/*
+ * Quoting from ISO/IEC 9899:TC2:
+ *
+ * 6.2.5.13 Types
+ * Each complex type has the same representation and alignment requirements as
+ * an array type containing exactly two elements of the corresponding real type;
+ * the first element is equal to the real part, and the second element to the
+ * imaginary part, of the complex number.
+ */
+typedef union {
+        float complex z;
+        float parts[2];
+} float_complex;
+
+typedef union {
+        double complex z;
+        double parts[2];
+} double_complex;
+
+typedef union {
+        long double complex z;
+        long double parts[2];
+} long_double_complex;
+
+#define REAL_PART(z)    ((z).parts[0])
+#define IMAG_PART(z)    ((z).parts[1])
+
+#endif  /* _COMPLEX_H */
+
diff -Naur newlib-1.18.0.orig/newlib/libm/common/modfl.c newlib-1.18.0/newlib/libm/common/modfl.c
--- newlib-1.18.0.orig/newlib/libm/common/modfl.c	2009-04-18 00:15:43.000000000 +0200
+++ newlib-1.18.0/newlib/libm/common/modfl.c	2010-11-26 09:40:30.748686295 +0100
@@ -36,7 +36,7 @@
 long double
 modfl (long double x, long double *iptr)
 {
-  return modf(x, iptr);
+  return modf(x, (double*) iptr);
 }
 #endif
 
diff -Naur newlib-1.18.0.orig/newlib/libm/common/sf_llrint.c newlib-1.18.0/newlib/libm/common/sf_llrint.c
--- newlib-1.18.0.orig/newlib/libm/common/sf_llrint.c	2009-04-03 19:39:24.000000000 +0200
+++ newlib-1.18.0/newlib/libm/common/sf_llrint.c	2010-11-26 09:40:30.748686295 +0100
@@ -71,7 +71,7 @@
           GET_FLOAT_WORD (i0, t);
           /* Detect the all-zeros representation of plus and
              minus zero, which fails the calculation below. */
-          if ((i0 & ~(1 << 31)) == 0)
+          if ((i0 & ~((__uint32_t)1 << 31)) == 0)
               return 0;
           j0 = ((i0 >> 23) & 0xff) - 0x7f;
           i0 &= 0x7fffff;
diff -Naur newlib-1.18.0.orig/newlib/libm/common/sf_round.c newlib-1.18.0/newlib/libm/common/sf_round.c
--- newlib-1.18.0.orig/newlib/libm/common/sf_round.c	2005-02-24 20:02:35.000000000 +0100
+++ newlib-1.18.0/newlib/libm/common/sf_round.c	2010-11-26 09:40:30.748686295 +0100
@@ -38,7 +38,7 @@
           w &= 0x80000000;
           if (exponent_less_127 == -1)
             /* Result is +1.0 or -1.0. */
-            w |= (127 << 23);
+            w |= ((__uint32_t)127 << 23);
         }
       else
         {
diff -Naur newlib-1.18.0.orig/newlib/libm/complex/cabs.c newlib-1.18.0/newlib/libm/complex/cabs.c
--- newlib-1.18.0.orig/newlib/libm/complex/cabs.c	1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.18.0/newlib/libm/complex/cabs.c	2010-11-26 09:40:30.749686481 +0100
@@ -0,0 +1,53 @@
+/* $NetBSD: cabs.c,v 1.1 2007/08/20 16:01:30 drochner Exp $ */
+
+/*
+ * Written by Matthias Drochner <drochner@NetBSD.org>.
+ * Public domain.
+ *
+ * imported and modified include for newlib 2010/10/03 
+ * Marco Atzeri <marco_atzeri@yahoo.it>
+ */
+
+/*
+FUNCTION
+        <<cabs>>, <<cabsf>>---complex absolute-value
+
+INDEX
+        cabs
+INDEX
+        cabsf
+
+ANSI_SYNOPSIS
+       #include <complex.h>
+       double cabs(double complex <[z]>);
+       float cabsf(float complex <[z]>);
+
+
+DESCRIPTION
+        These functions compute compute the complex absolute value 
+        (also called norm, modulus, or magnitude) of <[z]>. 
+
+        <<cabsf>> is identical to <<cabs>>, except that it performs
+        its calculations on <<floats complex>>.
+
+RETURNS
+        The cabs functions return the complex absolute value.
+
+PORTABILITY
+        <<cabs>> and <<cabsf>> are ISO C99
+
+QUICKREF
+        <<cabs>> and <<cabsf>> are ISO C99
+
+*/
+
+
+#include <complex.h>
+#include <math.h>
+
+double
+cabs(double complex z)
+{
+
+	return hypot( creal(z), cimag(z) );
+}
diff -Naur newlib-1.18.0.orig/newlib/libm/complex/cabsf.c newlib-1.18.0/newlib/libm/complex/cabsf.c
--- newlib-1.18.0.orig/newlib/libm/complex/cabsf.c	1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.18.0/newlib/libm/complex/cabsf.c	2010-11-26 09:40:30.749686481 +0100
@@ -0,0 +1,19 @@
+/* $NetBSD: cabsf.c,v 1.1 2007/08/20 16:01:30 drochner Exp $ */
+
+/*
+ * Written by Matthias Drochner <drochner@NetBSD.org>.
+ * Public domain.
+ *
+ * imported and modified include for newlib 2010/10/03 
+ * Marco Atzeri <marco_atzeri@yahoo.it>
+ */
+
+#include <complex.h>
+#include <math.h>
+
+float
+cabsf(float complex z)
+{
+
+	return hypotf( crealf(z), cimagf(z) );
+}
diff -Naur newlib-1.18.0.orig/newlib/libm/complex/cacos.c newlib-1.18.0/newlib/libm/complex/cacos.c
--- newlib-1.18.0.orig/newlib/libm/complex/cacos.c	1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.18.0/newlib/libm/complex/cacos.c	2010-11-26 09:40:30.749686481 +0100
@@ -0,0 +1,89 @@
+/* $NetBSD: cacos.c,v 1.1 2007/08/20 16:01:30 drochner Exp $ */
+
+/*-
+ * Copyright (c) 2007 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software written by Stephen L. Moshier.
+ * It is redistributed by the NetBSD Foundation by permission of the author.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * imported and modified include for newlib 2010/10/03 
+ * Marco Atzeri <marco_atzeri@yahoo.it>
+ */
+
+/*
+FUNCTION
+        <<cacos>>, <<cacosf>>---complex arc cosine
+
+INDEX
+        cacos
+INDEX
+        cacosf
+
+ANSI_SYNOPSIS
+       #include <complex.h>
+       double complex cacos(double complex <[z]>);
+       float complex cacosf(float complex <[z]>);
+
+
+DESCRIPTION
+        These functions compute the complex arc cosine of <[z]>,
+        with branch cuts outside the interval [-1, +1] along the real axis.
+
+        <<cacosf>> is identical to <<cacos>>, except that it performs
+        its calculations on <<floats complex>>.
+
+RETURNS
+        @ifnottex
+        These functions return the complex arc cosine value, in the range
+        of a strip mathematically  unbounded  along the imaginary axis
+        and in the interval [0, pi] along the real axis.
+        @end ifnottex
+        @tex
+        These functions return the complex arc cosine value, in the range
+        of a strip mathematically  unbounded  along the imaginary axis
+        and in the interval [<<0>>, $\pi$] along the real axis.
+        @end tex
+
+PORTABILITY
+        <<cacos>> and <<cacosf>> are ISO C99
+
+QUICKREF
+        <<cacos>> and <<cacosf>> are ISO C99
+
+*/
+
+#include <complex.h>
+#include <math.h>
+
+double complex
+cacos(double complex z)
+{
+	double complex w;
+
+	w = casin(z);
+	w = M_PI_2 - creal(w);
+	w -= (cimag(w) * I);
+	return w;
+}
diff -Naur newlib-1.18.0.orig/newlib/libm/complex/cacosf.c newlib-1.18.0/newlib/libm/complex/cacosf.c
--- newlib-1.18.0.orig/newlib/libm/complex/cacosf.c	1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.18.0/newlib/libm/complex/cacosf.c	2010-11-26 09:40:30.749686481 +0100
@@ -0,0 +1,46 @@
+/* $NetBSD: cacosf.c,v 1.1 2007/08/20 16:01:30 drochner Exp $ */
+
+/*-
+ * Copyright (c) 2007 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software written by Stephen L. Moshier.
+ * It is redistributed by the NetBSD Foundation by permission of the author.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * imported and modified include for newlib 2010/10/03 
+ * Marco Atzeri <marco_atzeri@yahoo.it>
+ */
+
+#include <complex.h>
+#include <math.h>
+
+float complex
+cacosf(float complex z)
+{
+	float complex w;
+
+	w = casinf(z);
+	w = ((float)M_PI_2 - crealf(w)) - cimagf(w) * I;
+	return w;
+}
diff -Naur newlib-1.18.0.orig/newlib/libm/complex/cacosh.c newlib-1.18.0/newlib/libm/complex/cacosh.c
--- newlib-1.18.0.orig/newlib/libm/complex/cacosh.c	1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.18.0/newlib/libm/complex/cacosh.c	2010-11-26 09:40:30.750686667 +0100
@@ -0,0 +1,93 @@
+/* $NetBSD: cacosh.c,v 1.2 2009/08/03 19:41:32 drochner Exp $ */
+
+/*-
+ * Copyright (c) 2007 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software written by Stephen L. Moshier.
+ * It is redistributed by the NetBSD Foundation by permission of the author.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * imported and modified include for newlib 2010/10/03 
+ * Marco Atzeri <marco_atzeri@yahoo.it>
+ */
+
+/*
+FUNCTION
+        <<cacosh>>, <<cacoshf>>---complex arc hyperbolic cosine
+
+INDEX
+        cacosh
+INDEX
+        cacoshf
+
+ANSI_SYNOPSIS
+       #include <complex.h>
+       double complex cacosh(double complex <[z]>);
+       float complex cacoshf(float complex <[z]>);
+
+
+DESCRIPTION
+        These functions compute the complex arc hyperbolic cosine of <[z]>,
+        with a branch cut at values less than 1 along the real axis.
+
+        <<cacoshf>> is identical to <<cacosh>>, except that it performs
+        its calculations on <<floats complex>>.
+
+RETURNS
+        @ifnottex
+        These functions return the complex arc hyperbolic cosine value, 
+        in the range of a half-strip of non-negative values along the 
+        real axis and in the interval [-i * pi, +i * pi] along the 
+        imaginary axis.
+        @end ifnottex
+        @tex
+        These functions return the complex arc hyperbolic cosine value, 
+        in the range of a half-strip of non-negative values along the 
+        real axis and in the interval [$-i\pi$, $+i\pi$] along the 
+        imaginary axis.
+        @end tex
+
+PORTABILITY
+        <<cacosh>> and <<cacoshf>> are ISO C99
+
+QUICKREF
+        <<cacosh>> and <<cacoshf>> are ISO C99
+
+*/
+
+
+#include <complex.h>
+
+double complex
+cacosh(double complex z)
+{
+	double complex w;
+
+#if 0 /* does not give the principal value */
+	w = I * cacos(z);
+#else
+	w = clog(z + csqrt(z + 1) * csqrt(z - 1));
+#endif
+	return w;
+}
diff -Naur newlib-1.18.0.orig/newlib/libm/complex/cacoshf.c newlib-1.18.0/newlib/libm/complex/cacoshf.c
--- newlib-1.18.0.orig/newlib/libm/complex/cacoshf.c	1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.18.0/newlib/libm/complex/cacoshf.c	2010-11-26 09:40:30.750686667 +0100
@@ -0,0 +1,48 @@
+/* $NetBSD: cacoshf.c,v 1.2 2009/08/03 19:41:32 drochner Exp $ */
+
+/*-
+ * Copyright (c) 2007 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software written by Stephen L. Moshier.
+ * It is redistributed by the NetBSD Foundation by permission of the author.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * imported and modified include for newlib 2010/10/03 
+ * Marco Atzeri <marco_atzeri@yahoo.it>
+ */
+
+#include <complex.h>
+
+float complex
+cacoshf(float complex z)
+{
+	float complex w;
+
+#if 0 /* does not give the principal value */
+	w = I * cacosf(z);
+#else
+	w = clogf(z + csqrtf(z + 1) * csqrtf(z - 1));
+#endif
+	return w;
+}
diff -Naur newlib-1.18.0.orig/newlib/libm/complex/carg.c newlib-1.18.0/newlib/libm/complex/carg.c
--- newlib-1.18.0.orig/newlib/libm/complex/carg.c	1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.18.0/newlib/libm/complex/carg.c	2010-11-26 09:40:30.750686667 +0100
@@ -0,0 +1,59 @@
+/* $NetBSD: carg.c,v 1.1 2007/08/20 16:01:31 drochner Exp $ */
+
+/*
+ * Written by Matthias Drochner <drochner@NetBSD.org>.
+ * Public domain.
+ *
+ * imported and modified include for newlib 2010/10/03 
+ * Marco Atzeri <marco_atzeri@yahoo.it>
+ */
+
+/*
+FUNCTION
+        <<carg>>, <<cargf>>---argument (phase angle)
+
+INDEX
+        carg
+INDEX
+        cargf
+
+ANSI_SYNOPSIS
+       #include <complex.h>
+       double carg(double complex <[z]>);
+       float cargf(float complex <[z]>);
+
+
+DESCRIPTION
+        These functions compute the argument (also called phase angle) 
+        of <[z]>, with a branch cut along the negative real axis.
+
+        <<cargf>> is identical to <<carg>>, except that it performs
+        its calculations on <<floats complex>>.
+
+RETURNS
+        @ifnottex
+        The carg functions return the value of the argument in the 
+        interval [-pi, +pi]
+        @end ifnottex
+        @tex
+        The carg functions return the value of the argument in the 
+        interval [$-\pi$, $+\pi$]
+        @end tex
+
+PORTABILITY
+        <<carg>> and <<cargf>> are ISO C99
+
+QUICKREF
+        <<carg>> and <<cargf>> are ISO C99
+
+*/
+
+#include <complex.h>
+#include <math.h>
+
+double
+carg(double complex z)
+{
+
+	return atan2( cimag(z) , creal(z) );
+}
diff -Naur newlib-1.18.0.orig/newlib/libm/complex/cargf.c newlib-1.18.0/newlib/libm/complex/cargf.c
--- newlib-1.18.0.orig/newlib/libm/complex/cargf.c	1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.18.0/newlib/libm/complex/cargf.c	2010-11-26 09:40:30.750686667 +0100
@@ -0,0 +1,19 @@
+/* $NetBSD: cargf.c,v 1.1 2007/08/20 16:01:31 drochner Exp $ */
+
+/*
+ * Written by Matthias Drochner <drochner@NetBSD.org>.
+ * Public domain.
+ *
+ * imported and modified include for newlib 2010/10/03 
+ * Marco Atzeri <marco_atzeri@yahoo.it>
+ */
+
+#include <complex.h>
+#include <math.h>
+
+float
+cargf(float complex z)
+{
+
+	return atan2f( cimagf(z), crealf(z) );
+}
diff -Naur newlib-1.18.0.orig/newlib/libm/complex/casin.c newlib-1.18.0/newlib/libm/complex/casin.c
--- newlib-1.18.0.orig/newlib/libm/complex/casin.c	1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.18.0/newlib/libm/complex/casin.c	2010-11-26 09:40:30.750686667 +0100
@@ -0,0 +1,165 @@
+/* $NetBSD: casin.c,v 1.1 2007/08/20 16:01:31 drochner Exp $ */
+
+/*-
+ * Copyright (c) 2007 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software written by Stephen L. Moshier.
+ * It is redistributed by the NetBSD Foundation by permission of the author.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * imported and modified include for newlib 2010/10/03 
+ * Marco Atzeri <marco_atzeri@yahoo.it>
+ */
+
+/*
+FUNCTION
+        <<casin>>, <<casinf>>---complex arc sine
+
+INDEX
+        casin
+INDEX
+        casinf
+
+ANSI_SYNOPSIS
+       #include <complex.h>
+       double complex casin(double complex <[z]>);
+       float complex casinf(float complex <[z]>);
+
+
+DESCRIPTION
+        These functions compute the complex arc sine of <[z]>,
+        with branch cuts outside the interval [-1, +1] along the real axis.
+
+        <<casinf>> is identical to <<casin>>, except that it performs
+        its calculations on <<floats complex>>.
+
+RETURNS
+        @ifnottex
+        These functions return the complex arc sine value, in the range
+        of a strip mathematically  unbounded  along the imaginary axis
+        and in the interval [-pi/2, +pi/2] along the real axis.
+        @end ifnottex
+        @tex
+        These functions return the complex arc sine value, in the range
+        of a strip mathematically  unbounded  along the imaginary axis
+        and in the interval [$-\pi/2$, $+\pi/2$] along the real axis.
+        @end tex
+
+PORTABILITY
+        <<casin>> and <<casinf>> are ISO C99
+
+QUICKREF
+        <<casin>> and <<casinf>> are ISO C99
+
+*/
+
+
+#include <complex.h>
+#include <math.h>
+
+#ifdef __weak_alias
+__weak_alias(casin, _casin)
+#endif
+
+double complex
+casin(double complex z)
+{
+	double complex w;
+	double complex ca, ct, zz, z2;
+	double x, y;
+
+	x = creal(z);
+	y = cimag(z);
+
+#if 0 /* MD: test is incorrect, casin(>1) is defined */
+	if (y == 0.0) {
+		if (fabs(x) > 1.0) {
+			w = M_PI_2 + 0.0 * I;
+#if 0
+			mtherr ("casin", DOMAIN);
+#endif
+		} else {
+			w = asin(x) + 0.0 * I;
+		}
+		return w;
+	}
+#endif
+
+/* Power series expansion */
+/*
+b = cabs(z);
+if( b < 0.125 )
+{
+z2.r = (x - y) * (x + y);
+z2.i = 2.0 * x * y;
+
+cn = 1.0;
+n = 1.0;
+ca.r = x;
+ca.i = y;
+sum.r = x;
+sum.i = y;
+do
+	{
+	ct.r = z2.r * ca.r  -  z2.i * ca.i;
+	ct.i = z2.r * ca.i  +  z2.i * ca.r;
+	ca.r = ct.r;
+	ca.i = ct.i;
+
+	cn *= n;
+	n += 1.0;
+	cn /= n;
+	n += 1.0;
+	b = cn/n;
+
+	ct.r *= b;
+	ct.i *= b;
+	sum.r += ct.r;
+	sum.i += ct.i;
+	b = fabs(ct.r) + fabs(ct.i);
+	}
+while( b > MACHEP );
+w->r = sum.r;
+w->i = sum.i;
+return;
+}
+*/
+
+
+	ca = x + y * I;
+	ct = ca * I;
+	/* sqrt( 1 - z*z) */
+	/* cmul( &ca, &ca, &zz ) */
+	/*x * x  -  y * y */
+	zz = (x - y) * (x + y) + (2.0 * x * y) * I;
+
+	zz = 1.0 - creal(zz) - cimag(zz) * I;
+	z2 = csqrt(zz);
+
+	zz = ct + z2;
+	zz = clog(zz);
+	/* multiply by 1/i = -i */
+	w = zz * (-1.0 * I);
+	return w;
+}
diff -Naur newlib-1.18.0.orig/newlib/libm/complex/casinf.c newlib-1.18.0/newlib/libm/complex/casinf.c
--- newlib-1.18.0.orig/newlib/libm/complex/casinf.c	1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.18.0/newlib/libm/complex/casinf.c	2010-11-26 09:40:30.750686667 +0100
@@ -0,0 +1,122 @@
+/* $NetBSD: casinf.c,v 1.1 2007/08/20 16:01:31 drochner Exp $ */
+
+/*-
+ * Copyright (c) 2007 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software written by Stephen L. Moshier.
+ * It is redistributed by the NetBSD Foundation by permission of the author.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * imported and modified include for newlib 2010/10/03 
+ * Marco Atzeri <marco_atzeri@yahoo.it>
+ */
+
+#include <complex.h>
+#include <math.h>
+
+#ifdef __weak_alias
+__weak_alias(casinf, _casinf)
+#endif
+
+float complex
+casinf(float complex z)
+{
+	float complex w;
+	float complex ca, ct, zz, z2;
+	float x, y;
+
+	x = crealf(z);
+	y = cimagf(z);
+
+#if 0 /* MD: test is incorrect, casin(>1) is defined */
+	if (y == 0.0f) {
+		if (fabsf(x) > 1.0) {
+			w = M_PI_2 + 0.0f * I;
+#if 0
+			mtherr ("casin", DOMAIN);
+#endif
+		} else {
+			w = asinf(x) + 0.0f * I;
+		}
+		return w;
+	}
+#endif
+
+/* Power series expansion */
+/*
+b = cabsf(z);
+if( b < 0.125 )
+{
+z2.r = (x - y) * (x + y);
+z2.i = 2.0 * x * y;
+
+cn = 1.0;
+n = 1.0;
+ca.r = x;
+ca.i = y;
+sum.r = x;
+sum.i = y;
+do
+	{
+	ct.r = z2.r * ca.r  -  z2.i * ca.i;
+	ct.i = z2.r * ca.i  +  z2.i * ca.r;
+	ca.r = ct.r;
+	ca.i = ct.i;
+
+	cn *= n;
+	n += 1.0;
+	cn /= n;
+	n += 1.0;
+	b = cn/n;
+
+	ct.r *= b;
+	ct.i *= b;
+	sum.r += ct.r;
+	sum.i += ct.i;
+	b = fabsf(ct.r) + fabsf(ct.i);
+	}
+while( b > MACHEP );
+w->r = sum.r;
+w->i = sum.i;
+return;
+}
+*/
+
+
+	ca = x + y * I;
+	ct = ca * I;
+	/* sqrt( 1 - z*z) */
+	/* cmul( &ca, &ca, &zz ) */
+	/*x * x  -  y * y */
+	zz = (x - y) * (x + y) + (2.0f * x * y) * I;
+
+	zz = 1.0f - crealf(zz) - cimagf(zz) * I;
+	z2 = csqrtf(zz);
+
+	zz = ct + z2;
+	zz = clogf(zz);
+	/* multiply by 1/i = -i */
+	w = zz * (-1.0f * I);
+	return w;
+}
diff -Naur newlib-1.18.0.orig/newlib/libm/complex/casinh.c newlib-1.18.0/newlib/libm/complex/casinh.c
--- newlib-1.18.0.orig/newlib/libm/complex/casinh.c	1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.18.0/newlib/libm/complex/casinh.c	2010-11-26 09:40:30.750686667 +0100
@@ -0,0 +1,97 @@
+/* $NetBSD: casinh.c,v 1.1 2007/08/20 16:01:31 drochner Exp $ */
+
+/*-
+ * Copyright (c) 2007 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software written by Stephen L. Moshier.
+ * It is redistributed by the NetBSD Foundation by permission of the author.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * imported and modified include for newlib 2010/10/03 
+ * Marco Atzeri <marco_atzeri@yahoo.it>
+ */
+
+/*
+FUNCTION
+        <<casinh>>, <<casinhf>>---complex arc hyperbolic sine
+
+INDEX
+        casinh
+INDEX
+        casinhf
+
+ANSI_SYNOPSIS
+       #include <complex.h>
+       double complex casinh(double complex <[z]>);
+       float complex casinhf(float complex <[z]>);
+
+
+DESCRIPTION
+        @ifnottex
+        These functions compute the complex arc hyperbolic sine of <[z]>,
+        with branch cuts outside the interval [-i, +i] along the 
+        imaginary axis.        
+        @end ifnottex
+        @tex
+        These functions compute the complex arc hyperbolic sine of <[z]>,
+        with branch cuts outside the interval [$-i$, $+i$] along the 
+        imaginary axis.        
+        @end tex
+
+        <<casinhf>> is identical to <<casinh>>, except that it performs
+        its calculations on <<floats complex>>.
+
+RETURNS
+        @ifnottex
+        These functions return the complex arc hyperbolic sine value, 
+        in the range of a strip mathematically unbounded along the 
+        real axis and in the interval [-i*p/2, +i*p/2] along the 
+        imaginary axis.
+        @end ifnottex
+        @tex
+        These functions return the complex arc hyperbolic sine value, 
+        in the range of a strip mathematically unbounded along the 
+        real axis and in the interval [$-i\pi/2$, $+i\pi/2$] along the 
+        imaginary axis.
+        @end tex
+
+PORTABILITY
+        <<casinh>> and <<casinhf>> are ISO C99
+
+QUICKREF
+        <<casinh>> and <<casinhf>> are ISO C99
+
+*/
+
+
+#include <complex.h>
+
+double complex
+casinh(double complex z)
+{
+	double complex w;
+
+	w = -1.0 * I * casin(z * I);
+	return w;
+}
diff -Naur newlib-1.18.0.orig/newlib/libm/complex/casinhf.c newlib-1.18.0/newlib/libm/complex/casinhf.c
--- newlib-1.18.0.orig/newlib/libm/complex/casinhf.c	1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.18.0/newlib/libm/complex/casinhf.c	2010-11-26 09:40:30.750686667 +0100
@@ -0,0 +1,44 @@
+/* $NetBSD: casinhf.c,v 1.1 2007/08/20 16:01:32 drochner Exp $ */
+
+/*-
+ * Copyright (c) 2007 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software written by Stephen L. Moshier.
+ * It is redistributed by the NetBSD Foundation by permission of the author.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * imported and modified include for newlib 2010/10/03 
+ * Marco Atzeri <marco_atzeri@yahoo.it>
+ */
+
+#include <complex.h>
+
+float complex
+casinhf(float complex z)
+{
+	float complex w;
+
+	w = -1.0f * I * casinf(z * I);
+	return w;
+}
diff -Naur newlib-1.18.0.orig/newlib/libm/complex/catan.c newlib-1.18.0/newlib/libm/complex/catan.c
--- newlib-1.18.0.orig/newlib/libm/complex/catan.c	1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.18.0/newlib/libm/complex/catan.c	2010-11-26 09:40:30.751686851 +0100
@@ -0,0 +1,137 @@
+/* $NetBSD: catan.c,v 1.1 2007/08/20 16:01:32 drochner Exp $ */
+
+/*-
+ * Copyright (c) 2007 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software written by Stephen L. Moshier.
+ * It is redistributed by the NetBSD Foundation by permission of the author.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * imported and modified include for newlib 2010/10/03 
+ * Marco Atzeri <marco_atzeri@yahoo.it>
+ */
+
+/*
+FUNCTION
+        <<catan>>, <<catanf>>---complex arc tangent
+
+INDEX
+        catan
+INDEX
+        catanf
+
+ANSI_SYNOPSIS
+       #include <complex.h>
+       double complex catan(double complex <[z]>);
+       float complex catanf(float complex <[z]>);
+
+
+DESCRIPTION
+        @ifnottex
+        These functions compute the complex arc tangent of <[z]>,
+        with branch cuts outside the interval [-i, +i] along the 
+        imaginary axis.
+        @end ifnottex
+        @tex
+        These functions compute the complex arc tangent of <[z]>,
+        with branch cuts outside the interval [$-i$, $+i$] along the 
+        imaginary axis.
+        @end tex
+
+        <<catanf>> is identical to <<catan>>, except that it performs
+        its calculations on <<floats complex>>.
+
+RETURNS
+        @ifnottex
+        These functions return the complex arc tangent value, in the range
+        of a strip mathematically  unbounded  along the imaginary axis
+        and in the interval [-pi/2, +pi/2] along the real axis.
+        @end ifnottex
+        @tex
+        These functions return the complex arc tangent, in the range
+        of a strip mathematically  unbounded  along the imaginary axis
+        and in the interval [$-\pi/2$, $+\pi/2$] along the real axis.
+        @end tex
+
+PORTABILITY
+        <<catan>> and <<catanf>> are ISO C99
+
+QUICKREF
+        <<catan>> and <<catanf>> are ISO C99
+
+*/
+
+
+#include <complex.h>
+#include <math.h>
+#include <float.h>
+#include "cephes_subr.h"
+
+#ifdef __weak_alias
+__weak_alias(catan, _catan)
+#endif
+
+#ifdef DBL_MAX
+#define MAXNUM DBL_MAX
+#else
+#define MAXNUM 1.0e308
+#endif
+
+double complex
+catan(double complex z)
+{
+	double complex w;
+	double a, t, x, x2, y;
+
+	x = creal(z);
+	y = cimag(z);
+
+	if ((x == 0.0) && (y > 1.0))
+		goto ovrf;
+
+	x2 = x * x;
+	a = 1.0 - x2 - (y * y);
+	if (a == 0.0)
+		goto ovrf;
+
+	t = 0.5 * atan2(2.0 * x, a);
+	w = _redupi(t);
+
+	t = y - 1.0;
+	a = x2 + (t * t);
+	if (a == 0.0)
+		goto ovrf;
+
+	t = y + 1.0;
+	a = (x2 + (t * t))/a;
+	w = w + (0.25 * log(a)) * I;
+	return w;
+
+ovrf:
+#if 0
+	mtherr ("catan", OVERFLOW);
+#endif
+	w = MAXNUM + MAXNUM * I;
+	return w;
+}
diff -Naur newlib-1.18.0.orig/newlib/libm/complex/catanf.c newlib-1.18.0/newlib/libm/complex/catanf.c
--- newlib-1.18.0.orig/newlib/libm/complex/catanf.c	1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.18.0/newlib/libm/complex/catanf.c	2010-11-26 09:40:30.751686851 +0100
@@ -0,0 +1,86 @@
+/* $NetBSD: catanf.c,v 1.1 2007/08/20 16:01:32 drochner Exp $ */
+
+/*-
+ * Copyright (c) 2007 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software written by Stephen L. Moshier.
+ * It is redistributed by the NetBSD Foundation by permission of the author.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * imported and modified include for newlib 2010/10/03 
+ * Marco Atzeri <marco_atzeri@yahoo.it>
+ */
+
+#include <complex.h>
+#include <math.h>
+#include <float.h>
+#include "cephes_subrf.h"
+
+#ifdef __weak_alias
+__weak_alias(catanf, _catanf)
+#endif
+
+#ifdef FLT_MAX
+#define MAXNUMF FLT_MAX
+#else
+#define MAXNUMF 1.0e38F
+#endif
+
+float complex
+catanf(float complex z)
+{
+	float complex w;
+	float a, t, x, x2, y;
+
+	x = crealf(z);
+	y = cimagf(z);
+
+	if ((x == 0.0f) && (y > 1.0f))
+		goto ovrf;
+
+	x2 = x * x;
+	a = 1.0f - x2 - (y * y);
+	if (a == 0.0f)
+		goto ovrf;
+
+	t = 0.5f * atan2f(2.0f * x, a);
+	w = _redupif(t);
+
+	t = y - 1.0f;
+	a = x2 + (t * t);
+	if (a == 0.0f)
+		goto ovrf;
+
+	t = y + 1.0f;
+	a = (x2 + (t * t))/a;
+	w = w + (0.25f * logf(a)) * I;
+	return w;
+
+ovrf:
+#if 0
+	mtherr ("catan", OVERFLOW);
+#endif
+	w = MAXNUMF + MAXNUMF * I;
+	return w;
+}
diff -Naur newlib-1.18.0.orig/newlib/libm/complex/catanh.c newlib-1.18.0/newlib/libm/complex/catanh.c
--- newlib-1.18.0.orig/newlib/libm/complex/catanh.c	1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.18.0/newlib/libm/complex/catanh.c	2010-11-26 09:40:30.751686851 +0100
@@ -0,0 +1,90 @@
+/* $NetBSD: catanh.c,v 1.1 2007/08/20 16:01:32 drochner Exp $ */
+
+/*-
+ * Copyright (c) 2007 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software written by Stephen L. Moshier.
+ * It is redistributed by the NetBSD Foundation by permission of the author.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * imported and modified include for newlib 2010/10/03 
+ * Marco Atzeri <marco_atzeri@yahoo.it>
+ */
+
+/*
+FUNCTION
+        <<catanh>>, <<catanhf>>---complex arc hyperbolic tangent
+
+INDEX
+        catanh
+INDEX
+        catanhf
+
+ANSI_SYNOPSIS
+       #include <complex.h>
+       double complex catanh(double complex <[z]>);
+       float complex catanhf(float complex <[z]>);
+
+
+DESCRIPTION
+        These functions compute the complex arc hyperbolic tan of <[z]>,
+        with branch cuts outside the interval [-1, +1] along the
+        real axis.
+
+        <<catanhf>> is identical to <<catanh>>, except that it performs
+        its calculations on <<floats complex>>.
+
+RETURNS
+        @ifnottex
+        These functions return the complex arc hyperbolic tangent value,
+        in the range of a strip mathematically unbounded along the
+        real axis and in the interval [-i*p/2, +i*p/2] along the
+        imaginary axis.
+        @end ifnottex
+        @tex
+        These functions return the complex arc hyperbolic tangent value,
+        in the range of a strip mathematically unbounded along the
+        real axis and in the interval [$-i\pi/2$, $+i\pi/2$] along the
+        imaginary axis.
+        @end tex
+
+PORTABILITY
+        <<catanh>> and <<catanhf>> are ISO C99
+
+QUICKREF
+        <<catanh>> and <<catanhf>> are ISO C99
+
+*/
+
+
+#include <complex.h>
+
+double complex
+catanh(double complex z)
+{
+	double complex w;
+
+	w = -1.0 * I * catan(z * I);
+	return w;
+}
diff -Naur newlib-1.18.0.orig/newlib/libm/complex/catanhf.c newlib-1.18.0/newlib/libm/complex/catanhf.c
--- newlib-1.18.0.orig/newlib/libm/complex/catanhf.c	1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.18.0/newlib/libm/complex/catanhf.c	2010-11-26 09:40:30.751686851 +0100
@@ -0,0 +1,44 @@
+/* $NetBSD: catanhf.c,v 1.1 2007/08/20 16:01:32 drochner Exp $ */
+
+/*-
+ * Copyright (c) 2007 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software written by Stephen L. Moshier.
+ * It is redistributed by the NetBSD Foundation by permission of the author.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * imported and modified include for newlib 2010/10/03 
+ * Marco Atzeri <marco_atzeri@yahoo.it>
+ */
+
+#include <complex.h>
+
+float complex
+catanhf(float complex z)
+{
+	float complex w;
+
+	w = -1.0f * I * catanf(z * I);
+	return w;
+}
diff -Naur newlib-1.18.0.orig/newlib/libm/complex/ccos.c newlib-1.18.0/newlib/libm/complex/ccos.c
--- newlib-1.18.0.orig/newlib/libm/complex/ccos.c	1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.18.0/newlib/libm/complex/ccos.c	2010-11-26 09:40:30.751686851 +0100
@@ -0,0 +1,81 @@
+/* $NetBSD: ccos.c,v 1.1 2007/08/20 16:01:32 drochner Exp $ */
+
+/*-
+ * Copyright (c) 2007 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software written by Stephen L. Moshier.
+ * It is redistributed by the NetBSD Foundation by permission of the author.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * imported and modified include for newlib 2010/10/03 
+ * Marco Atzeri <marco_atzeri@yahoo.it>
+ */
+
+/*
+FUNCTION
+        <<ccos>>, <<ccosf>>---complex cosine
+
+INDEX
+        ccos
+INDEX
+        ccosf
+
+ANSI_SYNOPSIS
+       #include <complex.h>
+       double complex ccos(double complex <[z]>);
+       float complex ccosf(float complex <[z]>);
+
+
+DESCRIPTION
+        These functions compute the complex cosine of <[z]>.
+
+        <<ccosf>> is identical to <<ccos>>, except that it performs
+        its calculations on <<floats complex>>.
+
+RETURNS
+        These functions return the complex cosine value.
+
+PORTABILITY
+        <<ccos>> and <<ccosf>> are ISO C99
+
+QUICKREF
+        <<ccos>> and <<ccosf>> are ISO C99
+
+*/
+
+
+#include <complex.h>
+#include <math.h>
+#include "cephes_subr.h"
+
+double complex
+ccos(double complex z)
+{
+	double complex w;
+	double ch, sh;
+
+	_cchsh(cimag(z), &ch, &sh);
+	w = cos(creal(z)) * ch - (sin(creal(z)) * sh) * I;
+	return w;
+}
diff -Naur newlib-1.18.0.orig/newlib/libm/complex/ccosf.c newlib-1.18.0/newlib/libm/complex/ccosf.c
--- newlib-1.18.0.orig/newlib/libm/complex/ccosf.c	1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.18.0/newlib/libm/complex/ccosf.c	2010-11-26 09:40:30.751686851 +0100
@@ -0,0 +1,48 @@
+/* $NetBSD: ccosf.c,v 1.1 2007/08/20 16:01:33 drochner Exp $ */
+
+/*-
+ * Copyright (c) 2007 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software written by Stephen L. Moshier.
+ * It is redistributed by the NetBSD Foundation by permission of the author.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * imported and modified include for newlib 2010/10/03 
+ * Marco Atzeri <marco_atzeri@yahoo.it>
+ */
+
+#include <complex.h>
+#include <math.h>
+#include "cephes_subrf.h"
+
+float complex
+ccosf(float complex z)
+{
+	float complex w;
+	float ch, sh;
+
+	_cchshf(cimagf(z), &ch, &sh);
+	w = cosf(crealf(z)) * ch - (sinf(crealf(z)) * sh) * I;
+	return w;
+}
diff -Naur newlib-1.18.0.orig/newlib/libm/complex/ccosh.c newlib-1.18.0/newlib/libm/complex/ccosh.c
--- newlib-1.18.0.orig/newlib/libm/complex/ccosh.c	1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.18.0/newlib/libm/complex/ccosh.c	2010-11-26 09:40:30.751686851 +0100
@@ -0,0 +1,81 @@
+/* $NetBSD: ccosh.c,v 1.1 2007/08/20 16:01:33 drochner Exp $ */
+
+/*-
+ * Copyright (c) 2007 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software written by Stephen L. Moshier.
+ * It is redistributed by the NetBSD Foundation by permission of the author.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * imported and modified include for newlib 2010/10/03 
+ * Marco Atzeri <marco_atzeri@yahoo.it>
+ */
+
+/*
+FUNCTION
+        <<ccosh>>, <<ccoshf>>---complex hyperbolic cosine
+
+INDEX
+        ccosh
+INDEX
+        ccoshf
+
+ANSI_SYNOPSIS
+       #include <complex.h>
+       double complex ccosh(double complex <[z]>);
+       float complex ccoshf(float complex <[z]>);
+
+
+DESCRIPTION
+        These functions compute the complex hyperbolic cosine of <[z]>.
+
+        <<ccoshf>> is identical to <<ccosh>>, except that it performs
+        its calculations on <<floats complex>>.
+
+RETURNS
+        These functions return the complex hyperbolic cosine value.
+
+PORTABILITY
+        <<ccosh>> and <<ccoshf>> are ISO C99
+
+QUICKREF
+        <<ccosh>> and <<ccoshf>> are ISO C99
+
+*/
+
+
+#include <complex.h>
+#include <math.h>
+
+double complex
+ccosh(double complex z)
+{
+	double complex w;
+	double x, y;
+
+	x = creal(z);
+	y = cimag(z);
+	w = cosh(x) * cos(y) + (sinh(x) * sin(y)) * I;
+	return w;
+}
diff -Naur newlib-1.18.0.orig/newlib/libm/complex/ccoshf.c newlib-1.18.0/newlib/libm/complex/ccoshf.c
--- newlib-1.18.0.orig/newlib/libm/complex/ccoshf.c	1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.18.0/newlib/libm/complex/ccoshf.c	2010-11-26 09:40:30.751686851 +0100
@@ -0,0 +1,48 @@
+/* $NetBSD: ccoshf.c,v 1.1 2007/08/20 16:01:33 drochner Exp $ */
+
+/*-
+ * Copyright (c) 2007 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software written by Stephen L. Moshier.
+ * It is redistributed by the NetBSD Foundation by permission of the author.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * imported and modified include for newlib 2010/10/03 
+ * Marco Atzeri <marco_atzeri@yahoo.it>
+ */
+
+#include <complex.h>
+#include <math.h>
+
+float complex
+ccoshf(float complex z)
+{
+	float complex w;
+	float x, y;
+
+	x = crealf(z);
+	y = cimagf(z);
+	w = coshf(x) * cosf(y) + (sinhf(x) * sinf(y)) * I;
+	return w;
+}
diff -Naur newlib-1.18.0.orig/newlib/libm/complex/cephes_subr.c newlib-1.18.0/newlib/libm/complex/cephes_subr.c
--- newlib-1.18.0.orig/newlib/libm/complex/cephes_subr.c	1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.18.0/newlib/libm/complex/cephes_subr.c	2010-11-26 09:40:30.752687034 +0100
@@ -0,0 +1,126 @@
+/* $NetBSD: cephes_subr.c,v 1.1 2007/08/20 16:01:33 drochner Exp $ */
+
+/*-
+ * Copyright (c) 2007 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software written by Stephen L. Moshier.
+ * It is redistributed by the NetBSD Foundation by permission of the author.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * imported and modified include for newlib 2010/10/03 
+ * Marco Atzeri <marco_atzeri@yahoo.it>
+ */
+
+#include <complex.h>
+#include <math.h>
+#include "cephes_subr.h"
+
+/* calculate cosh and sinh */
+
+void
+_cchsh(double x, double *c, double *s)
+{
+	double e, ei;
+
+	if (fabs(x) <= 0.5) {
+		*c = cosh(x);
+		*s = sinh(x);
+	} else {
+		e = exp(x);
+		ei = 0.5 / e;
+		e = 0.5 * e;
+		*s = e - ei;
+		*c = e + ei;
+	}
+}
+
+/* Program to subtract nearest integer multiple of PI */
+
+/* extended precision value of PI: */
+static const double DP1 = 3.14159265160560607910E0;
+static const double DP2 = 1.98418714791870343106E-9;
+static const double DP3 = 1.14423774522196636802E-17;
+#define MACHEP 1.1e-16
+
+double
+_redupi(double x)
+{
+	double t;
+	long i;
+
+	t = x / M_PI;
+	if (t >= 0.0)
+		t += 0.5;
+	else
+		t -= 0.5;
+
+	i = t;	/* the multiple */
+	t = i;
+	t = ((x - t * DP1) - t * DP2) - t * DP3;
+	return t;
+}
+
+/* Taylor series expansion for cosh(2y) - cos(2x) */
+
+double
+_ctans(double complex z)
+{
+	double f, x, x2, y, y2, rn, t;
+	double d;
+
+	x = fabs(2.0 * creal(z));
+	y = fabs(2.0 * cimag(z));
+
+	x = _redupi(x);
+
+	x = x * x;
+	y = y * y;
+	x2 = 1.0;
+	y2 = 1.0;
+	f = 1.0;
+	rn = 0.0;
+	d = 0.0;
+	do {
+		rn += 1.0;
+		f *= rn;
+		rn += 1.0;
+		f *= rn;
+		x2 *= x;
+		y2 *= y;
+		t = y2 + x2;
+		t /= f;
+		d += t;
+
+		rn += 1.0;
+		f *= rn;
+		rn += 1.0;
+		f *= rn;
+		x2 *= x;
+		y2 *= y;
+		t = y2 - x2;
+		t /= f;
+		d += t;
+	} while (fabs(t/d) > MACHEP);
+	return d;
+}
diff -Naur newlib-1.18.0.orig/newlib/libm/complex/cephes_subrf.c newlib-1.18.0/newlib/libm/complex/cephes_subrf.c
--- newlib-1.18.0.orig/newlib/libm/complex/cephes_subrf.c	1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.18.0/newlib/libm/complex/cephes_subrf.c	2010-11-26 09:40:30.752687034 +0100
@@ -0,0 +1,125 @@
+/* $NetBSD: cephes_subrf.c,v 1.1 2007/08/20 16:01:34 drochner Exp $ */
+
+/*-
+ * Copyright (c) 2007 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software written by Stephen L. Moshier.
+ * It is redistributed by the NetBSD Foundation by permission of the author.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * imported and modified include for newlib 2010/10/03 
+ * Marco Atzeri <marco_atzeri@yahoo.it>
+ */
+
+#include <complex.h>
+#include <math.h>
+#include "cephes_subrf.h"
+
+/* calculate cosh and sinh */
+
+void
+_cchshf(float x, float *c, float *s)
+{
+	float e, ei;
+
+	if (fabsf(x) <= 0.5f) {
+		*c = coshf(x);
+		*s = sinhf(x);
+	} else {
+		e = expf(x);
+		ei = 0.5f / e;
+		e = 0.5f * e;
+		*s = e - ei;
+		*c = e + ei;
+	}
+}
+
+/* Program to subtract nearest integer multiple of PI */
+
+/* extended precision value of PI: */
+static const double DP1 =  3.140625;
+static const double DP2 =  9.67502593994140625E-4;
+static const double DP3 =  1.509957990978376432E-7;
+#define MACHEPF 3.0e-8
+
+float
+_redupif(float x)
+{
+	float t;
+	long i;
+
+	t = x / (float)M_PI;
+	if (t >= 0.0f)
+		t += 0.5f;
+	else
+		t -= 0.5f;
+
+	i = t;	/* the multiple */
+	t = i;
+	t = ((x - t * DP1) - t * DP2) - t * DP3;
+	return t;
+}
+
+/* Taylor series expansion for cosh(2y) - cos(2x) */
+
+float
+_ctansf(float complex z)
+{
+	float f, x, x2, y, y2, rn, t, d;
+
+	x = fabsf(2.0f * crealf(z));
+	y = fabsf(2.0f * cimagf(z));
+
+	x = _redupif(x);
+
+	x = x * x;
+	y = y * y;
+	x2 = 1.0f;
+	y2 = 1.0f;
+	f = 1.0f;
+	rn = 0.0f;
+	d = 0.0f;
+	do {
+		rn += 1.0f;
+		f *= rn;
+		rn += 1.0f;
+		f *= rn;
+		x2 *= x;
+		y2 *= y;
+		t = y2 + x2;
+		t /= f;
+		d += t;
+
+		rn += 1.0f;
+		f *= rn;
+		rn += 1.0f;
+		f *= rn;
+		x2 *= x;
+		y2 *= y;
+		t = y2 - x2;
+		t /= f;
+		d += t;
+	} while (fabsf(t/d) > MACHEPF);
+	return d;
+}
diff -Naur newlib-1.18.0.orig/newlib/libm/complex/cephes_subrf.h newlib-1.18.0/newlib/libm/complex/cephes_subrf.h
--- newlib-1.18.0.orig/newlib/libm/complex/cephes_subrf.h	1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.18.0/newlib/libm/complex/cephes_subrf.h	2010-11-26 09:40:30.752687034 +0100
@@ -0,0 +1,5 @@
+/* $NetBSD: cephes_subrf.h,v 1.1 2007/08/20 16:01:34 drochner Exp $ */
+
+void _cchshf(float, float *, float *);
+float _redupif(float);
+float _ctansf(float complex);
diff -Naur newlib-1.18.0.orig/newlib/libm/complex/cephes_subr.h newlib-1.18.0/newlib/libm/complex/cephes_subr.h
--- newlib-1.18.0.orig/newlib/libm/complex/cephes_subr.h	1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.18.0/newlib/libm/complex/cephes_subr.h	2010-11-26 09:40:30.752687034 +0100
@@ -0,0 +1,5 @@
+/* $NetBSD: cephes_subr.h,v 1.1 2007/08/20 16:01:33 drochner Exp $ */
+
+void _cchsh(double, double *, double *);
+double _redupi(double);
+double _ctans(double complex);
diff -Naur newlib-1.18.0.orig/newlib/libm/complex/cexp.c newlib-1.18.0/newlib/libm/complex/cexp.c
--- newlib-1.18.0.orig/newlib/libm/complex/cexp.c	1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.18.0/newlib/libm/complex/cexp.c	2010-11-26 09:40:30.752687034 +0100
@@ -0,0 +1,82 @@
+/* $NetBSD: cexp.c,v 1.1 2007/08/20 16:01:34 drochner Exp $ */
+
+/*-
+ * Copyright (c) 2007 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software written by Stephen L. Moshier.
+ * It is redistributed by the NetBSD Foundation by permission of the author.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * imported and modified include for newlib 2010/10/03 
+ * Marco Atzeri <marco_atzeri@yahoo.it>
+ */
+
+/*
+FUNCTION
+        <<cexp>>, <<cexpf>>---complex base-e exponential
+
+INDEX
+        cexp
+INDEX
+        cexpf
+
+ANSI_SYNOPSIS
+       #include <complex.h>
+       double complex cexp(double complex <[z]>);
+       float complex cexpf(float complex <[z]>);
+
+
+DESCRIPTION
+        These functions compute  the complex base-<[e]> exponential of <[z]>.
+
+        <<cexpf>> is identical to <<cexp>>, except that it performs
+        its calculations on <<floats complex>>.
+
+RETURNS
+        The cexp functions return the complex base-<[e]> exponential value.
+
+PORTABILITY
+        <<cexp>> and <<cexpf>> are ISO C99
+
+QUICKREF
+        <<cexp>> and <<cexpf>> are ISO C99
+
+*/
+
+
+#include <complex.h>
+#include <math.h>
+
+double complex
+cexp(double complex z)
+{
+	double complex w;
+	double r, x, y;
+
+	x = creal(z);
+	y = cimag(z);
+	r = exp(x);
+	w = r * cos(y) + r * sin(y) * I;
+	return w;
+}
diff -Naur newlib-1.18.0.orig/newlib/libm/complex/cexpf.c newlib-1.18.0/newlib/libm/complex/cexpf.c
--- newlib-1.18.0.orig/newlib/libm/complex/cexpf.c	1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.18.0/newlib/libm/complex/cexpf.c	2010-11-26 09:40:30.752687034 +0100
@@ -0,0 +1,49 @@
+/* $NetBSD: cexpf.c,v 1.1 2007/08/20 16:01:34 drochner Exp $ */
+
+/*-
+ * Copyright (c) 2007 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software written by Stephen L. Moshier.
+ * It is redistributed by the NetBSD Foundation by permission of the author.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * imported and modified include for newlib 2010/10/03 
+ * Marco Atzeri <marco_atzeri@yahoo.it>
+ */
+
+#include <complex.h>
+#include <math.h>
+
+float complex
+cexpf(float complex z)
+{
+	float complex w;
+	float r, x, y;
+
+	x = crealf(z);
+	y = cimagf(z);
+	r = expf(x);
+	w = r * cosf(y) + r * sinf(y) * I;
+	return w;
+}
diff -Naur newlib-1.18.0.orig/newlib/libm/complex/cimag.c newlib-1.18.0/newlib/libm/complex/cimag.c
--- newlib-1.18.0.orig/newlib/libm/complex/cimag.c	1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.18.0/newlib/libm/complex/cimag.c	2010-11-26 09:40:30.752687034 +0100
@@ -0,0 +1,53 @@
+/* $NetBSD: cimag.c,v 1.2 2010/09/15 16:11:29 christos Exp $ */
+
+/*
+ * Written by Matthias Drochner <drochner@NetBSD.org>.
+ * Public domain.
+ *
+ * imported and modified include for newlib 2010/10/03 
+ * Marco Atzeri <marco_atzeri@yahoo.it>
+ */
+
+/*
+FUNCTION
+        <<cimag>>, <<cimagf>>---imaginary part
+
+INDEX
+        cimag
+INDEX
+        cimagf
+
+ANSI_SYNOPSIS
+       #include <complex.h>
+       double cimag(double complex <[z]>);
+       float cimagf(float complex <[z]>);
+
+
+DESCRIPTION
+        These functions compute the imaginary part of <[z]>.
+
+        <<cimagf>> is identical to <<cimag>>, except that it performs
+        its calculations on <<floats complex>>.
+
+RETURNS
+        The cimag functions return the imaginary part value (as a real).
+
+PORTABILITY
+        <<cimag>> and <<cimagf>> are ISO C99
+
+QUICKREF
+        <<cimag>> and <<cimagf>> are ISO C99
+
+*/
+
+
+#include <complex.h>
+#include "../common/fdlibm.h"
+
+double
+cimag(double complex z)
+{
+	double_complex w = { .z = z };
+
+	return (IMAG_PART(w));
+}
diff -Naur newlib-1.18.0.orig/newlib/libm/complex/cimagf.c newlib-1.18.0/newlib/libm/complex/cimagf.c
--- newlib-1.18.0.orig/newlib/libm/complex/cimagf.c	1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.18.0/newlib/libm/complex/cimagf.c	2010-11-26 09:40:30.752687034 +0100
@@ -0,0 +1,20 @@
+/* $NetBSD: cimagf.c,v 1.2 2010/09/15 16:11:29 christos Exp $ */
+
+/*
+ * Written by Matthias Drochner <drochner@NetBSD.org>.
+ * Public domain.
+ *
+ * imported and modified include for newlib 2010/10/03 
+ * Marco Atzeri <marco_atzeri@yahoo.it>
+ */
+
+#include <complex.h>
+#include "../common/fdlibm.h"
+
+float
+cimagf(float complex z)
+{
+	float_complex w = { .z = z };
+
+	return (IMAG_PART(w));
+}
diff -Naur newlib-1.18.0.orig/newlib/libm/complex/clog.c newlib-1.18.0/newlib/libm/complex/clog.c
--- newlib-1.18.0.orig/newlib/libm/complex/clog.c	1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.18.0/newlib/libm/complex/clog.c	2010-11-26 09:40:30.753687217 +0100
@@ -0,0 +1,91 @@
+/* $NetBSD: clog.c,v 1.1 2007/08/20 16:01:35 drochner Exp $ */
+
+/*-
+ * Copyright (c) 2007 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software written by Stephen L. Moshier.
+ * It is redistributed by the NetBSD Foundation by permission of the author.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * imported and modified include for newlib 2010/10/03 
+ * Marco Atzeri <marco_atzeri@yahoo.it>
+ */
+
+/*
+FUNCTION
+        <<clog>>, <<clogf>>---complex base-e logarithm
+
+INDEX
+        clog
+INDEX
+        clogf
+
+ANSI_SYNOPSIS
+       #include <complex.h>
+       double complex clog(double complex <[z]>);
+       float complex clogf(float complex <[z]>);
+
+
+DESCRIPTION
+        These functions compute the complex natural (base-<[e]>) logarithm 
+        of <[z]>, with a branch cut along the negative real axis. 
+
+        <<clogf>> is identical to <<clog>>, except that it performs
+        its calculations on <<floats complex>>.
+
+RETURNS
+        @ifnottex
+        The clog functions return the complex natural logarithm value, in 
+        the range of a strip mathematically unbounded along the real axis 
+        and in the interval [-i*pi , +i*pi] along the imaginary axis.
+        @end ifnottex
+        @tex
+        The clog functions return the complex natural logarithm value, in
+        the range of a strip mathematically unbounded along the real axis
+         and in the interval [$-i\pi$, $+i\pi$] along the imaginary axis.
+        @end tex
+
+PORTABILITY
+        <<clog>> and <<clogf>> are ISO C99
+
+QUICKREF
+        <<clog>> and <<clogf>> are ISO C99
+
+*/
+
+#include <complex.h>
+#include <math.h>
+
+double complex
+clog(double complex z)
+{
+	double complex w;
+	double p, rr;
+
+	rr = cabs(z);
+	p = log(rr);
+	rr = atan2(cimag(z), creal(z));
+	w = p + rr * I;
+	return w;
+}
diff -Naur newlib-1.18.0.orig/newlib/libm/complex/clogf.c newlib-1.18.0/newlib/libm/complex/clogf.c
--- newlib-1.18.0.orig/newlib/libm/complex/clogf.c	1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.18.0/newlib/libm/complex/clogf.c	2010-11-26 09:40:30.753687217 +0100
@@ -0,0 +1,49 @@
+/* $NetBSD: clogf.c,v 1.1 2007/08/20 16:01:35 drochner Exp $ */
+
+/*-
+ * Copyright (c) 2007 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software written by Stephen L. Moshier.
+ * It is redistributed by the NetBSD Foundation by permission of the author.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * imported and modified include for newlib 2010/10/03 
+ * Marco Atzeri <marco_atzeri@yahoo.it>
+ */
+
+#include <complex.h>
+#include <math.h>
+
+float complex
+clogf(float complex z)
+{
+	float complex w;
+	float p, rr;
+
+	rr = cabsf(z);
+	p = logf(rr);
+	rr = atan2f(cimagf(z), crealf(z));
+	w = p + rr * I;
+	return w;
+}
diff -Naur newlib-1.18.0.orig/newlib/libm/complex/complex.tex newlib-1.18.0/newlib/libm/complex/complex.tex
--- newlib-1.18.0.orig/newlib/libm/complex/complex.tex	1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.18.0/newlib/libm/complex/complex.tex	2010-11-26 09:40:30.753687217 +0100
@@ -0,0 +1,55 @@
+@node Complex
+@chapter Mathematical Complex Functions (@file{complex.h})
+
+This chapter groups the complex mathematical functions.  The
+corresponding definitions and declarations are in @file{complex.h}.  
+Functions and documentations are taken from NetBSD.
+
+@menu 
+* cabs::	Complex absolute value
+* cacos::	Complex arc cosine
+* cacosh::	Complex arc hyperbolic cosine
+* carg::	Argument (also called phase angle)
+* casin::	Complex arc sine
+* casinh::	Complex arc hyperbolic sine
+* catan::	Complex arc tangent
+* catanh::	Complex arc hyperbolic tangent
+* ccos::	Complex cosine
+* ccosh::	Complex hyperbolic cosine
+* cexp::	Complex exponent
+* cimag::	Imaginary part
+* clog::	Complex natural (base e) logarithm
+* conj::	Complex conjugate
+* cpow::	Complex power function
+* cproj::	Compute a projection on the Riemann sphere
+* creal::	Real part
+* csin::	Complex sine
+* csinh::	Complex hyperbolic sine
+* csqrt::	Complex square root
+* ctan::	Complex tangent
+* ctanh::	Complex hyperbolic tangent
+@end menu
+
+
+@page @include   complex/cabs.def
+@page @include   complex/cacos.def
+@page @include   complex/cacosh.def
+@page @include   complex/carg.def
+@page @include   complex/casin.def
+@page @include   complex/casinh.def
+@page @include   complex/catan.def
+@page @include   complex/catanh.def
+@page @include   complex/ccos.def
+@page @include   complex/ccosh.def
+@page @include   complex/cexp.def
+@page @include   complex/cimag.def
+@page @include   complex/clog.def
+@page @include   complex/conj.def
+@page @include   complex/cpow.def
+@page @include   complex/cproj.def
+@page @include   complex/creal.def
+@page @include   complex/csin.def
+@page @include   complex/csinh.def
+@page @include   complex/csqrt.def
+@page @include   complex/ctan.def
+@page @include   complex/ctanh.def
diff -Naur newlib-1.18.0.orig/newlib/libm/complex/conj.c newlib-1.18.0/newlib/libm/complex/conj.c
--- newlib-1.18.0.orig/newlib/libm/complex/conj.c	1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.18.0/newlib/libm/complex/conj.c	2010-11-26 09:40:30.753687217 +0100
@@ -0,0 +1,55 @@
+/* $NetBSD: conj.c,v 1.2 2010/09/15 16:11:29 christos Exp $ */
+
+/*
+ * Written by Matthias Drochner <drochner@NetBSD.org>.
+ * Public domain.
+ *
+ * imported and modified include for newlib 2010/10/03 
+ * Marco Atzeri <marco_atzeri@yahoo.it>
+ */
+
+/*
+FUNCTION
+        <<conj>>, <<conjf>>---complex conjugate
+
+INDEX
+        conj
+INDEX
+        conjf
+
+ANSI_SYNOPSIS
+       #include <complex.h>
+       double complex conj(double complex <[z]>);
+       float complex conjf(float complex <[z]>);
+
+
+DESCRIPTION
+        These functions compute the complex conjugate of <[z]>, 
+        by reversing the sign of its imaginary part.
+
+        <<conjf>> is identical to <<conj>>, except that it performs
+        its calculations on <<floats complex>>.
+
+RETURNS
+        The conj functions return the complex conjugate value.
+
+PORTABILITY
+        <<conj>> and <<conjf>> are ISO C99
+
+QUICKREF
+        <<conj>> and <<conjf>> are ISO C99
+
+*/
+
+#include <complex.h>
+#include "../common/fdlibm.h"
+
+double complex
+conj(double complex z)
+{
+	double_complex w = { .z = z };
+
+	IMAG_PART(w) = -IMAG_PART(w);
+
+	return (w.z);
+}
diff -Naur newlib-1.18.0.orig/newlib/libm/complex/conjf.c newlib-1.18.0/newlib/libm/complex/conjf.c
--- newlib-1.18.0.orig/newlib/libm/complex/conjf.c	1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.18.0/newlib/libm/complex/conjf.c	2010-11-26 09:40:30.753687217 +0100
@@ -0,0 +1,22 @@
+/* $NetBSD: conjf.c,v 1.2 2010/09/15 16:11:29 christos Exp $ */
+
+/*
+ * Written by Matthias Drochner <drochner@NetBSD.org>.
+ * Public domain.
+ *
+ * imported and modified include for newlib 2010/10/03 
+ * Marco Atzeri <marco_atzeri@yahoo.it>
+ */
+
+#include <complex.h>
+#include "../common/fdlibm.h"
+
+float complex
+conjf(float complex z)
+{
+	float_complex w = { .z = z };
+
+	IMAG_PART(w) = -IMAG_PART(w);
+
+	return (w.z);
+}
diff -Naur newlib-1.18.0.orig/newlib/libm/complex/cpow.c newlib-1.18.0/newlib/libm/complex/cpow.c
--- newlib-1.18.0.orig/newlib/libm/complex/cpow.c	1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.18.0/newlib/libm/complex/cpow.c	2010-11-26 09:40:30.753687217 +0100
@@ -0,0 +1,101 @@
+/* $NetBSD: cpow.c,v 1.1 2007/08/20 16:01:35 drochner Exp $ */
+
+/*-
+ * Copyright (c) 2007 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software written by Stephen L. Moshier.
+ * It is redistributed by the NetBSD Foundation by permission of the author.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * imported and modified include for newlib 2010/10/03 
+ * Marco Atzeri <marco_atzeri@yahoo.it>
+ */
+
+/*
+FUNCTION
+        <<cpow>>, <<cpowf>>---complex power
+
+INDEX
+        cpow
+INDEX
+        cpowf
+
+ANSI_SYNOPSIS
+       #include <complex.h>
+       double complex cpow(double complex <[x]>, double complex <[y]>);
+       float complex cpowf(float complex <[x]>, float complex <[y]>);
+
+
+DESCRIPTION
+        @ifnottex
+        The cpow functions compute the complex power function x^y 
+        power, with a branch cut for the first parameter along the 
+        negative real axis.
+        @end ifnottex
+        @tex
+        The cpow functions compute the complex power function $x^y$ 
+        power, with a branch cut for the first parameter along the 
+        negative real axis.
+        @end tex
+
+        <<cpowf>> is identical to <<cpow>>, except that it performs
+        its calculations on <<floats complex>>.
+
+RETURNS
+        The cpow functions return the complex power function value.
+
+PORTABILITY
+        <<cpow>> and <<cpowf>> are ISO C99
+
+QUICKREF
+        <<cpow>> and <<cpowf>> are ISO C99
+
+*/
+
+
+#include <complex.h>
+#include <math.h>
+
+double complex
+cpow(double complex a, double complex z)
+{
+	double complex w;
+	double x, y, r, theta, absa, arga;
+
+	x = creal(z);
+	y = cimag(z);
+	absa = cabs(a);
+	if (absa == 0.0) {
+		return (0.0 + 0.0 * I);
+	}
+	arga = carg(a);
+	r = pow(absa, x);
+	theta = x * arga;
+	if (y != 0.0) {
+		r = r * exp(-y * arga);
+		theta = theta + y * log(absa);
+	}
+	w = r * cos(theta) + (r * sin(theta)) * I;
+	return w;
+}
diff -Naur newlib-1.18.0.orig/newlib/libm/complex/cpowf.c newlib-1.18.0/newlib/libm/complex/cpowf.c
--- newlib-1.18.0.orig/newlib/libm/complex/cpowf.c	1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.18.0/newlib/libm/complex/cpowf.c	2010-11-26 09:40:30.753687217 +0100
@@ -0,0 +1,59 @@
+/* $NetBSD: cpowf.c,v 1.1 2007/08/20 16:01:36 drochner Exp $ */
+
+/*-
+ * Copyright (c) 2007 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software written by Stephen L. Moshier.
+ * It is redistributed by the NetBSD Foundation by permission of the author.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * imported and modified include for newlib 2010/10/03 
+ * Marco Atzeri <marco_atzeri@yahoo.it>
+ */
+
+#include <complex.h>
+#include <math.h>
+
+float complex
+cpowf(float complex a, float complex z)
+{
+	float complex w;
+	float x, y, r, theta, absa, arga;
+
+	x = crealf(z);
+	y = cimagf(z);
+	absa = cabsf(a);
+	if (absa == 0.0f) {
+		return (0.0f + 0.0f * I);
+	}
+	arga = cargf(a);
+	r = powf(absa, x);
+	theta = x * arga;
+	if (y != 0.0f) {
+		r = r * expf(-y * arga);
+		theta = theta + y * logf(absa);
+	}
+	w = r * cosf(theta) + (r * sinf(theta)) * I;
+	return w;
+}
diff -Naur newlib-1.18.0.orig/newlib/libm/complex/cproj.c newlib-1.18.0/newlib/libm/complex/cproj.c
--- newlib-1.18.0.orig/newlib/libm/complex/cproj.c	1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.18.0/newlib/libm/complex/cproj.c	2010-11-26 09:40:30.753687217 +0100
@@ -0,0 +1,106 @@
+/*	$NetBSD: cproj.c,v 1.3 2010/09/20 17:51:38 christos Exp $	*/
+
+/*-
+ * Copyright (c) 2010 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * imported and modified include for newlib 2010/10/03 
+ * Marco Atzeri <marco_atzeri@yahoo.it>
+ */
+
+/*
+FUNCTION
+        <<cproj>>, <<cprojf>>--- Riemann sphere projection
+ 
+INDEX
+        cproj
+INDEX
+        cprojf
+
+ANSI_SYNOPSIS
+       #include <complex.h>
+       double complex cproj(double complex <[z]>);
+       float complex cprojf(float complex <[z]>);
+
+
+DESCRIPTION
+        These functions compute a projection of <[z]> onto the Riemann 
+        sphere: <[z]> projects to <[z]> except that all complex infinities 
+        (even those with one infinite part and one NaN part) project 
+        to positive infinity on the real axis. If <[z]> has an infinite part,
+        then <<cproj>>(<[z]>) is equivalent to
+
+                 INFINITY + I * copysign(0.0, cimag(z))
+
+        <<cprojf>> is identical to <<cproj>>, except that it performs
+        its calculations on <<floats complex>>.
+
+RETURNS
+        The cproj functions return the value of the projection onto 
+        the Riemann sphere.
+
+PORTABILITY
+        <<cproj>> and <<cprojf>> are ISO C99
+
+QUICKREF
+        <<cproj>> and <<cprojf>> are ISO C99
+
+*/
+
+#include <sys/cdefs.h>
+/*__RCSID("$NetBSD: cproj.c,v 1.3 2010/09/20 17:51:38 christos Exp $"); */
+
+#include <complex.h>
+#include <math.h>
+
+#include "../common/fdlibm.h"
+
+/*
+ * cproj(double complex z)
+ *
+ * These functions return the value of the projection (not stereographic!)
+ * onto the Riemann sphere.
+ *
+ * z projects to z, except that all complex infinities (even those with one
+ * infinite part and one NaN part) project to positive infinity on the real axis.
+ * If z has an infinite part, then cproj(z) shall be equivalent to:
+ *
+ * INFINITY + I * copysign(0.0, cimag(z))
+ */
+double complex
+cproj(double complex z)
+{
+	double_complex w = { .z = z };
+
+	if (isinf(creal(z) || isinf(cimag(z)))) {
+#ifdef __INFINITY
+		REAL_PART(w) = __INFINITY;
+#else
+		REAL_PART(w) = INFINITY;
+#endif
+		IMAG_PART(w) = copysign(0.0, cimag(z));
+	}
+
+	return (w.z);
+}
diff -Naur newlib-1.18.0.orig/newlib/libm/complex/cprojf.c newlib-1.18.0/newlib/libm/complex/cprojf.c
--- newlib-1.18.0.orig/newlib/libm/complex/cprojf.c	1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.18.0/newlib/libm/complex/cprojf.c	2010-11-26 09:40:30.753687217 +0100
@@ -0,0 +1,68 @@
+/*	$NetBSD: cprojf.c,v 1.3 2010/09/20 17:51:38 christos Exp $	*/
+
+/*-
+ * Copyright (c) 2010 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * imported and modified include for newlib 2010/10/03 
+ * Marco Atzeri <marco_atzeri@yahoo.it>
+ */
+
+#include <sys/cdefs.h>
+/*__RCSID("$NetBSD: cprojf.c,v 1.3 2010/09/20 17:51:38 christos Exp $"); */
+
+#include <complex.h>
+#include <math.h>
+
+#include "../common/fdlibm.h"
+
+/*
+ * cprojf(float complex z)
+ *
+ * These functions return the value of the projection (not stereographic!)
+ * onto the Riemann sphere.
+ *
+ * z projects to z, except that all complex infinities (even those with one
+ * infinite part and one NaN part) project to positive infinity on the real axis.
+ * If z has an infinite part, then cproj(z) shall be equivalent to:
+ *
+ * INFINITY + I * copysign(0.0, cimag(z))
+ */
+
+float complex
+cprojf(float complex z)
+{
+	float_complex w = { .z = z };
+
+	if (isinf(crealf(z) || isinf(cimagf(z)))) {
+#ifdef __INFINITY
+		REAL_PART(w) = __INFINITY;
+#else
+		REAL_PART(w) = INFINITY;
+#endif
+		IMAG_PART(w) = copysignf(0.0, cimagf(z));
+	}
+
+	return (w.z);
+}
diff -Naur newlib-1.18.0.orig/newlib/libm/complex/creal.c newlib-1.18.0/newlib/libm/complex/creal.c
--- newlib-1.18.0.orig/newlib/libm/complex/creal.c	1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.18.0/newlib/libm/complex/creal.c	2010-11-26 09:40:30.754687401 +0100
@@ -0,0 +1,53 @@
+/* $NetBSD: creal.c,v 1.2 2010/09/15 16:11:29 christos Exp $ */
+
+/*
+ * Written by Matthias Drochner <drochner@NetBSD.org>.
+ * Public domain.
+ *
+ * imported and modified include for newlib 2010/10/03 
+ * Marco Atzeri <marco_atzeri@yahoo.it>
+ */
+
+/*
+FUNCTION
+        <<creal>>, <<crealf>>---real part
+
+INDEX
+        creal
+INDEX
+        crealf
+
+ANSI_SYNOPSIS
+       #include <complex.h>
+       double creal(double complex <[z]>);
+       float crealf(float complex <[z]>);
+
+
+DESCRIPTION
+        These functions compute the real part of <[z]>.
+
+        <<crealf>> is identical to <<creal>>, except that it performs
+        its calculations on <<floats complex>>.
+
+RETURNS
+        The creal functions return the real part value.
+
+PORTABILITY
+        <<creal>> and <<crealf>> are ISO C99
+
+QUICKREF
+        <<creal>> and <<crealf>> are ISO C99
+
+*/
+
+
+#include <complex.h>
+#include "../common/fdlibm.h"
+
+double
+creal(double complex z)
+{
+	double_complex w = { .z = z };
+
+	return (REAL_PART(w));
+}
diff -Naur newlib-1.18.0.orig/newlib/libm/complex/crealf.c newlib-1.18.0/newlib/libm/complex/crealf.c
--- newlib-1.18.0.orig/newlib/libm/complex/crealf.c	1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.18.0/newlib/libm/complex/crealf.c	2010-11-26 09:40:30.754687401 +0100
@@ -0,0 +1,20 @@
+/* $NetBSD: crealf.c,v 1.2 2010/09/15 16:11:29 christos Exp $ */
+
+/*
+ * Written by Matthias Drochner <drochner@NetBSD.org>.
+ * Public domain.
+ *
+ * imported and modified include for newlib 2010/10/03 
+ * Marco Atzeri <marco_atzeri@yahoo.it>
+ */
+
+#include <complex.h>
+#include "../common/fdlibm.h"
+
+float
+crealf(float complex z)
+{
+	float_complex w = { .z = z };
+
+	return (REAL_PART(w));
+}
diff -Naur newlib-1.18.0.orig/newlib/libm/complex/csin.c newlib-1.18.0/newlib/libm/complex/csin.c
--- newlib-1.18.0.orig/newlib/libm/complex/csin.c	1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.18.0/newlib/libm/complex/csin.c	2010-11-26 09:40:30.754687401 +0100
@@ -0,0 +1,81 @@
+/* $NetBSD: csin.c,v 1.1 2007/08/20 16:01:36 drochner Exp $ */
+
+/*-
+ * Copyright (c) 2007 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software written by Stephen L. Moshier.
+ * It is redistributed by the NetBSD Foundation by permission of the author.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * imported and modified include for newlib 2010/10/03 
+ * Marco Atzeri <marco_atzeri@yahoo.it>
+ */
+
+/*
+FUNCTION
+        <<csin>>, <<csinf>>---complex sine
+
+INDEX
+        csin
+INDEX
+        csinf
+
+ANSI_SYNOPSIS
+       #include <complex.h>
+       double complex csin(double complex <[z]>);
+       float complex csinf(float complex <[z]>);
+
+
+DESCRIPTION
+        These functions compute the complex sine of <[z]>.
+
+        <<csinf>> is identical to <<csin>>, except that it performs
+        its calculations on <<floats complex>>.
+
+RETURNS
+        These functions return the complex sine value.
+
+PORTABILITY
+        <<csin>> and <<csinf>> are ISO C99
+
+QUICKREF
+        <<csin>> and <<csinf>> are ISO C99
+
+*/
+
+
+#include <complex.h>
+#include <math.h>
+#include "cephes_subr.h"
+
+double complex
+csin(double complex z)
+{
+	double complex w;
+	double ch, sh;
+
+	_cchsh(cimag(z), &ch, &sh);
+	w = sin(creal(z)) * ch + (cos(creal(z)) * sh) * I;
+	return w;
+}
diff -Naur newlib-1.18.0.orig/newlib/libm/complex/csinf.c newlib-1.18.0/newlib/libm/complex/csinf.c
--- newlib-1.18.0.orig/newlib/libm/complex/csinf.c	1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.18.0/newlib/libm/complex/csinf.c	2010-11-26 09:40:30.754687401 +0100
@@ -0,0 +1,48 @@
+/* $NetBSD: csinf.c,v 1.1 2007/08/20 16:01:36 drochner Exp $ */
+
+/*-
+ * Copyright (c) 2007 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software written by Stephen L. Moshier.
+ * It is redistributed by the NetBSD Foundation by permission of the author.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * imported and modified include for newlib 2010/10/03 
+ * Marco Atzeri <marco_atzeri@yahoo.it>
+ */
+
+#include <complex.h>
+#include <math.h>
+#include "cephes_subrf.h"
+
+float complex
+csinf(float complex z)
+{
+	float complex w;
+	float ch, sh;
+
+	_cchshf(cimagf(z), &ch, &sh);
+	w = sinf(crealf(z)) * ch + (cosf(crealf(z)) * sh) * I;
+	return w;
+}
diff -Naur newlib-1.18.0.orig/newlib/libm/complex/csinh.c newlib-1.18.0/newlib/libm/complex/csinh.c
--- newlib-1.18.0.orig/newlib/libm/complex/csinh.c	1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.18.0/newlib/libm/complex/csinh.c	2010-11-26 09:40:30.754687401 +0100
@@ -0,0 +1,80 @@
+/* $NetBSD: csinh.c,v 1.1 2007/08/20 16:01:36 drochner Exp $ */
+
+/*-
+ * Copyright (c) 2007 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software written by Stephen L. Moshier.
+ * It is redistributed by the NetBSD Foundation by permission of the author.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * imported and modified include for newlib 2010/10/03 
+ * Marco Atzeri <marco_atzeri@yahoo.it>
+ */
+
+/*
+FUNCTION
+        <<csinh>>, <<csinhf>>---complex hyperbolic sine
+
+INDEX
+        csinh
+INDEX
+        csinhf
+
+ANSI_SYNOPSIS
+       #include <complex.h>
+       double complex csinh(double complex <[z]>);
+       float complex csinhf(float complex <[z]>);
+
+
+DESCRIPTION
+        These functions compute the complex hyperbolic sine of <[z]>.
+
+        <<ccoshf>> is identical to <<ccosh>>, except that it performs
+        its calculations on <<floats complex>>.
+
+RETURNS
+        These functions return the complex hyperbolic sine value.
+
+PORTABILITY
+        <<csinh>> and <<csinhf>> are ISO C99
+
+QUICKREF
+        <<csinh>> and <<csinhf>> are ISO C99
+
+*/
+
+#include <complex.h>
+#include <math.h>
+
+double complex
+csinh(double complex z)
+{
+	double complex w;
+	double x, y;
+
+	x = creal(z);
+	y = cimag(z);
+	w = sinh(x) * cos(y) + (cosh(x) * sin(y)) * I;
+	return w;
+}
diff -Naur newlib-1.18.0.orig/newlib/libm/complex/csinhf.c newlib-1.18.0/newlib/libm/complex/csinhf.c
--- newlib-1.18.0.orig/newlib/libm/complex/csinhf.c	1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.18.0/newlib/libm/complex/csinhf.c	2010-11-26 09:40:30.754687401 +0100
@@ -0,0 +1,48 @@
+/* $NetBSD: csinhf.c,v 1.1 2007/08/20 16:01:37 drochner Exp $ */
+
+/*-
+ * Copyright (c) 2007 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software written by Stephen L. Moshier.
+ * It is redistributed by the NetBSD Foundation by permission of the author.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * imported and modified include for newlib 2010/10/03 
+ * Marco Atzeri <marco_atzeri@yahoo.it>
+ */
+
+#include <complex.h>
+#include <math.h>
+
+float complex
+csinhf(float complex z)
+{
+	float complex w;
+	float x, y;
+
+	x = crealf(z);
+	y = cimagf(z);
+	w = sinhf(x) * cosf(y) + (coshf(x) * sinf(y)) * I;
+	return w;
+}
diff -Naur newlib-1.18.0.orig/newlib/libm/complex/csqrt.c newlib-1.18.0/newlib/libm/complex/csqrt.c
--- newlib-1.18.0.orig/newlib/libm/complex/csqrt.c	1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.18.0/newlib/libm/complex/csqrt.c	2010-11-26 09:40:30.754687401 +0100
@@ -0,0 +1,137 @@
+/* $NetBSD: csqrt.c,v 1.1 2007/08/20 16:01:37 drochner Exp $ */
+
+/*-
+ * Copyright (c) 2007 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software written by Stephen L. Moshier.
+ * It is redistributed by the NetBSD Foundation by permission of the author.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * imported and modified include for newlib 2010/10/03 
+ * Marco Atzeri <marco_atzeri@yahoo.it>
+ */
+
+/*
+FUNCTION
+        <<csqrt>>, <<csqrtf>>---complex square root
+
+INDEX
+        csqrt
+INDEX
+        csqrtf
+
+ANSI_SYNOPSIS
+       #include <complex.h>
+       double complex csqrt(double complex <[z]>);
+       float complex csqrtf(float complex <[z]>);
+
+
+DESCRIPTION
+        These functions compute the complex square root of <[z]>, with 
+        a branch cut along the negative real axis. 
+
+        <<csqrtf>> is identical to <<csqrt>>, except that it performs
+        its calculations on <<floats complex>>.
+
+RETURNS
+        The csqrt functions return the complex square root value, in 
+        the range of the right halfplane (including the imaginary axis).
+
+PORTABILITY
+        <<csqrt>> and <<csqrtf>> are ISO C99
+
+QUICKREF
+        <<csqrt>> and <<csqrtf>> are ISO C99
+
+*/
+
+
+#include <complex.h>
+#include <math.h>
+
+double complex
+csqrt(double complex z)
+{
+	double complex w;
+	double x, y, r, t, scale;
+
+	x = creal (z);
+	y = cimag (z);
+
+	if (y == 0.0) {
+		if (x == 0.0) {
+			w = 0.0 + y * I;
+		} else {
+			r = fabs(x);
+			r = sqrt(r);
+			if (x < 0.0) {
+				w = 0.0 + r * I;
+			} else {
+				w = r + y * I;
+			}
+		}
+		return w;
+	}
+	if (x == 0.0) {
+		r = fabs(y);
+		r = sqrt(0.5 * r);
+		if (y > 0)
+			w = r + r * I;
+		else
+			w = r - r * I;
+		return w;
+	}
+	/* Rescale to avoid internal overflow or underflow.  */
+	if ((fabs(x) > 4.0) || (fabs(y) > 4.0)) {
+		x *= 0.25;
+		y *= 0.25;
+		scale = 2.0;
+	} else {
+#if 1
+		x *= 1.8014398509481984e16;  /* 2^54 */
+		y *= 1.8014398509481984e16;
+		scale = 7.450580596923828125e-9; /* 2^-27 */
+#else
+		x *= 4.0;
+		y *= 4.0;
+		scale = 0.5;
+#endif
+	}
+	w = x + y * I;
+	r = cabs(w);
+	if (x > 0) {
+		t = sqrt(0.5 * r + 0.5 * x);
+		r = scale * fabs((0.5 * y) / t );
+		t *= scale;
+	} else {
+		r = sqrt(0.5 * r - 0.5 * x);
+		t = scale * fabs((0.5 * y) / r);
+		r *= scale;
+	}
+	if (y < 0)
+		w = t - r * I;
+	else
+		w = t + r * I;
+	return w;
+}
diff -Naur newlib-1.18.0.orig/newlib/libm/complex/csqrtf.c newlib-1.18.0/newlib/libm/complex/csqrtf.c
--- newlib-1.18.0.orig/newlib/libm/complex/csqrtf.c	1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.18.0/newlib/libm/complex/csqrtf.c	2010-11-26 09:40:30.754687401 +0100
@@ -0,0 +1,102 @@
+/* $NetBSD: csqrtf.c,v 1.1 2007/08/20 16:01:37 drochner Exp $ */
+
+/*-
+ * Copyright (c) 2007 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software written by Stephen L. Moshier.
+ * It is redistributed by the NetBSD Foundation by permission of the author.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * imported and modified include for newlib 2010/10/03 
+ * Marco Atzeri <marco_atzeri@yahoo.it>
+ */
+
+#include <complex.h>
+#include <math.h>
+
+float complex
+csqrtf(float complex z)
+{
+	float complex w;
+	float x, y, r, t, scale;
+
+	x = crealf (z);
+	y = cimagf (z);
+
+	if (y == 0.0f) {
+		if (x < 0.0f) {
+			w = 0.0f + sqrtf(-x) * I;
+			return w;
+		} else if (x == 0.0f) {
+			return (0.0f + y * I);
+		} else {
+			w = sqrtf(x) + y * I;
+			return w;
+		}
+	}
+
+	if (x == 0.0f) {
+		r = fabsf(y);
+		r = sqrtf(0.5f * r);
+		if (y > 0)
+			w = r + r * I;
+		else
+			w = r - r * I;
+		return w;
+	}
+
+	/* Rescale to avoid internal overflow or underflow.  */
+	if ((fabsf(x) > 4.0f) || (fabsf(y) > 4.0f)) {
+		x *= 0.25f;
+		y *= 0.25f;
+		scale = 2.0f;
+	} else {
+#if 1
+		x *= 6.7108864e7f; /* 2^26 */
+		y *= 6.7108864e7f;
+		scale = 1.220703125e-4f; /* 2^-13 */
+#else
+		x *= 4.0f;
+		y *= 4.0f;
+		scale = 0.5f;
+#endif
+	}
+	w = x + y * I;
+	r = cabsf(w);
+	if( x > 0 ) {
+		t = sqrtf(0.5f * r + 0.5f * x);
+		r = scale * fabsf((0.5f * y) / t);
+		t *= scale;
+	} else {
+		r = sqrtf(0.5f * r - 0.5f * x);
+		t = scale * fabsf((0.5f * y) / r);
+		r *= scale;
+	}
+
+	if (y < 0)
+		w = t - r * I;
+	else
+		w = t + r * I;
+	return w;
+}
diff -Naur newlib-1.18.0.orig/newlib/libm/complex/ctan.c newlib-1.18.0/newlib/libm/complex/ctan.c
--- newlib-1.18.0.orig/newlib/libm/complex/ctan.c	1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.18.0/newlib/libm/complex/ctan.c	2010-11-26 09:40:30.755687585 +0100
@@ -0,0 +1,98 @@
+/* $NetBSD: ctan.c,v 1.1 2007/08/20 16:01:37 drochner Exp $ */
+
+/*-
+ * Copyright (c) 2007 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software written by Stephen L. Moshier.
+ * It is redistributed by the NetBSD Foundation by permission of the author.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * imported and modified include for newlib 2010/10/03 
+ * Marco Atzeri <marco_atzeri@yahoo.it>
+ */
+
+/*
+FUNCTION
+        <<ctan>>, <<ctanf>>---complex tangent
+
+INDEX
+        ctan
+INDEX
+        ctanf
+
+ANSI_SYNOPSIS
+       #include <complex.h>
+       double complex ctan(double complex <[z]>);
+       float complex ctanf(float complex <[z]>);
+
+
+DESCRIPTION
+        These functions compute the complex tangent of <[z]>.
+
+        <<ctanf>> is identical to <<ctan>>, except that it performs
+        its calculations on <<floats complex>>.
+
+RETURNS
+        These functions return the complex tangent value.
+
+PORTABILITY
+        <<ctan>> and <<ctanf>> are ISO C99
+
+QUICKREF
+        <<ctan>> and <<ctanf>> are ISO C99
+
+*/
+
+
+#include <complex.h>
+#include <math.h>
+#include <float.h>
+#include "cephes_subr.h"
+
+#ifdef DBL_MAX
+#define MAXNUM DBL_MAX
+#else
+#define MAXNUM 1.0e308
+#endif
+
+double complex
+ctan(double complex z)
+{
+	double complex w;
+	double d;
+
+	d = cos(2.0 * creal(z)) + cosh(2.0 * cimag(z));
+
+	if (fabs(d) < 0.25)
+		d = _ctans(z);
+
+	if (d == 0.0) {
+		/* mtherr ("ctan", OVERFLOW); */
+		w = MAXNUM + MAXNUM * I;
+		return w;
+	}
+
+	w = sin(2.0 * creal(z)) / d + (sinh(2.0 * cimag(z)) / d) * I;
+	return w;
+}
diff -Naur newlib-1.18.0.orig/newlib/libm/complex/ctanf.c newlib-1.18.0/newlib/libm/complex/ctanf.c
--- newlib-1.18.0.orig/newlib/libm/complex/ctanf.c	1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.18.0/newlib/libm/complex/ctanf.c	2010-11-26 09:40:30.755687585 +0100
@@ -0,0 +1,65 @@
+/* $NetBSD: ctanf.c,v 1.1 2007/08/20 16:01:38 drochner Exp $ */
+
+/*-
+ * Copyright (c) 2007 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software written by Stephen L. Moshier.
+ * It is redistributed by the NetBSD Foundation by permission of the author.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * imported and modified include for newlib 2010/10/03 
+ * Marco Atzeri <marco_atzeri@yahoo.it>
+ */
+
+#include <complex.h>
+#include <math.h>
+#include <float.h>
+#include "cephes_subrf.h"
+
+#ifdef FLT_MAX
+#define MAXNUMF FLT_MAX
+#else
+#define MAXNUMF 1.0e38f
+#endif
+
+float complex
+ctanf(float complex z)
+{
+	float complex w;
+	float d;
+
+	d = cosf(2.0f * crealf(z)) + coshf(2.0f * cimagf(z));
+
+	if (fabsf(d) < 0.25f)
+		d = _ctansf(z);
+
+	if (d == 0.0f) {
+		/* mtherr ("ctan", OVERFLOW); */
+		w = MAXNUMF + MAXNUMF * I;
+		return w;
+	}
+
+	w = sinf(2.0f * crealf(z)) / d + (sinhf(2.0f * cimagf(z)) / d) * I;
+	return w;
+}
diff -Naur newlib-1.18.0.orig/newlib/libm/complex/ctanh.c newlib-1.18.0/newlib/libm/complex/ctanh.c
--- newlib-1.18.0.orig/newlib/libm/complex/ctanh.c	1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.18.0/newlib/libm/complex/ctanh.c	2010-11-26 09:40:30.755687585 +0100
@@ -0,0 +1,83 @@
+/* $NetBSD: ctanh.c,v 1.1 2007/08/20 16:01:38 drochner Exp $ */
+
+/*-
+ * Copyright (c) 2007 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software written by Stephen L. Moshier.
+ * It is redistributed by the NetBSD Foundation by permission of the author.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * imported and modified include for newlib 2010/10/03 
+ * Marco Atzeri <marco_atzeri@yahoo.it>
+ */
+
+/*
+FUNCTION
+        <<ctanh>>, <<ctanf>>---complex hyperbolic tangent
+
+INDEX
+        ctanh
+INDEX
+        ctanhf
+
+ANSI_SYNOPSIS
+       #include <complex.h>
+       double complex ctanh(double complex <[z]>);
+       float complex ctanhf(float complex <[z]>);
+
+
+DESCRIPTION
+        These functions compute the complex hyperbolic tangent of <[z]>.
+
+        <<ctanhf>> is identical to <<ctanh>>, except that it performs
+        its calculations on <<floats complex>>.
+
+RETURNS
+        These functions return the complex hyperbolic tangent value.
+
+PORTABILITY
+        <<ctanh>> and <<ctanhf>> are ISO C99
+
+QUICKREF
+        <<ctanh>> and <<ctanhf>> are ISO C99
+
+*/
+
+
+#include <complex.h>
+#include <math.h>
+
+double complex
+ctanh(double complex z)
+{
+	double complex w;
+	double x, y, d;
+
+	x = creal(z);
+	y = cimag(z);
+	d = cosh(2.0 * x) + cos(2.0 * y);
+	w = sinh(2.0 * x) / d  +  (sin(2.0 * y) / d) * I;
+
+	return w;
+}
diff -Naur newlib-1.18.0.orig/newlib/libm/complex/ctanhf.c newlib-1.18.0/newlib/libm/complex/ctanhf.c
--- newlib-1.18.0.orig/newlib/libm/complex/ctanhf.c	1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.18.0/newlib/libm/complex/ctanhf.c	2010-11-26 09:40:30.755687585 +0100
@@ -0,0 +1,50 @@
+/* $NetBSD: ctanhf.c,v 1.1 2007/08/20 16:01:38 drochner Exp $ */
+
+/*-
+ * Copyright (c) 2007 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software written by Stephen L. Moshier.
+ * It is redistributed by the NetBSD Foundation by permission of the author.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * imported and modified include for newlib 2010/10/03 
+ * Marco Atzeri <marco_atzeri@yahoo.it>
+ */
+
+#include <complex.h>
+#include <math.h>
+
+float complex
+ctanhf(float complex z)
+{
+	float complex w;
+	float x, y, d;
+
+	x = crealf(z);
+	y = cimagf(z);
+	d = coshf(2.0f * x) + cosf(2.0f * y);
+	w = sinhf(2.0f * x) / d  +  (sinf(2.0f * y) / d) * I;
+
+	return w;
+}
diff -Naur newlib-1.18.0.orig/newlib/libm/complex/Makefile.am newlib-1.18.0/newlib/libm/complex/Makefile.am
--- newlib-1.18.0.orig/newlib/libm/complex/Makefile.am	1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.18.0/newlib/libm/complex/Makefile.am	2010-11-26 09:40:30.748686295 +0100
@@ -0,0 +1,59 @@
+## Process this file with automake to generate Makefile.in
+
+AUTOMAKE_OPTIONS = cygnus
+
+INCLUDES = -I$(srcdir)/../common -I$(srcdir)/ $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS)
+
+src = cabs.c cacos.c cacosh.c carg.c casin.c casinh.c \
+      catan.c catanh.c ccos.c ccosh.c cephes_subr.c \
+      cexp.c cimag.c  clog.c conj.c  \
+      cpow.c cproj.c  creal.c  \
+      csin.c csinh.c csqrt.c ctan.c ctanh.c
+	
+
+fsrc =	cabsf.c casinf.c ccosf.c cimagf.c cprojf.c  \
+        csqrtf.c cacosf.c casinhf.c ccoshf.c clogf.c \
+        crealf.c ctanf.c cacoshf.c catanf.c   \
+        cephes_subrf.c conjf.c csinf.c ctanhf.c \
+        cargf.c catanhf.c cexpf.c cpowf.c csinhf.c
+
+libcomplex_la_LDFLAGS = -Xcompiler -nostdlib
+
+if USE_LIBTOOL
+noinst_LTLIBRARIES = libcomplex.la
+libcomplex_la_SOURCES = $(src) $(fsrc)
+noinst_DATA = objectlist.awk.in
+else
+noinst_LIBRARIES = lib.a
+lib_a_SOURCES = $(src) $(fsrc)
+lib_a_CFLAGS = $(AM_CFLAGS)
+noinst_DATA =
+endif # USE_LIBTOOL
+
+include $(srcdir)/../../Makefile.shared
+
+chobj =	cabs.def cacos.def cacosh.def carg.def \
+        casin.def casinh.def catan.def catanh.def \
+        ccos.def ccosh.def cexp.def cimag.def clog.def \
+        conj.def cpow.def cproj.def creal.def \
+        csin.def csinh.def csqrt.def ctan.def ctanh.def
+
+
+SUFFIXES = .def
+
+CHEW = ../../doc/makedoc -f $(srcdir)/../../doc/doc.str
+
+.c.def:
+	$(CHEW) < $< > $*.def 2> $*.ref
+	touch stmp-def
+
+TARGETDOC = ../tmp.texi
+
+doc: $(chobj)
+	cat $(srcdir)/complex.tex >> $(TARGETDOC)
+
+CLEANFILES = $(chobj) *.ref
+
+# A partial dependency list.
+
+$(lib_a_OBJECTS): $(srcdir)/../../libc/include/complex.h $(srcdir)/cephes_subr.h $(srcdir)/cephes_subrf.h
diff -Naur newlib-1.18.0.orig/newlib/libm/complex/Makefile.in newlib-1.18.0/newlib/libm/complex/Makefile.in
--- newlib-1.18.0.orig/newlib/libm/complex/Makefile.in	1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.18.0/newlib/libm/complex/Makefile.in	2010-11-26 09:40:30.749686481 +0100
@@ -0,0 +1,813 @@
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = $(srcdir)/../../Makefile.shared $(srcdir)/Makefile.in \
+	$(srcdir)/Makefile.am
+subdir = complex
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/../../libtool.m4 \
+	$(top_srcdir)/../../ltoptions.m4 \
+	$(top_srcdir)/../../ltsugar.m4 \
+	$(top_srcdir)/../../ltversion.m4 \
+	$(top_srcdir)/../../lt~obsolete.m4 \
+	$(top_srcdir)/../acinclude.m4 $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/../../mkinstalldirs
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+ARFLAGS = cru
+lib_a_AR = $(AR) $(ARFLAGS)
+lib_a_LIBADD =
+am__objects_1 = lib_a-cabs.$(OBJEXT) lib_a-cacos.$(OBJEXT) \
+	lib_a-cacosh.$(OBJEXT) lib_a-carg.$(OBJEXT) \
+	lib_a-casin.$(OBJEXT) lib_a-casinh.$(OBJEXT) \
+	lib_a-catan.$(OBJEXT) lib_a-catanh.$(OBJEXT) \
+	lib_a-ccos.$(OBJEXT) lib_a-ccosh.$(OBJEXT) \
+	lib_a-cephes_subr.$(OBJEXT) lib_a-cexp.$(OBJEXT) \
+	lib_a-cimag.$(OBJEXT) lib_a-clog.$(OBJEXT) \
+	lib_a-conj.$(OBJEXT) lib_a-cpow.$(OBJEXT) \
+	lib_a-cproj.$(OBJEXT) lib_a-creal.$(OBJEXT) \
+	lib_a-csin.$(OBJEXT) lib_a-csinh.$(OBJEXT) \
+	lib_a-csqrt.$(OBJEXT) lib_a-ctan.$(OBJEXT) \
+	lib_a-ctanh.$(OBJEXT)
+am__objects_2 = lib_a-cabsf.$(OBJEXT) lib_a-casinf.$(OBJEXT) \
+	lib_a-ccosf.$(OBJEXT) lib_a-cimagf.$(OBJEXT) \
+	lib_a-cprojf.$(OBJEXT) lib_a-csqrtf.$(OBJEXT) \
+	lib_a-cacosf.$(OBJEXT) lib_a-casinhf.$(OBJEXT) \
+	lib_a-ccoshf.$(OBJEXT) lib_a-clogf.$(OBJEXT) \
+	lib_a-crealf.$(OBJEXT) lib_a-ctanf.$(OBJEXT) \
+	lib_a-cacoshf.$(OBJEXT) lib_a-catanf.$(OBJEXT) \
+	lib_a-cephes_subrf.$(OBJEXT) lib_a-conjf.$(OBJEXT) \
+	lib_a-csinf.$(OBJEXT) lib_a-ctanhf.$(OBJEXT) \
+	lib_a-cargf.$(OBJEXT) lib_a-catanhf.$(OBJEXT) \
+	lib_a-cexpf.$(OBJEXT) lib_a-cpowf.$(OBJEXT) \
+	lib_a-csinhf.$(OBJEXT)
+@USE_LIBTOOL_FALSE@am_lib_a_OBJECTS = $(am__objects_1) \
+@USE_LIBTOOL_FALSE@	$(am__objects_2)
+lib_a_OBJECTS = $(am_lib_a_OBJECTS)
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+libcomplex_la_LIBADD =
+am__objects_3 = cabs.lo cacos.lo cacosh.lo carg.lo casin.lo casinh.lo \
+	catan.lo catanh.lo ccos.lo ccosh.lo cephes_subr.lo cexp.lo \
+	cimag.lo clog.lo conj.lo cpow.lo cproj.lo creal.lo csin.lo \
+	csinh.lo csqrt.lo ctan.lo ctanh.lo
+am__objects_4 = cabsf.lo casinf.lo ccosf.lo cimagf.lo cprojf.lo \
+	csqrtf.lo cacosf.lo casinhf.lo ccoshf.lo clogf.lo crealf.lo \
+	ctanf.lo cacoshf.lo catanf.lo cephes_subrf.lo conjf.lo \
+	csinf.lo ctanhf.lo cargf.lo catanhf.lo cexpf.lo cpowf.lo \
+	csinhf.lo
+@USE_LIBTOOL_TRUE@am_libcomplex_la_OBJECTS = $(am__objects_3) \
+@USE_LIBTOOL_TRUE@	$(am__objects_4)
+libcomplex_la_OBJECTS = $(am_libcomplex_la_OBJECTS)
+libcomplex_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(libcomplex_la_LDFLAGS) $(LDFLAGS) -o $@
+@USE_LIBTOOL_TRUE@am_libcomplex_la_rpath =
+DEFAULT_INCLUDES = -I.@am__isrc@
+depcomp =
+am__depfiles_maybe =
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+	$(LDFLAGS) -o $@
+SOURCES = $(lib_a_SOURCES) $(libcomplex_la_SOURCES)
+DATA = $(noinst_DATA)
+ETAGS = etags
+CTAGS = ctags
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCAS = @CCAS@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBM_MACHINE_LIB = @LIBM_MACHINE_LIB@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NEWLIB_CFLAGS = @NEWLIB_CFLAGS@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+READELF = @READELF@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+aext = @aext@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+libm_machine_dir = @libm_machine_dir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+lpfx = @lpfx@
+machine_dir = @machine_dir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+newlib_basedir = @newlib_basedir@
+oext = @oext@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+subdirs = @subdirs@
+sys_dir = @sys_dir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AUTOMAKE_OPTIONS = cygnus
+INCLUDES = -I$(srcdir)/../common -I$(srcdir)/ $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS)
+src = cabs.c cacos.c cacosh.c carg.c casin.c casinh.c \
+      catan.c catanh.c ccos.c ccosh.c cephes_subr.c \
+      cexp.c cimag.c  clog.c conj.c  \
+      cpow.c cproj.c  creal.c  \
+      csin.c csinh.c csqrt.c ctan.c ctanh.c
+
+fsrc = cabsf.c casinf.c ccosf.c cimagf.c cprojf.c  \
+        csqrtf.c cacosf.c casinhf.c ccoshf.c clogf.c \
+        crealf.c ctanf.c cacoshf.c catanf.c   \
+        cephes_subrf.c conjf.c csinf.c ctanhf.c \
+        cargf.c catanhf.c cexpf.c cpowf.c csinhf.c
+
+libcomplex_la_LDFLAGS = -Xcompiler -nostdlib
+@USE_LIBTOOL_TRUE@noinst_LTLIBRARIES = libcomplex.la
+@USE_LIBTOOL_TRUE@libcomplex_la_SOURCES = $(src) $(fsrc)
+@USE_LIBTOOL_FALSE@noinst_DATA = 
+@USE_LIBTOOL_TRUE@noinst_DATA = objectlist.awk.in
+@USE_LIBTOOL_FALSE@noinst_LIBRARIES = lib.a
+@USE_LIBTOOL_FALSE@lib_a_SOURCES = $(src) $(fsrc)
+@USE_LIBTOOL_FALSE@lib_a_CFLAGS = $(AM_CFLAGS)
+chobj = cabs.def cacos.def cacosh.def carg.def \
+        casin.def casinh.def catan.def catanh.def \
+        ccos.def ccosh.def cexp.def cimag.def clog.def \
+        conj.def cpow.def cproj.def creal.def \
+        csin.def csinh.def csqrt.def ctan.def ctanh.def
+
+SUFFIXES = .def
+CHEW = ../../doc/makedoc -f $(srcdir)/../../doc/doc.str
+TARGETDOC = ../tmp.texi
+CLEANFILES = $(chobj) *.ref
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .def .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/../../Makefile.shared $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+	        && { if test -f $@; then exit 0; else break; fi; }; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --cygnus complex/Makefile'; \
+	$(am__cd) $(top_srcdir) && \
+	  $(AUTOMAKE) --cygnus complex/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+clean-noinstLIBRARIES:
+	-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+lib.a: $(lib_a_OBJECTS) $(lib_a_DEPENDENCIES) 
+	-rm -f lib.a
+	$(lib_a_AR) lib.a $(lib_a_OBJECTS) $(lib_a_LIBADD)
+	$(RANLIB) lib.a
+
+clean-noinstLTLIBRARIES:
+	-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+	@list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
+	  dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+	  test "$$dir" != "$$p" || dir=.; \
+	  echo "rm -f \"$${dir}/so_locations\""; \
+	  rm -f "$${dir}/so_locations"; \
+	done
+libcomplex.la: $(libcomplex_la_OBJECTS) $(libcomplex_la_DEPENDENCIES) 
+	$(libcomplex_la_LINK) $(am_libcomplex_la_rpath) $(libcomplex_la_OBJECTS) $(libcomplex_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+.c.o:
+	$(COMPILE) -c $<
+
+.c.obj:
+	$(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+	$(LTCOMPILE) -c -o $@ $<
+
+lib_a-cabs.o: cabs.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-cabs.o `test -f 'cabs.c' || echo '$(srcdir)/'`cabs.c
+
+lib_a-cabs.obj: cabs.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-cabs.obj `if test -f 'cabs.c'; then $(CYGPATH_W) 'cabs.c'; else $(CYGPATH_W) '$(srcdir)/cabs.c'; fi`
+
+lib_a-cacos.o: cacos.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-cacos.o `test -f 'cacos.c' || echo '$(srcdir)/'`cacos.c
+
+lib_a-cacos.obj: cacos.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-cacos.obj `if test -f 'cacos.c'; then $(CYGPATH_W) 'cacos.c'; else $(CYGPATH_W) '$(srcdir)/cacos.c'; fi`
+
+lib_a-cacosh.o: cacosh.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-cacosh.o `test -f 'cacosh.c' || echo '$(srcdir)/'`cacosh.c
+
+lib_a-cacosh.obj: cacosh.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-cacosh.obj `if test -f 'cacosh.c'; then $(CYGPATH_W) 'cacosh.c'; else $(CYGPATH_W) '$(srcdir)/cacosh.c'; fi`
+
+lib_a-carg.o: carg.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-carg.o `test -f 'carg.c' || echo '$(srcdir)/'`carg.c
+
+lib_a-carg.obj: carg.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-carg.obj `if test -f 'carg.c'; then $(CYGPATH_W) 'carg.c'; else $(CYGPATH_W) '$(srcdir)/carg.c'; fi`
+
+lib_a-casin.o: casin.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-casin.o `test -f 'casin.c' || echo '$(srcdir)/'`casin.c
+
+lib_a-casin.obj: casin.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-casin.obj `if test -f 'casin.c'; then $(CYGPATH_W) 'casin.c'; else $(CYGPATH_W) '$(srcdir)/casin.c'; fi`
+
+lib_a-casinh.o: casinh.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-casinh.o `test -f 'casinh.c' || echo '$(srcdir)/'`casinh.c
+
+lib_a-casinh.obj: casinh.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-casinh.obj `if test -f 'casinh.c'; then $(CYGPATH_W) 'casinh.c'; else $(CYGPATH_W) '$(srcdir)/casinh.c'; fi`
+
+lib_a-catan.o: catan.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-catan.o `test -f 'catan.c' || echo '$(srcdir)/'`catan.c
+
+lib_a-catan.obj: catan.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-catan.obj `if test -f 'catan.c'; then $(CYGPATH_W) 'catan.c'; else $(CYGPATH_W) '$(srcdir)/catan.c'; fi`
+
+lib_a-catanh.o: catanh.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-catanh.o `test -f 'catanh.c' || echo '$(srcdir)/'`catanh.c
+
+lib_a-catanh.obj: catanh.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-catanh.obj `if test -f 'catanh.c'; then $(CYGPATH_W) 'catanh.c'; else $(CYGPATH_W) '$(srcdir)/catanh.c'; fi`
+
+lib_a-ccos.o: ccos.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ccos.o `test -f 'ccos.c' || echo '$(srcdir)/'`ccos.c
+
+lib_a-ccos.obj: ccos.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ccos.obj `if test -f 'ccos.c'; then $(CYGPATH_W) 'ccos.c'; else $(CYGPATH_W) '$(srcdir)/ccos.c'; fi`
+
+lib_a-ccosh.o: ccosh.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ccosh.o `test -f 'ccosh.c' || echo '$(srcdir)/'`ccosh.c
+
+lib_a-ccosh.obj: ccosh.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ccosh.obj `if test -f 'ccosh.c'; then $(CYGPATH_W) 'ccosh.c'; else $(CYGPATH_W) '$(srcdir)/ccosh.c'; fi`
+
+lib_a-cephes_subr.o: cephes_subr.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-cephes_subr.o `test -f 'cephes_subr.c' || echo '$(srcdir)/'`cephes_subr.c
+
+lib_a-cephes_subr.obj: cephes_subr.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-cephes_subr.obj `if test -f 'cephes_subr.c'; then $(CYGPATH_W) 'cephes_subr.c'; else $(CYGPATH_W) '$(srcdir)/cephes_subr.c'; fi`
+
+lib_a-cexp.o: cexp.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-cexp.o `test -f 'cexp.c' || echo '$(srcdir)/'`cexp.c
+
+lib_a-cexp.obj: cexp.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-cexp.obj `if test -f 'cexp.c'; then $(CYGPATH_W) 'cexp.c'; else $(CYGPATH_W) '$(srcdir)/cexp.c'; fi`
+
+lib_a-cimag.o: cimag.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-cimag.o `test -f 'cimag.c' || echo '$(srcdir)/'`cimag.c
+
+lib_a-cimag.obj: cimag.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-cimag.obj `if test -f 'cimag.c'; then $(CYGPATH_W) 'cimag.c'; else $(CYGPATH_W) '$(srcdir)/cimag.c'; fi`
+
+lib_a-clog.o: clog.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-clog.o `test -f 'clog.c' || echo '$(srcdir)/'`clog.c
+
+lib_a-clog.obj: clog.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-clog.obj `if test -f 'clog.c'; then $(CYGPATH_W) 'clog.c'; else $(CYGPATH_W) '$(srcdir)/clog.c'; fi`
+
+lib_a-conj.o: conj.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-conj.o `test -f 'conj.c' || echo '$(srcdir)/'`conj.c
+
+lib_a-conj.obj: conj.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-conj.obj `if test -f 'conj.c'; then $(CYGPATH_W) 'conj.c'; else $(CYGPATH_W) '$(srcdir)/conj.c'; fi`
+
+lib_a-cpow.o: cpow.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-cpow.o `test -f 'cpow.c' || echo '$(srcdir)/'`cpow.c
+
+lib_a-cpow.obj: cpow.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-cpow.obj `if test -f 'cpow.c'; then $(CYGPATH_W) 'cpow.c'; else $(CYGPATH_W) '$(srcdir)/cpow.c'; fi`
+
+lib_a-cproj.o: cproj.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-cproj.o `test -f 'cproj.c' || echo '$(srcdir)/'`cproj.c
+
+lib_a-cproj.obj: cproj.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-cproj.obj `if test -f 'cproj.c'; then $(CYGPATH_W) 'cproj.c'; else $(CYGPATH_W) '$(srcdir)/cproj.c'; fi`
+
+lib_a-creal.o: creal.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-creal.o `test -f 'creal.c' || echo '$(srcdir)/'`creal.c
+
+lib_a-creal.obj: creal.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-creal.obj `if test -f 'creal.c'; then $(CYGPATH_W) 'creal.c'; else $(CYGPATH_W) '$(srcdir)/creal.c'; fi`
+
+lib_a-csin.o: csin.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-csin.o `test -f 'csin.c' || echo '$(srcdir)/'`csin.c
+
+lib_a-csin.obj: csin.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-csin.obj `if test -f 'csin.c'; then $(CYGPATH_W) 'csin.c'; else $(CYGPATH_W) '$(srcdir)/csin.c'; fi`
+
+lib_a-csinh.o: csinh.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-csinh.o `test -f 'csinh.c' || echo '$(srcdir)/'`csinh.c
+
+lib_a-csinh.obj: csinh.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-csinh.obj `if test -f 'csinh.c'; then $(CYGPATH_W) 'csinh.c'; else $(CYGPATH_W) '$(srcdir)/csinh.c'; fi`
+
+lib_a-csqrt.o: csqrt.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-csqrt.o `test -f 'csqrt.c' || echo '$(srcdir)/'`csqrt.c
+
+lib_a-csqrt.obj: csqrt.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-csqrt.obj `if test -f 'csqrt.c'; then $(CYGPATH_W) 'csqrt.c'; else $(CYGPATH_W) '$(srcdir)/csqrt.c'; fi`
+
+lib_a-ctan.o: ctan.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ctan.o `test -f 'ctan.c' || echo '$(srcdir)/'`ctan.c
+
+lib_a-ctan.obj: ctan.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ctan.obj `if test -f 'ctan.c'; then $(CYGPATH_W) 'ctan.c'; else $(CYGPATH_W) '$(srcdir)/ctan.c'; fi`
+
+lib_a-ctanh.o: ctanh.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ctanh.o `test -f 'ctanh.c' || echo '$(srcdir)/'`ctanh.c
+
+lib_a-ctanh.obj: ctanh.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ctanh.obj `if test -f 'ctanh.c'; then $(CYGPATH_W) 'ctanh.c'; else $(CYGPATH_W) '$(srcdir)/ctanh.c'; fi`
+
+lib_a-cabsf.o: cabsf.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-cabsf.o `test -f 'cabsf.c' || echo '$(srcdir)/'`cabsf.c
+
+lib_a-cabsf.obj: cabsf.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-cabsf.obj `if test -f 'cabsf.c'; then $(CYGPATH_W) 'cabsf.c'; else $(CYGPATH_W) '$(srcdir)/cabsf.c'; fi`
+
+lib_a-casinf.o: casinf.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-casinf.o `test -f 'casinf.c' || echo '$(srcdir)/'`casinf.c
+
+lib_a-casinf.obj: casinf.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-casinf.obj `if test -f 'casinf.c'; then $(CYGPATH_W) 'casinf.c'; else $(CYGPATH_W) '$(srcdir)/casinf.c'; fi`
+
+lib_a-ccosf.o: ccosf.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ccosf.o `test -f 'ccosf.c' || echo '$(srcdir)/'`ccosf.c
+
+lib_a-ccosf.obj: ccosf.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ccosf.obj `if test -f 'ccosf.c'; then $(CYGPATH_W) 'ccosf.c'; else $(CYGPATH_W) '$(srcdir)/ccosf.c'; fi`
+
+lib_a-cimagf.o: cimagf.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-cimagf.o `test -f 'cimagf.c' || echo '$(srcdir)/'`cimagf.c
+
+lib_a-cimagf.obj: cimagf.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-cimagf.obj `if test -f 'cimagf.c'; then $(CYGPATH_W) 'cimagf.c'; else $(CYGPATH_W) '$(srcdir)/cimagf.c'; fi`
+
+lib_a-cprojf.o: cprojf.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-cprojf.o `test -f 'cprojf.c' || echo '$(srcdir)/'`cprojf.c
+
+lib_a-cprojf.obj: cprojf.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-cprojf.obj `if test -f 'cprojf.c'; then $(CYGPATH_W) 'cprojf.c'; else $(CYGPATH_W) '$(srcdir)/cprojf.c'; fi`
+
+lib_a-csqrtf.o: csqrtf.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-csqrtf.o `test -f 'csqrtf.c' || echo '$(srcdir)/'`csqrtf.c
+
+lib_a-csqrtf.obj: csqrtf.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-csqrtf.obj `if test -f 'csqrtf.c'; then $(CYGPATH_W) 'csqrtf.c'; else $(CYGPATH_W) '$(srcdir)/csqrtf.c'; fi`
+
+lib_a-cacosf.o: cacosf.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-cacosf.o `test -f 'cacosf.c' || echo '$(srcdir)/'`cacosf.c
+
+lib_a-cacosf.obj: cacosf.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-cacosf.obj `if test -f 'cacosf.c'; then $(CYGPATH_W) 'cacosf.c'; else $(CYGPATH_W) '$(srcdir)/cacosf.c'; fi`
+
+lib_a-casinhf.o: casinhf.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-casinhf.o `test -f 'casinhf.c' || echo '$(srcdir)/'`casinhf.c
+
+lib_a-casinhf.obj: casinhf.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-casinhf.obj `if test -f 'casinhf.c'; then $(CYGPATH_W) 'casinhf.c'; else $(CYGPATH_W) '$(srcdir)/casinhf.c'; fi`
+
+lib_a-ccoshf.o: ccoshf.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ccoshf.o `test -f 'ccoshf.c' || echo '$(srcdir)/'`ccoshf.c
+
+lib_a-ccoshf.obj: ccoshf.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ccoshf.obj `if test -f 'ccoshf.c'; then $(CYGPATH_W) 'ccoshf.c'; else $(CYGPATH_W) '$(srcdir)/ccoshf.c'; fi`
+
+lib_a-clogf.o: clogf.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-clogf.o `test -f 'clogf.c' || echo '$(srcdir)/'`clogf.c
+
+lib_a-clogf.obj: clogf.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-clogf.obj `if test -f 'clogf.c'; then $(CYGPATH_W) 'clogf.c'; else $(CYGPATH_W) '$(srcdir)/clogf.c'; fi`
+
+lib_a-crealf.o: crealf.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-crealf.o `test -f 'crealf.c' || echo '$(srcdir)/'`crealf.c
+
+lib_a-crealf.obj: crealf.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-crealf.obj `if test -f 'crealf.c'; then $(CYGPATH_W) 'crealf.c'; else $(CYGPATH_W) '$(srcdir)/crealf.c'; fi`
+
+lib_a-ctanf.o: ctanf.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ctanf.o `test -f 'ctanf.c' || echo '$(srcdir)/'`ctanf.c
+
+lib_a-ctanf.obj: ctanf.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ctanf.obj `if test -f 'ctanf.c'; then $(CYGPATH_W) 'ctanf.c'; else $(CYGPATH_W) '$(srcdir)/ctanf.c'; fi`
+
+lib_a-cacoshf.o: cacoshf.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-cacoshf.o `test -f 'cacoshf.c' || echo '$(srcdir)/'`cacoshf.c
+
+lib_a-cacoshf.obj: cacoshf.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-cacoshf.obj `if test -f 'cacoshf.c'; then $(CYGPATH_W) 'cacoshf.c'; else $(CYGPATH_W) '$(srcdir)/cacoshf.c'; fi`
+
+lib_a-catanf.o: catanf.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-catanf.o `test -f 'catanf.c' || echo '$(srcdir)/'`catanf.c
+
+lib_a-catanf.obj: catanf.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-catanf.obj `if test -f 'catanf.c'; then $(CYGPATH_W) 'catanf.c'; else $(CYGPATH_W) '$(srcdir)/catanf.c'; fi`
+
+lib_a-cephes_subrf.o: cephes_subrf.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-cephes_subrf.o `test -f 'cephes_subrf.c' || echo '$(srcdir)/'`cephes_subrf.c
+
+lib_a-cephes_subrf.obj: cephes_subrf.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-cephes_subrf.obj `if test -f 'cephes_subrf.c'; then $(CYGPATH_W) 'cephes_subrf.c'; else $(CYGPATH_W) '$(srcdir)/cephes_subrf.c'; fi`
+
+lib_a-conjf.o: conjf.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-conjf.o `test -f 'conjf.c' || echo '$(srcdir)/'`conjf.c
+
+lib_a-conjf.obj: conjf.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-conjf.obj `if test -f 'conjf.c'; then $(CYGPATH_W) 'conjf.c'; else $(CYGPATH_W) '$(srcdir)/conjf.c'; fi`
+
+lib_a-csinf.o: csinf.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-csinf.o `test -f 'csinf.c' || echo '$(srcdir)/'`csinf.c
+
+lib_a-csinf.obj: csinf.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-csinf.obj `if test -f 'csinf.c'; then $(CYGPATH_W) 'csinf.c'; else $(CYGPATH_W) '$(srcdir)/csinf.c'; fi`
+
+lib_a-ctanhf.o: ctanhf.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ctanhf.o `test -f 'ctanhf.c' || echo '$(srcdir)/'`ctanhf.c
+
+lib_a-ctanhf.obj: ctanhf.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ctanhf.obj `if test -f 'ctanhf.c'; then $(CYGPATH_W) 'ctanhf.c'; else $(CYGPATH_W) '$(srcdir)/ctanhf.c'; fi`
+
+lib_a-cargf.o: cargf.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-cargf.o `test -f 'cargf.c' || echo '$(srcdir)/'`cargf.c
+
+lib_a-cargf.obj: cargf.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-cargf.obj `if test -f 'cargf.c'; then $(CYGPATH_W) 'cargf.c'; else $(CYGPATH_W) '$(srcdir)/cargf.c'; fi`
+
+lib_a-catanhf.o: catanhf.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-catanhf.o `test -f 'catanhf.c' || echo '$(srcdir)/'`catanhf.c
+
+lib_a-catanhf.obj: catanhf.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-catanhf.obj `if test -f 'catanhf.c'; then $(CYGPATH_W) 'catanhf.c'; else $(CYGPATH_W) '$(srcdir)/catanhf.c'; fi`
+
+lib_a-cexpf.o: cexpf.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-cexpf.o `test -f 'cexpf.c' || echo '$(srcdir)/'`cexpf.c
+
+lib_a-cexpf.obj: cexpf.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-cexpf.obj `if test -f 'cexpf.c'; then $(CYGPATH_W) 'cexpf.c'; else $(CYGPATH_W) '$(srcdir)/cexpf.c'; fi`
+
+lib_a-cpowf.o: cpowf.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-cpowf.o `test -f 'cpowf.c' || echo '$(srcdir)/'`cpowf.c
+
+lib_a-cpowf.obj: cpowf.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-cpowf.obj `if test -f 'cpowf.c'; then $(CYGPATH_W) 'cpowf.c'; else $(CYGPATH_W) '$(srcdir)/cpowf.c'; fi`
+
+lib_a-csinhf.o: csinhf.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-csinhf.o `test -f 'csinhf.c' || echo '$(srcdir)/'`csinhf.c
+
+lib_a-csinhf.obj: csinhf.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-csinhf.obj `if test -f 'csinhf.c'; then $(CYGPATH_W) 'csinhf.c'; else $(CYGPATH_W) '$(srcdir)/csinhf.c'; fi`
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	set x; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	shift; \
+	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  if test $$# -gt 0; then \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      "$$@" $$unique; \
+	  else \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      $$unique; \
+	  fi; \
+	fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	test -z "$(CTAGS_ARGS)$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && $(am__cd) $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) "$$here"
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+check-am:
+check: check-am
+all-am: Makefile $(LIBRARIES) $(LTLIBRARIES) $(DATA)
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+	-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \
+	clean-noinstLTLIBRARIES mostlyclean-am
+
+distclean: distclean-am
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-libtool clean-noinstLIBRARIES clean-noinstLTLIBRARIES \
+	ctags distclean distclean-compile distclean-generic \
+	distclean-libtool distclean-tags dvi dvi-am html html-am info \
+	info-am install install-am install-data install-data-am \
+	install-dvi install-dvi-am install-exec install-exec-am \
+	install-html install-html-am install-info install-info-am \
+	install-man install-pdf install-pdf-am install-ps \
+	install-ps-am install-strip installcheck installcheck-am \
+	installdirs maintainer-clean maintainer-clean-generic \
+	mostlyclean mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \
+	uninstall-am
+
+objectlist.awk.in: $(noinst_LTLIBRARIES)
+	-rm -f objectlist.awk.in
+	for i in `ls *.lo` ; \
+	do \
+	  echo $$i `pwd`/$$i >> objectlist.awk.in ; \
+	done
+
+.c.def:
+	$(CHEW) < $< > $*.def 2> $*.ref
+	touch stmp-def
+
+doc: $(chobj)
+	cat $(srcdir)/complex.tex >> $(TARGETDOC)
+
+# A partial dependency list.
+
+$(lib_a_OBJECTS): $(srcdir)/../../libc/include/complex.h $(srcdir)/cephes_subr.h $(srcdir)/cephes_subrf.h
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff -Naur newlib-1.18.0.orig/newlib/libm/configure newlib-1.18.0/newlib/libm/configure
--- newlib-1.18.0.orig/newlib/libm/configure	2009-12-17 21:41:42.000000000 +0100
+++ newlib-1.18.0/newlib/libm/configure	2010-11-26 09:40:30.758688136 +0100
@@ -12649,7 +12649,7 @@
 
 
 
-ac_config_files="$ac_config_files Makefile math/Makefile mathfp/Makefile common/Makefile"
+ac_config_files="$ac_config_files Makefile math/Makefile mathfp/Makefile common/Makefile complex/Makefile"
 
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
@@ -13632,6 +13632,7 @@
     "math/Makefile") CONFIG_FILES="$CONFIG_FILES math/Makefile" ;;
     "mathfp/Makefile") CONFIG_FILES="$CONFIG_FILES mathfp/Makefile" ;;
     "common/Makefile") CONFIG_FILES="$CONFIG_FILES common/Makefile" ;;
+    "complex/Makefile") CONFIG_FILES="$CONFIG_FILES complex/Makefile" ;;
 
   *) { { $as_echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
 $as_echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
diff -Naur newlib-1.18.0.orig/newlib/libm/configure.in newlib-1.18.0/newlib/libm/configure.in
--- newlib-1.18.0.orig/newlib/libm/configure.in	2009-04-17 18:18:17.000000000 +0200
+++ newlib-1.18.0/newlib/libm/configure.in	2010-11-26 09:40:30.759688320 +0100
@@ -61,5 +61,5 @@
 
 AC_SUBST(LIBM_MACHINE_LIB)
 
-AC_CONFIG_FILES([Makefile math/Makefile mathfp/Makefile common/Makefile])
+AC_CONFIG_FILES([Makefile math/Makefile mathfp/Makefile common/Makefile complex/Makefile])
 AC_OUTPUT
diff -Naur newlib-1.18.0.orig/newlib/libm/libm.texinfo newlib-1.18.0/newlib/libm/libm.texinfo
--- newlib-1.18.0.orig/newlib/libm/libm.texinfo	2009-12-17 21:41:42.000000000 +0100
+++ newlib-1.18.0/newlib/libm/libm.texinfo	2010-11-26 09:40:30.759688320 +0100
@@ -93,6 +93,7 @@
 
 @menu
 * Math::           The mathematical functions (`math.h').
+* Complex::        The mathematical complex functions (`complex.h').
 * Reentrancy::     The functions in libm are not reentrant by default.
 * Long Double Functions:: The long double function support of libm.
 * Index::
diff -Naur newlib-1.18.0.orig/newlib/libm/Makefile.am newlib-1.18.0/newlib/libm/Makefile.am
--- newlib-1.18.0.orig/newlib/libm/Makefile.am	2007-05-24 19:33:41.000000000 +0200
+++ newlib-1.18.0/newlib/libm/Makefile.am	2010-11-26 09:40:30.747686111 +0100
@@ -8,17 +8,17 @@
 MATHDIR = math
 endif
 
-SUBDIRS = $(MATHDIR) common machine
+SUBDIRS = $(MATHDIR) common complex machine 
 
 libm_la_LDFLAGS = -Xcompiler -nostdlib
 
 if USE_LIBTOOL
-SUBLIBS = $(MATHDIR)/lib$(MATHDIR).$(aext) common/libcommon.$(aext) $(LIBM_MACHINE_LIB)
+SUBLIBS = $(MATHDIR)/lib$(MATHDIR).$(aext) common/libcommon.$(aext) complex/libcomplex.$(aext)  $(LIBM_MACHINE_LIB)
 noinst_LTLIBRARIES = libm.la
 libm_la_SOURCES =
 libm_la_LIBADD = $(SUBLIBS)
 else
-SUBLIBS = $(MATHDIR)/lib.$(aext) common/lib.$(aext) $(LIBM_MACHINE_LIB)
+SUBLIBS = $(MATHDIR)/lib.$(aext) common/lib.$(aext) complex/lib.$(aext) $(LIBM_MACHINE_LIB)
 noinst_LIBRARIES = libm.a
 libm.a: $(SUBLIBS)
 	rm -f $@
@@ -39,7 +39,7 @@
 
 libm_TEXINFOS = targetdep.tex
 
-libm.dvi: targetdep.tex math/stmp-def
+libm.dvi: targetdep.tex math/stmp-def complex/stmp-def
 
 stmp-targetdep: force
 	rm -f tmp.texi
@@ -56,6 +56,8 @@
 
 math/stmp-def: stmp-targetdep ; @true
 
+complex/stmp-def: stmp-targetdep ; @true
+
 .PHONY: force
 force:
 
diff -Naur newlib-1.18.0.orig/newlib/libm/Makefile.in newlib-1.18.0/newlib/libm/Makefile.in
--- newlib-1.18.0.orig/newlib/libm/Makefile.in	2009-10-21 00:44:24.000000000 +0200
+++ newlib-1.18.0/newlib/libm/Makefile.in	2010-11-26 09:40:30.748686295 +0100
@@ -62,10 +62,12 @@
 LTLIBRARIES = $(noinst_LTLIBRARIES)
 am__DEPENDENCIES_1 =
 @USE_LIBTOOL_FALSE@am__DEPENDENCIES_2 = $(MATHDIR)/lib.$(aext) \
-@USE_LIBTOOL_FALSE@	common/lib.$(aext) $(am__DEPENDENCIES_1)
+@USE_LIBTOOL_FALSE@	common/lib.$(aext) complex/lib.$(aext) \
+@USE_LIBTOOL_FALSE@	$(am__DEPENDENCIES_1)
 @USE_LIBTOOL_TRUE@am__DEPENDENCIES_2 =  \
 @USE_LIBTOOL_TRUE@	$(MATHDIR)/lib$(MATHDIR).$(aext) \
 @USE_LIBTOOL_TRUE@	common/libcommon.$(aext) \
+@USE_LIBTOOL_TRUE@	complex/libcomplex.$(aext) \
 @USE_LIBTOOL_TRUE@	$(am__DEPENDENCIES_1)
 @USE_LIBTOOL_TRUE@libm_la_DEPENDENCIES = $(am__DEPENDENCIES_2)
 am_libm_la_OBJECTS =
@@ -138,7 +140,7 @@
 	$(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS
 ETAGS = etags
 CTAGS = ctags
-DIST_SUBDIRS = math mathfp common machine
+DIST_SUBDIRS = math mathfp common complex machine
 ACLOCAL = @ACLOCAL@
 AMTAR = @AMTAR@
 AR = @AR@
@@ -196,6 +198,7 @@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 RANLIB = @RANLIB@
@@ -268,10 +271,10 @@
 AUTOMAKE_OPTIONS = cygnus
 @NEWLIB_HW_FP_FALSE@MATHDIR = math
 @NEWLIB_HW_FP_TRUE@MATHDIR = mathfp
-SUBDIRS = $(MATHDIR) common machine
+SUBDIRS = $(MATHDIR) common complex machine 
 libm_la_LDFLAGS = -Xcompiler -nostdlib
-@USE_LIBTOOL_FALSE@SUBLIBS = $(MATHDIR)/lib.$(aext) common/lib.$(aext) $(LIBM_MACHINE_LIB)
-@USE_LIBTOOL_TRUE@SUBLIBS = $(MATHDIR)/lib$(MATHDIR).$(aext) common/libcommon.$(aext) $(LIBM_MACHINE_LIB)
+@USE_LIBTOOL_FALSE@SUBLIBS = $(MATHDIR)/lib.$(aext) common/lib.$(aext) complex/lib.$(aext) $(LIBM_MACHINE_LIB)
+@USE_LIBTOOL_TRUE@SUBLIBS = $(MATHDIR)/lib$(MATHDIR).$(aext) common/libcommon.$(aext) complex/libcomplex.$(aext)  $(LIBM_MACHINE_LIB)
 @USE_LIBTOOL_TRUE@noinst_LTLIBRARIES = libm.la
 @USE_LIBTOOL_TRUE@libm_la_SOURCES = 
 @USE_LIBTOOL_TRUE@libm_la_LIBADD = $(SUBLIBS)
@@ -859,7 +862,7 @@
 
 $(SUBLIBS):
 
-libm.dvi: targetdep.tex math/stmp-def
+libm.dvi: targetdep.tex math/stmp-def complex/stmp-def
 
 stmp-targetdep: force
 	rm -f tmp.texi
@@ -876,6 +879,8 @@
 
 math/stmp-def: stmp-targetdep ; @true
 
+complex/stmp-def: stmp-targetdep ; @true
+
 .PHONY: force
 force:
 
diff -Naur newlib-1.18.0.orig/newlib/libm/math/Makefile.am newlib-1.18.0/newlib/libm/math/Makefile.am
--- newlib-1.18.0.orig/newlib/libm/math/Makefile.am	2009-03-25 20:13:01.000000000 +0100
+++ newlib-1.18.0/newlib/libm/math/Makefile.am	2010-11-26 09:40:30.759688320 +0100
@@ -19,7 +19,7 @@
 	w_log.c w_log10.c w_pow.c w_remainder.c \
 	w_scalb.c w_sinh.c w_sqrt.c \
 	w_sincos.c \
-	w_cabs.c w_drem.c \
+	w_drem.c \
 	s_asinh.c s_atan.c s_ceil.c \
 	s_cos.c s_erf.c s_fabs.c s_floor.c \
 	s_frexp.c s_ldexp.c \
@@ -42,7 +42,7 @@
 	wf_log.c wf_log10.c wf_pow.c wf_remainder.c \
 	wf_scalb.c wf_sinh.c wf_sqrt.c \
 	wf_sincos.c \
-	wf_cabs.c wf_drem.c \
+	wf_drem.c \
 	sf_asinh.c sf_atan.c sf_ceil.c \
 	sf_cos.c sf_erf.c sf_fabs.c sf_floor.c \
 	sf_frexp.c sf_ldexp.c \
diff -Naur newlib-1.18.0.orig/newlib/libm/math/Makefile.in newlib-1.18.0/newlib/libm/math/Makefile.in
--- newlib-1.18.0.orig/newlib/libm/math/Makefile.in	2009-10-21 00:44:27.000000000 +0200
+++ newlib-1.18.0/newlib/libm/math/Makefile.in	2010-11-26 09:40:30.760688503 +0100
@@ -80,7 +80,7 @@
 	lib_a-w_pow.$(OBJEXT) lib_a-w_remainder.$(OBJEXT) \
 	lib_a-w_scalb.$(OBJEXT) lib_a-w_sinh.$(OBJEXT) \
 	lib_a-w_sqrt.$(OBJEXT) lib_a-w_sincos.$(OBJEXT) \
-	lib_a-w_cabs.$(OBJEXT) lib_a-w_drem.$(OBJEXT) \
+	lib_a-w_drem.$(OBJEXT) \
 	lib_a-s_asinh.$(OBJEXT) lib_a-s_atan.$(OBJEXT) \
 	lib_a-s_ceil.$(OBJEXT) lib_a-s_cos.$(OBJEXT) \
 	lib_a-s_erf.$(OBJEXT) lib_a-s_fabs.$(OBJEXT) \
@@ -114,7 +114,7 @@
 	lib_a-wf_pow.$(OBJEXT) lib_a-wf_remainder.$(OBJEXT) \
 	lib_a-wf_scalb.$(OBJEXT) lib_a-wf_sinh.$(OBJEXT) \
 	lib_a-wf_sqrt.$(OBJEXT) lib_a-wf_sincos.$(OBJEXT) \
-	lib_a-wf_cabs.$(OBJEXT) lib_a-wf_drem.$(OBJEXT) \
+	lib_a-wf_drem.$(OBJEXT) \
 	lib_a-sf_asinh.$(OBJEXT) lib_a-sf_atan.$(OBJEXT) \
 	lib_a-sf_ceil.$(OBJEXT) lib_a-sf_cos.$(OBJEXT) \
 	lib_a-sf_erf.$(OBJEXT) lib_a-sf_fabs.$(OBJEXT) \
@@ -137,7 +137,7 @@
 	w_exp.lo w_fmod.lo w_gamma.lo wr_gamma.lo w_hypot.lo w_j0.lo \
 	w_j1.lo w_jn.lo w_lgamma.lo wr_lgamma.lo w_log.lo w_log10.lo \
 	w_pow.lo w_remainder.lo w_scalb.lo w_sinh.lo w_sqrt.lo \
-	w_sincos.lo w_cabs.lo w_drem.lo s_asinh.lo s_atan.lo s_ceil.lo \
+	w_sincos.lo w_drem.lo s_asinh.lo s_atan.lo s_ceil.lo \
 	s_cos.lo s_erf.lo s_fabs.lo s_floor.lo s_frexp.lo s_ldexp.lo \
 	s_signif.lo s_sin.lo s_tan.lo s_tanh.lo w_exp2.lo w_tgamma.lo
 am__objects_4 = kf_rem_pio2.lo kf_cos.lo kf_sin.lo kf_tan.lo \
@@ -150,7 +150,7 @@
 	wf_gamma.lo wrf_gamma.lo wf_hypot.lo wf_j0.lo wf_j1.lo \
 	wf_jn.lo wf_lgamma.lo wrf_lgamma.lo wf_log.lo wf_log10.lo \
 	wf_pow.lo wf_remainder.lo wf_scalb.lo wf_sinh.lo wf_sqrt.lo \
-	wf_sincos.lo wf_cabs.lo wf_drem.lo sf_asinh.lo sf_atan.lo \
+	wf_sincos.lo wf_drem.lo sf_asinh.lo sf_atan.lo \
 	sf_ceil.lo sf_cos.lo sf_erf.lo sf_fabs.lo sf_floor.lo \
 	sf_frexp.lo sf_ldexp.lo sf_signif.lo sf_sin.lo sf_tan.lo \
 	sf_tanh.lo wf_exp2.lo wf_tgamma.lo
@@ -320,7 +320,7 @@
 	w_log.c w_log10.c w_pow.c w_remainder.c \
 	w_scalb.c w_sinh.c w_sqrt.c \
 	w_sincos.c \
-	w_cabs.c w_drem.c \
+	w_drem.c \
 	s_asinh.c s_atan.c s_ceil.c \
 	s_cos.c s_erf.c s_fabs.c s_floor.c \
 	s_frexp.c s_ldexp.c \
@@ -343,7 +343,7 @@
 	wf_log.c wf_log10.c wf_pow.c wf_remainder.c \
 	wf_scalb.c wf_sinh.c wf_sqrt.c \
 	wf_sincos.c \
-	wf_cabs.c wf_drem.c \
+	wf_drem.c \
 	sf_asinh.c sf_atan.c sf_ceil.c \
 	sf_cos.c sf_erf.c sf_fabs.c sf_floor.c \
 	sf_frexp.c sf_ldexp.c \
@@ -746,12 +746,6 @@
 lib_a-w_sincos.obj: w_sincos.c
 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-w_sincos.obj `if test -f 'w_sincos.c'; then $(CYGPATH_W) 'w_sincos.c'; else $(CYGPATH_W) '$(srcdir)/w_sincos.c'; fi`
 
-lib_a-w_cabs.o: w_cabs.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-w_cabs.o `test -f 'w_cabs.c' || echo '$(srcdir)/'`w_cabs.c
-
-lib_a-w_cabs.obj: w_cabs.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-w_cabs.obj `if test -f 'w_cabs.c'; then $(CYGPATH_W) 'w_cabs.c'; else $(CYGPATH_W) '$(srcdir)/w_cabs.c'; fi`
-
 lib_a-w_drem.o: w_drem.c
 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-w_drem.o `test -f 'w_drem.c' || echo '$(srcdir)/'`w_drem.c
 
@@ -1148,12 +1142,6 @@
 lib_a-wf_sincos.obj: wf_sincos.c
 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-wf_sincos.obj `if test -f 'wf_sincos.c'; then $(CYGPATH_W) 'wf_sincos.c'; else $(CYGPATH_W) '$(srcdir)/wf_sincos.c'; fi`
 
-lib_a-wf_cabs.o: wf_cabs.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-wf_cabs.o `test -f 'wf_cabs.c' || echo '$(srcdir)/'`wf_cabs.c
-
-lib_a-wf_cabs.obj: wf_cabs.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-wf_cabs.obj `if test -f 'wf_cabs.c'; then $(CYGPATH_W) 'wf_cabs.c'; else $(CYGPATH_W) '$(srcdir)/wf_cabs.c'; fi`
-
 lib_a-wf_drem.o: wf_drem.c
 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-wf_drem.o `test -f 'wf_drem.c' || echo '$(srcdir)/'`wf_drem.c
 
diff -Naur newlib-1.18.0.orig/newlib/libm/math/w_cabs.c newlib-1.18.0/newlib/libm/math/w_cabs.c
--- newlib-1.18.0.orig/newlib/libm/math/w_cabs.c	2000-02-17 20:39:51.000000000 +0100
+++ newlib-1.18.0/newlib/libm/math/w_cabs.c	1970-01-01 01:00:00.000000000 +0100
@@ -1,20 +0,0 @@
-/*
- * cabs() wrapper for hypot().
- * 
- * Written by J.T. Conklin, <jtc@wimsey.com>
- * Placed into the Public Domain, 1994.
- */
-
-#include "fdlibm.h"
-
-struct complex {
-	double x;
-	double y;
-};
-
-double
-cabs(z)
-	struct complex z;
-{
-	return hypot(z.x, z.y);
-}
diff -Naur newlib-1.18.0.orig/newlib/libm/math/wf_cabs.c newlib-1.18.0/newlib/libm/math/wf_cabs.c
--- newlib-1.18.0.orig/newlib/libm/math/wf_cabs.c	2000-02-17 20:39:51.000000000 +0100
+++ newlib-1.18.0/newlib/libm/math/wf_cabs.c	1970-01-01 01:00:00.000000000 +0100
@@ -1,20 +0,0 @@
-/*
- * cabsf() wrapper for hypotf().
- * 
- * Written by J.T. Conklin, <jtc@wimsey.com>
- * Placed into the Public Domain, 1994.
- */
-
-#include "fdlibm.h"
-
-struct complex {
-	float x;
-	float y;
-};
-
-float
-cabsf(z)
-	struct complex z;
-{
-	return hypotf(z.x, z.y);
-}
diff -Naur newlib-1.18.0.orig/newlib/Makefile.am newlib-1.18.0/newlib/Makefile.am
--- newlib-1.18.0.orig/newlib/Makefile.am	2009-08-18 23:48:05.000000000 +0200
+++ newlib-1.18.0/newlib/Makefile.am	2010-11-26 09:40:30.734683626 +0100
@@ -81,7 +81,7 @@
 	libc.a
 endif
 
-noinst_DATA = stmp-targ-include
+BUILT_SOURCES = stmp-targ-include
 
 toollib_DATA = $(CRT0) $(CRT1)
 
diff -Naur newlib-1.18.0.orig/newlib/Makefile.in newlib-1.18.0/newlib/Makefile.in
--- newlib-1.18.0.orig/newlib/Makefile.in	2009-10-21 00:43:45.000000000 +0200
+++ newlib-1.18.0/newlib/Makefile.in	2010-11-26 09:40:30.734683626 +0100
@@ -122,7 +122,7 @@
 	install-pdf-recursive install-ps-recursive install-recursive \
 	installcheck-recursive installdirs-recursive pdf-recursive \
 	ps-recursive uninstall-recursive
-DATA = $(noinst_DATA) $(toollib_DATA)
+DATA = $(toollib_DATA)
 RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
   distclean-recursive maintainer-clean-recursive
 AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
@@ -351,7 +351,7 @@
 @USE_LIBTOOL_FALSE@toollib_LIBRARIES = libm.a \
 @USE_LIBTOOL_FALSE@	libc.a
 
-noinst_DATA = stmp-targ-include
+BUILT_SOURCES = stmp-targ-include
 toollib_DATA = $(CRT0) $(CRT1)
 
 # The functions ldexp, frexp and modf are traditionally supplied in
@@ -411,7 +411,7 @@
 
 # dejagnu support
 RUNTESTFLAGS = 
-all: newlib.h
+all: $(BUILT_SOURCES) newlib.h
 	$(MAKE) $(AM_MAKEFLAGS) all-recursive
 
 .SUFFIXES:
@@ -725,14 +725,16 @@
 	done
 check-am:
 	$(MAKE) $(AM_MAKEFLAGS) check-DEJAGNU
-check: check-recursive
+check: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) check-recursive
 all-am: Makefile $(LIBRARIES) $(LTLIBRARIES) $(DATA) newlib.h
 installdirs: installdirs-recursive
 installdirs-am:
 	for dir in "$(DESTDIR)$(toollibdir)" "$(DESTDIR)$(toollibdir)" "$(DESTDIR)$(toollibdir)"; do \
 	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
 	done
-install: install-recursive
+install: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) install-recursive
 install-exec: install-exec-recursive
 install-data: install-data-recursive
 uninstall: uninstall-recursive
@@ -758,6 +760,7 @@
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
 	@echo "it deletes files that may require special tools to rebuild."
+	-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
 clean: clean-recursive
 
 clean-am: clean-generic clean-libtool clean-toollibLIBRARIES \
@@ -833,8 +836,9 @@
 uninstall-am: uninstall-toollibDATA uninstall-toollibLIBRARIES \
 	uninstall-toollibLTLIBRARIES
 
-.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all check-am \
-	ctags-recursive install-am install-strip tags-recursive
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all check \
+	check-am ctags-recursive install install-am install-strip \
+	tags-recursive
 
 .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
 	all all-am am--refresh check check-DEJAGNU check-am clean \
