cvs: php4 /scripts/ext_skel_ng extension_parser.php
| From: | Hartmut Holzgraefe | Date: | Wed, 23 Apr 2003 16:09:23 +0000 |
| Subject: | cvs: php4 /scripts/ext_skel_ng extension_parser.php | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-20444@lists.php.net to get a copy of this message | ||
hholzgra Wed Apr 23 12:09:23 2003 EDT
Modified files:
/php4/scripts/ext_skel_ng extension_parser.php
Log:
start to parse the <deps> tag -> support both C and C++ extensions
Index: php4/scripts/ext_skel_ng/extension_parser.php
diff -u php4/scripts/ext_skel_ng/extension_parser.php:1.9
php4/scripts/ext_skel_ng/extension_parser.php:1.10
--- php4/scripts/ext_skel_ng/extension_parser.php:1.9 Thu Mar 20 15:20:37 2003
+++ php4/scripts/ext_skel_ng/extension_parser.php Wed Apr 23 12:09:23 2003
@@ -37,6 +37,7 @@
$this->phpini = array();
$this->users = array();
$this->dependson = array();
+ $this->language = "c";
$this->files = array("c"=>array(), "h"=>array());
@@ -109,6 +110,14 @@
// }}}
+ // {{{ dependencies
+
+ function handle_deps($attr) {
+ if (isset($attr["language"])) $this->language = $attr["language"];
+ }
+
+ // }}}
+
// {{{ constants
function handle_constants_constant($attr) {
@@ -824,7 +833,7 @@
// {{{ code file
function write_code_file() {
- $filename = "{$this->name}.c";
+ $filename = "{$this->name}.{$this->language}"; // todo extension logic
$this->files["c"][] = $filename;
$fp = fopen("{$this->name}/$filename", "w");
@@ -899,11 +908,23 @@
PHP_ARG_ENABLE({$this->name} , whether to enable {$this->name} functions,
[ --disable-{$this->name} Disable {$this->name} functions], yes)
+");
+
+ if ($this->language === "cpp") {
+ fputs($fp, "PHP_REQUIRE_CXX\n");
+ }
+
+ fputs($fp, "
if test \"\$PHP_$upname\" != \"no\"; then
AC_DEFINE(HAVE_$upname, 1, [ ])
PHP_NEW_EXTENSION({$this->name}, ".join(" ",
$this->files['c'])." , \$ext_shared)
fi
");
+
+ if ($this->language === "cpp") {
+ echo "PHP_ADD_LIBRARY(stdc++)\n";
+ }
+
fclose($fp);
}