From: Ben Gras Date: Fri, 8 Jul 2011 14:21:00 +0000 (+0200) Subject: libm: add i387/ dir, fix test51 compilation X-Git-Tag: v3.2.0~484 X-Git-Url: http://zhaoyanbai.com/repos/doc/roff.7.html?a=commitdiff_plain;h=a4ac03c188cc576f32902c65e6409aa66e755da3;p=minix.git libm: add i387/ dir, fix test51 compilation . if $MACHINE_ARCH is unknown, use $MACHINE like in libc . fixes test51 compilation for gcc/clang (with other compile and link fixes) --- diff --git a/lib/nbsd_libm/Makefile b/lib/nbsd_libm/Makefile index 3c3de53b9..860eb95cb 100644 --- a/lib/nbsd_libm/Makefile +++ b/lib/nbsd_libm/Makefile @@ -13,6 +13,14 @@ # # +.warning MACHINE_ARCH is first ${MACHINE_ARCH} + +.if ${MACHINE_ARCH} == "unknown" +MACHINE_ARCH:= ${MACHINE} +.endif + +.warning MACHINE_ARCH is now ${MACHINE_ARCH} + # # There are two options in making libm at fdlibm compile time: # _IEEE_LIBM --- IEEE libm; smaller, and somewhat faster diff --git a/lib/nbsd_libm/arch/i387/fenv.c b/lib/nbsd_libm/arch/i387/fenv.c index 035afd3bf..085e030ab 100644 --- a/lib/nbsd_libm/arch/i387/fenv.c +++ b/lib/nbsd_libm/arch/i387/fenv.c @@ -122,8 +122,10 @@ static void __test_sse(void) size_t oldlen = sizeof(__HAS_SSE); int rv; +#ifndef __minix rv = sysctlbyname("machdep.sse", &__HAS_SSE, &oldlen, NULL, 0); if (rv == -1) +#endif __HAS_SSE = 0; } diff --git a/test/Makefile b/test/Makefile index 720e010ba..0c7b3a387 100644 --- a/test/Makefile +++ b/test/Makefile @@ -2,8 +2,8 @@ GCC?=gcc CFLAGS= -O0 -D_MINIX -D_POSIX_SOURCE -CFLAGS-GCC= $(CFLAGS) -Wall -CFLAGS-GCCFPU= $(CFLAGS) -Wall -mhard-float +CFLAGS-GCC= $(CFLAGS) -Wall -D_NETBSD_SOURCE +CFLAGS-GCCFPU= $(CFLAGS) -Wall -mhard-float CFLAGS-GCCFPU= $(CFLAGS-GCC) -W -mhard-float OBJ= test1 test2 test3 test4 test5 test6 test7 test8 test9 \ @@ -33,7 +33,7 @@ $(GCCOBJ): if which $(GCC) >/dev/null 2>&1; then $(GCC) $(CFLAGS-GCC) -o $@ ${@:S/-gcc//}.c; fi $(GCCFPUOBJ): - if which $(GCC) >/dev/null 2>&1; then $(GCC) $(CFLAGS-GCCFPU) -o $@ ${@:S/-gcc//}.c; fi + if which $(GCC) >/dev/null 2>&1; then $(GCC) $(CFLAGS-GCCFPU) -o $@ ${@:S/-gcc//}.c -lm; fi $(ROOTOBJ): $(CC) $(CFLAGS) $@.c diff --git a/test/test51.c b/test/test51.c index 6527fc4ff..449ad72f6 100644 --- a/test/test51.c +++ b/test/test51.c @@ -5,6 +5,7 @@ * Part of this test is somewhat based on the GNU GCC ucontext test set. * */ + #include #include #include @@ -14,6 +15,8 @@ #include #include +#include + _PROTOTYPE( void do_calcs, (void) ); _PROTOTYPE( void do_child, (void) ); _PROTOTYPE( void do_parent, (void) );