autoconf: Configurable DRI drivers
authorDan Nicholson <dbn.lists@gmail.com>
Thu, 15 Nov 2007 16:59:57 +0000 (08:59 -0800)
committerDan Nicholson <dbn.lists@gmail.com>
Fri, 7 Dec 2007 22:34:27 +0000 (14:34 -0800)
The user can request specific DRI drivers to build rather than the
default of "all that build on this platform". This allows the list of
drivers to be easily slimmed down.

This is controlled through the option --with-dri-drivers. For example:

    ./configure --with-driver=dri --with-dri-drivers="i965,nouveau"

Unfortunately, using this setting means the DRI drivers aren't filtered
by platform anymore and you might try to build something that doesn't
work.

configure.ac

index 814fb2e364fb4b216f20189c9fbc7b067a2449f5..c639378d0e8515c3d1db56f1059fa3d98f183341 100644 (file)
@@ -325,8 +325,8 @@ AC_ARG_ENABLE(glx-tls,
         GLX_USE_TLS="$enableval",
         GLX_USE_TLS=no)
 dnl Directory for DRI drivers
-AC_ARG_WITH(dridriverdir,
-    [AS_HELP_STRING([--with-dridriverdir=DIR],
+AC_ARG_WITH(dri-driverdir,
+    [AS_HELP_STRING([--with-dri-driverdir=DIR],
         [directory for the DRI drivers @<:@/usr/X11R6/lib/modules/dri@:>@])],
     DRI_DRIVER_INSTALL_DIR="$withval",
     DRI_DRIVER_INSTALL_DIR='/usr/X11R6/lib/modules/dri')
@@ -338,6 +338,32 @@ AC_ARG_ENABLE(driglx-direct,
         driglx_direct="$enableval",
         driglx_direct="yes")
 
+dnl Which drivers to build - default is chosen by platform
+AC_ARG_WITH(dri-drivers,
+    [AS_HELP_STRING([--with-dri-drivers@<:@=DIRS...@:>@],
+        [comma delimited DRI drivers to build @<:@default=auto by platform@:>@])],
+    with_dri_drivers="$withval",
+    with_dri_drivers=yes)
+if test "x$with_dri_drivers" = x; then
+    with_dri_drivers=no
+fi
+
+dnl If $with_dri_drivers is yes, directories will be added through
+dnl platform checks
+DRI_DIRS=""
+case "$with_dri_drivers" in
+no|yes) ;;
+*)
+    # verify the requested driver directories exist
+    dri_drivers=`IFS=,; echo $with_dri_drivers`
+    for driver in $dri_drivers; do
+        test -d "$srcdir/src/mesa/drivers/dri/$driver" || \
+            AC_MSG_ERROR([DRI driver directory '$driver' doesn't exist])
+    done
+    DRI_DIRS="$dri_drivers"
+    ;;
+esac
+
 dnl Just default to no EGL for now
 USING_EGL=0
 AC_SUBST(USING_EGL)
@@ -364,15 +390,21 @@ if test "$mesa_driver" = dri; then
 
         case "$host_cpu" in
         i*86)
-            DRI_DIRS="i810 i915tex i915 i965 mach64 mga r128 r200 r300 \
-                radeon s3v savage sis tdfx trident unichrome ffb"
+            if test "x$DRI_DIRS" = x; then
+                DRI_DIRS="i810 i915tex i915 i965 mach64 mga r128 r200 r300 \
+                    radeon s3v savage sis tdfx trident unichrome ffb"
+            fi
             ;;
         x86_64)
-            DRI_DIRS="i915tex i915 i965 mach64 mga r128 r200 radeon tdfx \
-                unichrome savage r300"
+            if test "x$DRI_DIRS" = x; then
+                DRI_DIRS="i915tex i915 i965 mach64 mga r128 r200 radeon tdfx \
+                    unichrome savage r300"
+            fi
             ;;
         powerpc*)
-            DRI_DIRS="mach64 r128 r200 r300 radeon tdfx"
+            if test "x$DRI_DIRS" = x; then
+                DRI_DIRS="mach64 r128 r200 r300 radeon tdfx"
+            fi
             ;;
         esac
         ;;
@@ -387,8 +419,10 @@ if test "$mesa_driver" = dri; then
             CXXFLAGS="$CXXFLAGS -ansi -pedantic"
         fi
 
-        DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 radeon tdfx \
-            unichrome savage sis"
+        if test "x$DRI_DIRS" = x; then
+            DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 radeon tdfx \
+                unichrome savage sis"
+        fi
         ;;
     esac
     DRI_DIRS=`echo "$DRI_DIRS" | $SED 's/  */ /g'`