[Glamor] [PATCH] Explicitly link to required libraries

Armin K krejzi at email.com
Fri Mar 29 12:29:21 PDT 2013


When using -Wl,--no-undefined in LDFLAGS it reports
missing references to several libraries' functions.
This patch makes libglamor explicitly link to such
libraries.

It also adds glamor_egl.c into libglamor sources
because other libglamor source files use its
functions.
---
 configure.ac    | 15 +++++++++++++++
 src/Makefile.am | 28 +++++++++++++++++++---------
 2 files changed, 34 insertions(+), 9 deletions(-)

diff --git a/configure.ac b/configure.ac
index 5ff6ae1..8b0f41f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -63,6 +63,21 @@ LIBEGL="egl"
 LIBGLESV2="glesv2"
 LIBGBM="gbm"
 
+PKG_CHECK_MODULES(PIXMAN, $LIBPIXMAN)
+
+AC_CHECK_LIB([dl], [dlopen], LIBDL_LIBS="-ldl")
+AC_SUBST(LIBDL_LIBS)
+
+AC_CHECK_LIB([m], [floor], LIBM_LIBS="-lm")
+AC_SUBST(LIBM_LIBS)
+
+AC_CHECK_LIB([glapi], [_glapi_Context], [SHARED_GLAPI=yes], [SHARED_GLAPI=no])
+
+if test "x$SHARED_GLAPI = xyes"; then
+   GLAPI_LIBS="-lglapi"
+fi
+AC_SUBST(GLAPI_LIBS)
+
 # Define a configure option for an alternate input module directory
 AC_ARG_WITH(xorg-module-dir,
             AC_HELP_STRING([--with-xorg-module-dir=DIR],
diff --git a/src/Makefile.am b/src/Makefile.am
index 4beb559..7a630b4 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -5,15 +5,22 @@ lib_LTLIBRARIES = libglamor.la
 SOLARIS_ASM_CFLAGS=""
 
 if GLAMOR_GLES2
-libglamor_la_LIBADD = $(GLESV2_LIBS)
+libglamor_la_LIBADD = $(GLESV2_LIBS) $(GLAPI_LIBS)
 else
-libglamor_la_LIBADD = $(GL_LIBS)
+libglamor_la_LIBADD = $(GL_LIBS) $(GLAPI_LIBS)
 endif
 
 AM_CPPFLAGS = \
 	$(XORG_INCS)
 
-AM_CFLAGS = $(CWARNFLAGS) $(XORG_CFLAGS) $(DIX_CFLAGS) $(LIBDRM_CFLAGS)
+AM_CFLAGS =                 \
+	$(CWARNFLAGS)       \
+	$(XORG_CFLAGS)      \
+	$(DIX_CFLAGS)       \
+	$(LIBDRM_CFLAGS)    \
+	$(PIXMAN_CFLAGS)    \
+	-I$(top_srcdir)/src \
+        $(NULL)
 
 libglamor_la_LDFLAGS = -version-info 0:0:0
 
@@ -60,13 +67,16 @@ libglamor_la_SOURCES = \
 sdk_HEADERS = glamor.h
 
 if EGL
-LIBGLAMOREGL = libglamoregl.la
-module_LTLIBRARIES = $(LIBGLAMOREGL)
+
+AM_CFLAGS += $(EGL_CFLAGS) $(GLX_DEFINES)
+libglamor_la_SOURCES += glamor_egl.c
+libglamor_la_LIBADD += $(EGL_LIBS) $(GLX_SYS_LIBS)
+
+module_LTLIBRARIES = libglamoregl.la
 libglamoregl_la_DEPENDENCIES = libglamor.la
 libglamoregl_la_LDFLAGS = -avoid-version -module
-libglamoregl_la_LIBADD = $(EGL_LIBS) $(GLX_SYS_LIBS) libglamor.la
-libglamoregl_la_SOURCES = glamor_eglmodule.c $(top_srcdir)/src/glamor_egl.c
-libglamoregl_la_CFLAGS = $(AM_CFLAGS) $(GLX_DEFINES) -I$(top_srcdir)/src $(LIBDRM_CFLAGS) $(EGL_CFLAGS)
+libglamoregl_la_LIBADD =  libglamor.la
+libglamoregl_la_SOURCES = glamor_eglmodule.c
 endif
 
-
+libglamor_la_LIBADD += $(PIXMAN_LIBS) $(LIBDL_LIBS) $(LIBM_LIBS)
-- 
1.8.2



More information about the Glamor mailing list