diff configure.in @ 1133:609c060fd2a2

The MacOSX Carbon/Cocoa/X11 all in one library patch. Relevant emails: To: SDL Developers <sdl@libsdl.org> From: =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb@algonet.se> Date: Mon, 30 May 2005 23:29:04 +0200 Subject: [SDL] Mac OS X Video Drivers [patch] I've updated/added the Carbon and X11 video drivers to the Mac OS X port of SDL 1.2 (the CVS version), and made the Cocoa driver and runtime *optional*. The default is still Cocoa, and the "Quartz" driver. But you can now also use "toolbox" for Carbon, and "x11" for running with Apple's (or other) X11 server: export SDL_VIDEODRIVER=x11 export SDL_VIDEO_GL_DRIVER=/usr/X11R6/lib/libGL.dylib It also checks if the frameworks are available, by a: #include <Carbon/Carbon.h> or #import <Cocoa/Cocoa.h> (this should make it configure on plain Darwin as well?) Here are the new configure targets: --enable-video-cocoa use Cocoa/Quartz video driver default=yes --enable-video-carbon use Carbon/QuickDraw video driver default=yes --enable-video-x11 use X11 video driver default=no ./configure --enable-video-cocoa --enable-video-carbon --enable-video-x11 \ --x-includes=/usr/X11R6/include --x-libraries=/usr/X11R6/lib The Carbon version is just an updated version of the old SDL driver for Mac OS 9, and could probably be improved... (but it does work, including the Carbon version of SDLmain) If you disable cocoa, you can run with -framework Carbon only, and the C version of SDL_main.c. And if you disable carbon too, you can still use the X11 version which doesn't require SDLmain. I updated the DrawSprocket version, but did not include it. (no blitters or VRAM GWorlds etc. available on OS X anyway) Besides for Mac OS 9, I don't think there's any use for it ? And note that any performance on Mac OS X equals OpenGL anyway... You can get "fair" software SDL results on captured CG displays, but for decent frame rates you need to be using GL for rendering. Finally, here is the patch itself: http://www.algonet.se/~afb/SDL-12CVS-macvideo.patch --anders PS. It says "video", but as usual it applies to mouse/keyboard too. ------ To: A list for developers using the SDL library <sdl@libsdl.org> From: =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb@algonet.se> Date: Sun, 4 Sep 2005 10:02:15 +0200 Subject: [SDL] Updated Mac patch Updated the previous Mac patch to disable Carbon by default. Also "fixed" the SDL.spec again, so that it builds on Darwin. http://www.algonet.se/~afb/SDL-1.2.9-mac.patch Also applied fine to SDL12 CVS, when I tried it.
author Ryan C. Gordon <icculus@icculus.org>
date Thu, 08 Sep 2005 06:16:14 +0000
parents fb8818ee9112
children d16c010d5d98
line wrap: on
line diff
--- a/configure.in	Thu Aug 25 20:31:58 2005 +0000
+++ b/configure.in	Thu Sep 08 06:16:14 2005 +0000
@@ -742,6 +742,28 @@
     fi
 }
 
+
+dnl Check for X11 on Mac OS X / Darwin
+CheckMacX11()
+{
+    AC_ARG_ENABLE(video-x11,
+[  --enable-video-x11      use X11 video driver [default=no]],
+                  , enable_video_x11=no)
+    if test x$enable_video = xyes -a x$enable_video_x11 = xyes; then
+        AC_PATH_X
+        AC_PATH_XTRA
+        if test x$have_x = xyes; then
+            CFLAGS="$CFLAGS $X_CFLAGS -DENABLE_X11 -DXTHREADS -I$srcdir/include -I$srcdir/src/video"
+            if test x$ac_cv_func_shmat != xyes; then
+                CFLAGS="$CFLAGS -DNO_SHARED_MEMORY"
+            fi
+            SYSTEM_LIBS="$SYSTEM_LIBS $X_LIBS -lX11 -lXext"
+            VIDEO_SUBDIRS="$VIDEO_SUBDIRS x11"
+            VIDEO_DRIVERS="$VIDEO_DRIVERS x11/libvideo_x11.la"
+        fi
+    fi
+}
+
 dnl Find the X11 DGA 2.0 include and library directories
 CheckDGA()
 {
@@ -1128,7 +1150,9 @@
         CFLAGS="$CFLAGS -DHAVE_OPENGL"
         case "$target" in
             *-*-darwin*)
-                SYSTEM_LIBS="$SYSTEM_LIBS -framework OpenGL -framework AGL"
+                SYSTEM_LIBS="$SYSTEM_LIBS -framework OpenGL"
+                # The following is probably not available in Darwin:
+                SYSTEM_LIBS="$SYSTEM_LIBS -framework AGL"
         esac
     fi
 }
@@ -1635,15 +1659,34 @@
 dnl Set up the Mac toolbox video driver for Mac OS 7-9
 CheckTOOLBOX()
 {
+    CFLAGS="$CFLAGS -DENABLE_TOOLBOX -DENABLE_DRAWSPROCKET"
     VIDEO_SUBDIRS="$VIDEO_SUBDIRS maccommon"
     VIDEO_DRIVERS="$VIDEO_DRIVERS maccommon/libvideo_maccommon.la"
     VIDEO_SUBDIRS="$VIDEO_SUBDIRS macrom"
     VIDEO_DRIVERS="$VIDEO_DRIVERS macrom/libvideo_macrom.la"
+    VIDEO_SUBDIRS="$VIDEO_SUBDIRS macdsp"
+    VIDEO_DRIVERS="$VIDEO_DRIVERS macdsp/libvideo_macdsp.la"
 }
 
-dnl Set up the Mac toolbox video driver for Mac OS X
+dnl Set up the Carbon/QuickDraw video driver for Mac OS X (but not Darwin)
 CheckCARBON()
 {
+    AC_ARG_ENABLE(video-carbon,
+[  --enable-video-carbon   use Carbon/QuickDraw video driver [default=no]],
+                  , enable_video_carbon=no)
+  if test x$enable_video = xyes -a x$enable_video_carbon = xyes; then
+    AC_MSG_CHECKING(for Carbon framework)
+    have_carbon=no
+    if test x$have_carbon != xyes; then
+        AC_TRY_COMPILE([
+          #include <Carbon/Carbon.h>
+        ],[
+        ],[
+        have_carbon=yes
+        ])
+    fi
+    AC_MSG_RESULT($have_carbon)
+    if test x$have_carbon = xyes; then
     # "MACOSX" is not an official definition, but it's commonly
     # accepted as a way to differentiate between what runs on X
     # and what runs on older Macs - while in theory "Carbon" defns
@@ -1656,11 +1699,35 @@
     VIDEO_DRIVERS="$VIDEO_DRIVERS maccommon/libvideo_maccommon.la"
     VIDEO_SUBDIRS="$VIDEO_SUBDIRS macrom"
     VIDEO_DRIVERS="$VIDEO_DRIVERS macrom/libvideo_macrom.la"
+    #VIDEO_SUBDIRS="$VIDEO_SUBDIRS macdsp"
+    #VIDEO_DRIVERS="$VIDEO_DRIVERS macdsp/libvideo_macdsp.la"
+    fi
+  fi
 }
 
-dnl Set up the Mac toolbox video driver for Mac OS X
-CheckQUARTZ()
+dnl Set up the Cocoa/Quartz video driver for Mac OS X (but not Darwin)
+CheckCOCOA()
 {
+    AC_ARG_ENABLE(video-cocoa,
+[  --enable-video-cocoa    use Cocoa/Quartz video driver [default=yes]],
+                  , enable_video_cocoa=yes)
+  if test x$enable_video = xyes -a x$enable_video_cocoa = xyes; then
+    old_CFLAGS="$CFLAGS"
+    dnl work around that we don't have Objective-C support in autoconf
+    CFLAGS="$CFLAGS -x objective-c"
+    AC_MSG_CHECKING(for Cocoa framework)
+    have_cocoa=no
+    if test x$have_cocoa != xyes; then
+        AC_TRY_COMPILE([
+          #import <Cocoa/Cocoa.h>
+        ],[
+        ],[
+        have_cocoa=yes
+        ])
+    fi
+    AC_MSG_RESULT($have_cocoa)
+    CFLAGS="$old_CFLAGS"
+    if test x$have_cocoa = xyes; then
     # "MACOSX" is not an official definition, but it's commonly
     # accepted as a way to differentiate between what runs on X
     # and what runs on older Macs - while in theory "Carbon" defns
@@ -1672,6 +1739,8 @@
       -DENABLE_QUARTZ -DMACOSX -DTARGET_API_${mac_autoconf_target_workaround}_CARBON=1 -I\$(top_srcdir)/src/video/quartz"
     VIDEO_SUBDIRS="$VIDEO_SUBDIRS quartz"
     VIDEO_DRIVERS="$VIDEO_DRIVERS quartz/libvideo_quartz.la"
+    fi
+  fi
 }
 
 dnl Check for the dlfcn.h interface for dynamically loading objects
@@ -2581,13 +2650,15 @@
         SDL_LIBS="-lSDLmain $SDL_LIBS"
         ;;
     *-*-darwin* )
-        # Strictly speaking, we want "Mac OS X", not "Darwin", which is
+        # This could be either full "Mac OS X", or plain "Darwin" which is
         # just the OS X kernel sans upper layers like Carbon and Cocoa.
-        # But config.guess comes back with "darwin", so go with the flow.
+        # Next line is broken, and a few files below require Mac OS X (full)
         ARCH=macosx
         CheckDummyVideo
         CheckDiskAudio
-        CheckQUARTZ
+        CheckCOCOA
+        CheckCARBON
+        CheckMacX11
         CheckMacGL
         CheckPTHREAD
         CheckSIGACTION
@@ -2625,8 +2696,16 @@
         fi
         # The MacOS X platform requires special setup.
         SDL_LIBS="-lSDLmain $SDL_LIBS"
-        # The Cocoa backend still needs Carbon, and the YUV code QuickTime
-        SYSTEM_LIBS="$SYSTEM_LIBS -framework Cocoa -framework Carbon -framework QuickTime"
+        if test x$enable_video_cocoa = xyes; then
+            SYSTEM_LIBS="$SYSTEM_LIBS -framework Cocoa"
+        fi
+        if test x$enable_video_carbon = xyes -o x$enable_video_cocoa = xyes; then
+            # The Cocoa backend still needs Carbon, and the YUV code QuickTime
+            SYSTEM_LIBS="$SYSTEM_LIBS -framework Carbon -framework QuickTime"
+        fi
+        #if test x$enable_video_carbon = xyes; then
+        #    SYSTEM_LIBS="$SYSTEM_LIBS -framework DrawSprocket"
+        #fi
         ;;
     *-*-mint*)
         ARCH=mint
@@ -2746,6 +2825,8 @@
 AM_CONDITIONAL(USE_DIRECTX, test x$use_directx = xyes)
 AM_CONDITIONAL(USE_CLONE, test x$use_clone = xyes)
 AM_CONDITIONAL(HAVE_NASM, test x$use_nasm = xyes)
+AM_CONDITIONAL(USE_COCOA, test x$enable_video_cocoa = xyes)
+AM_CONDITIONAL(USE_CARBON, test x$enable_video_carbon = xyes)
 
 # Set conditional variables for shared and static library selection.
 # These are not used in any Makefile.am but in sdl-config.in.
@@ -2773,7 +2854,13 @@
     SHARED_SYSTEM_LIBS="$SYSTEM_LIBS"
     ;;
   macosx)
-    SHARED_SYSTEM_LIBS="-framework Cocoa"
+    SHARED_SYSTEM_LIBS=""
+    if test x$enable_video = xyes -a x$enable_video_cocoa = xyes; then
+      SHARED_SYSTEM_LIBS="$SHARED_SYSTEM_LIBS -framework Cocoa"
+    fi
+    if test x$enable_video = xyes -a x$enable_video_carbon = xyes; then
+      SHARED_SYSTEM_LIBS="$SHARED_SYSTEM_LIBS -framework Carbon"
+    fi
     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
       SHARED_SYSTEM_LIBS="$SHARED_SYSTEM_LIBS -framework OpenGL"
     fi
@@ -2874,6 +2961,7 @@
 include/Makefile
 src/Makefile
 src/main/Makefile
+src/main/macos/Makefile
 src/main/macosx/Makefile
 src/main/macosx/Info.plist
 src/audio/Makefile