簡體   English   中英

./configure 使用 CPPFLAGS 指定目錄時找不到頭文件

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

我正在嘗試在 Mac OS X Mavericks 上構建 php gettext 模塊。

使用brew install gettext ,並在/usr/local/opt/gettext中提供檢查的頭文件。

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

如何在運行配置時覆蓋環境變量? ,我執行./configure LDFLAGS='-L/usr/local/opt/gettext/lib/' CPPFLAGS='-I/usr/local/opt/gettext/include/'來得到這個錯誤信息。

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 <--

這有什么問題? 為什么configure在指定目錄的時候找不到頭文件?

查看 ./configure 腳本,我注意到該腳本沒有查看我提供的環境變量。 我只是修改了腳本(第 4067 行)以使其正常工作。

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

編譯 php 時,您可以將 --with-gettext=/usr/local/opt/gettext 作為選項傳遞給配置命令 - 這就是設置 $PHP_GETTEXT 變量的原因。

'/usr/include'一般需要指定引入文件的目錄

if test -f "/usr/include/WeWorkFinanceSdk_C.h" && test -f 
"/usr/include/libWeWorkFinanceSdk_C.so"; then
AC_MSG_RESULT(yes)
else
 AC_MSG_ERROR(cannot find WeWorkFinanceSdk_C.h in path ${PHP_WXWORK_FINANCE_SDK})
fi

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM