summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Bowling <kevin.bowling@kev009.com>2021-06-23 00:01:26 -0700
committerKevin Bowling <kevin.bowling@kev009.com>2021-06-23 00:05:50 -0700
commitcc195a147078190bd6116165bab35af05d0ee1dc (patch)
tree7347bde4c828c56c38e84c7bbbda08d64d1fee4b
parent5b9b10591b50278dd450589226256ea29ba08e2a (diff)
build: Add support for libglvnd
-rw-r--r--Makefile.am6
-rw-r--r--configure.ac54
2 files changed, 39 insertions, 21 deletions
diff --git a/Makefile.am b/Makefile.am
index 3050df1..2186347 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -30,8 +30,8 @@ AM_CPPFLAGS = -DLIBRARYBUILD \
-I$(top_srcdir)/src/libnurbs/internals \
-I$(top_srcdir)/src/libnurbs/interface \
-I$(top_srcdir)/src/libnurbs/nurbtess
-AM_CFLAGS = $(GL_CFLAGS) $(OSMESA_CFLAGS) $(WARNCFLAGS) $(VISIBILITY_CFLAGS)
-AM_CXXFLAGS = $(GL_CFLAGS) $(OSMESA_CFLAGS) $(WARNCXXFLAGS) $(VISIBILITY_CXXFLAGS)
+AM_CFLAGS = $(GL_CFLAGS) $(LIBGLVND_CFLAGS) $(OSMESA_CFLAGS) $(WARNCFLAGS) $(VISIBILITY_CFLAGS)
+AM_CXXFLAGS = $(GL_CFLAGS) $(LIBGLVND_CFLAGS) $(OSMESA_CFLAGS) $(WARNCXXFLAGS) $(VISIBILITY_CXXFLAGS)
GL_includedir = $(includedir)/GL
GL_include_HEADERS = \
@@ -130,7 +130,7 @@ libGLU_la_SOURCES = \
src/libnurbs/nurbtess/sampleMonoPoly.cc \
src/libnurbs/nurbtess/sampledLine.cc \
src/libnurbs/nurbtess/searchTree.cc
-libGLU_la_LIBADD = $(GL_LIBS) $(OSMESA_LIBS)
+libGLU_la_LIBADD = $(GL_LIBS) $(LIBGLVND_LIBS) $(OSMESA_LIBS)
libGLU_la_LDFLAGS = -version-number $(GLU_LIBRARY_VERSION) -no-undefined -export-symbols-regex '^glu'
EXTRA_DIST = \
diff --git a/configure.ac b/configure.ac
index f1bb7b1..e4555d6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -58,34 +58,52 @@ m4_ifndef([PKG_PROG_PKG_CONFIG],
ACLOCAL="aclocal -I/other/macro/dir" before running autoreconf.])])
PKG_PROG_PKG_CONFIG()
+AC_ARG_ENABLE(libglvnd,
+ AS_HELP_STRING([--enable-libglvnd],
+ [Enable use of libglvnd]),
+ [LIBGLVND="$enableval"],
+ [LIBGLVND=no])
+
AC_ARG_ENABLE(osmesa,
AS_HELP_STRING([--enable-osmesa],
[Enable use of OSMesa instead of libGL]),
[OSMESA="$enableval"],
[OSMESA=no])
-dnl Get the pkg-config definitions for libGL/OSMesa. We include a fallback
-dnl path for implementations that don't provide a .pc file
-if test "x$OSMESA" = "xyes"; then
+dnl Get the pkg-config definitions for libglvnd/OSMesa/libGL. We include a
+dnl fallback path for implementations that don't provide a .pc file
+AS_IF([test "x$LIBGLVND" = "xyes"], [
+ GLU_REQUIRES="libglvnd"
+ PKG_CHECK_MODULES(LIBGLVND, [opengl], [], [
+ AC_CHECK_HEADER([GL/gl.h],
+ [],
+ AC_MSG_ERROR([libglvnd GL not found]))
+ AC_CHECK_LIB([OpenGL],
+ [glBegin],
+ [GL_LIBS=-lOpenGL],
+ AC_MSG_ERROR([libglvnd libOpenGL required]))
+ ])
+], [test "x$OSMESA" = "xyes"], [
GLU_REQUIRES="osmesa"
PKG_CHECK_MODULES(OSMESA, [osmesa], [], [
- AC_CHECK_LIB([OSMesa],
- [glBegin],
- [OSMESA_LIBS=-lOSMesa],
- AC_MSG_ERROR([OSMesa required]))
- ])
-else
+ AC_CHECK_LIB([OSMesa],
+ [glBegin],
+ [OSMESA_LIBS=-lOSMesa],
+ AC_MSG_ERROR([OSMesa required]))
+ ])
+], [
GLU_REQUIRES="gl"
PKG_CHECK_MODULES(GL, [gl], [], [
- AC_CHECK_HEADER([GL/gl.h],
- [],
- AC_MSG_ERROR([GL not found]))
- AC_CHECK_LIB([GL],
- [glBegin],
- [GL_LIBS=-lGL],
- AC_MSG_ERROR([GL required]))
- ])
-fi
+ AC_CHECK_HEADER([GL/gl.h],
+ [],
+ AC_MSG_ERROR([GL not found]))
+ AC_CHECK_LIB([GL],
+ [glBegin],
+ [GL_LIBS=-lGL],
+ AC_MSG_ERROR([GL required]))
+ ])
+])
+
AC_SUBST([GLU_REQUIRES])
dnl Set up C warning and visibility flags.