File: config.m4

package info (click to toggle)
php-imagick 3.0.0~rc1-1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 756 kB
  • ctags: 671
  • sloc: ansic: 12,816; xml: 84; php: 82; makefile: 27; sh: 24
file content (95 lines) | stat: -rw-r--r-- 3,356 bytes parent folder | download
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
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)

PHP_ARG_WITH(imagick-gm, whether to enable the imagick GraphicsMagick backend,
[ --with-imagick-gm[=DIR]	GraphicsMagick backend. NO LONGER SUPPORTED!], no, no)

if test $PHP_IMAGICK_GM != "no"; then
	AC_MSG_ERROR(GraphicsMagick backend is no longer supported)
fi

if test $PHP_IMAGICK != "no"; then

  AC_MSG_CHECKING(ImageMagick MagickWand API configuration program)
		
  for i in $PHP_IMAGICK /usr/local /usr;
  do
    test -r $i/bin/MagickWand-config && IMAGICK_AFTER_BWC_BREAK=true && WAND_BINARY=$i/bin/MagickWand-config && break
  done
		
	if test -z "$WAND_BINARY"; then
    for i in $PHP_IMAGICK /usr/local /usr;
    do
      test -r $i/bin/Wand-config && WAND_BINARY=$i/bin/Wand-config && break
    done
  fi
		
  if test -z "$WAND_BINARY"; then
    AC_MSG_ERROR(not found. Please provide a path to MagickWand-config or Wand-config program.)
  fi
		
  AC_MSG_RESULT(found in $WAND_BINARY)

  IMAGEMAGICK_VERSION_ORIG=`$WAND_BINARY --version`
  IMAGEMAGICK_VERSION_MASK=`echo ${IMAGEMAGICK_VERSION_ORIG} | awk 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`

  AC_MSG_CHECKING(if ImageMagick version is at least 6.2.4)
  if test "$IMAGEMAGICK_VERSION_MASK" -ge 6002004; then
    AC_MSG_RESULT(found version $IMAGEMAGICK_VERSION_ORIG)
  else
    AC_MSG_ERROR(no. You need at least Imagemagick version 6.2.4 to use Imagick.)
  fi
		
  WAND_DIR=`$WAND_BINARY --prefix` 
		
  if test -z "$IMAGICK_AFTER_BWC_BREAK"; then
    AC_MSG_CHECKING(for magick-wand.h header file)
    if test -r $WAND_DIR/include/wand/magick-wand.h; then
      AC_MSG_RESULT(found in $WAND_DIR/include/wand/magick-wand.h)
  	else
  		AC_MSG_ERROR(Cannot locate header file magick-wand.h)
    fi	
  else	
    AC_MSG_CHECKING(for MagickWand.h header file)

    if test -r $WAND_DIR/include/ImageMagick/wand/MagickWand.h; then
      AC_MSG_RESULT(found in $WAND_DIR/include/ImageMagick/wand/MagickWand.h)
    else
      AC_MSG_ERROR(Cannot locate header file MagickWand.h)
    fi
    AC_DEFINE(IMAGICK_USE_NEW_HEADER,1,[ ])
    PHP_IMAGICK_USE_NEW_HEADER=1
  fi

  AC_MSG_CHECKING([PHP version is at least 5.1.3])

  if test -z "${PHP_VERSION_ID}"; then
    if test -z "${PHP_CONFIG}"; then
      AC_MSG_ERROR([php-config not found])
    fi
    PHP_IMAGICK_FOUND_VERNUM=`${PHP_CONFIG} --vernum`;
    PHP_IMAGICK_FOUND_VERSION=`${PHP_CONFIG} --version`
  else
    PHP_IMAGICK_FOUND_VERNUM="${PHP_VERSION_ID}"
    PHP_IMAGICK_FOUND_VERSION="${PHP_VERSION}"
  fi

  if test "$PHP_IMAGICK_FOUND_VERNUM" -ge "50103"; then
    AC_MSG_RESULT(yes. found $PHP_IMAGICK_FOUND_VERSION)
  else 
    AC_MSG_ERROR(no. found $PHP_IMAGICK_FOUND_VERSION)
  fi

  AC_DEFINE(HAVE_IMAGICK,1,[ ])

  IMAGICK_LIBS=`$WAND_BINARY --libs`
  IMAGICK_INCS=`$WAND_BINARY --cflags`
      
  PHP_EVAL_LIBLINE($IMAGICK_LIBS, IMAGICK_SHARED_LIBADD)
  PHP_EVAL_INCLINE($IMAGICK_INCS)

  PHP_SUBST(IMAGICK_SHARED_LIBADD)
		
  PHP_NEW_EXTENSION(imagick, imagick_class.c imagickdraw_class.c imagickpixel_class.c imagickpixeliterator_class.c imagick_helpers.c imagick_read.c imagick.c, $ext_shared)
  PHP_INSTALL_HEADERS([ext/imagick], [php_imagick.h php_imagick_defs.h php_imagick_shared.h php_imagick_config.h])
fi