diff --git a/configure.ac b/configure.ac index 1e58d02c6..4ce4a0394 100644 --- a/configure.ac +++ b/configure.ac @@ -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], , [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 diff --git a/src/Main/Makefile.am b/src/Main/Makefile.am index 85d66c1ee..db58cab4a 100644 --- a/src/Main/Makefile.am +++ b/src/Main/Makefile.am @@ -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 diff --git a/src/Main/fg_os.hxx b/src/Main/fg_os.hxx index 14f939795..dfe26f426 100644 --- a/src/Main/fg_os.hxx +++ b/src/Main/fg_os.hxx @@ -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 +#endif + enum { MOUSE_BUTTON_LEFT, MOUSE_BUTTON_MIDDLE,