新聞中心
本篇文章為大家展示了深入淺析PHP 中的 config.m4,內(nèi)容簡(jiǎn)明扼要并且容易理解,絕對(duì)能使你眼前一亮,通過這篇文章的詳細(xì)介紹希望你能有所收獲。
最近在看php擴(kuò)展相關(guān)的東西,雖然來來回回編輯了好多次config.m4,并且也在技術(shù)社區(qū)看到了 config.m4是什么?什么作用?
類的問題,但是還是覺得有必要在深入的了解下。
.m4后綴的文件一般被當(dāng)做 通用的宏處理,來看下官方的介紹:
GNU M4 is an implementation of the traditional Unix macro processor. It is mostly SVR4 compatible although it has some extensions (for example, handling more than 9 positional parameters to macros). GNU M4 also has built-in functions for including files, running shell commands, doing arithmetic, etc.
GNU M4 is a macro processor in the sense that it copies its input to the output expanding macros as it goes. Macros are either builtin or user-defined and can take any number of arguments. Besides just doing macro expansion, m4 has builtin functions for including named files, running UNIX commands, doing integer arithmetic, manipulating text in various ways, recursion etc... m4 can be used either as a front-end to a compiler or as a macro processor in its own right.
One of the biggest users of GNU M4 is the GNU Autoconf project.
簡(jiǎn)單而通俗易懂的翻譯下:GNU M4是傳統(tǒng)UNIX宏處理器的一種實(shí)現(xiàn)方式,它還具有一些內(nèi)置功能,包括文件,shell,運(yùn)算等。
作為一個(gè)宏處理器,將輸入復(fù)制到擴(kuò)展的輸出,它要么內(nèi)置,要么用戶定義,且可以接受參數(shù)。另外這個(gè)還有內(nèi)置函數(shù),包括命名文件、運(yùn)行UNIX命令、執(zhí)行整數(shù)運(yùn)算、以各種方式操作文本、遞歸等。M4既可以作為編譯器的前端使用,也可以作為自己的宏處理器使用。
GNU M4的大用戶之一是GNU AutoCOF項(xiàng)目。
到這里大致了解到,它是作為一個(gè)宏處理器,然后再想想PHP擴(kuò)展里面用到它做了什么,先看看 php源碼擴(kuò)展目錄ext中 bcmath 中的代碼:
dnl dnl $Id$ dnl PHP_ARG_ENABLE(bcmath, whether to enable bc style precision math functions, [ --enable-bcmath Enable bc style precision math functions]) if test "$PHP_BCMATH" != "no"; then PHP_NEW_EXTENSION(bcmath, bcmath.c \ libbcmath/src/add.c libbcmath/src/div.c libbcmath/src/init.c libbcmath/src/neg.c libbcmath/src/outofmem.c libbcmath/src/raisemod.c libbcmath/src/rt.c libbcmath/src/sub.c \ libbcmath/src/compare.c libbcmath/src/divmod.c libbcmath/src/int2num.c libbcmath/src/num2long.c libbcmath/src/output.c libbcmath/src/recmul.c \ libbcmath/src/sqrt.c libbcmath/src/zero.c libbcmath/src/debug.c libbcmath/src/doaddsub.c libbcmath/src/nearzero.c libbcmath/src/num2str.c libbcmath/src/raise.c \ libbcmath/src/rmzero.c libbcmath/src/str2num.c, $ext_shared,,-I@ext_srcdir@/libbcmath/src) PHP_ADD_BUILD_DIR($ext_builddir/libbcmath/src) AC_DEFINE(HAVE_BCMATH, 1, [Whether you have bcmath]) fi
本文題目:深入淺析PHP中的config.m4-創(chuàng)新互聯(lián)
文章分享:http://www.ef60e0e.cn/article/geddo.html