configure.in
branchgsoc2009_ps3
changeset 3155 abc49915ccb2
parent 3154 95e48f7a3a93
child 3158 30f3b987fec3
--- 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
 }