From eca7863cf4fa103f1716b3810948fdcefc92eb5a Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Mon, 15 Mar 2004 02:26:34 +0000 Subject: [PATCH] add libXtst check simplify --- stepmania/autoconf/m4/opengl.m4 | 63 ++++++++++++--------------------- stepmania/configure.ac | 2 +- stepmania/src/Makefile.am | 6 ++-- 3 files changed, 28 insertions(+), 43 deletions(-) diff --git a/stepmania/autoconf/m4/opengl.m4 b/stepmania/autoconf/m4/opengl.m4 index 583fbb3b87..d83ef00825 100644 --- a/stepmania/autoconf/m4/opengl.m4 +++ b/stepmania/autoconf/m4/opengl.m4 @@ -1,47 +1,30 @@ -AC_DEFUN(SM_OPENGL, +AC_DEFUN(SM_X_WITH_OPENGL, [ - GL_LIBS= - if test "$GL_LIBS" = ""; then - AC_CHECK_LIB(GL, glPushMatrix, have_gl=yes) - AC_CHECK_LIB(GLU, gluGetString, have_glu=yes, , [-lGL]) - if test "$have_gl" = "yes" -a "$have_glu" = "yes"; then - GL_LIBS="-lGL -lGLU" - fi - fi + AC_PATH_X + AC_PATH_XTRA + + # See if we can compile X applications without using X_CFLAGS. + AC_MSG_CHECKING(if $X_CFLAGS is really necessary) + AC_TRY_COMPILE( [#include ], [], + [X_CFLAGS= + AC_MSG_RESULT(no)], + [AC_MSG_RESULT(yes)]) - # Some broken systems need us to link to X explicitly because - # the GL library needs it, instead of doing it automatically. - if test "$GL_LIBS" = ""; then - AC_PATH_X - AC_PATH_XTRA + XLIBS="$X_LIBS $X_EXTRA_LIBS $X_PRE_LIBS -lX11" - oldLIBS=$LIBS - EXTRALIBS="$X_LIBS $X_EXTRA_LIBS $X_PRE_LIBS -lX11" - LIBS="$LIBS $EXTRALIBS" + # Check for libXtst. + AC_CHECK_LIB(Xtst, XTestQueryExtension, + XLIBS="$XLIBS -lXtst" + [AC_DEFINE(HAVE_LIBXTST, 1, [libXtst available])], + , + [$XLIBS]) - if test "$GL_LIBS" = ""; then - AC_CHECK_LIB(GL, glPushMatrix, have_gl=yes) - AC_CHECK_LIB(GLU, gluGetString, have_glu=yes, , [-lGL]) - if test "$have_gl" = "yes" -a "$have_glu" = "yes"; then - GL_LIBS="-lGL -lGLU" - fi - fi + # Check for libGL and libGLU. + AC_CHECK_LIB(GL, glPushMatrix, XLIBS="$XLIBS -lGL", + AC_MSG_ERROR([No OpenGL library could be found.]), [$XLIBS]) + AC_CHECK_LIB(GLU, gluGetString, XLIBS="$XLIBS -lGLU", + AC_MSG_ERROR([No GLU library could be found.]), [$XLIBS]) - if test "$GL_LIBS" != ""; then - GL_LIBS="$GL_LIBS $EXTRALIBS" - fi - LIBS=$oldLIBS - oldLIBS= - EXTRALIBS= - fi - - if test "$GL_LIBS" = ""; then - if test "$have_gl" != "yes"; then - AC_MSG_ERROR([No OpenGL library could be found.]) - else - AC_MSG_ERROR([No GLU library could be found.]) - fi - fi - AC_SUBST(GL_LIBS) + AC_SUBST(XLIBS) ]) diff --git a/stepmania/configure.ac b/stepmania/configure.ac index 034636cacf..9bfcff03b3 100644 --- a/stepmania/configure.ac +++ b/stepmania/configure.ac @@ -52,7 +52,7 @@ if test "$with_prof" = "yes"; then test "$DEFAULT_LDFLAGS" = "yes" && LDFLAGS="$LDFLAGS -pg" fi -SM_OPENGL +SM_X_WITH_OPENGL AM_PATH_SDL(1.2.6,enable_sdl=yes,enable_sdl=no) AM_CONDITIONAL(NHAVE_SDL, test "$enable_sdl" = "no" ) diff --git a/stepmania/src/Makefile.am b/stepmania/src/Makefile.am index 15e98dceb6..e6c616fbca 100644 --- a/stepmania/src/Makefile.am +++ b/stepmania/src/Makefile.am @@ -13,6 +13,8 @@ AM_CFLAGS = # generates enormous output. AM_CXXFLAGS += -finline-limit=300 +AM_CXXFLAGS += $(X_CFLAGS) + if NHAVE_SDL # We use our own copy of SDL if the one on the system isn't new enough. (Most # systems have 1.2.5; we need 1.2.6.) We still end up linking dynamically to @@ -103,7 +105,7 @@ Sound += arch/Sound/RageSoundDriver_ALSA9.cpp arch/Sound/RageSoundDriver_ALSA9.h arch/Sound/ALSA9Dynamic.cpp arch/Sound/ALSA9Dynamic.h \ ALSA9Functions.h -# Add this to CPPFLAGS, not stepmania_CPPFLAGS: that'll cause multiple copies of +# Add this to AM_CXXFLAGS, not stepmania_CXXFLAGS: that'll cause multiple copies of # several sources to be built. We link to this at runtime, so don't add ALSA_LDFLAGS. AM_CXXFLAGS += $(ALSA_CFLAGS) endif @@ -233,7 +235,7 @@ stepmania_SOURCES = $(Screens) $(DataStructures) $(FileTypes) $(StepMania) $(Arc $(Rage) $(Actors) $(GlobalSingletons) $(crypto) stepmania_LDADD = \ - $(GL_LIBS) \ + $(XLIBS) \ $(USE_SDL_LIBS) -lSDL_image \ $(LUA_LIBS) \ $(AUDIO_LIBS) \