cvs: php4 /scripts/ext_skel_ng extension.xml extension_parser.php
| From: | Hartmut Holzgraefe | Date: | Wed, 23 Apr 2003 16:40:52 +0000 |
| Subject: | cvs: php4 /scripts/ext_skel_ng extension.xml extension_parser.php | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-20454@lists.php.net to get a copy of this message | ||
hholzgra Wed Apr 23 12:40:52 2003 EDT
Modified files:
/php4/scripts/ext_skel_ng extension.xml extension_parser.php
Log:
config.m4 generation revisited
Index: php4/scripts/ext_skel_ng/extension.xml
diff -u php4/scripts/ext_skel_ng/extension.xml:1.4 php4/scripts/ext_skel_ng/extension.xml:1.5
--- php4/scripts/ext_skel_ng/extension.xml:1.4 Mon Feb 24 05:57:48 2003
+++ php4/scripts/ext_skel_ng/extension.xml Wed Apr 23 12:40:52 2003
@@ -38,7 +38,7 @@
</changelog>
- <deps>
+ <deps language="c">
<!-- these are not yet used in any way :( -->
<with defaults='/usr:/usr/local'
testfile='include/dummy.h'></with>
<lib name='dummy' function='dummy'
searchpath='/usr/lib:/lib'></lib>
Index: php4/scripts/ext_skel_ng/extension_parser.php
diff -u php4/scripts/ext_skel_ng/extension_parser.php:1.18
php4/scripts/ext_skel_ng/extension_parser.php:1.19
--- php4/scripts/ext_skel_ng/extension_parser.php:1.18 Wed Apr 23 12:39:50 2003
+++ php4/scripts/ext_skel_ng/extension_parser.php Wed Apr 23 12:40:52 2003
@@ -944,35 +944,77 @@
// {{{ config.m4 file
function write_config_m4() {
- $upname = $this->name;
+ $upname = strtoupper($this->name);
- $fp = fopen("{$this->name}/config.m4", "w");
- fputs($fp,
-"dnl
-dnl \$ Id: \$
+ ob_start();
+
+ echo
+'dnl
+dnl $ Id: $
dnl
+';
+
+ if(isset($this->with)) {
+ echo "
+PHP_ARG_WITH({$this->name}, whether to enable {$this->name} functions,
+[ --with-{$this->name}[=DIR] With {$this->name} support], yes)
+";
-PHP_ARG_ENABLE({$this->name} , whether to enable {$this->name} functions,
-[ --disable-{$this->name} Disable {$this->name} functions], yes)
+ echo "
+if test \"\$PHP_$upname\" != \"no\"; then
+ if test -r \"\$PHP_$upname/{$this->with['testfile']}\"; then
+ PHP_{$upname}_DIR=\"\$PHP_$upname\"
+ else
+ AC_MSG_CHECKING(for {$this->name} in default path)
+ for i in ".str_replace(":","
",$this->with['defaults'])."; do
+ if test -r \"\$i/{$this->with['testfile']}\"; then
+ PHP_{$upname}_DIR=\$i
+ AC_MSG_RESULT(found in \$i)
+ fi
+ done
+ fi
+fi
-");
+PHP_ADD_INCLUDE(\$PHP_{$upname}_DIR/include)
+";
- if ($this->language === "cpp") {
- fputs($fp, "PHP_REQUIRE_CXX\n");
+ if (count($this->libs)) {
+ echo "PHP_SUBST({$upname}_SHARED_LIBADD)\n";
+
+ foreach ($this->libs as $lib) {
+ echo "PHP_ADD_LIBRARY_WITH_PATH($lib[name], \$PHP_{$upname}_DIR/lib,
{$upname}_SHARED_LIBADD)\n";
+ if(isset($lib['function'])) {
+ echo "AC_CHECK_LIB($lib[name], $lib[function],
[AC_DEFINE(HAVE_".strtoupper($lib['name']).",1,[ ])], [AC_MSG_ERROR($lib[name]
library not found or wrong version)],)\n";
+ }
+ }
}
- fputs($fp, "
+ } else {
+ echo "
+PHP_ARG_ENABLE({$this->name} , whether to enable {$this->name} functions,
+[ --disable-{$this->name} Disable {$this->name} support], yes)
+";
+ }
+
+ if ($this->language === "cpp") {
+ echo "PHP_REQUIRE_CXX\n";
+ }
+
+ echo "
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";
- }
+ if ($this->language === "cpp") {
+ echo " PHP_ADD_LIBRARY(stdc++)\n";
+ }
+ $fp = fopen("{$this->name}/config.m4", "w");
+ fputs($fp, ob_get_contents());
fclose($fp);
+ ob_end_clean();
}
// }}}