Release 2.0.3
[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.0.3], [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=0])
12 LT_INIT([disable-static])
13 AC_CONFIG_TESTDIR([tests], [.])
14
15 OPENCL_VERSION="1.2"
16 AC_SUBST([OPENCL_VERSION])
17
18 # Checks for programs.
19 AC_PROG_CC_C89
20 AC_PROG_INSTALL
21 AC_PROG_LN_S
22
23 AC_PATH_PROG([ASCIIDOC], [asciidoc], [])
24 AC_PATH_PROG([A2X], [a2x], [])
25 AC_PATH_PROG([XMLTO], [xmlto], [])
26 AM_CONDITIONAL([GEN_DOC], [\
27         test x"$ASCIIDOC" != x && \
28         test x"$A2X" != x && \
29         test x"$XMLTO" != x ])
30
31 # Checks for libraries.
32 AC_CHECK_LIB([dl], [dlopen])
33
34 # Checks for header files.
35 AC_CHECK_HEADERS([stdlib.h string.h])
36 cl_h=no
37 case $host_os in
38   darwin* )
39     AC_CHECK_HEADER([OpenCL/opencl.h],[cl_h=yes])
40     ;;
41   * )
42     AC_CHECK_HEADER([CL/opencl.h],[cl_h=yes])
43     ;;
44 esac
45 if test $cl_h = no; then
46   AC_MSG_ERROR([OpenCL headers are required])
47 fi
48 AC_MSG_CHECKING([whether OpenCL headers 1.2 are available])
49 AC_PREPROC_IFELSE([
50   AC_LANG_PROGRAM([[
51 #if defined(__APPLE__) || defined(__MACOSX)
52 #  include <OpenCL/opencl.h>
53 #else
54 #  include <CL/opencl.h>
55 #endif
56 #ifndef CL_VERSION_1_2
57 #  error Cannot find CL_VERSION_1_2 symbol
58 #endif
59     ]], [[
60     ]])],[
61   AC_MSG_RESULT([yes])
62 ],[
63   AC_MSG_RESULT([no])
64   AC_MSG_FAILURE([OpenCL headers for OpenCL 1.2 are required])
65 ])
66
67 # Checks for typedefs, structures, and compiler characteristics.
68 AC_C_INLINE
69 AC_TYPE_SIZE_T
70 AC_C_CONST
71
72 NO_DEPRECATED_DECLARATIONS_FLAGS=
73 AX_CHECK_COMPILER_FLAGS([-Wno-deprecated-declarations],
74   [NO_DEPRECATED_DECLARATIONS_FLAGS="-Wno-deprecated-declarations"])
75 AC_SUBST([NO_DEPRECATED_DECLARATIONS_FLAGS])
76
77 # Checks for library functions.
78 AC_FUNC_MALLOC
79 AC_FUNC_REALLOC
80 AC_CHECK_FUNCS([strstr])
81
82 # --enable-pthread-once
83 AC_ARG_ENABLE([pthread-once],
84   [AS_HELP_STRING([--enable-pthread-once],
85                [use pthread_once() to ensure correct initialisation without polling])],
86   [pthread_once=$enableval],
87   [pthread_once=no])
88
89 if test "$pthread_once" = yes ; then
90   AX_PTHREAD([
91     AC_DEFINE([USE_PTHREAD], [1],
92               [pthreads are available])
93   ], [
94     AC_MSG_ERROR([No pthread detected on this platform!])
95   ])
96 fi
97
98 # --disable-debug
99 AC_ARG_ENABLE([debug],
100   [AS_HELP_STRING([--disable-debug],
101                [remove debug and additionnal checks (default is included)])],
102   [use_debug=$enableval],
103   [use_debug=yes])
104 if  test "x$use_debug" != xno ; then
105   AC_DEFINE([DEBUG_OCL_ICD], [1],
106             [Add DEBUG additionnal code])
107 fi
108
109 # --enable-update-database
110 AC_ARG_ENABLE([update-database],
111   [AS_HELP_STRING([--enable-update-database],
112                [update the YAML database from the currently installed ICD Loader and OpenCL headers (root access required)])],
113   [update_database=$enableval],
114   [update_database=no])
115 AM_CONDITIONAL([UPDATE_DATABASE], [test x"$update_database" != xno])
116
117 # always use versionned symbols (check required for MacOSX)
118 AM_CONDITIONAL([USE_MAP], [true])
119
120 AC_CONFIG_FILES([
121   Makefile
122   doc/Makefile
123   tests/Makefile
124
125   OpenCL.pc
126   ocl-icd.pc
127   tests/atlocal
128 ])
129 AC_OUTPUT