summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorHartmut Holzgraefe <hholzgra@php.net>2003-04-23 16:40:52 +0000
committerHartmut Holzgraefe <hholzgra@php.net>2003-04-23 16:40:52 +0000
commitc9b4c8f85b4d8d3a688fea61273e51e03e7821d0 (patch)
treec37e18a3cb510036879bcb425805ebf5da90cd5d /scripts
parent7c220887fac87bce5ba5bc20ceac73b2acb0340a (diff)
downloadphp-git-c9b4c8f85b4d8d3a688fea61273e51e03e7821d0.tar.gz
config.m4 generation revisited
Diffstat (limited to 'scripts')
-rw-r--r--scripts/ext_skel_ng/extension.xml2
-rw-r--r--scripts/ext_skel_ng/extension_parser.php72
2 files changed, 58 insertions, 16 deletions
diff --git a/scripts/ext_skel_ng/extension.xml b/scripts/ext_skel_ng/extension.xml
index 17cca9d6d9..7d5d1eee10 100644
--- a/scripts/ext_skel_ng/extension.xml
+++ b/scripts/ext_skel_ng/extension.xml
@@ -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>
diff --git a/scripts/ext_skel_ng/extension_parser.php b/scripts/ext_skel_ng/extension_parser.php
index ba0177b02a..65fa624eb0 100644
--- a/scripts/ext_skel_ng/extension_parser.php
+++ b/scripts/ext_skel_ng/extension_parser.php
@@ -944,35 +944,77 @@ $code .= "
// {{{ 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();
}
// }}}