]> git.mxchange.org Git - flightgear.git/commitdiff
First attempt to make it possible to use either SDL or glut at compile time.
authorehofman <ehofman>
Wed, 7 Apr 2004 14:42:41 +0000 (14:42 +0000)
committerehofman <ehofman>
Wed, 7 Apr 2004 14:42:41 +0000 (14:42 +0000)
configure.ac
src/Main/Makefile.am
src/Main/fg_os.hxx

index 1e58d02c6fbcdaf346c672fd3ea3ef3162f5511a..4ce4a03947017f4223eaa1f05d4ec8cda7bc78d2 100644 (file)
@@ -10,6 +10,8 @@ dnl Require at least automake 2.52
 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, 0.9.4)
 
 dnl Checks for programs.
@@ -29,9 +31,6 @@ if test "x$with_simgear" != "x" ; then
     EXTRA_DIRS="${EXTRA_DIRS} $with_simgear"
 fi
 
-dnl set the $host variable based on local machine/os
-AC_CANONICAL_HOST
-
 case "${host}" in
 *-*-irix*)
     if test "$CXX" = "CC"; then
@@ -215,6 +214,15 @@ AC_SEARCH_LIBS(dlclose, dl)
 
 base_LIBS="$LIBS"
 
+dnl Check for SDL if enabled.
+AC_ARG_ENABLE(sdl, [  --enable-sdl    Configure to use SDL instead of GLUT], enable_sdl="yes", enable_sdl="")
+AM_CONDITIONAL(USE_SDL, test "x$enable_sdl" = "xyes")
+if test "x$enable_sdl" = "xyes"; then
+    AC_DEFINE([PU_USE_SDL], 1, [Define to use SDL])
+else
+    AC_DEFINE([PU_USE_GLUT], 1, [Define to use glut])
+fi
+
 dnl check for glut location
 AC_CHECK_HEADER(GL/glut.h)
 if test "x$ac_cv_header_GL_glut_h" = "xyes"; then
@@ -224,8 +232,10 @@ else
     if test "x$ac_cv_header_GLUT_glut_h" = "xyes"; then
         AC_DEFINE([FG_GLUT_H], <GLUT/glut.h>, [Define as glut.h include location])
     else
-        echo "Neither GL/glut.h nor GLUT/glut.h found.  Cannot continue"
-        exit
+        if test "x$enable_sdl" != "xyes"; then
+            echo "Neither GL/glut.h nor GLUT/glut.h found.  Cannot continue"
+            exit
+        fi
     fi
 fi
 
@@ -290,6 +300,9 @@ case "${host}" in
 
     AC_SEARCH_LIBS(gluLookAt, [ GLU MesaGLU ])
     AC_SEARCH_LIBS(glutGetModifiers, [ glut freeglut ])
+    if test "x$enable_sdl" = "xyes"; then
+        AC_SEARCH_LIBS(SDL_Init, SDL)
+    fi
     ;;
 
 esac
index 85d66c1eea20778e81db4e9bb453aa7500c9fc95..db58cab4a72c7569ac58fdf34e12be07f0ba5b33 100644 (file)
@@ -10,6 +10,12 @@ else
 THREAD_LIBS =
 endif
 
+if USE_SDL
+GFX_SOURCES = fg_os_sdl.cxx fg_os.hxx
+else
+GFX_SOURCES = fg_os.cxx fg_os.hxx
+endif
+
 if FG_USE_CLOUDS_3D
 CLOUD3D_LIBS = -lsgclouds3d
 else
@@ -41,7 +47,7 @@ libMain_a_SOURCES = \
        util.cxx util.hxx \
        viewer.cxx viewer.hxx \
        viewmgr.cxx viewmgr.hxx \
-       fg_os.cxx fg_os.hxx
+       $(GFX_SOURCES)
 
 fgfs_SOURCES = bootstrap.cxx
 
index 14f9397958bef094d98464aa499a5ec613641bcc..dfe26f42624549a5281b4a18f36ff5e443249485 100644 (file)
@@ -3,7 +3,11 @@
 
 // Plib pui needs to know at compile time what toolkit is in use.
 // Change this when we move to something other than glut.
-#define PU_USE_GLUT
+// #define PU_USE_GLUT -- moved to configure.ac -- EMH
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 
 enum { MOUSE_BUTTON_LEFT,
        MOUSE_BUTTON_MIDDLE,