summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2019-05-31 21:42:15 +0300
committerAndrei Karas <akaras@inbox.ru>2019-05-31 21:46:40 +0300
commitbdbab22de6556e904343d5d4bb21c20595f57b0b (patch)
treec3bca4cd18b12c8911e999389fd36979369de9c1
parent27004e91dc0f1a38886008d419b85e5fdbab369c (diff)
downloadplus-bdbab22de6556e904343d5d4bb21c20595f57b0b.tar.gz
plus-bdbab22de6556e904343d5d4bb21c20595f57b0b.tar.bz2
plus-bdbab22de6556e904343d5d4bb21c20595f57b0b.tar.xz
plus-bdbab22de6556e904343d5d4bb21c20595f57b0b.zip
Fix compilation warnings with new mesa and SDL 1.2
Add workaround to fix SDL redefine bug.
-rwxr-xr-xconfigure.ac34
-rw-r--r--src/Makefile.am5
-rw-r--r--src/graphicsmanager.h6
-rw-r--r--src/render/opengl/mgltypes.h6
-rw-r--r--src/render/vertexes/openglgraphicsvertexes.h1
-rw-r--r--src/resources/fboinfo.h6
-rw-r--r--src/resources/image/image.h6
-rw-r--r--src/resources/openglimagehelper.h6
-rw-r--r--src/resources/safeopenglimagehelper.h6
9 files changed, 76 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index d84bec5ea..7bdca2844 100755
--- a/configure.ac
+++ b/configure.ac
@@ -53,6 +53,37 @@ AC_DEFUN([AC_CHECK_LD_FLAG],
]
)
+AC_DEFUN([AC_CHECK_GLXEXT],
+ [
+ AC_MSG_CHECKING([whether have glext.h])
+ OLD_CXXFLAGS="$CXXFLAGS"
+ CXXFLAGS=""
+ $1=no
+ AC_LINK_IFELSE(
+ [AC_LANG_SOURCE([
+ #include <GL/gl.h>
+ #include <GL/glext.h>
+ #ifndef __gl_glext_h_
+ #error __gl_glext_h_ not defined
+ #endif
+ int main(int argc, char **argv)
+ {
+ return 0;
+ }
+ ])],
+ [
+ AC_MSG_RESULT([yes])
+ $1=yes
+ ],
+ [
+ AC_MSG_RESULT([no])
+ $1=no
+ ]
+ )
+ CXXFLAGS="$OLD_CXXFLAGS"
+ ]
+)
+
# Enable -Werror
AC_ARG_ENABLE(werror,
[ --enable-werror Fail build if warning present],
@@ -333,6 +364,9 @@ fi
AM_CONDITIONAL(USE_SDL2, test x$with_sdl2 = xyes)
+AC_CHECK_GLXEXT(have_glext)
+AM_CONDITIONAL(HAVE_GLEXT, test x$have_glext = xyes)
+
# Option to enable internal sdl-gfx for SDL2 (for now it enabled by default)
if test "x$with_internalsdlgfx" == "xno"; then
with_internalsdlgfx=no
diff --git a/src/Makefile.am b/src/Makefile.am
index d2279b33c..a1934ac22 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -90,6 +90,11 @@ manaplus_CXXFLAGS += -DHAVE_EXECINFO
dyecmd_CXXFLAGS += -DHAVE_EXECINFO
endif
+if HAVE_GLEXT
+manaplus_CXXFLAGS += -DHAVE_GLEXT
+dyecmd_CXXFLAGS += -DHAVE_GLEXT
+endif
+
if ENABLE_PUGIXML
manaplus_CXXFLAGS += -DENABLE_PUGIXML
dyecmd_CXXFLAGS += -DENABLE_PUGIXML
diff --git a/src/graphicsmanager.h b/src/graphicsmanager.h
index eef60b50c..9033f7f63 100644
--- a/src/graphicsmanager.h
+++ b/src/graphicsmanager.h
@@ -30,10 +30,16 @@
#ifndef USE_SDL2
#define GL_GLEXT_PROTOTYPES 1
#endif // USE_SDL2
+#ifdef HAVE_GLEXT
+#define NO_SDL_GLEXT
+#endif // HAVE_GLEXT
PRAGMA48(GCC diagnostic push)
PRAGMA48(GCC diagnostic ignored "-Wshadow")
#include <SDL_opengl.h>
PRAGMA48(GCC diagnostic pop)
+#ifdef HAVE_GLEXT
+#include <GL/glext.h>
+#endif // HAVE_GLEXT
// hack to hide warnings
#undef GL_GLEXT_VERSION
#undef GL_GLEXT_PROTOTYPES
diff --git a/src/render/opengl/mgltypes.h b/src/render/opengl/mgltypes.h
index 9cc2644ca..874e4c9ff 100644
--- a/src/render/opengl/mgltypes.h
+++ b/src/render/opengl/mgltypes.h
@@ -32,10 +32,16 @@
#ifndef USE_SDL2
#define GL_GLEXT_PROTOTYPES 1
#endif // USE_SDL2
+#ifdef HAVE_GLEXT
+#define NO_SDL_GLEXT
+#endif // HAVE_GLEXT
PRAGMA48(GCC diagnostic push)
PRAGMA48(GCC diagnostic ignored "-Wshadow")
#include <SDL_opengl.h>
PRAGMA48(GCC diagnostic pop)
+#ifdef HAVE_GLEXT
+#include <GL/glext.h>
+#endif // HAVE_GLEXT
#ifdef __native_client__
#include <GL/Regal.h>
#else // __native_client__
diff --git a/src/render/vertexes/openglgraphicsvertexes.h b/src/render/vertexes/openglgraphicsvertexes.h
index 88661d3a8..3bc7f7f52 100644
--- a/src/render/vertexes/openglgraphicsvertexes.h
+++ b/src/render/vertexes/openglgraphicsvertexes.h
@@ -33,6 +33,7 @@
#endif // USE_SDL2
PRAGMA48(GCC diagnostic push)
PRAGMA48(GCC diagnostic ignored "-Wshadow")
+#define GL_GLEXT_LEGACY
#include <SDL_opengl.h>
PRAGMA48(GCC diagnostic pop)
#endif // ANDROID
diff --git a/src/resources/fboinfo.h b/src/resources/fboinfo.h
index e18e9b938..5f47630c1 100644
--- a/src/resources/fboinfo.h
+++ b/src/resources/fboinfo.h
@@ -29,10 +29,16 @@
#include <GLES/gl.h>
#include <GLES/glext.h>
#else // ANDROID
+#ifdef HAVE_GLEXT
+#define NO_SDL_GLEXT
+#endif // HAVE_GLEXT
PRAGMA48(GCC diagnostic push)
PRAGMA48(GCC diagnostic ignored "-Wshadow")
#include <SDL_opengl.h>
PRAGMA48(GCC diagnostic pop)
+#ifdef HAVE_GLEXT
+#include <GL/glext.h>
+#endif // HAVE_GLEXT
#if defined(__APPLE__)
#include <OpenGL/glext.h>
#elif !defined(__native_client__)
diff --git a/src/resources/image/image.h b/src/resources/image/image.h
index 31836483e..b15ff7d33 100644
--- a/src/resources/image/image.h
+++ b/src/resources/image/image.h
@@ -37,10 +37,16 @@
#ifndef USE_SDL2
#define GL_GLEXT_PROTOTYPES 1
#endif // USE_SDL2
+#ifdef HAVE_GLEXT
+#define NO_SDL_GLEXT
+#endif // HAVE_GLEXT
PRAGMA48(GCC diagnostic push)
PRAGMA48(GCC diagnostic ignored "-Wshadow")
#include <SDL_opengl.h>
PRAGMA48(GCC diagnostic pop)
+#ifdef HAVE_GLEXT
+#include <GL/glext.h>
+#endif // HAVE_GLEXT
#endif // ANDROID
#endif // USE_OPENGL
diff --git a/src/resources/openglimagehelper.h b/src/resources/openglimagehelper.h
index b2fd153e6..173f53bb7 100644
--- a/src/resources/openglimagehelper.h
+++ b/src/resources/openglimagehelper.h
@@ -41,10 +41,16 @@
#ifndef USE_SDL2
#define GL_GLEXT_PROTOTYPES 1
#endif // USE_SDL2
+#ifdef HAVE_GLEXT
+#define NO_SDL_GLEXT
+#endif // HAVE_GLEXT
PRAGMA48(GCC diagnostic push)
PRAGMA48(GCC diagnostic ignored "-Wshadow")
#include <SDL_opengl.h>
PRAGMA48(GCC diagnostic pop)
+#ifdef HAVE_GLEXT
+#include <GL/glext.h>
+#endif // HAVE_GLEXT
#endif // ANDROID
class Dye;
diff --git a/src/resources/safeopenglimagehelper.h b/src/resources/safeopenglimagehelper.h
index c212288f8..4a2e9346b 100644
--- a/src/resources/safeopenglimagehelper.h
+++ b/src/resources/safeopenglimagehelper.h
@@ -41,10 +41,16 @@
#ifndef USE_SDL2
#define GL_GLEXT_PROTOTYPES 1
#endif // USE_SDL2
+#ifdef HAVE_GLEXT
+#define NO_SDL_GLEXT
+#endif // HAVE_GLEXT
PRAGMA48(GCC diagnostic push)
PRAGMA48(GCC diagnostic ignored "-Wshadow")
#include <SDL_opengl.h>
PRAGMA48(GCC diagnostic pop)
+#ifdef HAVE_GLEXT
+#include <GL/glext.h>
+#endif // HAVE_GLEXT
#endif // ANDROID
class Dye;