Prechádzať zdrojové kódy

OpenLIBM builds on linux.

Disable -std=c99 on linux for now, as gcc does freaks out in math_private.h
on the definition of IEEE_WORD_ORDER, and defines ieee_double_shape_type twice.

Disable building s_cbrtl.c for the time being as it requires ieeefp.h
Viral B. Shah 13 rokov pred
rodič
commit
7129663350
4 zmenil súbory, kde vykonal 37 pridanie a 12 odobranie
  1. 2 1
      Make.inc
  2. 2 1
      src/Makefile
  3. 23 10
      src/math_private.h
  4. 10 0
      src/openlibm.h

+ 2 - 1
Make.inc

@@ -1,5 +1,5 @@
 CC=gcc
-CFLAGS=-std=c99 -O2 -fPIC -I. -I../include -I../ld128 -I../src -D__BSD_VISIBLE -Wno-implicit-function-declaration 
+CFLAGS=-O2 -fPIC -I. -I../include -I../ld128 -I../src -D__BSD_VISIBLE -Wno-implicit-function-declaration
 
 default: all
 
@@ -19,6 +19,7 @@ endif
 
 ifeq ($(OS), Darwin)
 SHLIB_EXT = dylib
+CFLAGS+=-std=c99
 endif
 
 # Colors for make

+ 2 - 1
src/Makefile

@@ -39,12 +39,13 @@ SRCS+=	s_copysignl.o s_fabsl.o s_llrintl.o s_lrintl.o s_modfl.o
 # If long double != double use these; otherwise, we alias the double versions.
 SRCS+=	e_acosl.o e_asinl.o e_atan2l.o e_fmodl.o \
 	e_hypotl.o e_remainderl.o e_sqrtl.o \
-	s_atanl.o s_cbrtl.o s_ceill.o s_cosl.o s_cprojl.o \
+	s_atanl.o s_ceill.o s_cosl.o s_cprojl.o \
 	s_csqrtl.o s_floorl.o s_fmal.o \
 	s_frexpl.o s_logbl.o s_nexttoward.o \
 	s_remquol.o \
 	s_sinl.o s_tanl.o s_truncl.o w_cabsl.o \
 	s_nextafterl.o s_rintl.o s_scalbnl.o 
+#	s_cbrtl.o
 
 # C99 complex functions
 SRCS+=	s_ccosh.o s_ccoshf.o s_cexp.o s_cexpf.o \

+ 23 - 10
src/math_private.h

@@ -18,7 +18,30 @@
 #define	_MATH_PRIVATE_H_
 
 #include <sys/types.h>
+
+#ifdef __APPLE__
 #include <machine/endian.h>
+#ifdef __arm__
+#if defined(__VFP_FP__)
+#define	IEEE_WORD_ORDER	BYTE_ORDER
+#else
+#define	IEEE_WORD_ORDER	BIG_ENDIAN
+#endif
+#else /* __arm__ */
+#define	IEEE_WORD_ORDER	BYTE_ORDER
+#endif
+#endif
+
+#ifdef __linux__
+#include <endian.h>
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+#define IEEE_WORD_ORDER LITTLE_ENDIAN
+#endif
+#if __BYTE_ORDER == __BIG_ENDIAN
+#define IEEE_WORD_ORDER BIG_ENDIAN
+#endif
+#endif
+
 #include <complex.h>
 
 /*
@@ -39,16 +62,6 @@
  * ints.
  */
 
-#ifdef __arm__
-#if defined(__VFP_FP__)
-#define	IEEE_WORD_ORDER	BYTE_ORDER
-#else
-#define	IEEE_WORD_ORDER	BIG_ENDIAN
-#endif
-#else /* __arm__ */
-#define	IEEE_WORD_ORDER	BYTE_ORDER
-#endif
-
 #if IEEE_WORD_ORDER == BIG_ENDIAN
 
 typedef union

+ 10 - 0
src/openlibm.h

@@ -18,8 +18,18 @@
 #define	_MATH_H_
 
 #include <sys/cdefs.h>
+#ifdef __APPLE__
 #include <sys/_types.h>
 #include <machine/_limits.h>
+#endif
+
+#ifdef __linux__
+#include <sys/types.h>
+#include <limits.h>
+#define __pure2 
+#endif
+
+
 
 /*
  * ANSI/POSIX