Fixes in build systems for autotools and cmake, see Issue 438

Thanks to Daniel KO Listas at the ODE mailing list
Don't build graphics demos when OpenGL or GLUT is not found
CMake will still build the non-graphical HelloWorld demo (output text to console)

Fix linker error: ThreadingDemo requires pthreads on UNIX systems
Thanks to reptor, see also http://bulletphysics.org/Bullet/phpBB3/posting.php?mode=reply&f=9&t=5748
This commit is contained in:
erwin.coumans
2010-10-06 23:07:00 +00:00
parent eefffc2cf2
commit cbeb5864eb
8 changed files with 159 additions and 94 deletions

View File

@@ -81,10 +81,53 @@ AM_CONDITIONAL([CONDITIONAL_BUILD_MULTITHREADED], [test "$build_multithreaded" =
AC_ARG_ENABLE([demos],
[AS_HELP_STRING([--disable-demos],
[disable Bullet demos])],
[disable Bullet demos])],
[],
[enable_demos=yes])
AM_CONDITIONAL([CONDITIONAL_BUILD_DEMOS], [false])
dnl Check for OpenGL and GLUT
if test "x$drawstuff" = "xOSX"; then
AC_DEFINE([HAVE_APPLE_OPENGL_FRAMEWORK], [1],
[Use the Apple OpenGL framework.])
GL_LIBS="-framework GLUT -framework OpenGL -framework Carbon -framework AGL"
have_glut=yes
else
have_gl_headers=yes
AC_CHECK_HEADERS(GL/gl.h GL/glu.h GL/glext.h GL/glut.h, ,
[have_gl_headers=no],
[[#ifdef WIN32
#include <windows.h>
#endif
#if HAVE_GL_GL_H
#include <GL/gl.h>
#endif
#if HAVE_GL_GLU_H
#include <GL/glu.h>
#endif
]])
have_gl=no
have_glu=no
have_glut=no
TEMP_LDFLAGS="$LDFLAGS"
AC_CHECK_LIB(GL, main, [GL_LIBS="-lGL"; have_gl=yes])
AC_CHECK_LIB(GLU, main, [GL_LIBS="-lGLU $GL_LIBS"; have_glu=yes], , -lGL)
AC_CHECK_LIB(GLUT, main, [GL_LIBS="-lGLUT -LGLU $GL_LIBS"; have_glut=yes], ,-lGLUT)
AC_CHECK_LIB(opengl32, main, [GL_LIBS="-lopengl32"; have_gl=yes])
AC_CHECK_LIB(glu32, main, [GL_LIBS="-lglu32 $GL_LIBS"; have_glu=yes], , -lopengl32)
LDFLAGS="$TEMP_LDFLAGS"
if test $have_gl = no -o $have_glu = no -o $have_gl_headers = no; then
if test x$enable_demos = xyes; then
AC_MSG_WARN([Demos and Extras will not be built because OpenGL and GLUT doesn't seem to work. See `config.log' for details.])
fi
enable_demos=no
else
AC_MSG_NOTICE([Found OpenGL])
fi
fi
AC_SUBST(GL_LIBS)
if test "x$enable_demos" != xno; then
AC_MSG_NOTICE([Building Bullet demos])
AM_CONDITIONAL([CONDITIONAL_BUILD_DEMOS],[true])