./configure cannot locate header file when the directory is specified with CPPFLAGS

醉酒当歌 提交于 2019-12-13 16:22:13

问题


I'm trying to build php gettext module on Mac OS X Mavericks.

Installed gettext with brew install gettext, and checked header files are available at /usr/local/opt/gettext.

$ ls /usr/local/opt/gettext/include/
autosprintf.h   gettext-po.h    libintl.h

With a help in the post of How to override environment variables when running configure?, I executed ./configure LDFLAGS='-L/usr/local/opt/gettext/lib/' CPPFLAGS='-I/usr/local/opt/gettext/include/' to get this error message.

checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... re2c
checking for re2c version... 0.13.6 (ok)
checking for gawk... gawk
checking for GNU gettext support... yes, shared
configure: error: Cannot locate header file libintl.h <--

What's wrong with this? Why configure cannot find the header file when I specified the directory?


回答1:


Looking into the ./configure script, I noticed the script doesn't look into the environmental variable that I give. I just modified the script (Line 4067) to get it work.

if test "$PHP_GETTEXT" != "no"; then
  for i in $PHP_GETTEXT /usr/local /usr /usr/local/opt/gettext; do
    test -r $i/include/libintl.h && GETTEXT_DIR=$i && break
  done



回答2:


When compiling php you can pass --with-gettext=/usr/local/opt/gettext as an option to the configure commmand - thats what sets the $PHP_GETTEXT variable.



来源:https://stackoverflow.com/questions/21165067/configure-cannot-locate-header-file-when-the-directory-is-specified-with-cppfl

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!