xref: /imagick/config.m4 (revision c9319d19)
1PHP_ARG_WITH(imagick, whether to enable the imagick extension,
2[ --with-imagick[=DIR]	Enables the imagick extension. DIR is the prefix to ImageMagick installation directory.], no)
3
4
5if test $PHP_IMAGICK != "no"; then
6
7#
8# Find ImageMagick
9#
10if test "$ext_shared" != "yes" && test "$ext_shared" != "shared"; then
11  define('PHP_IMAGICK_STATIC', 1)
12  PHP_IMAGICK_STATIC=yes
13fi
14m4_include(ifdef('PHP_IMAGICK_STATIC',PHP_EXT_BUILDDIR(imagick)[/],)[imagemagick.m4])
15
16# This line checks that ImageMagick is available, and
17# meets our minimum supported version. TODO change to 6.7.0
18IM_FIND_IMAGEMAGICK([6.2.4], [$PHP_IMAGICK])
19
20#
21# PHP minimum version
22#
23  AC_MSG_CHECKING([PHP version is at least 5.3.2])
24
25  if test -z "${PHP_VERSION_ID}"; then
26    if test -z "${PHP_CONFIG}"; then
27      AC_MSG_ERROR([php-config not found])
28    fi
29    if test -z "${AWK}"; then
30      AC_MSG_ERROR([awk not found])
31    fi
32    PHP_IMAGICK_FOUND_VERSION=`${PHP_CONFIG} --version`
33    PHP_IMAGICK_FOUND_VERNUM=`echo "${PHP_IMAGICK_FOUND_VERSION}" | $AWK 'BEGIN { FS = "."; } { printf "%d", ([$]1 * 100 + [$]2) * 100 + [$]3;}'`
34  else
35    PHP_IMAGICK_FOUND_VERNUM="${PHP_VERSION_ID}"
36    PHP_IMAGICK_FOUND_VERSION="${PHP_VERSION}"
37  fi
38
39  if test "$PHP_IMAGICK_FOUND_VERNUM" -ge "50302"; then
40    AC_MSG_RESULT(yes. found $PHP_IMAGICK_FOUND_VERSION)
41  else
42    AC_MSG_ERROR(no. found $PHP_IMAGICK_FOUND_VERSION)
43  fi
44
45#
46# Set libs and CFLAGS for building
47#
48	echo "libs"
49	echo $IM_IMAGEMAGICK_LIBS
50	echo ""
51	echo $IMAGICK_SHARED_LIBADD
52
53  PHP_EVAL_LIBLINE($IM_IMAGEMAGICK_LIBS, IMAGICK_SHARED_LIBADD)
54  PHP_EVAL_INCLINE($IM_IMAGEMAGICK_CFLAGS)
55
56  old_LIBS=$LIBS
57  LIBS="$LIBS $IM_IMAGEMAGICK_LIBS"
58
59  PHP_CHECK_FUNC(MagickGetVersion)
60
61  LIBS=$old_LIBS
62
63  AC_MSG_CHECKING(omp_pause_resource_all usability)
64  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
65    #include <omp.h>
66  ]],[[
67    omp_pause_resource_all(omp_pause_hard);
68  ]])],[
69    AC_MSG_RESULT(yes)
70
71    AS_IF([test "$(uname)" == "Darwin"],[
72      PHP_CHECK_FUNC(omp_pause_resource_all, omp)
73      PHP_ADD_LIBRARY(omp,, IMAGICK_SHARED_LIBADD)
74    ],[
75      PHP_CHECK_FUNC(omp_pause_resource_all, gomp)
76      PHP_ADD_LIBRARY(gomp,, IMAGICK_SHARED_LIBADD)
77    ])
78  ],[
79    AC_MSG_RESULT(no)
80  ])
81
82  PHP_SUBST(IMAGICK_SHARED_LIBADD)
83  AC_DEFINE(HAVE_IMAGICK,1,[ ])
84  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)
85  PHP_INSTALL_HEADERS([ext/imagick], [php_imagick_shared.h])
86fi
87