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.7], [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_0])
22 OPENCL_VERSION="m4_translit(REQ_OPENCL_VERSION, [_], [.])"
23 AC_SUBST([OPENCL_VERSION])
25 # Checks for programs.
31 AC_PATH_PROG([ASCIIDOC], [asciidoc], [])
32 AC_PATH_PROG([A2X], [a2x], [])
33 AC_PATH_PROG([XMLTO], [xmlto], [])
34 AM_CONDITIONAL([GEN_DOC], [\
35 test x"$ASCIIDOC" != x && \
36 test x"$A2X" != x && \
37 test x"$XMLTO" != x ])
39 # Checks for libraries.
40 AC_CHECK_LIB([dl], [dlopen])
42 # Checks for header files.
43 AC_CHECK_HEADERS([stdlib.h string.h])
47 AC_CHECK_HEADER([OpenCL/opencl.h],[cl_h=yes])
50 AC_CHECK_HEADER([CL/opencl.h],[cl_h=yes])
53 if test $cl_h = yes; then
54 AC_MSG_CHECKING([whether OpenCL headers $OPENCL_VERSION are available])
57 #if defined(__APPLE__) || defined(__MACOSX)
58 # include <OpenCL/opencl.h>
60 # include <CL/opencl.h>
62 #ifndef CL_VERSION_]REQ_OPENCL_VERSION[
63 # error Cannot find CL_VERSION_]REQ_OPENCL_VERSION[ symbol
74 # Checks for typedefs, structures, and compiler characteristics.
79 NO_DEPRECATED_DECLARATIONS_FLAGS=
80 AX_CHECK_COMPILER_FLAGS([-Wno-deprecated-declarations],
81 [NO_DEPRECATED_DECLARATIONS_FLAGS="-Wno-deprecated-declarations"])
82 AC_SUBST([NO_DEPRECATED_DECLARATIONS_FLAGS])
84 # Checks for library functions.
87 AC_CHECK_FUNCS([strstr])
89 # --enable-pthread-once
90 AC_ARG_ENABLE([pthread-once],
91 [AS_HELP_STRING([--enable-pthread-once],
92 [use pthread_once() to ensure correct initialisation without polling])],
93 [pthread_once=$enableval],
96 if test "$pthread_once" = yes ; then
98 AC_DEFINE([USE_PTHREAD], [1],
99 [pthreads are available])
101 AC_MSG_ERROR([No pthread detected on this platform!])
105 # --enable-official-khronos-headers
106 AC_ARG_ENABLE([official-khronos-headers],
107 [AS_HELP_STRING([--enable-official-khronos-headers],
108 [use official Khronos OpenCL headers provided in the sources instead of OpenCL headers installed on the system])],
109 [khronos_headers=$enableval],
110 [khronos_headers=may])
112 AS_CASE([$cl_h,$khronos_headers],
113 [no,no], [AC_MSG_ERROR([No $OPENCL_VERSION OpenCL headers available and --disable-official-khronos-headers used])],
114 [no,*], [khronos_headers=yes],
115 [yes,yes], [AC_MSG_WARN([Using internal copy of OpenCL headers as requested, even if they are available on the system])],
116 [yes,*], [khronos_headers=no],
117 [AC_MSG_ERROR([Internal error. Please, report this bug])])
119 if test $khronos_headers = no; then
120 AC_MSG_NOTICE([using system OpenCL headers])
122 AC_MSG_NOTICE([using internal copy of OpenCL headers])
123 AM_CPPFLAGS="$AM_CPPFLAGS -I\${abs_top_srcdir}/khronos-headers"
124 AC_SUBST([AM_CPPFLAGS])
128 AC_ARG_ENABLE([debug],
129 [AS_HELP_STRING([--disable-debug],
130 [remove debug and additionnal checks (default is included)])],
131 [use_debug=$enableval],
133 if test "x$use_debug" != xno ; then
134 AC_DEFINE([DEBUG_OCL_ICD], [1],
135 [Add DEBUG additionnal code])
138 # --enable-update-database
139 AC_ARG_ENABLE([update-database],
140 [AS_HELP_STRING([--enable-update-database],
141 [update the YAML database from the currently installed ICD Loader and OpenCL headers (root access required)])],
142 [update_database=$enableval],
143 [update_database=no])
144 AM_CONDITIONAL([UPDATE_DATABASE], [test x"$update_database" != xno])
146 # always use versionned symbols (check required for MacOSX)
147 AM_CONDITIONAL([USE_MAP], [true])