From 03ee4999656731bbf8d2fb530e123590f1a2e724 Mon Sep 17 00:00:00 2001 From: Dan Nicholson Date: Fri, 25 Apr 2008 11:33:12 -0700 Subject: [PATCH] glcore: Set all external variables in configuration Rather than hiding the pkg-config checks in the glcore Makefile, set the glcore variables in the configuration. This takes advantage of make not evaluating the variables until they are referenced. The glcore setup in configure is also sanitized to always link with -lm and -lpthread since these are always needed. --- configs/autoconf.in | 1 + configs/default | 3 +++ configs/freebsd-dri | 3 ++- configs/linux-dri | 3 ++- configure.ac | 16 ++++++++++++---- src/mesa/drivers/xorg/Makefile | 7 ++++--- 6 files changed, 24 insertions(+), 9 deletions(-) diff --git a/configs/autoconf.in b/configs/autoconf.in index 1bf655f..0bee160 100644 --- a/configs/autoconf.in +++ b/configs/autoconf.in @@ -84,6 +84,7 @@ GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) @GLW_MESA_DEPS@ \ APP_LIB_DEPS = $(EXTRA_LIB_PATH) @APP_LIB_DEPS@ # GLcore dependencies +GLCORE_CFLAGS = @GLCORE_CFLAGS@ GLCORE_LIB_DEPS = $(EXTRA_LIB_PATH) @GLCORE_LIB_DEPS@ # DRI dependencies diff --git a/configs/default b/configs/default index 9705d6b..435514a 100644 --- a/configs/default +++ b/configs/default @@ -80,6 +80,9 @@ GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) $(EXTRA_LIB_PATH) -lXt -lX11 # Program dependencies - specific GL/glut libraries added in Makefiles APP_LIB_DEPS = -lm +# GLcore dependencies +GLCORE_CFLAGS = `pkg-config --cflags xorg-server` +GLCORE_LIB_DEPS = `pkg-config --libs xorg-server` -lm -lpthread # Installation directories (for make install) diff --git a/configs/freebsd-dri b/configs/freebsd-dri index bb8fb4a..7ca3b66 100644 --- a/configs/freebsd-dri +++ b/configs/freebsd-dri @@ -34,7 +34,8 @@ LIBDRM_LIB = `pkg-config --libs libdrm` DRI_LIB_DEPS = -L/usr/local/lib -lm -pthread -lexpat $(LIBDRM_LIB) GL_LIB_DEPS = -L/usr/local/lib -lX11 -lXext -lXxf86vm -lXdamage -lXfixes \ -lm -pthread $(LIBDRM_LIB) -GLCORE_LIB_DEPS = -lm -pthread +GLCORE_CFLAGS = `pkg-config --cflags xorg-server` +GLCORE_LIB_DEPS = `pkg-config --libs xorg-server` -lm -lpthread -ldl GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -L/usr/local/lib -lGLU -lGL -lX11 -lXmu -lXt -lXi -lm GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -L/usr/local/lib -lGL -lXt -lX11 diff --git a/configs/linux-dri b/configs/linux-dri index b4889d0..968fcb5 100644 --- a/configs/linux-dri +++ b/configs/linux-dri @@ -48,7 +48,8 @@ LIBDRM_LIB = `pkg-config --libs libdrm` DRI_LIB_DEPS = $(EXTRA_LIB_PATH) -lm -lpthread -lexpat -ldl $(LIBDRM_LIB) GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lXxf86vm -lXdamage -lXfixes \ -lm -lpthread -ldl $(LIBDRM_LIB) -GLCORE_LIB_DEPS = -lm -lpthread -ldl +GLCORE_CFLAGS = `pkg-config --cflags xorg-server` +GLCORE_LIB_DEPS = `pkg-config --libs xorg-server` -lm -lpthread -ldl # This is now 0 by default since it seems to confuse the hell out of people diff --git a/configure.ac b/configure.ac index 8f5f0a7..81e18a9 100644 --- a/configure.ac +++ b/configure.ac @@ -387,7 +387,6 @@ xlib) GL_LIB_DEPS="$X_LIBS -lX11 -lXext" fi GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm -lpthread" - GLCORE_LIB_DEPS="" # if static, move the external libraries to the programs # and empty the libraries for libGL @@ -419,16 +418,13 @@ dri) # need DRM libs, -lpthread, etc. GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS" - GLCORE_LIB_DEPS="-lm -lpthread $DLOPEN_LIBS" ;; osmesa) # No libGL for osmesa GL_LIB_DEPS="" - GLCORE_LIB_DEPS="" ;; esac AC_SUBST(GL_LIB_DEPS) -AC_SUBST(GLCORE_LIB_DEPS) dnl dnl More X11 setup @@ -648,6 +644,18 @@ AC_SUBST(OSMESA_LIB_DEPS) AC_SUBST(OSMESA_MESA_DEPS) dnl +dnl GLcore configuration +dnl +# delay pkg-config checks until `make glcore' run +GLCORE_CFLAGS='`pkg-config --cflags xorg-server`' +GLCORE_LIB_DEPS='`pkg-config --libs xorg-server` -lm -lpthread' +if test "$mesa_driver" = dri; then + GLCORE_LIB_DEPS="$GLCORE_LIB_DEPS $DLOPEN_LIBS" +fi +AC_SUBST(GLCORE_CFLAGS) +AC_SUBST(GLCORE_LIB_DEPS) + +dnl dnl GLU configuration dnl AC_ARG_ENABLE(glu, diff --git a/src/mesa/drivers/xorg/Makefile b/src/mesa/drivers/xorg/Makefile index a1b4174..1499a60 100644 --- a/src/mesa/drivers/xorg/Makefile +++ b/src/mesa/drivers/xorg/Makefile @@ -45,15 +45,16 @@ INCLUDES = \ -I$(TOP)/include \ -I$(TOP)/src/mesa \ -I$(TOP)/src/mesa/main \ - -I$(TOP)/src/mesa/glapi \ - `pkg-config --cflags xorg-server` + -I$(TOP)/src/mesa/glapi ifeq ("${DRIVER_DIRS}", "dri") INCLUDES += \ -I$(TOP)/src/mesa/drivers/dri/common \ - `pkg-config --cflags libdrm` + $(LIBDRM_CFLAGS) endif +INCLUDES += $(GLCORE_CFLAGS) + # undef 'USE_XSHM' to make it explicit that 'XFree86Server' takes precedence DRIVER_DEFINES = -UUSE_XSHM -DXFree86Server -- 1.5.3.2