summaryrefslogtreecommitdiffstats
path: root/configure.ac
diff options
context:
space:
mode:
authorEmil Velikov <[email protected]>2014-02-04 17:26:38 +0000
committerEmil Velikov <[email protected]>2014-02-18 00:00:19 +0000
commitee55500c22a000d95ef4e5855b150f35ea0b5bba (patch)
tree255844304eff486161f5f191e93d7a28275c4dd3 /configure.ac
parent35f6eed742fa8d9ede8bd781fbd89a0212815de4 (diff)
configure: cleanup classic dri drivers handling
* Make sure that only drivers that are handled by configure.ac are included in DRI_DIRS. * Change with_dri_drivers default value to auto, and set enable autodetection, when enable_opengl is on. v2: Move "test" to the correct location. v3: Squash DRI_DIRS handling before the switch statement. Suggested by Ilia Mirkin Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Matt Turner <[email protected]>
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac122
1 files changed, 59 insertions, 63 deletions
diff --git a/configure.ac b/configure.ac
index ee6d253664b..0c9044b5e50 100644
--- a/configure.ac
+++ b/configure.ac
@@ -948,37 +948,20 @@ AC_ARG_WITH([dri-drivers],
[comma delimited classic DRI drivers list, e.g.
"swrast,i965,radeon" @<:@default=auto@:>@])],
[with_dri_drivers="$withval"],
- [with_dri_drivers=yes])
-if test "x$with_dri_drivers" = x; then
- with_dri_drivers=no
-fi
+ [with_dri_drivers=auto])
-dnl If $with_dri_drivers is yes, directories will be added through
-dnl platform checks
-DRI_DIRS=""
case "$with_dri_drivers" in
no) ;;
-yes)
+auto)
# classic DRI drivers
if test "x$enable_opengl" = xyes; then
- DRI_DIRS="yes"
- fi
- ;;
-*)
- # 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([classic DRI driver directory '$driver' does not exist])
- done
- DRI_DIRS="$dri_drivers"
- if test -n "$DRI_DIRS" -a "x$enable_opengl" != xyes; then
- AC_MSG_ERROR([--with-dri-drivers requires OpenGL])
+ with_dri_drivers="yes"
fi
;;
esac
-dnl Set DRI_DIRS, DEFINES and LIB_DEPS
+dnl If $with_dri_drivers is yes, drivers will be added through
+dnl platform checks. Set DEFINES and LIB_DEPS
if test "x$enable_dri" = xyes; then
# Platform specific settings and drivers to build
case "$host_os" in
@@ -992,8 +975,8 @@ if test "x$enable_dri" = xyes; then
case "$host_cpu" in
powerpc* | sparc*)
# Build only the drivers for cards that exist on PowerPC/sparc
- if test "x$DRI_DIRS" = "xyes"; then
- DRI_DIRS="r200 radeon swrast"
+ if test "x$with_dri_drivers" = "xyes"; then
+ with_dri_drivers="r200 radeon swrast"
fi
;;
esac
@@ -1011,19 +994,17 @@ if test "x$enable_dri" = xyes; then
;;
cygwin*)
DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1"
- if test "x$DRI_DIRS" = "xyes"; then
- DRI_DIRS="swrast"
+ if test "x$with_dri_drivers" = "xyes"; then
+ with_dri_drivers="swrast"
fi
;;
esac
# default drivers
- if test "x$DRI_DIRS" = "xyes"; then
- DRI_DIRS="i915 i965 nouveau r200 radeon swrast"
+ if test "x$with_dri_drivers" = "xyes"; then
+ with_dri_drivers="i915 i965 nouveau r200 radeon swrast"
fi
- DRI_DIRS=`echo "$DRI_DIRS" | $SED 's/ */ /g'`
-
# Check for expat
PKG_CHECK_EXISTS([EXPAT], [have_expat=yes], [have_expat=no])
if test "x$have_expat" = "xyes"; then
@@ -1035,8 +1016,8 @@ if test "x$enable_dri" = xyes; then
fi
# If we are building any DRI driver other than swrast.
- if test -n "$DRI_DIRS"; then
- if test x"$DRI_DIRS" != xswrast; then
+ if test -n "$with_dri_drivers"; then
+ if test "x$with_dri_drivers" != xswrast; then
# ... libdrm is required
if test "x$have_libdrm" != xyes; then
AC_MSG_ERROR([DRI drivers requires libdrm >= $LIBDRM_REQUIRED])
@@ -1053,38 +1034,55 @@ if test "x$enable_dri" = xyes; then
fi
+AC_SUBST([DRI_LIB_DEPS])
+AC_SUBST([GALLIUM_DRI_LIB_DEPS])
+
+DRI_DIRS=""
+dnl Duplicates in DRI_DIRS are removed by sorting it after this block
+if test -n "$with_dri_drivers"; then
+ if test "x$enable_opengl" != xyes; then
+ AC_MSG_ERROR([--with-dri-drivers requires OpenGL])
+ fi
+
+ dri_drivers=`IFS=', '; echo $with_dri_drivers`
+ for driver in $dri_drivers; do
+ DRI_DIRS+="$driver "
+ case "x$driver" in
+ xi915)
+ HAVE_I915_DRI=yes;
+ PKG_CHECK_MODULES([INTEL], [libdrm_intel >= $LIBDRM_INTEL_REQUIRED])
+ ;;
+ xi965)
+ HAVE_I965_DRI=yes;
+ PKG_CHECK_MODULES([INTEL], [libdrm_intel >= $LIBDRM_INTEL_REQUIRED])
+ ;;
+ xnouveau)
+ HAVE_NOUVEAU_DRI=yes;
+ PKG_CHECK_MODULES([NOUVEAU], [libdrm_nouveau >= $LIBDRM_NVVIEUX_REQUIRED])
+ ;;
+ xradeon)
+ HAVE_RADEON_DRI=yes;
+ PKG_CHECK_MODULES([RADEON], [libdrm_radeon >= $LIBDRM_RADEON_REQUIRED])
+ ;;
+ xr200)
+ HAVE_R200_DRI=yes;
+ PKG_CHECK_MODULES([RADEON], [libdrm_radeon >= $LIBDRM_RADEON_REQUIRED])
+ ;;
+ xswrast)
+ HAVE_SWRAST_DRI=yes;
+ ;;
+ *)
+ AC_MSG_ERROR([classic DRI driver '$driver' does not exist])
+ ;;
+ esac
+ done
+fi
+DRI_DIRS=`echo $DRI_DIRS|tr " " "\n"|sort -u|tr "\n" " "`
+
AM_CONDITIONAL(NEED_MEGADRIVER, test -n "$DRI_DIRS")
AM_CONDITIONAL(NEED_LIBMESA, test "x$enable_xlib_glx" = xyes -o \
"x$enable_osmesa" = xyes -o \
-n "$DRI_DIRS")
-AC_SUBST([DRI_LIB_DEPS])
-AC_SUBST([GALLIUM_DRI_LIB_DEPS])
-
-case $DRI_DIRS in
-*i915*)
- PKG_CHECK_MODULES([INTEL], [libdrm_intel >= $LIBDRM_INTEL_REQUIRED])
- HAVE_I915_DRI=yes;
- ;;
-*i965*)
- PKG_CHECK_MODULES([INTEL], [libdrm_intel >= $LIBDRM_INTEL_REQUIRED])
- HAVE_I965_DRI=yes;
- ;;
-*nouveau*)
- PKG_CHECK_MODULES([NOUVEAU], [libdrm_nouveau >= $LIBDRM_NVVIEUX_REQUIRED])
- HAVE_NOUVEAU_DRI=yes;
- ;;
-*radeon*)
- PKG_CHECK_MODULES([RADEON], [libdrm_radeon >= $LIBDRM_RADEON_REQUIRED])
- HAVE_RADEON_DRI=yes;
- ;;
-*r200*)
- PKG_CHECK_MODULES([RADEON], [libdrm_radeon >= $LIBDRM_RADEON_REQUIRED])
- HAVE_R200_DRI=yes;
- ;;
-*swrast*)
- HAVE_SWRAST_DRI=yes;
- ;;
-esac
dnl
dnl OSMesa configuration
@@ -2125,12 +2123,10 @@ xnono)
esac
if test "x$enable_dri" != xno; then
- # cleanup the drivers var
- dri_dirs=`echo $DRI_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
if test "x$DRI_DIRS" = x; then
echo " DRI drivers: no"
else
- echo " DRI drivers: $dri_dirs"
+ echo " DRI drivers: $DRI_DIRS"
fi
echo " DRI driver dir: $DRI_DRIVER_INSTALL_DIR"
fi