-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathconfig.m4
49 lines (40 loc) · 1.33 KB
/
config.m4
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
PHP_ARG_ENABLE(opencl, whether to enable opencl functions,
[ --enable-opencl Enable opencl support])
if test "$PHP_OPENCL" != "no"; then
export OLD_CPPFLAGS="$CPPFLAGS"
export CPPFLAGS="$CPPFLAGS $INCLUDES"
AC_MSG_CHECKING(PHP version)
AC_TRY_COMPILE([#include <php_version.h>], [
#if !defined(PHP_VERSION_ID) || PHP_VERSION_ID < 50300
#error this extension requires at least PHP version 5.3.0
#endif
],
[AC_MSG_RESULT(ok)],
[AC_MSG_ERROR([need at least PHP 5.3.0])])
export CPPFLAGS="$OLD_CPPFLAGS"
export OLD_LIBS="$LIBS"
export LIBS="$OLD_LIBS"
if test `uname -s` = "Darwin"; then
PHP_CHECK_FRAMEWORK(OpenCL, clGetPlatformIDs,
[],[
AC_MSG_ERROR([OpenCL framework is not available])
])
else
PHP_CHECK_LIBRARY(OpenCL, clGetPlatformIDs,
[
PHP_EVAL_LIBLINE([-lOpenCL], OPENCL_SHARED_LIBADD)
],[
AC_MSG_ERROR([OpenCL library is not available])
],[
-lOpenCL
])
fi
export LIBS="$OLD_LIBS"
PHP_REQUIRE_CXX()
PHPCL_SOURCES="opencl.c params.c"
PHPCL_SOURCES="$PHPCL_SOURCES platform.c device.c context.c queue.c"
PHPCL_SOURCES="$PHPCL_SOURCES memory.c program.c kernel.c event.c sampler.c"
PHPCL_SOURCES="$PHPCL_SOURCES kernel_arg.cxx"
PHP_SUBST(OPENCL_SHARED_LIBADD)
PHP_NEW_EXTENSION(opencl, $PHPCL_SOURCES, $ext_shared, "", "", 1)
fi