Allow osmesa to be enabled or disabled

The conditional in src/mesa/Makefile currently hardcodes the cases where
libOSMesa can be built on libGL. Likewise, the xlib case always includes
libOSMesa in the stand-alone target.

This changes the conditional to a loop over the DRIVER_DIRS variable.
This means that any driver configuration can enable or disable osmesa.
The current "stand-alone" rule is changed so that DRIVER_DIRS=x11 and
DRIVER_DIRS="x11 osmesa" are both respected.

The configure option is changed to --enable-gl-osmesa as this change
allows libOSMesa to be built upon any of the libGL-enabling drivers.
This commit is contained in:
Dan Nicholson
2007-12-30 08:41:53 -08:00
parent 540faf5f91
commit 544ab209e7
3 changed files with 41 additions and 49 deletions

View File

@@ -523,20 +523,20 @@ dnl
dnl OSMesa configuration dnl OSMesa configuration
dnl dnl
if test "$mesa_driver" = xlib; then if test "$mesa_driver" = xlib; then
default_xlib_osmesa=yes default_gl_osmesa=yes
else else
default_xlib_osmesa=no default_gl_osmesa=no
fi fi
AC_ARG_ENABLE(xlib-osmesa, AC_ARG_ENABLE(gl-osmesa,
[AS_HELP_STRING([--disable-xlib-osmesa], [AS_HELP_STRING([--enable-gl-osmesa],
[enable OSMesa on Xlib libGL @<:@default=enabled for xlib driver@:>@])], [enable OSMesa on libGL @<:@default=enabled for xlib driver@:>@])],
xlib_osmesa="$enableval", gl_osmesa="$enableval",
xlib_osmesa="$default_xlib_osmesa") gl_osmesa="$default_gl_osmesa")
if test "x$xlib_osmesa" = xyes; then if test "x$gl_osmesa" = xyes; then
if test "$mesa_driver" = xlib; then if test "$mesa_driver" = osmesa; then
DRIVER_DIRS="$DRIVER_DIRS osmesa" AC_MSG_ERROR([libGL is not available for OSMesa driver])
else else
AC_MSG_ERROR([Can only enable OSMesa on libGL for Xlib]) DRIVER_DIRS="$DRIVER_DIRS osmesa"
fi fi
fi fi
@@ -822,21 +822,17 @@ echo " libdir: $libdir"
dnl Driver info dnl Driver info
echo "" echo ""
echo " Driver: $mesa_driver" echo " Driver: $mesa_driver"
case "$mesa_driver" in if echo "$DRIVER_DIRS" | grep 'osmesa' >/dev/null 2>&1; then
xlib|osmesa) echo " OSMesa: lib$OSMESA_LIB"
if echo "$DRIVER_DIRS" | grep 'osmesa' >/dev/null 2>&1; then else
echo " OSMesa: lib$OSMESA_LIB" echo " OSMesa: no"
else fi
echo " OSMesa: no" if test "$mesa_driver" = dri; then
fi
;;
dri)
# cleanup the drivers var # cleanup the drivers var
dri_dirs=`echo $DRI_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'` dri_dirs=`echo $DRI_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
echo " DRI drivers: $dri_dirs" echo " DRI drivers: $dri_dirs"
echo " DRI driver dir: $DRI_DRIVER_INSTALL_DIR" echo " DRI driver dir: $DRI_DRIVER_INSTALL_DIR"
;; fi
esac
dnl Libraries dnl Libraries
echo "" echo ""

View File

@@ -116,6 +116,12 @@ be used. In this case, the <code>--with-x</code>,
<code>--x-includes</code> and <code>--x-libraries</code> options can <code>--x-includes</code> and <code>--x-libraries</code> options can
control the use of X for Mesa. control the use of X for Mesa.
</li> </li>
<li><code>--enable-gl-osmesa</code> - The <a href="osmesa.html">OSMesa
library</a> can be built on top of libGL for drivers that provide it.
This option controls whether to build libOSMesa. By default, this is
enabled for the Xlib driver and disabled otherwise. Note that this
option is different than using OSMesa as the driver.
</li>
<li><code>--enable-debug</code> - This option will enable compiler <li><code>--enable-debug</code> - This option will enable compiler
options and macros to aid in debugging the Mesa libraries. options and macros to aid in debugging the Mesa libraries.
</li> </li>
@@ -156,16 +162,6 @@ libraries, as well as the X11 development headers, will be need to
support the Xlib driver. support the Xlib driver.
</li> </li>
<!-- Xlib specific options -->
<p>
<ul>
<li><code>--disable-xlib-osmesa</code> - By default, the OSMesa library
will be built and linked to the Xlib enabled libGL. This option disables
building of libOSMesa.
</li>
</ul>
</p>
<a name="dri"> <a name="dri">
<li><b><em>DRI</em></b> - This mode uses the DRI hardware drivers for <li><b><em>DRI</em></b> - This mode uses the DRI hardware drivers for
accelerated OpenGL rendering. Enable the DRI drivers with the option accelerated OpenGL rendering. Enable the DRI drivers with the option

View File

@@ -25,19 +25,17 @@ GL_TINY = 0$(MESA_MAJOR)0$(MESA_MINOR)0$(MESA_TINY)
# Figure out what to make here # Figure out what to make here
default: default:
@if [ "${DRIVER_DIRS}" = "dri" ] ; then \ @for driver in $(DRIVER_DIRS) ; do \
$(MAKE) linux-solo ; \ case "$$driver" in \
elif [ "${DRIVER_DIRS}" = "osmesa" ] ; then \ x11) $(MAKE) stand-alone ;; \
$(MAKE) osmesa-only ; \ dri) $(MAKE) linux-solo ;; \
elif [ "$(DRIVER_DIRS)" = "beos" ]; then \ osmesa) $(MAKE) osmesa-only ;; \
$(MAKE) beos ; \ beos) $(MAKE) beos ;; \
elif [ "$(DRIVER_DIRS)" = "directfb" ]; then \ directfb) $(MAKE) directfb ;; \
$(MAKE) directfb ; \ fbdev) $(MAKE) fbdev ;; \
elif [ "$(DRIVER_DIRS)" = "fbdev osmesa" ]; then \ *) echo "$$driver is invalid in DRIVER_DIRS" >&2; exit 1;; \
$(MAKE) fbdev ; $(MAKE) osmesa-only ; \ esac ; \
else \ done
$(MAKE) stand-alone ; \
fi
###################################################################### ######################################################################
@@ -105,7 +103,7 @@ OSMESA16_OBJECTS = \
$(OSMESA_DRIVER_OBJECTS) $(OSMESA_DRIVER_OBJECTS)
stand-alone: depend subdirs $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME) stand-alone: depend subdirs $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME)
osmesa-only: depend subdirs $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME) osmesa-only: depend subdirs $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME)
@@ -174,9 +172,11 @@ install: default gl.pc
@if [ -e $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME) ]; then \ @if [ -e $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME) ]; then \
$(INSTALL) $(TOP)/$(LIB_DIR)/libOSMesa* $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR); \ $(INSTALL) $(TOP)/$(LIB_DIR)/libOSMesa* $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR); \
fi fi
@if [ "${DRIVER_DIRS}" = "dri" ] ; then \ @for target in $(DRIVER_DIRS); do \
cd drivers/dri ; $(MAKE) install ; \ case "$$target" in \
fi dri) cd drivers/dri ; $(MAKE) install ;; \
esac; \
done
## NOT INSTALLED YET: ## NOT INSTALLED YET:
## $(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/include/GLES ## $(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/include/GLES