]> granicus.if.org Git - php/commitdiff
start to parse the <deps> tag -> support both C and C++ extensions
authorHartmut Holzgraefe <hholzgra@php.net>
Wed, 23 Apr 2003 16:09:23 +0000 (16:09 +0000)
committerHartmut Holzgraefe <hholzgra@php.net>
Wed, 23 Apr 2003 16:09:23 +0000 (16:09 +0000)
scripts/ext_skel_ng/extension_parser.php

index e0432a44b89b281007f328cf13fec45eef1de153..418f5de90581c5c5bb4b22197047a1a49551bf21 100644 (file)
@@ -37,6 +37,7 @@
                $this->phpini    = array();
                $this->users     = array();
                $this->dependson = array();
+    $this->language  = "c";
 
                $this->files = array("c"=>array(), "h"=>array());
                
 
                // }}} 
 
+  // {{{   dependencies
+
+  function handle_deps($attr) {
+    if (isset($attr["language"])) $this->language = $attr["language"];
+  }
+
+  // }}}
+
        // {{{   constants
 
                function handle_constants_constant($attr) {
@@ -824,7 +833,7 @@ $code .= "
   // {{{ 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 @@ dnl
 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);
        }