]> git.mxchange.org Git - flightgear.git/blobdiff - configure.ac
Merge branch 'durk/atcdcl-cond'
[flightgear.git] / configure.ac
index 1c1fa96132cbd491840954690d4ceb6d9897cd05..d1600c1754c0955f3a6179b2b674b007c0bacc88 100644 (file)
@@ -10,13 +10,14 @@ AC_PREREQ(2.52)
 dnl Initialize the automake stuff
 dnl set the $host variable based on local machine/os
 AC_CANONICAL_TARGET
-AM_INIT_AUTOMAKE(FlightGear, 1.9.1)
+AM_INIT_AUTOMAKE(FlightGear, 2.0.0)
 
 dnl Checks for programs.
 AC_PROG_MAKE_SET
 AC_PROG_CC
 AC_PROG_CPP
 AC_PROG_CXX
+AC_PROG_CXXCPP
 AC_PROG_RANLIB
 AC_PROG_INSTALL
 AC_PROG_LN_S
@@ -85,16 +86,32 @@ case "${host}" in
     ])
 
     # Mac OS X specific configure options
+    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(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"
+       export DYLD_FRAMEWORK_PATH="$DYLD_FRAMEWORK_PATH:$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"
+       export DYLD_FRAMEWORK_PATH="$DYLD_FRAMEWORK_PATH:$with_plib_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_osg_framework" != "x" ; then
-        echo "osg prefix is $with_osg_framework"
+    AC_ARG_WITH(openal_framework, [ --with-openal-framework=PREFIX    Speicfy the prefix path to OpenAL.framework ])
+    if test "x$with_openal_framework" != "x"; then
+        echo "OpenAL framework prefix is $with_openal_framework"
     fi
+
     ;;
 esac
 
@@ -211,7 +228,6 @@ if test "x$with_threads" = "xyes"; then
     CFLAGS="$CFLAGS -D_REENTRANT"
 fi
 AC_CHECK_HEADER(pthread.h)
-AM_CONDITIONAL(WITH_THREADS, test "x$with_threads" = "xyes")
 
 
 dnl Used by JSBSim to conditionally compile in fgfs interface code
@@ -272,6 +288,7 @@ if test "x$ac_cv_header_pthread_h" = "xyes"; then
   if test "x$ac_cv_search_pthread_exit" = "x-lc_r"; then
     CXXFLAGS="-pthread $CXXFLAGS"
     CFLAGS="-pthread $CFLAGS"
+    LIBS="-lsgthreads $LIBS"
   fi
 fi
 
@@ -347,7 +364,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"
     ;;
 
@@ -400,7 +417,7 @@ case "${host}" in
     dnl CygWin under Windoze.
     INCLUDES="$INCLUDES -I/usr/local/include/"
     LIBS="$LIBS -L/usr/local/lib"
-    AC_SEARCH_LIBS(alGenBuffers, [ openal32 openal ] )
+    AC_SEARCH_LIBS(alGenBuffers, [ openal32 openal 'openal -ldsound -lwinmm' ] )
     AC_SEARCH_LIBS(alutInit, [ openal32 ALut alut ] )
     LIBS="$LIBS -lwinmm -ldsound -ldxguid -lole32"
     openal_LIBS="$LIBS"
@@ -411,11 +428,19 @@ case "${host}" in
 *-apple-darwin*)
     dnl Mac OS X
 
+    # Mac OS X has OpenAL.framework with ALUT by default
+    # so we can use it without checking it.
+    # Note: SimGear needs to check the existance of alut.h since it includes the header.
     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 Check for OpenAL.framework when --with-openal-framework is specified
+    if test "x$with_openal_framework" != "x"; then
+      AC_CHECK_FRAMEWORK(OpenAL, [#include <OpenAL/alut.h>], $with_openal_framework)
+    fi
+
     ;;
 
 *)
@@ -601,18 +626,6 @@ dnl If we get here then plib is available, so force use of plib
 dnl joystick lib
 AC_DEFINE([ENABLE_PLIB_JOYSTICK], 1, [Define to enable plib joystick support])
 
-AC_CHECK_HEADER(osg/Version)
-if test "x$ac_cv_header_osg_Version" != "xyes"; then
-    echo
-    echo "You *must* have the OpenSceneGraph support library installed on your system"
-    echo "to build the FGFS simulator!"
-    echo
-    echo "Please see README.OSG for more details."
-    echo
-    echo "configure aborted."
-    exit
-fi
-
 # Find the OSG libraries.  Note special handling for OS X frameworks
 case "${host}" in
 *-apple-darwin*)
@@ -681,7 +694,7 @@ case "${host}" in
         AC_CHECK_LIB(osgViewerd,osgViewerGetVersion)
         AC_CHECK_LIB(osgSimd,osgSimGetVersion)
         AC_CHECK_LIB(osgParticled,osgParticleGetVersion)
-        LIBS="$LIBS -losgFXd"
+        LIBS="$LIBS -losgFXd $opengl_LIBS"
     else
         AC_CHECK_LIB(OpenThreads,OpenThreadsGetVersion)
         AC_CHECK_LIB(osg,osgGetVersion)
@@ -692,12 +705,25 @@ case "${host}" in
         AC_CHECK_LIB(osgViewer,osgViewerGetVersion)
         AC_CHECK_LIB(osgSim,osgSimGetVersion)
         AC_CHECK_LIB(osgParticle,osgParticleGetVersion)
-        LIBS="$LIBS -losgFX"
+        LIBS="$LIBS -losgFX $opengl_LIBS"
     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
+    echo
+    echo "You *must* have the OpenSceneGraph support library installed on your system"
+    echo "to build the FGFS simulator!"
+    echo
+    echo "Please see README.OSG for more details."
+    echo
+    echo "configure aborted."
+    exit
+fi
+
+
 AC_MSG_CHECKING([checking for osg::CullSettings::CLEAR_MASK])
 AC_COMPILE_IFELSE(
   [AC_LANG_PROGRAM([[#include <osg/CullSettings>]],
@@ -705,6 +731,41 @@ AC_COMPILE_IFELSE(
   [AC_DEFINE([HAVE_CULLSETTINGS_CLEAR_MASK],1,[define if OSG has CullSettings::CLEAR_MASK])
    AC_MSG_RESULT([yes])],
   [AC_MSG_RESULT([no])])
+
+# Special handling for static version of OSG
+if test -n "`echo "$CPPFLAGS" "$CXXFLAGS" "$CFLAGS" | grep "\-DOSG_LIBRARY_STATIC" 2>/dev/null`" ; then
+    saved_LIBS="$LIBS"
+    LIBS=""
+    #***** Check image support (needed for static build) *****
+    AC_SEARCH_LIBS([jpeg_read_header], [jpeg], [CPPFLAGS="$CPPFLAGS -DOSG_JPEG_ENABLED"])
+    AC_SEARCH_LIBS([png_read_image], [png 'png -lz'], [CPPFLAGS="$CPPFLAGS -DOSG_PNG_ENABLED"])
+    AC_SEARCH_LIBS([TIFFOpen], [tiff], [CPPFLAGS="$CPPFLAGS -DOSG_TIFF_ENABLED"])
+    img_LIBS="$LIBS"
+    LIBS="$saved_LIBS"
+
+    if test "x$with_osg" != "x" ; then
+        osg_prefix="$with_osg"
+    else
+        osg_prefix="/usr"
+    fi
+    PKG_CHECK_EXISTS([openscenegraph], [osg_version="`$PKG_CONFIG --modversion openscenegraph 2>/dev/null`"])
+    LIBS="-L$osg_prefix/lib/osgPlugins-$osg_version -losgdb_bmp -losgdb_dds -losgdb_hdr -losgdb_pic -losgdb_pnm -losgdb_rgb -losgdb_tga \
+                                                          -losgdb_3ds -losgdb_ac -losgdb_ive -losgdb_osg -losgdb_txf \
+                                                          -losgVolume -losgTerrain $LIBS -losgUtil"
+
+    if test -n "`echo "$CPPFLAGS" "$CXXFLAGS" "$CFLAGS" | grep "\-DOSG_JPEG_ENABLED" 2>/dev/null`" ; then
+      LIBS="$LIBS -losgdb_jpeg"
+    fi
+    if test -n "`echo "$CPPFLAGS" "$CXXFLAGS" "$CFLAGS" | grep "\-DOSG_PNG_ENABLED" 2>/dev/null`" ; then
+      LIBS="$LIBS -losgdb_png"
+    fi
+    if test -n "`echo "$CPPFLAGS" "$CXXFLAGS" "$CFLAGS" | grep "\-DOSG_TIFF_ENABLED" 2>/dev/null`" ; then
+      LIBS="$LIBS -losgdb_tiff"
+    fi
+
+    LIBS="$LIBS $img_LIBS"
+fi
+
 AC_LANG_POP
 
 dnl Check for system installed zlib
@@ -797,6 +858,7 @@ AC_CONFIG_FILES([ \
        src/Include/config.h-msvc6 \
        src/Include/config.h-msvc71 \
        src/Include/config.h-msvc8 \
+       src/Include/config.h-msvc90 \
        src/Aircraft/Makefile \
        src/Airports/Makefile \
        src/ATC/Makefile \