开发者社区 问答 正文

关于./configure 中的 --with 和 --enable 的疑问?

比如在linux下编译php的时候,进行./configure 的时候 需要指定编译选项,有时候用 --with 有时候用 --enable 有时候--with 后面需要=一个目录,到底有什么区别呢?

展开
收起
a123456678 2016-06-15 16:13:12 3149 分享 版权
1 条回答
写回答
取消 提交回答
  • ./configure --help 就能看到这些配置项的说明.其实大部分对应的就是PHP源代码ext下的各个扩展.--enable开头的表示这个扩展不依赖第三方的库,典型的如 --enable-opcache.--with开头的表示这个扩展依赖第三方的库,像--with-curl就依赖第三方的libcurl库,系统需要 安装这个库的开发包(头文件,共享库so文件,静态库a文件)才能通过configure配置.

    用于生成PECL扩展源码骨架的脚本php-src/ext/ext_skel里说到(其中dnl是注释符号):
    dnl If your extension references something external, use with:
    dnl PHP_ARG_WITH($extname, for $extname support,
    dnl Make sure that the comment is aligned:
    dnl [ --with-$extname Include $extname support])

    dnl Otherwise use enable:
    dnl PHP_ARG_ENABLE($extname, whether to enable $extname support,
    dnl Make sure that the comment is aligned:
    dnl [ --enable-$extname Enable $extname support])

    2019-07-17 19:39:36
    赞同 展开评论
问答分类:
问答地址: