I have made changes (improvements?) to the configure script. I have
attached a patch file for configure.ac with changes targeting issues
with building flightgear on my mac. The changes will only impact mac
users.

Changes made:

1) Fixed mixup in AC_ARG_WITH between osg and plib.

2) Added check for that openal framework can be located in the default
   framework path. Test for non-standard path is not implemented.

3) Added check if alut is a part of the OpenAL framework, if not the a
   AC_SEARCH_LIBS os performed to search for freealut. Snow Leopard
   does not provide alut as a part of the OpenAL framework.

4) I added --with-cocoa-framework option. This enables the user to
   switch from the default Carbon framework to Cocoa.

Comments:

Change 1) is an error in configure.ac and should be fixed even if the
rest of my changes are rejected.

Change 2) and 3) may break things for other mac users since there was
no checks before, configure simply set some variables without testing.

Change 4) is needed to compile 64-bit binaries on mac but the change
will not affect Carbon users. Carbon is 32-bit only whereas Cocoa
comes also in 64-bit flavour. (OSG works with Cocoa but OSG quicktime
support must be dropped and the ImageIO plug-in must probably be used
in OSG).

Can some other mac users try my changes and report back? If the
changes work on other machines than mine then can convince someone to
commit the changes to CVS.


Cheers,

Jari
Index: configure.ac
===================================================================
RCS file: /var/cvs/FlightGear-0.9/source/configure.ac,v
retrieving revision 1.154
diff -u -p -r1.154 configure.ac
--- configure.ac        17 Sep 2009 07:39:04 -0000      1.154
+++ configure.ac        31 Oct 2009 21:55:35 -0000
@@ -85,16 +85,27 @@ case "${host}" in
     ])
 
     # Mac OS X specific configure options
-    AC_ARG_WITH(osg_framework, [  --with-osg-framework=PREFIX       Specify 
the prefix path to osg frameworks [default=standard framework paths]])
 
-    if test "x$with_plib_framework" != "x" ; then
-        echo "plib prefix is $with_plib_framework"
+    # OpenAL framework is used by default, no openal_framework implemented.
+
+    AC_ARG_WITH(cocoa_framework, [  --with-cocoa-framework       Use the Cocoa 
rather than Carbon]])
+    if test "x$with_cocoa_framework" != "x" ; then
+        macAPI=Cocoa
+        AC_MSG_NOTICE([Using Cocoa framework])
+    else
+        macAPI=Carbon
+        AC_MSG_NOTICE([Using Carbon framework])
     fi
 
-    AC_ARG_WITH(plib_framework, [  --with-plib-framework=PREFIX       Specify 
the prefix path to PLIB framework [default=standard framework paths]])
+    AC_ARG_WITH(osg_framework, [  --with-osg-framework=PREFIX       Specify 
the prefix path to osg frameworks [default=standard framework paths]])
     if test "x$with_osg_framework" != "x" ; then
         echo "osg prefix is $with_osg_framework"
     fi
+
+    AC_ARG_WITH(plib_framework, [  --with-plib-framework=PREFIX       Specify 
the prefix path to PLIB framework [default=standard framework paths]])
+    if test "x$with_plib_framework" != "x" ; then
+        echo "plib prefix is $with_plib_framework"
+    fi
     ;;
 esac
 
@@ -335,7 +346,7 @@ case "${host}" in
 *-apple-darwin*)
     dnl Mac OS X
 
-    LIBS="$LIBS -framework GLUT -framework OpenGL -framework AGL -framework 
Carbon -lobjc"
+    LIBS="$LIBS -framework GLUT -framework OpenGL -framework AGL -framework 
$macAPI -lobjc"
     joystick_LIBS="$joystick_LIBS -framework IOKit -framework CoreFoundation"
     ;;
 
@@ -399,11 +410,27 @@ 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
+        AC_CHECK_FRAMEWORK(OpenAL,[#include <OpenAL/al.h>])
+        if test "x$ac_cv_framework_OpenAL" = "xyes" ; then
+            openal_LIBS="$FRAMEWORKS"
+            OPENAL_OK="yes"
+            # Looking for alut.h, if found assume that it is a part of
+            # the OpenAL package.
+            AC_CHECK_HEADERS([OpenAL/alut.h],[ALUT_OK="yes"])
+        fi
+    fi
+
+    # Check if alut was considered to be a part of the OpenAL
+    # framework above, if not try to locate a alut library.
+    if test "x$ALUT_OK" = "xno" ; then
+        AC_SEARCH_LIBS(alutInit, alut,
+                      [ ALUT_OK="yes" openal_LIBS="$openal_LIBS -lalut" ])
+    fi
     ;;
 
 *)
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to