ubuntu php扩展编译,在Ubuntu(Karmic Koala)上编译PHP扩展库

我在XP平台上编写了一些

PHP扩展库(在C/C++中).我现在已将源代码移到我的Ubuntu框中,并希望构建libs以便在我的Linux机器上使用.

但是,我遇到了许多障碍:

>我找不到phpize(甚至在安装php5dev包之后)

>我找不到ext_skel来生成骨架脚本/文件

[编辑]

感谢Pascal Martin和this question,我已经设法构建并测试了一个较小的库.我只想仔细检查我的.m4文件的内容(因为我不熟悉格式),然后再继续使用其他库.

这是自动生成的.m4文件的内容 – 任何熟悉该格式的人都可以解释它的含义 – 这样我就可以更加确定我已经取消注释了文件的正确部分.

config.m4文件的内容显示在下面的所有血腥细节中:

dnl $Id$

dnl config.m4 for extension tanlib

dnl Comments in this file start with the string 'dnl'.

dnl Remove where necessary. This file will not work

dnl without editing.

dnl If your extension references something external, use with:

dnl PHP_ARG_WITH(tanlib, for tanlib support,

dnl Make sure that the comment is aligned:

dnl [ --with-tanlib Include tanlib support])

dnl Otherwise use enable:

PHP_ARG_ENABLE(tanlib, whether to enable tanlib support,

dnl Make sure that the comment is aligned:

[ --enable-tanlib Enable tanlib support])

if test "$PHP_TANLIB" != "no"; then

dnl Write more examples of tests here...

dnl # --with-tanlib -> check with-path

dnl SEARCH_PATH="/usr/local /usr" # you might want to change this

dnl SEARCH_FOR="/include/tanlib.h" # you most likely want to change this

dnl if test -r $PHP_TANLIB/$SEARCH_FOR; then # path given as parameter

dnl TANLIB_DIR=$PHP_TANLIB

dnl else # search default path list

dnl AC_MSG_CHECKING([for tanlib files in default path])

dnl for i in $SEARCH_PATH ; do

dnl if test -r $i/$SEARCH_FOR; then

dnl TANLIB_DIR=$i

dnl AC_MSG_RESULT(found in $i)

dnl fi

dnl done

dnl fi

dnl

dnl if test -z "$TANLIB_DIR"; then

dnl AC_MSG_RESULT([not found])

dnl AC_MSG_ERROR([Please reinstall the tanlib distribution])

dnl fi

dnl # --with-tanlib -> add include path

dnl PHP_ADD_INCLUDE($TANLIB_DIR/include)

dnl # --with-tanlib -> check for lib and symbol presence

dnl LIBNAME=tanlib # you may want to change this

dnl LIBSYMBOL=tanlib # you most likely want to change this

dnl PHP_CHECK_LIBRARY($LIBNAME,$LIBSYMBOL,

dnl [

dnl PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $TANLIB_DIR/lib, TANLIB_SHARED_LIBADD)

AC_DEFINE(HAVE_TANLIBLIB,1,[ Whether you have tanlib])

dnl ],[

dnl AC_MSG_ERROR([wrong tanlib lib version or lib not found])

dnl ],[

dnl -L$TANLIB_DIR/lib -lm -ldl

dnl ])

dnl

dnl PHP_SUBST(TANLIB_SHARED_LIBADD)

PHP_NEW_EXTENSION(tanlib, tanlib.c, $ext_shared)

fi

有没有人搞定上面的?

顺便说一句,上面的config.m4文件是使用Autoconf 2.50生成的(我刚刚看到文档here,我正在慢慢消化它.

最佳答案 在我的Ubuntu计算机上,phpize位于:

$which phpize

/usr/bin/phpize

并且ext_skel应该位于PHP源中的“ext”目录中,您可以通过SVN获取.

这是ext目录:http://svn.php.net/viewvc/php/php-src/trunk/ext/

并且您可以查看脚本here的内容.

如果你更像是一个git用户,那么在github上有一个SVN的镜像:http://github.com/php/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值