forked from OCL-dev/ocl-icd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ac
197 lines (175 loc) · 5.71 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
#
# Copyright (c) 2012-2020, Brice Videau <bvideau@anl.gov>
# Copyright (c) 2012-2020, Vincent Danjean <Vincent.Danjean@ens-lyon.org>
AC_PREREQ([2.67])
AC_INIT([OpenCL ICD Loader], [2.3.1], [ocl-icd-devel@lists.forge.imag.fr], [ocl-icd])
AC_CONFIG_SRCDIR([ocl_icd_loader.c])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])
AC_CANONICAL_HOST
case $host_os in
*macos*) macos="yes" ;;
*darwin*) macos="yes" ;;
*) macos="no" ;;
esac
AM_INIT_AUTOMAKE([-Wall -Werror foreign 1.9 tar-pax check-news color-tests parallel-tests])
AMX_SILENT_RULES([AM_DEFAULT_VERBOSITY=1])
# AM_PROG_AR must be called before LT_INIT...
AM_PROG_AR
LT_INIT([disable-static])
AC_CONFIG_TESTDIR([tests], [.])
m4_define([REQ_OPENCL_VERSION],[3_0])
OPENCL_VERSION="m4_translit(REQ_OPENCL_VERSION, [_], [.])"
AC_SUBST([OPENCL_VERSION])
AC_DEFINE_UNQUOTED([OCL_ICD_OPENCL_VERSION], ["$OPENCL_VERSION"],
[supported OpenCL version])
# Checks for programs.
AC_PROG_CC_C89
AC_PROG_INSTALL
AC_PROG_LN_S
AM_PROG_CC_C_O
AC_PATH_PROG([ASCIIDOC], [asciidoc], [])
AC_PATH_PROG([A2X], [a2x], [])
AC_PATH_PROG([XMLTO], [xmlto], [])
AS_IF([ test x"$ASCIIDOC" != x && \
test x"$A2X" != x && \
test x"$XMLTO" != x ],
[
gen_doc=1
AC_MSG_NOTICE([generating documentation])
],
[
gen_doc=0
AC_MSG_NOTICE([documentation generation disabled])
])
AM_CONDITIONAL([GEN_DOC], [ test x"$gen_doc" = x1 ])
# Checks for libraries.
AC_CHECK_LIB([dl], [dlopen])
# Checks for header files.
AC_CHECK_HEADERS([stdlib.h string.h])
cl_h=no
case $host_os in
darwin* )
AC_CHECK_HEADER([OpenCL/opencl.h],[cl_h=yes])
AC_CHECK_HEADERS([OpenCL/cl_layer.h])
;;
* )
AC_CHECK_HEADER([CL/opencl.h],[cl_h=yes])
AC_CHECK_HEADERS([CL/cl_layer.h])
;;
esac
if test $cl_h = yes; then
AC_MSG_CHECKING([whether OpenCL headers $OPENCL_VERSION are available])
AC_PREPROC_IFELSE([
AC_LANG_PROGRAM([[
#if defined(__APPLE__) || defined(__MACOSX)
# include <OpenCL/opencl.h>
#else
# include <CL/opencl.h>
#endif
#ifndef CL_VERSION_]REQ_OPENCL_VERSION[
# error Cannot find CL_VERSION_]REQ_OPENCL_VERSION[ symbol
#endif
]], [[
]])],[
AC_MSG_RESULT([yes])
],[
AC_MSG_RESULT([no])
cl_h=no
])
fi
# Checks for typedefs, structures, and compiler characteristics.
AC_C_INLINE
AC_TYPE_SIZE_T
AC_C_CONST
NO_DEPRECATED_DECLARATIONS_FLAGS=
AX_CHECK_COMPILER_FLAGS([-Wno-deprecated-declarations],
[NO_DEPRECATED_DECLARATIONS_FLAGS="-Wno-deprecated-declarations"])
AC_SUBST([NO_DEPRECATED_DECLARATIONS_FLAGS])
# Checks for library functions.
AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_CHECK_FUNCS([strstr])
# --enable-pthread-once
AC_ARG_ENABLE([pthread-once],
[AS_HELP_STRING([--enable-pthread-once],
[use pthread_once() to ensure correct initialisation without polling])],
[pthread_once=$enableval],
[pthread_once=no])
if test "$pthread_once" = yes ; then
AX_PTHREAD([
AC_DEFINE([USE_PTHREAD], [1],
[pthreads are available])
], [
AC_MSG_ERROR([No pthread detected on this platform!])
])
fi
# --enable-official-khronos-headers
AC_ARG_ENABLE([official-khronos-headers],
[AS_HELP_STRING([--enable-official-khronos-headers],
[use official Khronos OpenCL headers provided in the sources instead of OpenCL headers installed on the system])],
[khronos_headers=$enableval],
[khronos_headers=may])
AS_CASE([$cl_h,$khronos_headers],
[no,no], [AC_MSG_ERROR([No $OPENCL_VERSION OpenCL headers available and --disable-official-khronos-headers used])],
[no,*], [khronos_headers=yes],
[yes,yes], [AC_MSG_WARN([Using internal copy of OpenCL headers as requested, even if they are available on the system])],
[yes,*], [khronos_headers=no],
[AC_MSG_ERROR([Internal error. Please, report this bug])])
if test $khronos_headers = no; then
AC_MSG_NOTICE([using system OpenCL headers])
else
AC_MSG_NOTICE([using internal copy of OpenCL headers])
AM_CPPFLAGS="$AM_CPPFLAGS -I\${abs_top_srcdir}/khronos-headers"
AC_SUBST([AM_CPPFLAGS])
fi
# --disable-debug
AC_ARG_ENABLE([debug],
[AS_HELP_STRING([--disable-debug],
[remove debug and additionnal checks (default is included)])],
[use_debug=$enableval],
[use_debug=yes])
if test "x$use_debug" != xno ; then
AC_DEFINE([DEBUG_OCL_ICD], [1],
[Add DEBUG additionnal code])
fi
# --enable-update-database
AC_ARG_ENABLE([update-database],
[AS_HELP_STRING([--enable-update-database],
[update the YAML database from the currently installed ICD Loader and OpenCL headers (root access required)])],
[update_database=$enableval],
[update_database=no])
AM_CONDITIONAL([UPDATE_DATABASE], [test x"$update_database" != xno])
# --enable-custom-vendordir
AC_ARG_ENABLE([custom-vendordir],
[AS_HELP_STRING([--enable-custom-vendordir],
[use the given directory instead of /etc/OpenCL/vendors to look for .icd files])],
[AS_CASE(["$enableval"],
[yes], [OCL_ICD_VENDORDIR="$sysconfdir/OpenCL/vendors"],
[no], [OCL_ICD_VENDORDIR='/etc/OpenCL/vendors'],
[OCL_ICD_VENDORDIR=$enableval])],
[OCL_ICD_VENDORDIR=/etc/OpenCL/vendors])
AC_SUBST([OCL_ICD_VENDORDIR])
AS_IF([test x"$OCL_ICD_VENDORDIR" = x"/etc/OpenCL/vendors" ], [
AC_MSG_NOTICE([using the official default vendors directory ($OCL_ICD_VENDORDIR)])
], [
AC_MSG_NOTICE([using an unofficial custom default vendors directory ($OCL_ICD_VENDORDIR)])
])
# always use versionned symbols (check required for MacOSX)
if test "x$macos" == xyes ; then
AM_CONDITIONAL([USE_MAP], [false])
else
AM_CONDITIONAL([USE_MAP], [true])
fi
AC_CONFIG_FILES([
Makefile
doc/Makefile
tests/Makefile
OpenCL.pc
ocl-icd.pc
tests/atlocal
])
AC_OUTPUT