Index: configure.ac
===================================================================
RCS file: /var/cvs/SimGear-0.3/source/configure.ac,v
retrieving revision 1.114
diff -u -r1.114 configure.ac
--- configure.ac	1 Mar 2009 12:36:54 -0000	1.114
+++ configure.ac	9 Sep 2009 04:44:32 -0000
@@ -126,6 +126,12 @@
     EXTRA_DIRS="${EXTRA_DIRS} $with_plib"
 fi
 
+AC_ARG_WITH(plib_framework, [ --with-plib-framework=PREFIX      Specify the prefix path to PLIB.framework ])
+
+if test "x$with_plib_framework" != "x"; then
+    echo "plib framework prefix is $with_plib_framework"
+fi
+
 # specify the osg location
 AC_ARG_WITH(osg, [  --with-osg=PREFIX       Specify the prefix path to osg])
 
@@ -134,6 +140,12 @@
     EXTRA_DIRS="${EXTRA_DIRS} $with_osg"
 fi
 
+AC_ARG_WITH(osg_framework, [ --with-osg-framework=PREFIX      Specify the prefix path to PLIB.framework ])
+
+if test "x$with_osg_framework" != "x"; then
+    echo "osg framework prefix is $with_osg_framework"
+fi
+
 dnl Determine an extra directories to add to include/lib search paths
 case "${host}" in
 *-apple-darwin* | *-*-cygwin* | *-*-mingw32*)
@@ -295,6 +307,36 @@
     # 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
+    AC_DEFUN([AC_CHECK_FRAMEWORK], [
+    AS_VAR_PUSHDEF([ac_Framework], [ac_cv_framework_$1])dnl
+    AC_CACHE_CHECK([whether compiler supports framework $1],
+        ac_Framework, [
+        saved_LIBS="$LIBS"
+        FRAMEWORKS="$FRAMEWORKS -framework $1"
+        if test "$3" = ""; then
+            FRAMEWORKS="$FRAMEWORKS $ADD2LD"
+        elif test "`echo $FRAMEWORKS | grep -- -F$3`" = ""; then
+            FRAMEWORKS="$FRAMEWORKS -F$3"
+            CXXFLAGS="$CXXFLAGS -F$3"
+            CCFLAGS="$CCFLAGS -F$3"
+            dnl This is needed for AC_TRY_LINK when a framework path is specified
+            export DYLD_FRAMEWORK_PATH="${DYLD_FRAMEWORK_PATH}:$3"
+        fi
+        AC_TRY_LINK(
+        [$2], [],
+        [AS_VAR_SET(ac_Framework, yes)], [AS_VAR_SET(ac_Framework, no); LIBS="$saved_LIBS"]
+        )
+    ])
+    AS_IF([test AS_VAR_GET(ac_Framework) = yes],
+        [AC_DEFINE(AS_TR_CPP(HAVE_FRAMEWORK_$1), 1, [Define if framework $1 is available.])]
+    )
+    AS_VAR_POPDEF([ac_Framework])dnl
+    ])
+
     ;;
 
 *)
@@ -351,9 +393,23 @@
 # The following are C++ items that need to be tested for with the c++
 # compiler
 
+CXXCPP="g++ -E"
 AC_LANG_PUSH(C++)
 
 dnl Check for "plib" without which we cannot go on
+case ${host} in 
+*-apple-darwin*)
+    # Check PLIB framework availability when with-plib-framework is specified 
+    if test "x$with_plib_framework" != "x"; then
+        AC_CHECK_FRAMEWORK(PLIB, [#include <plib/ul.h>], $with_plib_framework)
+        plib_FRAMEWORK="$FRAMEWORKS"
+        FRAMEWORKS=""
+        AC_SUBST(plib_FRAMEWORK)
+    fi
+    ;;
+esac
+AM_CONDITIONAL(HAVE_FRAMEWORK_PLIB, test "x$ac_cv_framework_PLIB" != "x")
+
 AC_CHECK_HEADER(plib/ul.h)
 if test "x$ac_cv_header_plib_ul_h" != "xyes"; then
     echo
@@ -391,8 +447,34 @@
 
 LIBS="$saved_LIBS"
 
+# OpenSceneGraph
+case "${host}" in
+*-apple-darwin*)
+    if test "x$with_osg_framework" != "x"; then
+        AC_CHECK_FRAMEWORK(osgViewer, [#include <osgViewer/Version>], $with_osg_framework)
+        AC_CHECK_FRAMEWORK(osgGA, [#include <osgGA/Version>], $with_osg_framework)
+        AC_CHECK_FRAMEWORK(osgText, [#include <osgText/Version>], $with_osg_framework)
+        AC_CHECK_FRAMEWORK(osgFX, [#include <osgFX/AnisotropicLighting>], $with_osg_framework)
+        AC_CHECK_FRAMEWORK(osgUtil, [#include <osgUtil/Version>], $with_osg_framework)
+        AC_CHECK_FRAMEWORK(osgDB, [#include <osgDB/Version>], $with_osg_framework)
+        AC_CHECK_FRAMEWORK(osgSim, [#include <osgSim/Version>], $with_osg_framework)
+        AC_CHECK_FRAMEWORK(osgParticle, [#include <osgParticle/Version>], $with_osg_framework)
+        AC_CHECK_FRAMEWORK(osg, [#include <osg/Version>], $with_osg_framework)
+        osg_FRAMEWORKS="$FRAMEWORKS"
+        FRAMEWORKS=""
+        AC_SUBST(osg_FRAMEWORKS)
+        AC_CHECK_FRAMEWORK(OpenThreads, [#include <OpenThreads/Version>], $with_osg_framework)
+        openthreads_FRAMEWORK="$FRAMEWORKS"
+        FRAMEWORKS=""
+        AC_SUBST(openthreads_FRAMEWORK)
+    fi
+    ;;
+esac
+AM_CONDITIONAL(HAVE_FRAMEWORK_OSG, test "x$ac_cv_framework_osg" != "x")
+
 AC_CHECK_HEADER(osg/Version)
 if test "x$ac_cv_header_osg_Version" != "xyes"; then
+  if test "x$ac_cv_framework_osg" != "xyes"; then
     echo
     echo "You *must* have the OpenSceneGraph support library installed on your system"
     echo "to build this version of SimGear!"
@@ -401,6 +483,7 @@
     echo
     echo "configure aborted."
     exit
+  fi
 fi
 
 AC_CHECK_HEADER(boost/version.hpp)
Index: ./simgear/io/Makefile.am
===================================================================
RCS file: /var/cvs/SimGear-0.3/source/simgear/io/Makefile.am,v
retrieving revision 1.6
diff -u -r1.6 Makefile.am
--- ./simgear/io/Makefile.am	22 Jul 2007 22:37:26 -0000	1.6
+++ ./simgear/io/Makefile.am	9 Sep 2009 04:44:41 -0000
@@ -31,10 +31,16 @@
 	$(top_builddir)/simgear/debug/libsgdebug.a \
 	$(top_builddir)/simgear/bucket/libsgbucket.a \
 	$(top_builddir)/simgear/misc/libsgmisc.a \
-	-lplibnet -lplibul -lz \
+	-lz \
 	$(network_LIBS) \
 	$(base_LIBS)
 
+if HAVE_FRAMEWORK_PLIB
+tcp_server_LDFLAGS = $(plib_FRAMEWORK)
+else
+tcp_server_LDFLAGS = -lplibnet -lplibul
+endif
+
 tcp_client_SOURCES = tcp_client.cxx
 
 tcp_client_LDADD = \
@@ -42,10 +48,16 @@
 	$(top_builddir)/simgear/debug/libsgdebug.a \
 	$(top_builddir)/simgear/bucket/libsgbucket.a \
 	$(top_builddir)/simgear/misc/libsgmisc.a \
-	-lplibnet -lplibul -lz \
+	-lz \
 	$(network_LIBS) \
 	$(base_LIBS)
 
+if HAVE_FRAMEWORK_PLIB
+tcp_client_LDFLAGS = $(plib_FRAMEWORK)
+else
+tcp_client_LDFLAGS = -lplibnet -lplibul
+endif
+
 socktest_SOURCES = socktest.cxx
 
 socktest_LDADD = \
@@ -53,9 +65,15 @@
 	$(top_builddir)/simgear/debug/libsgdebug.a \
 	$(top_builddir)/simgear/bucket/libsgbucket.a \
 	$(top_builddir)/simgear/misc/libsgmisc.a \
-	-lplibnet -lplibul -lz \
 	$(network_LIBS) \
-	$(base_LIBS)
+	$(base_LIBS) \
+        -lz
+
+if HAVE_FRAMEWORK_PLIB
+socktest_LDFLAGS = $(plib_FRAMEWORK)
+else
+socktest_LDFLAGS = -lplibnet -lplibul
+endif
 
 lowtest_SOURCES = lowtest.cxx
 
Index: ./simgear/props/Makefile.am
===================================================================
RCS file: /var/cvs/SimGear-0.3/source/simgear/props/Makefile.am,v
retrieving revision 1.5
diff -u -r1.5 Makefile.am
--- ./simgear/props/Makefile.am	15 Jan 2009 14:46:37 -0000	1.5
+++ ./simgear/props/Makefile.am	9 Sep 2009 04:44:48 -0000
@@ -20,7 +20,12 @@
 	$(top_builddir)/simgear/xml/libsgxml.a \
 	$(top_builddir)/simgear/misc/libsgmisc.a \
 	$(top_builddir)/simgear/debug/libsgdebug.a \
-	$(top_builddir)/simgear/structure/libsgstructure.a \
-	-lOpenThreads
+	$(top_builddir)/simgear/structure/libsgstructure.a
+
+if HAVE_FRAMEWORK_OSG
+props_test_LDFLAGS = $(openthreads_FRAMEWORK)
+else
+props_test_LDFLAGS = -lOpenThreads
+endif
 
 INCLUDES = -I$(top_srcdir)
Index: ./simgear/sound/Makefile.am
===================================================================
RCS file: /var/cvs/SimGear-0.3/source/simgear/sound/Makefile.am,v
retrieving revision 1.9
diff -u -r1.9 Makefile.am
--- ./simgear/sound/Makefile.am	20 Aug 2009 13:10:56 -0000	1.9
+++ ./simgear/sound/Makefile.am	9 Sep 2009 04:45:00 -0000
@@ -33,4 +33,10 @@
 #	$(openal_LIBS) \
 #	-lOpenThreads
 
+#if HAVE_FRAMEWORK_OSG
+#openal_test2_LDFLAGS = $(openthreads_FRAMEWORK)
+#else
+#openal_test2_LDFLAGS = -lOpenThreads
+#endif
+
 INCLUDES = -I$(top_srcdir) -DSRC_DIR=\"$(top_srcdir)/simgear/sound\"
