changeset 3155:abc49915ccb2 gsoc2009_ps3

Checking for spu-progs and libs.
author Martin Lowinski <martin@goldtopf.org>
date Tue, 11 Aug 2009 14:37:19 +0000
parents 95e48f7a3a93
children 4ead4cef6b7b
files Makefile.in configure.in src/video/ps3/spulibs/Makefile
diffstat 3 files changed, 37 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile.in	Mon Aug 10 18:05:33 2009 +0000
+++ b/Makefile.in	Tue Aug 11 14:37:19 2009 +0000
@@ -41,6 +41,8 @@
 SDLMAIN_OBJECTS = @SDLMAIN_OBJECTS@
 
 # SPU programs
+SPU_GCC = @SPU_GCC@
+EMBEDSPU = @EMBEDSPU@
 include $(srcdir)/src/video/ps3/spulibs/Makefile
 
 DIST = acinclude.m4 autogen.sh Borland.html Borland.zip BUGS build-scripts configure configure.in COPYING CREDITS docs docs.html include INSTALL Makefile.dc Makefile.minimal Makefile.in README* sdl-config.in sdl.m4 sdl.pc.in SDL.qpg.in SDL.spec SDL.spec.in src test TODO VisualC.html VisualC VisualCE Watcom-OS2.zip Watcom-Win32.zip WhatsNew Xcode
--- a/configure.in	Mon Aug 10 18:05:33 2009 +0000
+++ b/configure.in	Tue Aug 11 14:37:19 2009 +0000
@@ -1508,24 +1508,36 @@
                 AC_HELP_STRING([--enable-video-ps3], [use PlayStation 3 Cell driver [[default=yes]]]),
                 , enable_video_ps3=yes)
   if test x$enable_video = xyes -a x$enable_video_ps3 = xyes; then 
-    AC_MSG_CHECKING(for PlayStation 3 Cell support)
     video_ps3=no
-    AC_TRY_COMPILE([
-      #include <linux/fb.h>
-      #include <asm/ps3fb.h>
-    ],[  
-    ],[  
-      video_ps3=yes
-    ])   
-    AC_MSG_RESULT($video_ps3)
-    if test x$video_ps3 = xyes; then 
-      AC_DEFINE(SDL_VIDEO_DRIVER_PS3)
-      SOURCES="$SOURCES $srcdir/src/video/ps3/*.c"
-      EXTRA_CFLAGS="$EXTRA_CFLAGS -I/opt/cell/sdk/usr/include"
-      EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L/opt/cell/sdk/usr/lib -lspe2 -lfb_writer_spu -lyuv2rgb_spu -lbilin_scaler_spu"
-	  echo "*** Before building SDL please run make ps3libs"
-      have_video=yes
-    fi   
+    AC_CHECK_HEADER([linux/fb.h])
+    AC_CHECK_HEADER([asm/ps3fb.h], [have_ps3fb_hdr=yes], [],
+			[#ifndef _LINUX_TYPES_H
+				#include <linux/types.h>
+			#endif])
+    AC_CHECK_HEADER([libspe2.h], have_libspe2_hdr=yes)
+    AC_CHECK_LIB([spe2], spe_context_create, have_spe2_lib=yes)
+
+	AC_CHECK_PROGS(SPU_GCC, [spu-gcc])
+	AC_CHECK_PROGS(EMBEDSPU, [embedspu])
+
+	have_spu_libs=yes
+	AC_CHECK_LIB([fb_writer_spu], [main], [], [have_spu_libs=no])
+	AC_CHECK_LIB([yuv2rgb_spu], [main], [], [have_spu_libs=no])
+	AC_CHECK_LIB([bilin_scaler_spu], [main], [], [have_spu_libs=no])
+    if test x$have_ps3fb_hdr = xyes -a x$have_libspe2_hdr = xyes -a x$have_spe2_lib = xyes -a "$SPU_GCC" -a "$EMBEDSPU"; then
+		AC_DEFINE(SDL_VIDEO_DRIVER_PS3)
+		video_ps3=yes
+		have_video=yes
+		SOURCES="$SOURCES $srcdir/src/video/ps3/*.c"
+		EXTRA_CFLAGS="$EXTRA_CFLAGS -I/opt/cell/sdk/usr/include"
+		EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L/opt/cell/sdk/usr/lib -lspe2 -lfb_writer_spu -lyuv2rgb_spu -lbilin_scaler_spu"
+
+		if test x$have_spu_libs = xno; then 
+  			AC_MSG_WARN([ps3libs missing, please run make ps3libs])
+		fi
+	fi
+    AC_MSG_CHECKING([for PlayStation 3 Cell support])
+	AC_MSG_RESULT([$video_ps3])
   fi
 }
 
--- a/src/video/ps3/spulibs/Makefile	Mon Aug 10 18:05:33 2009 +0000
+++ b/src/video/ps3/spulibs/Makefile	Tue Aug 11 14:37:19 2009 +0000
@@ -2,9 +2,6 @@
 # libfb_writer_spu.so, libyuv2rgb_spu.so, libbilin_scaler_spu.so
 
 # Toolchain
-SPU_GCC=/usr/bin/spu-gcc
-PPU_EMBEDSPU=/usr/bin/embedspu
-PPU_AR=/usr/bin/ar
 PPU_LD=/usr/bin/ld
 SPU_SRCDIR=$(srcdir)/src/video/ps3/spulibs
 SPU_LIBDIR=$(srcdir)/src/video/ps3/spulibs/libs
@@ -21,10 +18,10 @@
 # fb_writer (basically copying from a to b)
 $(SPU_LIBDIR)/fb_writer_spu-embed.o: $(SPU_LIBDIR) $(SPU_SRCDIR)/fb_writer.c $(SPU_SRCDIR)/spu_common.h
 	$(SPU_GCC) $(SPU_CFLAGS) -o $(SPU_LIBDIR)/fb_writer_spu $(SPU_SRCDIR)/fb_writer.c -lm
-	$(PPU_EMBEDSPU) -m32 fb_writer_spu $(SPU_LIBDIR)/fb_writer_spu $(SPU_LIBDIR)/fb_writer_spu-embed.o
+	$(EMBEDSPU) -m32 fb_writer_spu $(SPU_LIBDIR)/fb_writer_spu $(SPU_LIBDIR)/fb_writer_spu-embed.o
 
 $(SPU_LIBDIR)/libfb_writer_spu.a: $(SPU_LIBDIR)/fb_writer_spu-embed.o
-	$(PPU_AR) -qcs $(SPU_LIBDIR)/libfb_writer_spu.a $(SPU_LIBDIR)/fb_writer_spu-embed.o
+	$(AR) -qcs $(SPU_LIBDIR)/libfb_writer_spu.a $(SPU_LIBDIR)/fb_writer_spu-embed.o
 
 $(SPU_LIBDIR)/libfb_writer_spu.so: $(SPU_LIBDIR)/fb_writer_spu-embed.o
 	$(PPU_LD) -o $(SPU_LIBDIR)/libfb_writer_spu.so -shared -soname=libfb_writer_spu.so $(SPU_LIBDIR)/fb_writer_spu-embed.o
@@ -33,10 +30,10 @@
 # yuv2rgb_converter (converting YV12/IYUV to RGB)
 $(SPU_LIBDIR)/yuv2rgb_spu-embed.o: $(SPU_LIBDIR) $(SPU_SRCDIR)/yuv2rgb_converter.c $(SPU_SRCDIR)/spu_common.h
 	$(SPU_GCC) $(SPU_CFLAGS) -o $(SPU_LIBDIR)/yuv2rgb_spu $(SPU_SRCDIR)/yuv2rgb_converter.c -lm
-	$(PPU_EMBEDSPU) -m32 yuv2rgb_spu $(SPU_LIBDIR)/yuv2rgb_spu $(SPU_LIBDIR)/yuv2rgb_spu-embed.o
+	$(EMBEDSPU) -m32 yuv2rgb_spu $(SPU_LIBDIR)/yuv2rgb_spu $(SPU_LIBDIR)/yuv2rgb_spu-embed.o
 
 $(SPU_LIBDIR)/libyuv2rgb_spu.a: $(SPU_LIBDIR)/yuv2rgb_spu-embed.o
-	$(PPU_AR) -qcs $(SPU_LIBDIR)/libyuv2rgb_spu.a $(SPU_LIBDIR)/yuv2rgb_spu-embed.o
+	$(AR) -qcs $(SPU_LIBDIR)/libyuv2rgb_spu.a $(SPU_LIBDIR)/yuv2rgb_spu-embed.o
 
 $(SPU_LIBDIR)/libyuv2rgb_spu.so: $(SPU_LIBDIR)/yuv2rgb_spu-embed.o
 	$(PPU_LD) -o $(SPU_LIBDIR)/libyuv2rgb_spu.so -shared -soname=libyuv2rgb_spu.so $(SPU_LIBDIR)/yuv2rgb_spu-embed.o
@@ -45,10 +42,10 @@
 # bilin_scaler (scaling bilinear YV12/IYUV pictures with resolutions /16)
 $(SPU_LIBDIR)/bilin_scaler_spu-embed.o: $(SPU_LIBDIR) $(SPU_SRCDIR)/bilin_scaler.c $(SPU_SRCDIR)/spu_common.h
 	$(SPU_GCC) $(SPU_CFLAGS) -o $(SPU_LIBDIR)/bilin_scaler_spu $(SPU_SRCDIR)/bilin_scaler.c -lm
-	$(PPU_EMBEDSPU) -m32 bilin_scaler_spu $(SPU_LIBDIR)/bilin_scaler_spu $(SPU_LIBDIR)/bilin_scaler_spu-embed.o
+	$(EMBEDSPU) -m32 bilin_scaler_spu $(SPU_LIBDIR)/bilin_scaler_spu $(SPU_LIBDIR)/bilin_scaler_spu-embed.o
 
 $(SPU_LIBDIR)/libbilin_scaler_spu.a: $(SPU_LIBDIR)/bilin_scaler_spu-embed.o
-	$(PPU_AR) -qcs $(SPU_LIBDIR)/libbilin_scaler_spu.a $(SPU_LIBDIR)/bilin_scaler_spu-embed.o
+	$(AR) -qcs $(SPU_LIBDIR)/libbilin_scaler_spu.a $(SPU_LIBDIR)/bilin_scaler_spu-embed.o
 
 $(SPU_LIBDIR)/libbilin_scaler_spu.so: $(SPU_LIBDIR)/bilin_scaler_spu-embed.o
 	$(PPU_LD) -o $(SPU_LIBDIR)/libbilin_scaler_spu.so -shared -soname=libbilin_scaler_spu.so $(SPU_LIBDIR)/bilin_scaler_spu-embed.o