Skip to content

Commit

Permalink
Housekeeping: Generate config header during configure regardless if b…
Browse files Browse the repository at this point in the history
…uilding inside php source tree

git-svn-id: http://svn.php.net/repository/pecl/imagick/trunk@288545 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information
mkoppanen committed Sep 21, 2009
1 parent 085aafe commit 77893d1
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 28 deletions.
19 changes: 15 additions & 4 deletions config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ if test $PHP_IMAGICK_GM != "no"; then
fi

if test $PHP_IMAGICK != "no"; then

AC_MSG_CHECKING(ImageMagick MagickWand API configuration program)

for i in $PHP_IMAGICK /usr/local /usr;
Expand Down Expand Up @@ -63,7 +63,8 @@ if test $PHP_IMAGICK != "no"; then
AC_MSG_ERROR(Cannot locate header file MagickWand.h)
fi

AC_DEFINE(IMAGICK_USE_NEW_HEADER,1,[ ])
AC_DEFINE(IMAGICK_USE_NEW_HEADER,1,[ ])
PHP_IMAGICK_USE_NEW_HEADER=1
fi

dnl Thanks to Antony Dovgal for pointing out that the
Expand Down Expand Up @@ -109,6 +110,16 @@ if test $PHP_IMAGICK != "no"; then
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)

dnl share headers
PHP_INSTALL_HEADERS([ext/imagick], [php_imagick.h php_imagick_defs.h config.h php_imagick_shared.h])
dnl Generate configuration header
if test ! -z "${PHP_IMAGICK_USE_NEW_HEADER}"; then
echo "#ifndef _PHP_IMAGICK_CONFIG_H_" > php_imagick_config.h
echo "# ifndef IMAGICK_USE_NEW_HEADER" >> php_imagick_config.h
echo "# define IMAGICK_USE_NEW_HEADER 1" >> php_imagick_config.h
echo "# endif" >> php_imagick_config.h
echo "#endif" >> php_imagick_config.h
else
echo "" > php_imagick_config.h
fi

PHP_INSTALL_HEADERS([ext/imagick], [php_imagick.h php_imagick_defs.h php_imagick_shared.h php_imagick_config.h])
fi
6 changes: 6 additions & 0 deletions config.w32
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ if (PHP_IMAGICK != "no") {
ADD_FLAG("CFLAGS_IMAGICK", "/D IMAGICK_USE_NEW_HEADER /D _MAGICKMOD_ /D _VISUALC_ /D NeedFunctionPrototypes /D _LIB");
EXTENSION('imagick', 'imagick_class.c imagickdraw_class.c imagickpixel_class.c imagickpixeliterator_class.c imagick_helpers.c imagick_read.c imagick.c');
AC_DEFINE('HAVE_IMAGICK', 1);

echo "#ifndef _PHP_IMAGICK_CONFIG_H_" > php_imagick_config.h
echo "# ifndef IMAGICK_USE_NEW_HEADER" >> php_imagick_config.h
echo "# define IMAGICK_USE_NEW_HEADER 1" >> php_imagick_config.h
echo "# endif" >> php_imagick_config.h
echo "#endif" >> php_imagick_config.h
} else {
WARNING("imagick not enabled; libraries and headers not found");
}
Expand Down
1 change: 0 additions & 1 deletion imagick.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#include "php_imagick.h"
#include "php_imagick_defs.h"
#include "php_imagick_macros.h"
#include "php_imagick_shared.h"

ZEND_DECLARE_MODULE_GLOBALS(imagick)

Expand Down
15 changes: 7 additions & 8 deletions php_imagick.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,30 +26,29 @@
#define PHP_IMAGICK_VERSION "2.3.1-dev"
#define PHP_IMAGICK_EXTNUM 20301

/* Import configure options
when building outside of
the PHP source tree */
/* Import configure options when building
outside of the PHP source tree */
#ifdef HAVE_CONFIG_H
#include "config.h"
# include "config.h"
#endif

#ifdef ZTS
#include "TSRM.h"
# include "TSRM.h"
#endif

/* Include PHP Standard Headers */
#include "php.h"

/* Include locale header */
#ifdef HAVE_LOCALE_H
#include <locale.h>
# include <locale.h>
#endif

/* Include magic wand header */
#ifdef IMAGICK_USE_NEW_HEADER
#include <wand/MagickWand.h>
# include <wand/MagickWand.h>
#else
#include <wand/magick-wand.h>
# include <wand/magick-wand.h>
#endif

#ifndef DefaultChannels
Expand Down
12 changes: 10 additions & 2 deletions php_imagick_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,16 @@
+----------------------------------------------------------------------+
*/
#ifndef PHP_IMAGICK_DEFS_H /* PHP_IMAGICK_DEFS_H */
/* Prevent double inclusion */
#define PHP_IMAGICK_DEFS_H
# define PHP_IMAGICK_DEFS_H

/*
API exports
*/
#ifdef PHP_WIN32
# define IMAGICK_EXPORTS __declspec(dllexport)
#else
# define IMAGICK_EXPORTS PHPAPI
#endif

/* Globals, needed for the ini settings */
ZEND_BEGIN_MODULE_GLOBALS(imagick)
Expand Down
14 changes: 1 addition & 13 deletions php_imagick_shared.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,10 @@
#ifndef _PHP_IMAGICK_SHARED_H_
# define _PHP_IMAGICK_SHARED_H_

#ifdef HAVE_CONFIG_H
# include "config.h"
#endif

#include "php_imagick_config.h"
#include "php_imagick.h"
#include "php_imagick_defs.h"

/*
API exports
*/
#ifdef PHP_WIN32
# define IMAGICK_EXPORTS __declspec(dllexport)
#else
# define IMAGICK_EXPORTS PHPAPI
#endif

/*
Allow extensions to use the class entries
*/
Expand Down

0 comments on commit 77893d1

Please sign in to comment.