2 # Process this file with autoconf to produce a configure script.
4 # Copyright (c) 2012-2015, Brice Videau <brice.videau@imag.fr>
5 # Copyright (c) 2012-2015, Vincent Danjean <Vincent.Danjean@ens-lyon.org>
9 AC_INIT([OpenCL ICD Loader], [2.2.9], [ocl-icd-devel@lists.forge.imag.fr], [ocl-icd])
10 AC_CONFIG_SRCDIR([ocl_icd_loader.c])
11 AC_CONFIG_AUX_DIR([build-aux])
12 AC_CONFIG_HEADERS([config.h])
13 AC_CONFIG_MACRO_DIR([m4])
14 AM_INIT_AUTOMAKE([-Wall -Werror foreign 1.9 tar-pax check-news color-tests parallel-tests])
15 AMX_SILENT_RULES([AM_DEFAULT_VERBOSITY=1])
16 # AM_PROG_AR must be called before LT_INIT...
18 LT_INIT([disable-static])
19 AC_CONFIG_TESTDIR([tests], [.])
21 m4_define([REQ_OPENCL_VERSION],[2_1])
22 OPENCL_VERSION="m4_translit(REQ_OPENCL_VERSION, [_], [.])"
23 AC_SUBST([OPENCL_VERSION])
24 AC_DEFINE_UNQUOTED([OCL_ICD_OPENCL_VERSION], ["$OPENCL_VERSION"],
25 [supported OpenCL version])
27 # Checks for programs.
33 AC_PATH_PROG([ASCIIDOC], [asciidoc], [])
34 AC_PATH_PROG([A2X], [a2x], [])
35 AC_PATH_PROG([XMLTO], [xmlto], [])
36 AM_CONDITIONAL([GEN_DOC], [\
37 test x"$ASCIIDOC" != x && \
38 test x"$A2X" != x && \
39 test x"$XMLTO" != x ])
41 # Checks for libraries.
42 AC_CHECK_LIB([dl], [dlopen])
44 # Checks for header files.
45 AC_CHECK_HEADERS([stdlib.h string.h])
49 AC_CHECK_HEADER([OpenCL/opencl.h],[cl_h=yes])
52 AC_CHECK_HEADER([CL/opencl.h],[cl_h=yes])
55 if test $cl_h = yes; then
56 AC_MSG_CHECKING([whether OpenCL headers $OPENCL_VERSION are available])
59 #if defined(__APPLE__) || defined(__MACOSX)
60 # include <OpenCL/opencl.h>
62 # include <CL/opencl.h>
64 #ifndef CL_VERSION_]REQ_OPENCL_VERSION[
65 # error Cannot find CL_VERSION_]REQ_OPENCL_VERSION[ symbol
76 # Checks for typedefs, structures, and compiler characteristics.
81 NO_DEPRECATED_DECLARATIONS_FLAGS=
82 AX_CHECK_COMPILER_FLAGS([-Wno-deprecated-declarations],
83 [NO_DEPRECATED_DECLARATIONS_FLAGS="-Wno-deprecated-declarations"])
84 AC_SUBST([NO_DEPRECATED_DECLARATIONS_FLAGS])
86 # Checks for library functions.
89 AC_CHECK_FUNCS([strstr])
91 # --enable-pthread-once
92 AC_ARG_ENABLE([pthread-once],
93 [AS_HELP_STRING([--enable-pthread-once],
94 [use pthread_once() to ensure correct initialisation without polling])],
95 [pthread_once=$enableval],
98 if test "$pthread_once" = yes ; then
100 AC_DEFINE([USE_PTHREAD], [1],
101 [pthreads are available])
103 AC_MSG_ERROR([No pthread detected on this platform!])
107 # --enable-official-khronos-headers
108 AC_ARG_ENABLE([official-khronos-headers],
109 [AS_HELP_STRING([--enable-official-khronos-headers],
110 [use official Khronos OpenCL headers provided in the sources instead of OpenCL headers installed on the system])],
111 [khronos_headers=$enableval],
112 [khronos_headers=may])
114 AS_CASE([$cl_h,$khronos_headers],
115 [no,no], [AC_MSG_ERROR([No $OPENCL_VERSION OpenCL headers available and --disable-official-khronos-headers used])],
116 [no,*], [khronos_headers=yes],
117 [yes,yes], [AC_MSG_WARN([Using internal copy of OpenCL headers as requested, even if they are available on the system])],
118 [yes,*], [khronos_headers=no],
119 [AC_MSG_ERROR([Internal error. Please, report this bug])])
121 if test $khronos_headers = no; then
122 AC_MSG_NOTICE([using system OpenCL headers])
124 AC_MSG_NOTICE([using internal copy of OpenCL headers])
125 AM_CPPFLAGS="$AM_CPPFLAGS -I\${abs_top_srcdir}/khronos-headers"
126 AC_SUBST([AM_CPPFLAGS])
130 AC_ARG_ENABLE([debug],
131 [AS_HELP_STRING([--disable-debug],
132 [remove debug and additionnal checks (default is included)])],
133 [use_debug=$enableval],
135 if test "x$use_debug" != xno ; then
136 AC_DEFINE([DEBUG_OCL_ICD], [1],
137 [Add DEBUG additionnal code])
140 # --enable-update-database
141 AC_ARG_ENABLE([update-database],
142 [AS_HELP_STRING([--enable-update-database],
143 [update the YAML database from the currently installed ICD Loader and OpenCL headers (root access required)])],
144 [update_database=$enableval],
145 [update_database=no])
146 AM_CONDITIONAL([UPDATE_DATABASE], [test x"$update_database" != xno])
148 # always use versionned symbols (check required for MacOSX)
149 AM_CONDITIONAL([USE_MAP], [true])