This lets us link EGL apps with libGL without pulling in X dependencies.
---
configs/autoconf.in | 2 +
configure.ac | 99 +++++++++++++++++++------------
src/gallium/state_trackers/egl/Makefile | 1 +
src/glx/x11/Makefile | 16 +++--
4 files changed, 72 insertions(+), 46 deletions(-)
diff --git a/configs/autoconf.in b/configs/autoconf.in
index 3063787..5eb7770 100644
--- a/configs/autoconf.in
+++ b/configs/autoconf.in
@@ -41,6 +41,8 @@ INSTALL = @INSTALL@
PYTHON2 = python
PYTHON_FLAGS = -t -O -O
+WITH_GLX = @WITH_GLX@
+
# Library names (base name)
GL_LIB = GL
GLU_LIB = GLU
diff --git a/configure.ac b/configure.ac
index b6c6535..8c17312 100644
--- a/configure.ac
+++ b/configure.ac
@@ -85,6 +85,7 @@ AC_SUBST([X11_INCLUDES])
dnl Compiler macros
DEFINES=""
AC_SUBST([DEFINES])
+AC_SUBST([GLX_DEFINES])
case "$host_os" in
linux*|*-gnu*|gnu*)
DEFINES="$DEFINES -D_GNU_SOURCE -DPTHREADS"
@@ -486,12 +487,7 @@ dnl If $with_demos is yes, directories will be added as
libs available
PROGRAM_DIRS=""
case "$with_demos" in
no) ;;
-yes)
- # If the driver isn't osmesa, we have libGL and can build xdemos
- if test "$mesa_driver" != osmesa; then
- PROGRAM_DIRS="xdemos"
- fi
- ;;
+yes) ;;
*)
# verify the requested demos directories exist
demos=`IFS=,; echo $with_demos`
@@ -592,33 +588,34 @@ dri)
DRI_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED"
# find the DRI deps for libGL
- if test "$x11_pkgconfig" = yes; then
- # add xcb modules if necessary
- dri_modules="x11 xext xxf86vm xdamage xfixes"
- if test "$enable_xcb" = yes; then
- dri_modules="$dri_modules x11-xcb xcb-glx"
- fi
-
- PKG_CHECK_MODULES([DRIGL], [$dri_modules])
- GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV $dri_modules"
- X11_INCLUDES="$X11_INCLUDES $DRIGL_CFLAGS"
- GL_LIB_DEPS="$DRIGL_LIBS"
- else
- # should check these...
- X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
- GL_LIB_DEPS="$X_LIBS -lX11 -lXext -lXxf86vm -lXdamage -lXfixes"
- GL_PC_LIB_PRIV="$GL_LIB_DEPS"
- GL_PC_CFLAGS="$X11_INCLUDES"
+ if test "$enable_glx" = yes; then
+ if test "$x11_pkgconfig" = yes; then
+ # add xcb modules if necessary
+ dri_modules="x11 xext xxf86vm xdamage xfixes"
+ if test "$enable_xcb" = yes; then
+ dri_modules="$dri_modules x11-xcb xcb-glx"
+ fi
- # XCB can only be used from pkg-config
- if test "$enable_xcb" = yes; then
- PKG_CHECK_MODULES([XCB],[x11-xcb xcb-glx])
- GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV x11-xcb xcb-glx"
- X11_INCLUDES="$X11_INCLUDES $XCB_CFLAGS"
- GL_LIB_DEPS="$GL_LIB_DEPS $XCB_LIBS"
+ PKG_CHECK_MODULES([DRIGL], [$dri_modules])
+ GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV $dri_modules"
+ X11_INCLUDES="$X11_INCLUDES $DRIGL_CFLAGS"
+ GL_LIB_DEPS="$DRIGL_LIBS"
+ else
+ # should check these...
+ X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
+ GL_LIB_DEPS="$X_LIBS -lX11 -lXext -lXxf86vm -lXdamage -lXfixes"
+ GL_PC_LIB_PRIV="$GL_LIB_DEPS"
+ GL_PC_CFLAGS="$X11_INCLUDES"
+
+ # XCB can only be used from pkg-config
+ if test "$enable_xcb" = yes; then
+ PKG_CHECK_MODULES([XCB],[x11-xcb xcb-glx])
+ GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV x11-xcb xcb-glx"
+ X11_INCLUDES="$X11_INCLUDES $XCB_CFLAGS"
+ GL_LIB_DEPS="$GL_LIB_DEPS $XCB_LIBS"
+ fi
fi
- fi
-
+ fi
# need DRM libs, -lpthread, etc.
GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
GL_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS"
@@ -710,10 +707,11 @@ if test "$mesa_driver" = dri; then
case "$host_os" in
linux*)
DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
+ GLX_DEFINES="-DGLX_INDIRECT_RENDERING"
if test "x$driglx_direct" = xyes; then
- DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
+ GLX_DEFINES="$GLX_DEFINES -DGLX_DIRECT_RENDERING"
fi
- DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS"
+ DEFINES="$DEFINES -DHAVE_ALIAS"
case "$host_cpu" in
x86_64)
@@ -744,9 +742,9 @@ if test "$mesa_driver" = dri; then
freebsd* | dragonfly*)
DEFINES="$DEFINES -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1"
DEFINES="$DEFINES -DIN_DRI_DRIVER -DHAVE_ALIAS"
- DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
+ GLX_DEFINES="-DGLX_INDIRECT_RENDERING"
if test "x$driglx_direct" = xyes; then
- DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
+ GLX_DEFINES="$GLX_DEFINES -DGLX_DIRECT_RENDERING"
fi
if test "x$GXX" = xyes; then
CXXFLAGS="$CXXFLAGS -ansi -pedantic"
@@ -761,13 +759,14 @@ if test "$mesa_driver" = dri; then
;;
gnu*)
DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
- DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS"
+ DEFINES="$DEFINES -DHAVE_ALIAS"
+ GLX_DEFINES="-DGLX_INDIRECT_RENDERING"
;;
solaris*)
DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
- DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
+ GLX_DEFINES="-DGLX_INDIRECT_RENDERING"
if test "x$driglx_direct" = xyes; then
- DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
+ GLX_DEFINES="$GLX_DEFINES -DGLX_DIRECT_RENDERING"
fi
;;
esac
@@ -923,12 +922,33 @@ if test "x$enable_egl" = xyes; then
if test "$have_xcb_dri2" = yes; then
EGL_DRIVERS_DIRS="$EGL_DRIVERS_DIRS dri2"
fi
+
+ if test "x$with_demos" == xyes; then
+ PROGRAM_DIRS="$PROGRAM_DIRS egl"
+ fi
fi
fi
AC_SUBST([EGL_LIB_DEPS])
AC_SUBST([EGL_DRIVERS_DIRS])
dnl
+dnl GLX configuration
+dnl
+AC_ARG_ENABLE([glx],
+ [AS_HELP_STRING([--disable-glx],
+ [disable GLX entrypoints in libGL @<:@default=enabled@:>@])],
+ [enable_glx="$enableval"],
+ [enable_glx=yes])
+if test "x$enable_glx" = xyes; then
+ DEFINES="$DEFINES $GLX_DEFINES"
+ if test "x$with_demos" == xyes; then
+ PROGRAM_DIRS="xdemos $PROGRAM_DIRS"
+ fi
+fi
+WITH_GLX=$enable_glx
+AC_SUBST([WITH_GLX])
+
+dnl
dnl GLU configuration
dnl
AC_ARG_ENABLE([glu],
@@ -1078,7 +1098,7 @@ if test "x$enable_glut" = xyes && test "$mesa_driver" =
osmesa; then
enable_glut=no
fi
-if test "x$enable_glut" = xyes; then
+if test "x$enable_glut" = xyes -a "x$enable_glx" = yes; then
SRC_DIRS="$SRC_DIRS glut/glx"
GLUT_CFLAGS=""
if test "x$GCC" = xyes; then
@@ -1404,6 +1424,7 @@ dnl Libraries
echo ""
echo " Shared libs: $enable_shared"
echo " Static libs: $enable_static"
+echo " GLX: $enable_glx"
if test "$enable_egl" = yes; then
echo " EGL: $EGL_DRIVERS_DIRS"
else
diff --git a/src/gallium/state_trackers/egl/Makefile
b/src/gallium/state_trackers/egl/Makefile
index 2863320..3841e8d 100644
--- a/src/gallium/state_trackers/egl/Makefile
+++ b/src/gallium/state_trackers/egl/Makefile
@@ -13,6 +13,7 @@ common_OBJECTS = $(common_SOURCES:.c=.o)
x11_INCLUDES = \
+ -DGLX_DIRECT_RENDERING \
-I$(TOP)/src/gallium/drivers \
-I$(TOP)/src/glx/x11 \
-I$(TOP)/src/mesa \
diff --git a/src/glx/x11/Makefile b/src/glx/x11/Makefile
index e681be8..e3fa6f0 100644
--- a/src/glx/x11/Makefile
+++ b/src/glx/x11/Makefile
@@ -1,5 +1,6 @@
TOP = ../../..
include $(TOP)/configs/current
+include $(TOP)/src/mesa/sources.mak
EXTRA_DEFINES = -DXF86VIDMODE -D_REENTRANT \
-DDEFAULT_DRIVER_DIR=\"$(DRI_DRIVER_SEARCH_DIR)\"
@@ -39,9 +40,13 @@ SOURCES = \
dri2_glx.c \
dri2.c
-GLAPI_LIB = $(TOP)/src/mesa/libglapi.a
+LIBGL_GLAPI_OBJECTS = $(addprefix $(TOP)/src/mesa/,$(GLAPI_OBJECTS))
-OBJECTS = $(SOURCES:.c=.o)
+ifeq ($(WITH_GLX), yes)
+OBJECTS = $(SOURCES:.c=.o) $(LIBGL_GLAPI_OBJECTS)
+else
+OBJECTS = $(LIBGL_GLAPI_OBJECTS)
+endif
INCLUDES = -I. \
-I$(TOP)/include \
@@ -66,14 +71,11 @@ INCLUDES = -I. \
default: depend $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME)
# Make libGL
-$(TOP)/$(LIB_DIR)/$(GL_LIB_NAME): $(OBJECTS) $(GLAPI_LIB) Makefile
+$(TOP)/$(LIB_DIR)/$(GL_LIB_NAME): $(OBJECTS) Makefile
$(MKLIB) -o $(GL_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
-major 1 -minor 2 $(MKLIB_OPTIONS) \
-install $(TOP)/$(LIB_DIR) -id
$(INSTALL_LIB_DIR)/lib$(GL_LIB).1.dylib \
- $(GL_LIB_DEPS) $(OBJECTS) $(GLAPI_LIB)
-
-$(GLAPI_LIB):
- @$(MAKE) -C $(TOP)/src/mesa libglapi.a
+ $(GL_LIB_DEPS) $(OBJECTS)
depend: $(SOURCES) Makefile
rm -f depend
--
1.6.5.rc2
------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Mesa3d-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev