Tatsuhiro Nishioka wrote:
Hi Jari,

First, I made patches for configure.ac in both SimGear and FlightGear
(except svn lib part) so please give it a try.

I tried your changes and they work well. However, I have a slightly different strategy so I took your changes and adopted them to my configure.ac files.

I have added a check for the OpenAL framework in my fg configure.ac, in your diff you simply assume that OpenAL is available. It may be true but better safe than sorry. (See fg-check4OpenAL-confgure.diff for details.) I added a same check to sg configure.ac (sg-check4OpenAL-configure.diff)

Your strategy with adding alut.h to your mac and use your patch to the sg/fg configure.ac files works well. I would like you to consider the below replacement strategy


# This assumes you have alut.h (that comes with Creative's
OpenAL.framework) in
/Developer/SDKs/MacOSX10.6/System/Library/OpenAL.framework/Headers

As I wrote in my previous posting I removed all dependency on alut.h.
This was trivial and required only changes in a few files in directory
simgear/simgear/sound. My understanding of the code is that the only
alut function used in simgear for mac is alutLoadWAVFile. If the changes proposed in my previous post in this thread are made to simgear CVS there is no need to add alut.h (and my sg configure.ac diff provided here can be used with the trivial change outlined in the diff).

My proposed changes could be augmented with declarations of all five alut functions in the OpenAL framework supplied by Apple. Use of any other alut functionality will break simgear on default mac OpenAL installation anyway. (It is possible to install freealut 1.1 and get support for more alut functionality).

My point is, we can add some declarations to simgear/simgear/sound/soundmgr_openal.hxx (or cxx) and get rid of alut.h. This is how I do it and it works.


Cheers,

Jari

Index: configure.ac
===================================================================
RCS file: /var/cvs/SimGear-0.3/source/configure.ac,v
retrieving revision 1.118
diff -u -p -r1.118 configure.ac
--- configure.ac        22 Nov 2009 22:23:01 -0000      1.118
+++ configure.ac        28 Nov 2009 20:34:19 -0000
@@ -303,12 +303,6 @@ case "${host}" in
 *-apple-darwin*)
     dnl Mac OS X
 
-    LIBS="$LIBS -framework IOKit -framework OpenAL"
-    openal_LIBS="$LIBS"
-    # not sure how to test if OpenAL exists on MacOS (does it come by default?)
-    OPENAL_OK="yes"
-    ALUT_OK="yes"
-
     dnl Thank you Christian Bauer from SheepSaver
     dnl Modified by Tatsuhiro Nishioka for accepting a given framework path
     dnl AC_CHECK_FRAMEWORK($1=NAME, $2=INCLUDES, $3=FRAMEWORK_PATH) ; $3 is 
optional
@@ -338,6 +332,32 @@ case "${host}" in
     AS_VAR_POPDEF([ac_Framework])dnl
     ])
 
+    LIBS="$LIBS -framework IOKit -framework OpenAL"
+    openal_LIBS="$LIBS"
+
+    if test "x$with_openal_lib" != "x"; then
+        echo "libopenal is not supported on Mac OS platform."
+        openal_LIBS=""
+    else
+        dnl Check that OpenAL framework can be found
+        save_CPPFLAGS=$CPPFLAGS
+        CPPFLAGS=
+        AC_CHECK_FRAMEWORK(OpenAL,[#include <OpenAL/al.h>])
+        if test "x$ac_cv_framework_OpenAL" = "xyes" ; then
+            openal_LIBS="$FRAMEWORKS"
+            OPENAL_OK="yes"
+            # alut backward compatibility libs are provided by Apple
+            # OpenAL (at least for OSX 10.5 and 10.6), no alut.h file
+            # is provided. Just un-comment below line, and remove the
+            # check in alut.h header.
+            # ALUT_OK="yes"
+            dnl Looking for alut.h, if found assume that it is a part
+            dnl of the OpenAL package.
+            AC_CHECK_HEADERS([OpenAL/alut.h],[ALUT_OK="yes"])
+        fi
+        CPPFLAGS=$save_CPPFLAGS
+    fi
+
     ;;
 
 *)
Index: configure.ac
===================================================================
RCS file: /var/cvs/FlightGear-0.9/source/configure.ac,v
retrieving revision 1.156
diff -u -p -r1.156 configure.ac
--- configure.ac        22 Nov 2009 22:23:40 -0000      1.156
+++ configure.ac        28 Nov 2009 20:28:04 -0000
@@ -399,11 +410,22 @@ case "${host}" in
 *-apple-darwin*)
     dnl Mac OS X
 
-    LIBS="$LIBS -framework IOKit -framework OpenAL"
-    openal_LIBS="$LIBS"
-    # not sure how to test if OpenAL exists on MacOS (does it come by default?)
-    OPENAL_OK="yes"
-    ALUT_OK="yes"
+    if test "x$with_openal_lib" != "x"; then
+        # Check for openal libs with AC_CHECK_LIB() missing here!
+        openal_LIBS=""
+    else
+        # Check that OpenAL framework can be found
+        save_CPPFLAGS=$CPPFLAGS
+        CPPFLAGS=
+        AC_CHECK_FRAMEWORK(OpenAL,[#include <OpenAL/al.h>])
+        if test "x$ac_cv_framework_OpenAL" = "xyes" ; then
+            openal_LIBS="$FRAMEWORKS"
+            OPENAL_OK="yes"
+            ALUT_OK="yes"
+        fi
+        CPPFLAGS=$save_CPPFLAGS
+    fi
+
     ;;
 
 *)
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to