From 7e07b57d9253a1d33cfa2a842bb4a4bc05f108a9 Mon Sep 17 00:00:00 2001 From: ehofman Date: Tue, 8 Sep 2009 17:07:31 +0000 Subject: [PATCH] test for the presence of alut.h. if it's not found only display a warning message in gl-info and test-env-map. A clean build without glut installed is now possible. --- configure.ac | 4 +--- tests/gl-info.c | 9 ++++++++- tests/test-env-map.cxx | 12 ++++++++++-- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/configure.ac b/configure.ac index 38ef030f1..7b0dab42d 100644 --- a/configure.ac +++ b/configure.ac @@ -487,8 +487,6 @@ AC_TRY_RUN([ #define MIN_PLIB_VERSION 185 int main() { - int major, minor, micro; - if ( PLIB_VERSION < MIN_PLIB_VERSION ) { return -1; } @@ -617,7 +615,7 @@ save_CPPFLAGS=$CPPFLAGS LIBS="" CPPFLAGS="-I/usr/include/subversion-1 `apr-1-config --includes`" AC_CHECK_LIB(svn_client-1, svn_client_checkout3) -AC_CHECK_HEADERS([svn_client.h]) +AC_CHECK_HEADERS([svn_client.h glut.h]) if test "x$ac_cv_header_svn_client_h" != "xyes"; then echo "TerraSync will shell out for command line subversion" svn_LIBS="" diff --git a/tests/gl-info.c b/tests/gl-info.c index 7d56fe811..7d5be7d37 100644 --- a/tests/gl-info.c +++ b/tests/gl-info.c @@ -24,7 +24,9 @@ Date: Fri, 24 Apr 1998 07:33:51 -0800 # include #else # include -# include +# ifdef HAVE_GLUT_H +# include +# endif #endif @@ -63,6 +65,7 @@ void getPrinti ( GLenum token, char *string ) int main ( int argc, char **argv ) { +#ifdef HAVE_GLUT_H glutInit ( &argc, argv ) ; glutInitDisplayMode ( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH ) ; glutCreateWindow ( "You should never see this window!" ) ; @@ -111,6 +114,10 @@ int main ( int argc, char **argv ) getPrinti( GL_UNPACK_SKIP_ROWS , "GL_UNPACK_SKIP_ROWS" ) ; getPrinti( GL_BLEND_SRC , "GL_BLEND_SRC" ) ; getPrinti( GL_BLEND_DST , "GL_BLEND_DST" ) ; +#else + + printf("GL Utility Toolkit (glut) was not found on this system.\n"); +#endif return 0 ; } diff --git a/tests/test-env-map.cxx b/tests/test-env-map.cxx index c3377bb33..0cb13dee9 100644 --- a/tests/test-env-map.cxx +++ b/tests/test-env-map.cxx @@ -16,13 +16,15 @@ # include #else # include -# include +# ifdef HAVE_GLUT_H +# include +# endif #endif #define TEXRES_X 256 #define TEXRES_Y 256 - +#ifdef HAVE_GLUT_H unsigned char env_map[TEXRES_X][TEXRES_Y][4]; GLuint texName; int window_x = 640, window_y = 480; @@ -248,9 +250,11 @@ void keyboard (unsigned char key, int x, int y) break; } } +#endif /* HAVE_GLUT_H */ int main(int argc, char** argv) { +#ifdef HAVE_GLUT_H glutInitWindowSize(window_x, window_y); glutInit(&argc, argv); glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); @@ -261,6 +265,10 @@ int main(int argc, char** argv) glutKeyboardFunc(keyboard); glutMainLoop(); +#else + + printf("GL Utility Toolkit (glut) was not found on this system.\n"); +#endif return 0; }