cvs: pear /CodeGen_PECL/PECL Extension.php
| From: | Hartmut Holzgraefe | Date: | Tue, 17 Oct 2006 14:15:29 +0000 |
| Subject: | cvs: pear /CodeGen_PECL/PECL Extension.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-42601@lists.php.net to get a copy of this message | ||
hholzgra Tue Oct 17 14:15:29 2006 UTC
Modified files:
/pear/CodeGen_PECL/PECL Extension.php
Log:
generate version check code for config.m4
http://cvs.php.net/viewvc.cgi/pear/CodeGen_PECL/PECL/Extension.php?r1=1.61&r2=1.62&diff_format=u
Index: pear/CodeGen_PECL/PECL/Extension.php
diff -u pear/CodeGen_PECL/PECL/Extension.php:1.61 pear/CodeGen_PECL/PECL/Extension.php:1.62
--- pear/CodeGen_PECL/PECL/Extension.php:1.61 Wed Oct 11 10:16:02 2006
+++ pear/CodeGen_PECL/PECL/Extension.php Tue Oct 17 14:15:29 2006
@@ -15,7 +15,7 @@
* @author Hartmut Holzgraefe <hartmut@php.net>
* @copyright 2005, 2006 Hartmut Holzgraefe
* @license http://www.php.net/license/3_0.txt
PHP License 3.0
- * @version CVS: $Id: Extension.php,v 1.61 2006/10/11 10:16:02 hholzgra Exp $
+ * @version CVS: $Id: Extension.php,v 1.62 2006/10/17 14:15:29 hholzgra Exp $
* @link http://pear.php.net/package/CodeGen_PECL
*/
@@ -1704,6 +1704,18 @@
echo " export OLD_CPPFLAGS=\"\$CPPFLAGS\"\n";
echo " export CPPFLAGS=\"\$CPPFLAGS \$INCLUDES
-DHAVE_".strtoupper($this->name)."\"\n";
+ echo "
+ AC_MSG_CHECKING(PHP version)
+ AC_TRY_COMPILE([#include <php_version.h>], [
+#if PHP_VERSION_ID < ".$this->minPhpVersionId()."
+#error this extension requires at least PHP version ".$this->minPhpVersion()."
+#endif
+],
+[AC_MSG_RESULT(ok)],
+[AC_MSG_ERROR([need at least PHP ".$this->minPhpVersion()."])])
+
+";
+
if (count($this->headers)) {
if (!isset($this->with[$this->name])) {
$this->terminate("global headers not bound to a --with option found and no
--with option by the default name");
@@ -2423,6 +2435,18 @@
}
/**
+ * Return minimal PHP version required to support the requested features
+ *
+ * @return string version string
+ */
+ function minPhpVersionId()
+ {
+ $id = explode('.', $this->minPhpVersion());
+
+ return (int)$id[0] * 10000 + (int)$id[1] * 100 + (int)$id[2];
+ }
+
+ /**
* Generate Editor settings block for documentation files
*
* @access public