diff -ruN d.orig/phobos/aclocal.m4 d/phobos/aclocal.m4 --- d.orig/phobos/aclocal.m4 Sun May 29 23:09:19 2005 +++ d/phobos/aclocal.m4 Thu Dec 29 13:03:59 2005 @@ -166,7 +166,7 @@ d_gc_data= case "$target_os" in - aix*) d_gc_data="$d_gc_data GC_Use_Data_Fixed" + aix*|solaris*) d_gc_data="$d_gc_data GC_Use_Data_Fixed" ;; cygwin*) d_gc_data="$d_gc_data GC_Use_Data_Fixed" ;; diff -ruN d.orig/phobos/config/config-mid d/phobos/config/config-mid --- d.orig/phobos/config/config-mid Sun May 29 23:09:19 2005 +++ d/phobos/config/config-mid Thu Dec 29 13:03:59 2005 @@ -91,53 +91,6 @@ int fpclassify(real x) { return __fpclassifyd(x); } int fpclassify(double x) { return __fpclassifyd(x); } int fpclassify(float x) { return __fpclassifyf(x); } -} else version (solaris) { - // for now this is a copy of the darwin stuff (and doesn't work) - version (all) { - enum { - FP_NAN = 1, /* NaN */ - FP_INFINITE = 2, /* + or - infinity */ - FP_ZERO = 3, /* + or - zero */ - FP_NORMAL = 4, /* all normal numbers */ - FP_SUBNORMAL = 5 /* denormal numbers */ - } - } - - extern (C) { - // the 'real' versions are declared, but do not actually exist... - int __isnand(double); - int __isnanf(float); - int __isnan(real); - int __isfinited(double); - int __isfinitef(float); - int __isfinite(real); - int __isnormald(double); - int __isnormalf(float); - int __isnormal(real); - int __fpclassifyd(double); - int __fpclassifyf(float); - int __fpclassify(real); - int __isinfd(double); - int __isinff(float); - int __isinf(real); - int __signbitd(double); - int __signbitf(float); - int __signbitl(real); - } - - int isnan(real x) { return __isnand(x); } - int isfinite(real x) { return __isfinited(x); } - int isnormal(real x) { return __isnormald(x); } - int isnormal(double x) { return __isnormald(x); } - int isnormal(float x) { return __isnormalf(x); } - int issubnormal(real x) { return __fpclassifyd(x) == FP_SUBNORMAL; } - int issubnormal(double x) { return __fpclassifyd(x) == FP_SUBNORMAL; } - int issubnormal(float x) { return __fpclassifyf(x) == FP_SUBNORMAL; } - int isinf(real x) { return __isinfd(x); } - int signbit(real x) { return __signbitd(x); } - int fpclassify(real x) { return __fpclassifyd(x); } - int fpclassify(double x) { return __fpclassifyd(x); } - int fpclassify(float x) { return __fpclassifyf(x); } } else { // %%TODO: slightly better: test which of __fpclassify[fdl] exist // and use those. Could do the same with __is @@ -181,6 +134,8 @@ alias __builtin_snprintf C_snprintf; alias __builtin_vsnprintf C_vsnprintf; +private extern (C) double strtod(char*, char**); + version (GNU_Have_strtold) { extern (C) real strtold(char*, char**); @@ -188,6 +143,15 @@ } else { - private extern (C) double strtod(char*, char**); extern (D) real cstrtold(char* a, char** b) { return strtod(a, b); } +} + +version (GNU_Have_strtof) +{ + extern (C) float strtof(char*, char**); + alias strtof cstrtof; +} +else +{ + extern (D) float cstrtof(char* a, char** b) { return strtod(a, b); } } diff -ruN d.orig/phobos/config/gen_math.c d/phobos/config/gen_math.c --- d.orig/phobos/config/gen_math.c Sun May 29 23:09:19 2005 +++ d/phobos/config/gen_math.c Thu Dec 29 13:03:59 2005 @@ -33,6 +33,15 @@ #define FP_NAN FP_SNAN #endif +#ifdef __sun__ +#include "sun_float.h" +#define FP_NORMAL FP_PNORM +#define FP_ZERO FP_PZERO +#define FP_INFINITE FP_PINF +#define FP_SUBNORMAL FP_PDENORM +#define FP_NAN FP_SNAN +#endif + void c_fpclassify() { printf("enum {\n"); diff -ruN d.orig/phobos/config/gen_unix.c d/phobos/config/gen_unix.c --- d.orig/phobos/config/gen_unix.c Sat Aug 13 01:51:59 2005 +++ d/phobos/config/gen_unix.c Thu Dec 29 13:03:59 2005 @@ -489,6 +489,9 @@ CESX( INADDR_ANY ); CESX( INADDR_LOOPBACK ); CESX( INADDR_BROADCAST ); +#ifndef INADDR_NONE +#define INADDR_NONE ((unsigned long) -1) +#endif CESX( INADDR_NONE ); CESA( ADDR_ANY, INADDR_ANY ); printf("}\n"); diff -ruN d.orig/phobos/configure.in d/phobos/configure.in --- d.orig/phobos/configure.in Sat Oct 29 04:40:46 2005 +++ d/phobos/configure.in Thu Dec 29 13:03:59 2005 @@ -262,6 +262,9 @@ AC_CHECK_FUNC(fwide,DCFG_FWIDE="GNU_Have_fwide",DCFG_FWIDE="") AC_SUBST(DCFG_FWIDE) +AC_CHECK_FUNC(strtof,DCFG_STRTOF="GNU_Have_strtof",DCFG_STRTOF="") +AC_SUBST(DCFG_STRTOF) + AC_CHECK_FUNC(strtold,DCFG_STRTOLD="GNU_Have_strtold",DCFG_STRTOLD="") AC_SUBST(DCFG_STRTOLD) diff -ruN d.orig/phobos/gcc/cbridge_math.c d/phobos/gcc/cbridge_math.c --- d.orig/phobos/gcc/cbridge_math.c Fri Aug 12 04:32:44 2005 +++ d/phobos/gcc/cbridge_math.c Thu Dec 29 13:03:59 2005 @@ -65,6 +65,43 @@ #endif +#ifdef __sun__ +/* must match with gen_math.c */ +#include "sun_float.h" +#undef fpclassify +static int our_fpclassify(double v) +{ + switch (fpclass(v)) { + + case FP_PNORM: + case FP_NNORM: + return FP_PNORM; + case FP_PZERO: + case FP_NZERO: + return FP_PZERO; + case FP_PINF: + case FP_NINF: + return FP_PINF; + case FP_PDENORM: + case FP_NDENORM: + return FP_PDENORM; + case FP_SNAN: + case FP_QNAN: + return FP_SNAN; + } +} +#define fpclassify our_fpclassify + +// TODO: on Solaris, signbit is available via libsunmath.so +#undef signbit +static int our_signbit(double v) +{ + return *(int*)(unsigned char *)(&v) < 0; +} +#define signbit our_signbit + +#endif + #define XFUNC(name) \ int _d_gnu_cbridge_##name##l(my_long_double v) { return name(v); } \ int _d_gnu_cbridge_##name##d(double v) { return name(v); } \ diff -ruN d.orig/phobos/gcc/sun_float.h d/phobos/gcc/sun_float.h --- d.orig/phobos/gcc/sun_float.h Thu Jan 1 01:00:00 1970 +++ d/phobos/gcc/sun_float.h Thu Dec 29 13:03:59 2005 @@ -0,0 +1,17 @@ +/* Can't #include because it will pick up the one + set up by GCC rather than the one in /usr/include. Hopefully, + these won't change. */ +#ifndef FP_PNORM + +#define FP_SNAN 0 +#define FP_QNAN 1 +#define FP_NINF 2 +#define FP_PINF 3 +#define FP_NDENORM 4 +#define FP_PDENORM 5 +#define FP_NZERO 6 +#define FP_PZERO 7 +#define FP_NNORM 8 +#define FP_PNORM 9 + +#endif diff -ruN d.orig/phobos/internal/gc/gcgccextern.d d/phobos/internal/gc/gcgccextern.d --- d.orig/phobos/internal/gc/gcgccextern.d Sun May 29 23:09:19 2005 +++ d/phobos/internal/gc/gcgccextern.d Thu Dec 29 18:41:34 2005 @@ -13,6 +13,7 @@ extern (C) int _bss_start__; extern (C) int _bss_end__; extern (C) int __fini_array_end; + extern (C) int __dso_handle; /* %% Move all this to configure script to test if it actually works? --enable-gc-data-fixed=Mode,s1,e1,s2,e2 @@ -22,6 +23,16 @@ version (aix) { alias _data Data_Start; + alias _end Data_End; + enum FM { One = 1, MinMax = 0, Two = 0 } + } + else version (solaris) + { + /* __dso_handle is probably not correct, but better than '_etext', + which segfaults. Boehm GC uses + #define DATASTART GC_SysVGetDataStart(0x10000, _etext). + */ + alias __dso_handle Data_Start; alias _end Data_End; enum FM { One = 1, MinMax = 0, Two = 0 } } diff -ruN d.orig/phobos/phobos-ver-syms.in d/phobos/phobos-ver-syms.in --- d.orig/phobos/phobos-ver-syms.in Sat Oct 29 04:40:46 2005 +++ d/phobos/phobos-ver-syms.in Thu Dec 29 13:03:59 2005 @@ -10,6 +10,7 @@ @DCFG_EXECVPE@ @DCFG_SPAWNVP@ @DCFG_FWIDE@ +@DCFG_STRTOF@ @DCFG_STRTOLD@ @DCFG_SA_LEN@ @DCFG_CBRIDGE_STDIO@ diff -ruN d.orig/phobos/std/c/stdlib.d d/phobos/std/c/stdlib.d --- d.orig/phobos/std/c/stdlib.d Fri Sep 9 23:27:05 2005 +++ d/phobos/std/c/stdlib.d Thu Dec 29 13:03:59 2005 @@ -72,8 +72,17 @@ double atof(char *); int atoi(char *); int atol(char *); -float strtof(char *,char **); double strtod(char *,char **); + +version (GNU) +{ + private import gcc.config; + alias gcc.config.cstrtof strtof; +} +else +{ + float strtof(char *,char **); +} //real strtold(char *,char **); version (darwin) diff -ruN d.orig/target-ver-syms.sh d/target-ver-syms.sh --- d.orig/target-ver-syms.sh Thu Apr 28 23:12:43 2005 +++ d/target-ver-syms.sh Thu Dec 29 13:03:59 2005 @@ -38,7 +38,7 @@ i*86) d_cpu_versym=X86 ;; *ppc*) d_cpu_versym=PPC ;; powerpc) d_cpu_versym=PPC ;; -sparc) d_cpu_versym=Sparc ;; +sparc) d_cpu_versym=SPARC ;; esac output=""