From d5b58c23bb5a7b1def427133a59a35da94836088 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 18 Nov 2003 02:16:57 +0000 Subject: [PATCH] Actually hook the cpuinfo module into the library. :) --- configure.in | 9 +++++++++ src/Makefile.am | 2 +- src/cpuinfo/Makefile.am | 3 ++- test/Makefile.am | 2 +- test/testcpuinfo.c | 15 +++++++++++++++ 5 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 test/testcpuinfo.c diff --git a/configure.in b/configure.in index c019a4892..3c056d966 100644 --- a/configure.in +++ b/configure.in @@ -226,6 +226,15 @@ if test x$enable_file = xyes; then 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() diff --git a/src/Makefile.am b/src/Makefile.am index 6fb87d3ab..4628be9ca 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -7,7 +7,7 @@ CORE_SUBDIRS = \ # 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@ diff --git a/src/cpuinfo/Makefile.am b/src/cpuinfo/Makefile.am index db3ff1820..c89d1de87 100644 --- a/src/cpuinfo/Makefile.am +++ b/src/cpuinfo/Makefile.am @@ -16,7 +16,6 @@ noinst_LTLIBRARIES = libcpuinfo.la if HAVE_NASM ARCH_SRCS = \ - gcpuinfo.c \ _cpuinfo.asm \ _pcihelp.asm else @@ -24,6 +23,8 @@ ARCH_SRCS = endif COMMON_SRCS = \ + cpuinfo.h \ + gcpuinfo.c \ SDL_cpuinfo.c libcpuinfo_la_SOURCES = $(ARCH_SRCS) $(COMMON_SRCS) diff --git a/test/Makefile.am b/test/Makefile.am index 619abbe32..4db8fdfe6 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -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 diff --git a/test/testcpuinfo.c b/test/testcpuinfo.c new file mode 100644 index 000000000..64d95116a --- /dev/null +++ b/test/testcpuinfo.c @@ -0,0 +1,15 @@ + +/* Test program to check SDL's CPU feature detection */ + +#include + +#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); +}