forked from Imagick/imagick
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.m4
111 lines (95 loc) · 3.54 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
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
PHP_ARG_WITH(imagick, whether to enable the imagick extension,
[ --with-imagick[=DIR] Enables the imagick extension. DIR is the prefix to ImageMagick installation directory.], no)
if test $PHP_IMAGICK != "no"; then
#
# Find ImageMagick
#
if test "$ext_shared" != "yes" && test "$ext_shared" != "shared"; then
define('PHP_IMAGICK_STATIC', 1)
PHP_IMAGICK_STATIC=yes
fi
m4_include(ifdef('PHP_IMAGICK_STATIC',PHP_EXT_BUILDDIR(imagick)[/],)[imagemagick.m4])
# This line checks that ImageMagick is available, and
# meets our minimum supported version. TODO change to 6.7.0
IM_FIND_IMAGEMAGICK([6.2.4], [$PHP_IMAGICK])
#
# PHP minimum version
#
AC_MSG_CHECKING([PHP version is at least 5.3.2])
if test -z "${PHP_VERSION_ID}"; then
if test -z "${PHP_CONFIG}"; then
AC_MSG_ERROR([php-config not found])
fi
if test -z "${AWK}"; then
AC_MSG_ERROR([awk not found])
fi
PHP_IMAGICK_FOUND_VERSION=`${PHP_CONFIG} --version`
PHP_IMAGICK_FOUND_VERNUM=`echo "${PHP_IMAGICK_FOUND_VERSION}" | $AWK 'BEGIN { FS = "."; } { printf "%d", ([$]1 * 100 + [$]2) * 100 + [$]3;}'`
else
PHP_IMAGICK_FOUND_VERNUM="${PHP_VERSION_ID}"
PHP_IMAGICK_FOUND_VERSION="${PHP_VERSION}"
fi
if test "$PHP_IMAGICK_FOUND_VERNUM" -ge "50302"; then
AC_MSG_RESULT(yes. found $PHP_IMAGICK_FOUND_VERSION)
else
AC_MSG_ERROR(no. found $PHP_IMAGICK_FOUND_VERSION)
fi
#
# Set libs and CFLAGS for building
#
echo "libs"
echo $IM_IMAGEMAGICK_LIBS
echo ""
echo $IMAGICK_SHARED_LIBADD
PHP_EVAL_LIBLINE($IM_IMAGEMAGICK_LIBS, IMAGICK_SHARED_LIBADD)
PHP_EVAL_INCLINE($IM_IMAGEMAGICK_CFLAGS)
old_LIBS=$LIBS
LIBS="$LIBS $IM_IMAGEMAGICK_LIBS"
PHP_CHECK_FUNC(MagickGetVersion)
LIBS=$old_LIBS
AC_MSG_CHECKING(omp_pause_resource_all usability)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <omp.h>
]],[[
omp_pause_resource_all(omp_pause_hard);
]])],[
AC_MSG_RESULT(yes)
AC_MSG_CHECKING([Which flavour of OpenMP to link])
if test "${GCC}" = "yes"; then
# Open64 (passes for GCC but uses different OpenMP implementation)
if test "x$GOMP_LIBS" = x ; then
if $CC --version 2>&1 | grep Open64 > /dev/null ; then
PHP_CHECK_FUNC(omp_pause_resource_all, openmp)
if test "x$ac_cv_func_omp_pause_resource_all" = "xyes"; then
PHP_ADD_LIBRARY(openmp,, IMAGICK_SHARED_LIBADD)
AC_MSG_RESULT([Open64 flavoured OpenMP])
fi
fi
fi
# Clang (passes for GCC but uses different OpenMP implementation)
if test "x$LIB_OMP" = x ; then
if $CC --version 2>&1 | grep clang > /dev/null ; then
PHP_CHECK_FUNC(omp_pause_resource_all, omp)
if test "x$ac_cv_func_omp_pause_resource_all" = "xyes"; then
PHP_ADD_LIBRARY(omp,, IMAGICK_SHARED_LIBADD)
AC_MSG_RESULT([Clang flavoured OpenMP])
fi
fi
fi
# GCC
if test "x$ac_cv_func_omp_pause_resource_all" = x ; then
PHP_CHECK_FUNC(omp_pause_resource_all, gomp)
if test "x$ac_cv_func_omp_pause_resource_all" = "xyes"; then
PHP_ADD_LIBRARY(gomp,, IMAGICK_SHARED_LIBADD)
AC_MSG_RESULT([GCC flavoured OpenMP])
fi
fi
fi
],[
AC_MSG_RESULT(no)
])
PHP_SUBST(IMAGICK_SHARED_LIBADD)
AC_DEFINE(HAVE_IMAGICK,1,[ ])
PHP_NEW_EXTENSION(imagick, imagick_file.c imagick_class.c imagickdraw_class.c imagickpixel_class.c imagickpixeliterator_class.c imagick_helpers.c imagick.c imagickkernel_class.c shim_im6_to_im7.c, $ext_shared,, $IM_IMAGEMAGICK_CFLAGS)
PHP_INSTALL_HEADERS([ext/imagick], [php_imagick_shared.h])
fi