changeset 740:e70f80e98f60

Actually hook the cpuinfo module into the library. :)
author Sam Lantinga <slouken@libsdl.org>
date Tue, 18 Nov 2003 02:16:57 +0000
parents 22dbf364c017
children 97b9c301df94
files configure.in src/Makefile.am src/cpuinfo/Makefile.am test/Makefile.am test/testcpuinfo.c
diffstat 5 files changed, 28 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/configure.in	Tue Nov 18 01:27:06 2003 +0000
+++ b/configure.in	Tue Nov 18 02:16:57 2003 +0000
@@ -226,6 +226,15 @@
 else
     CFLAGS="$CFLAGS -DDISABLE_FILE"
 fi
+AC_ARG_ENABLE(cpuinfo,
+[  --enable-cpuinfo        Enable the cpuinfo subsystem [default=yes]],
+              , enable_cpuinfo=yes)
+if test x$enable_cpuinfo = xyes; then
+    SDL_EXTRADIRS="$SDL_EXTRADIRS cpuinfo"
+    SDL_EXTRALIBS="$SDL_EXTRALIBS cpuinfo/libcpuinfo.la"
+else
+    CFLAGS="$CFLAGS -DDISABLE_CPUINFO"
+fi
 
 dnl See if the OSS audio interface is supported
 CheckOSS()
--- a/src/Makefile.am	Tue Nov 18 01:27:06 2003 +0000
+++ b/src/Makefile.am	Tue Nov 18 02:16:57 2003 +0000
@@ -7,7 +7,7 @@
 
 # These are the subdirectories which may be built
 EXTRA_SUBDIRS =			\
-	 audio video events joystick cdrom thread timer endian file hermes
+	 audio video events joystick cdrom thread timer endian file cpuinfo hermes
 
 # These are the subdirectories which will be built now
 SUBDIRS = $(CORE_SUBDIRS) @SDL_EXTRADIRS@
--- a/src/cpuinfo/Makefile.am	Tue Nov 18 01:27:06 2003 +0000
+++ b/src/cpuinfo/Makefile.am	Tue Nov 18 02:16:57 2003 +0000
@@ -16,7 +16,6 @@
 
 if HAVE_NASM
 ARCH_SRCS =			\
-	gcpuinfo.c		\
 	_cpuinfo.asm		\
 	_pcihelp.asm
 else
@@ -24,6 +23,8 @@
 endif
 
 COMMON_SRCS = 			\
+	cpuinfo.h		\
+	gcpuinfo.c		\
 	SDL_cpuinfo.c
 
 libcpuinfo_la_SOURCES = $(ARCH_SRCS) $(COMMON_SRCS)
--- a/test/Makefile.am	Tue Nov 18 01:27:06 2003 +0000
+++ b/test/Makefile.am	Tue Nov 18 02:16:57 2003 +0000
@@ -1,7 +1,7 @@
 AUTOMAKE_OPTIONS = no-dependencies
 
 noinst_PROGRAMS = \
-	testver testtypes testhread testlock testerror testsem testtimer \
+	testver testtypes testcpuinfo testhread testlock testerror testsem testtimer \
 	loopwave testcdrom testkeys testvidinfo checkkeys testwin graywin \
 	testsprite testbitmap testalpha testgamma testpalette testwm \
 	threadwin testoverlay testoverlay2 testgl testjoystick
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/testcpuinfo.c	Tue Nov 18 02:16:57 2003 +0000
@@ -0,0 +1,15 @@
+
+/* Test program to check SDL's CPU feature detection */
+
+#include <stdio.h>
+
+#include "SDL.h"
+#include "SDL_cpuinfo.h"
+
+int main(int argc, char *argv[])
+{
+	printf("MMX %s\n", SDL_HasMMX() ? "detected" : "not detected");
+	printf("3DNow %s\n", SDL_Has3DNow() ? "detected" : "not detected");
+	printf("SSE %s\n", SDL_HasSSE() ? "detected" : "not detected");
+	return(0);
+}