[Mesa-dev] [PATCH] clover: replace --enable-opencl-icd with --with-opencl-icd

EdB edb+mesa at sigluy.net
Wed May 6 14:34:26 PDT 2015


The standard ICD file path is /etc/OpenCL/vendor/.
However it doesn't fit well with custom build.
This option allow ICD vendor file installation path override
---
 configure.ac                           | 46 +++++++++++++++++++++++-----------
 src/gallium/targets/opencl/Makefile.am |  2 +-
 2 files changed, 33 insertions(+), 15 deletions(-)

diff --git a/configure.ac b/configure.ac
index 095e23e..90dba4e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -804,12 +804,6 @@ AC_ARG_ENABLE([opencl],
          [enable OpenCL library @<:@default=disabled@:>@])],
    [enable_opencl="$enableval"],
    [enable_opencl=no])
-AC_ARG_ENABLE([opencl_icd],
-   [AS_HELP_STRING([--enable-opencl-icd],
-          [Build an OpenCL ICD library to be loaded by an ICD implementation
-           @<:@default=disabled@:>@])],
-    [enable_opencl_icd="$enableval"],
-    [enable_opencl_icd=no])
 AC_ARG_ENABLE([xlib-glx],
     [AS_HELP_STRING([--enable-xlib-glx],
         [make GLX library Xlib-based instead of DRI-based @<:@default=disabled@:>@])],
@@ -1689,19 +1683,11 @@ if test "x$enable_opencl" = xyes; then
     # XXX: Use $enable_shared_pipe_drivers once converted to use static/shared pipe-drivers
     enable_gallium_loader=yes
 
-    if test "x$enable_opencl_icd" = xyes; then
-        OPENCL_LIBNAME="MesaOpenCL"
-    else
-        OPENCL_LIBNAME="OpenCL"
-    fi
-
     if test "x$have_libelf" != xyes; then
        AC_MSG_ERROR([Clover requires libelf])
     fi
 fi
 AM_CONDITIONAL(HAVE_CLOVER, test "x$enable_opencl" = xyes)
-AM_CONDITIONAL(HAVE_CLOVER_ICD, test "x$enable_opencl_icd" = xyes)
-AC_SUBST([OPENCL_LIBNAME])
 
 dnl
 dnl Gallium configuration
@@ -2006,6 +1992,38 @@ AC_ARG_WITH([d3d-libdir],
     [D3D_DRIVER_INSTALL_DIR="${libdir}/d3d"])
 AC_SUBST([D3D_DRIVER_INSTALL_DIR])
 
+dnl OpenCL ICD
+
+AC_ARG_WITH([opencl-icd],
+    [AS_HELP_STRING([--with-opencl-icd=@<:@no,standard,sysconfdir@:>@],
+        [Build an OpenCL ICD library to be loaded by an ICD implementation.
+         If @<:@standard@:>@ the OpenCL ICD vendor file installs in /etc/OpenCL/vendors.
+         @<:@sysconfdir@:>@ installs the file in $sysconfdir/OpenCL/vendors
+         @<:@default=no@:>@])],
+    [OPENCL_ICD="$withval"],
+    [OPENCL_ICD="no"])
+
+case "x$OPENCL_ICD" in
+xno)
+    OPENCL_LIBNAME="OpenCL"
+    ;;
+xstandard)
+    OPENCL_LIBNAME="MesaOpenCL"
+    ICD_FILE_DIR="/etc/OpenCL/vendors"
+    ;;
+xsysconfdir)
+    OPENCL_LIBNAME="MesaOpenCL"
+    ICD_FILE_DIR="$sysconfdir/OpenCL/vendors"
+    ;;
+*)
+    AC_MSG_ERROR(['$OPENCL_ICD' is not a valid option for --with-opencl-icd])
+    ;;
+esac
+
+AM_CONDITIONAL(HAVE_CLOVER_ICD, test "x$OPENCL_ICD" != xno)
+AC_SUBST([OPENCL_LIBNAME])
+AC_SUBST([ICD_FILE_DIR])
+
 dnl
 dnl Gallium helper functions
 dnl
diff --git a/src/gallium/targets/opencl/Makefile.am b/src/gallium/targets/opencl/Makefile.am
index 5daf327..781daa0 100644
--- a/src/gallium/targets/opencl/Makefile.am
+++ b/src/gallium/targets/opencl/Makefile.am
@@ -47,7 +47,7 @@ EXTRA_lib at OPENCL_LIBNAME@_la_DEPENDENCIES = opencl.sym
 EXTRA_DIST = mesa.icd opencl.sym
 
 if HAVE_CLOVER_ICD
-icddir = /etc/OpenCL/vendors/
+icddir = $(ICD_FILE_DIR)
 icd_DATA = mesa.icd
 endif
 
-- 
2.1.0



More information about the mesa-dev mailing list