Remove useless vendor_icd.first_platform
[ocl-icd] / configure.ac
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
3
4 AC_PREREQ([2.67])
5 AC_INIT([OpenCL ICD Loader], [2.2.4], [ocl-icd-devel@lists.forge.imag.fr], [ocl-icd])
6 AC_CONFIG_SRCDIR([ocl_icd_loader.c])
7 AC_CONFIG_AUX_DIR([build-aux])
8 AC_CONFIG_HEADERS([config.h])
9 AC_CONFIG_MACRO_DIR([m4])
10 AM_INIT_AUTOMAKE([-Wall -Werror foreign 1.9 tar-pax check-news color-tests parallel-tests])
11 AMX_SILENT_RULES([AM_DEFAULT_VERBOSITY=1])
12 # AM_PROG_AR must be called before LT_INIT...
13 AM_PROG_AR
14 LT_INIT([disable-static])
15 AC_CONFIG_TESTDIR([tests], [.])
16
17 OPENCL_VERSION="2.0"
18 AC_SUBST([OPENCL_VERSION])
19
20 # Checks for programs.
21 AC_PROG_CC_C89
22 AC_PROG_INSTALL
23 AC_PROG_LN_S
24 AM_PROG_CC_C_O
25
26 AC_PATH_PROG([ASCIIDOC], [asciidoc], [])
27 AC_PATH_PROG([A2X], [a2x], [])
28 AC_PATH_PROG([XMLTO], [xmlto], [])
29 AM_CONDITIONAL([GEN_DOC], [\
30         test x"$ASCIIDOC" != x && \
31         test x"$A2X" != x && \
32         test x"$XMLTO" != x ])
33
34 # Checks for libraries.
35 AC_CHECK_LIB([dl], [dlopen])
36
37 # Checks for header files.
38 AC_CHECK_HEADERS([stdlib.h string.h])
39 cl_h=no
40 case $host_os in
41   darwin* )
42     AC_CHECK_HEADER([OpenCL/opencl.h],[cl_h=yes])
43     ;;
44   * )
45     AC_CHECK_HEADER([CL/opencl.h],[cl_h=yes])
46     ;;
47 esac
48 if test $cl_h = yes; then
49   AC_MSG_CHECKING([whether OpenCL headers 2.0 are available])
50   AC_PREPROC_IFELSE([
51     AC_LANG_PROGRAM([[
52 #if defined(__APPLE__) || defined(__MACOSX)
53 #  include <OpenCL/opencl.h>
54 #else
55 #  include <CL/opencl.h>
56 #endif
57 #ifndef CL_VERSION_2_0
58 #  error Cannot find CL_VERSION_2_0 symbol
59 #endif
60       ]], [[
61       ]])],[
62     AC_MSG_RESULT([yes])
63   ],[
64     AC_MSG_RESULT([no])
65     cl_h=no
66   ])
67 fi
68
69 # Checks for typedefs, structures, and compiler characteristics.
70 AC_C_INLINE
71 AC_TYPE_SIZE_T
72 AC_C_CONST
73
74 NO_DEPRECATED_DECLARATIONS_FLAGS=
75 AX_CHECK_COMPILER_FLAGS([-Wno-deprecated-declarations],
76   [NO_DEPRECATED_DECLARATIONS_FLAGS="-Wno-deprecated-declarations"])
77 AC_SUBST([NO_DEPRECATED_DECLARATIONS_FLAGS])
78
79 # Checks for library functions.
80 AC_FUNC_MALLOC
81 AC_FUNC_REALLOC
82 AC_CHECK_FUNCS([strstr])
83
84 # --enable-pthread-once
85 AC_ARG_ENABLE([pthread-once],
86   [AS_HELP_STRING([--enable-pthread-once],
87                [use pthread_once() to ensure correct initialisation without polling])],
88   [pthread_once=$enableval],
89   [pthread_once=no])
90
91 if test "$pthread_once" = yes ; then
92   AX_PTHREAD([
93     AC_DEFINE([USE_PTHREAD], [1],
94               [pthreads are available])
95   ], [
96     AC_MSG_ERROR([No pthread detected on this platform!])
97   ])
98 fi
99
100 # --enable-official-khronos-headers
101 AC_ARG_ENABLE([official-khronos-headers],
102   [AS_HELP_STRING([--enable-official-khronos-headers],
103                [use official Khronos OpenCL headers provided in the sources instead of OpenCL headers installed on the system])],
104   [khronos_headers=$enableval],
105   [khronos_headers=may])
106
107 AS_CASE([$cl_h,$khronos_headers],
108   [no,no], [AC_MSG_ERROR([No 2.0 OpenCL headers available and --disable-official-khronos-headers used])],
109   [no,*], [khronos_headers=yes],
110   [yes,yes], [AC_MSG_WARN([Using internal copy of OpenCL headers as requested, even if they are available on the system])],
111   [yes,*], [khronos_headers=no],
112   [AC_MSG_ERROR([Internal error. Please, report this bug])])
113
114 if test $khronos_headers = no; then
115   AC_MSG_NOTICE([using system OpenCL headers])
116 else
117   AC_MSG_NOTICE([using internal copy of OpenCL headers])
118   AM_CPPFLAGS="$AM_CPPFLAGS -I\${abs_top_srcdir}/khronos-headers"
119   AC_SUBST([AM_CPPFLAGS])
120 fi
121
122 # --disable-debug
123 AC_ARG_ENABLE([debug],
124   [AS_HELP_STRING([--disable-debug],
125                [remove debug and additionnal checks (default is included)])],
126   [use_debug=$enableval],
127   [use_debug=yes])
128 if  test "x$use_debug" != xno ; then
129   AC_DEFINE([DEBUG_OCL_ICD], [1],
130             [Add DEBUG additionnal code])
131 fi
132
133 # --enable-update-database
134 AC_ARG_ENABLE([update-database],
135   [AS_HELP_STRING([--enable-update-database],
136                [update the YAML database from the currently installed ICD Loader and OpenCL headers (root access required)])],
137   [update_database=$enableval],
138   [update_database=no])
139 AM_CONDITIONAL([UPDATE_DATABASE], [test x"$update_database" != xno])
140
141 # always use versionned symbols (check required for MacOSX)
142 AM_CONDITIONAL([USE_MAP], [true])
143
144 AC_CONFIG_FILES([
145   Makefile
146   doc/Makefile
147   tests/Makefile
148
149   OpenCL.pc
150   ocl-icd.pc
151   tests/atlocal
152 ])
153 AC_OUTPUT