<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML ><HEAD ><TITLE >Reference: Some Configuration Macros</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK REL="HOME" TITLE="PHP 手册" HREF="index.html"><LINK REL="UP" TITLE="Zend API:深入 PHP 内核" HREF="zend.html"><LINK REL="PREVIOUS" TITLE="Where to Go from Here" HREF="zend.where-to-go.html"><LINK REL="NEXT" TITLE="API Macros" HREF="zend.api-macros.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=UTF-8"></HEAD ><BODY CLASS="sect1" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >PHP 手册</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="zend.where-to-go.html" ACCESSKEY="P" >上一页</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" >章 46. Zend API:深入 PHP 内核</TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="zend.api-macros.html" ACCESSKEY="N" >下一页</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="sect1" ><H1 CLASS="sect1" ><A NAME="zend.configuration-macros" >Reference: Some Configuration Macros</A ></H1 ><DIV CLASS="sect2" ><H2 CLASS="sect2" ><A NAME="zend.configuration-macros.config-m4" ><TT CLASS="filename" >config.m4</TT ></A ></H2 ><P > The file <TT CLASS="filename" >config.m4</TT > is processed by <TT CLASS="filename" >buildconf</TT > and must contain all the instructions to be executed during configuration. For example, these can include tests for required external files, such as header files, libraries, and so on. PHP defines a set of macros that can be used in this process, the most useful of which are described in <A HREF="zend.configuration-macros.html#tab.m4-macros" >表 46-18</A >. </P ><DIV CLASS="table" ><A NAME="tab.m4-macros" ></A ><P ><B >表 46-18. M4 Macros for <TT CLASS="filename" >config.m4</TT ></B ></P ><TABLE BORDER="1" CLASS="CALSTABLE" ><COL WIDTH="1.63*" TITLE="col1"><COL WIDTH="1*" TITLE="col2"><TBODY ><TR ><TD >Macro</TD ><TD >Description</TD ></TR ><TR ><TD ><TT CLASS="literal" >AC_MSG_CHECKING(message)</TT ></TD ><TD >Prints a "checking <message>" text during <TT CLASS="filename" >configure</TT >.</TD ></TR ><TR ><TD ><TT CLASS="literal" >AC_MSG_RESULT(value)</TT ></TD ><TD >Gives the result to <TT CLASS="literal" >AC_MSG_CHECKING</TT >; should specify either <TT CLASS="literal" >yes</TT > or <TT CLASS="literal" >no</TT > as <CODE CLASS="envar" >value</CODE >.</TD ></TR ><TR ><TD ><TT CLASS="literal" >AC_MSG_ERROR(message)</TT ></TD ><TD >Prints <CODE CLASS="envar" >message</CODE > as error message during <TT CLASS="filename" >configure</TT > and aborts the script.</TD ></TR ><TR ><TD ><TT CLASS="literal" >AC_DEFINE(name,value,description)</TT ></TD ><TD >Adds <TT CLASS="literal" >#define</TT > to <TT CLASS="filename" >php_config.h</TT > with the value of <CODE CLASS="envar" >value</CODE > and a comment that says <CODE CLASS="envar" >description</CODE > (this is useful for conditional compilation of your module).</TD ></TR ><TR ><TD ><TT CLASS="literal" >AC_ADD_INCLUDE(path)</TT ></TD ><TD >Adds a compiler include path; for example, used if the module needs to add search paths for header files.</TD ></TR ><TR ><TD ><TT CLASS="literal" >AC_ADD_LIBRARY_WITH_PATH(libraryname,librarypath)</TT ></TD ><TD >Specifies an additional library to link.</TD ></TR ><TR ><TD ><TT CLASS="literal" >AC_ARG_WITH(modulename,description,unconditionaltest,conditionaltest)</TT ></TD ><TD >Quite a powerful macro, adding the module with <CODE CLASS="envar" >description</CODE > to the <TT CLASS="filename" >configure --help</TT > output. PHP checks whether the option <TT CLASS="literal" >--with-<modulename></TT > is given to the <TT CLASS="filename" >configure</TT > script. If so, it runs the script <TT CLASS="literal" >unconditionaltest</TT > (for example, <TT CLASS="literal" >--with-myext=yes</TT >), in which case the value of the option is contained in the variable <CODE CLASS="envar" >$withval</CODE >. Otherwise, it executes <TT CLASS="literal" >conditionaltest</TT >. </TD ></TR ><TR ><TD ><TT CLASS="literal" >PHP_EXTENSION(modulename, [shared])</TT ></TD ><TD >This macro is a <SPAN CLASS="emphasis" ><I CLASS="emphasis" >must</I ></SPAN > to call for PHP to configure your extension. You can supply a second argument in addition to your module name, indicating whether you intend compilation as a shared module. This will result in a definition at compile time for your source as <TT CLASS="literal" >COMPILE_DL_<modulename></TT >.</TD ></TR ></TBODY ></TABLE ></DIV ></DIV ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="zend.where-to-go.html" ACCESSKEY="P" >上一页</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >起始页</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="zend.api-macros.html" ACCESSKEY="N" >下一页</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >Where to Go from Here</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="zend.html" ACCESSKEY="U" >上一级</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >API Macros</TD ></TR ></TABLE ></DIV ></BODY ></HTML >