cvs: pecl /PECL_Gen Extension.php

From: Date: Tue, 09 Nov 2004 18:52:11 +0000
Subject: cvs: pecl /PECL_Gen Extension.php
Groups: php.pecl.cvs 
Request: Send a blank email to pecl-cvs+get-2004@lists.php.net to get a copy of this message
hholzgra Tue Nov 9 13:52:11 2004 EDT Modified files: /pecl/PECL_Gen Extension.php Log: add support for config.m4 snippet position selection http://cvs.php.net/diff.php/pecl/PECL_Gen/Extension.php?r1=1.5&r2=1.6&ty=u Index: pecl/PECL_Gen/Extension.php diff -u pecl/PECL_Gen/Extension.php:1.5 pecl/PECL_Gen/Extension.php:1.6 --- pecl/PECL_Gen/Extension.php:1.5 Mon Jun 14 07:47:54 2004 +++ pecl/PECL_Gen/Extension.php Tue Nov 9 13:52:11 2004 @@ -16,7 +16,7 @@ // | Authors: Hartmut Holzgraefe <hholzgra@php.net> | // +----------------------------------------------------------------------+ // -// $Id: Extension.php,v 1.5 2004/06/14 11:47:54 hholzgra Exp $ +// $Id: Extension.php,v 1.6 2004/11/09 18:52:11 hholzgra Exp $ // // {{{ includes @@ -49,7 +49,7 @@ * A class that generates PECL extension soure and documenation files * * @access public - * @version $Id: Extension.php,v 1.5 2004/06/14 11:47:54 hholzgra Exp $ + * @version $Id: Extension.php,v 1.6 2004/11/09 18:52:11 hholzgra Exp $ */ class PECL_Gen_Extension @@ -233,7 +233,7 @@ * @var array * @access private */ - var $configfragments = array(); + var $configfragments = array("top"=>array(), "bottom"=>array()); // }}} @@ -513,17 +513,17 @@ case 'a': break; case 'c': - $this->configfragments[] = "AC_PROG_CC"; + $this->add_configfragment("AC_PROG_CC"); $this->add_package_file('c', $filename); break; case 'l': case 'flex': - $this->configfragments[] = "AM_PROG_LEX"; + $this->add_configfragment("AM_PROG_LEX"); $this->add_package_file('c', $filename); break; case 'y': case 'bison': - $this->configfragments[] = "AM_PROG_YACC"; + $this->add_configfragment("AM_PROG_YACC"); $this->add_package_file('c', $filename); break; default: @@ -594,9 +594,12 @@ * @access public * @param string */ - function add_configfragment($text) + function add_configfragment($text, $position="top") { - $this->configfragment[] = $text; + if (!in_array($position, array("top", "bottom"))) { + return $this->raiseError("'$position' is not a valid config snippet position"); + } + $this->configfragments[$position][] = $text; return true; } @@ -966,7 +969,7 @@ $code.= " +----------------------------------------------------------------------+\n"; if (is_object($this->license)) { - $code.= $this->license->license_comment(); + $code.= $this->license->getComment(); } else { $code.= sprintf(" | unknown license: %-52s |\n", $this->license); } @@ -1433,27 +1436,30 @@ */ function write_config_m4($dirpath) { $upname = strtoupper($this->name); - - ob_start(); - foreach ($this->configfragments as $fragment) { - echo "$fragment\n"; - } + ob_start(); echo 'dnl dnl $ Id: $ dnl '; + if (isset($this->with['attr'])) { echo " PHP_ARG_WITH({$this->name}, whether to enable {$this->name} functions, [ --with-{$this->name}[=DIR] With {$this->name} support]) -"; +\n"; - echo " -if test \"\$PHP_$upname\" != \"no\"; then + + echo "if test \"\$PHP_$upname\" != \"no\"; then\n\n"; + + foreach ($this->configfragments['top'] as $fragment) { + echo "$fragment\n"; + } + + echo if test -r \"\$PHP_$upname/{$this->with['attr']['testfile']}\"; then PHP_{$upname}_DIR=\"\$PHP_$upname\" else @@ -1481,6 +1487,9 @@ echo "if test \"\$PHP_$upname\" != \"no\"; then\n"; + foreach ($this->configfragments['top'] as $fragment) { + echo "$fragment\n"; + } foreach($this->headers as $header) { echo " AC_CHECK_HEADER([\$PHP_{$upname}_DIR/include/$header[name]], [], AC_MSG_ERROR('$header[name]' header not found))\n"; @@ -1534,6 +1543,10 @@ fclose($frag); } + foreach ($this->configfragments['bottom'] as $fragment) { + echo "$fragment\n"; + } + echo " fi

« previous php.pecl.cvs (#2004) next »