要安装目录文件,我想获取Glade(UI设计器)的目录,如下所示:
$ pkg-config --variable=catalogdir gladeui-2.0
/usr/share/glade/catalogs
但是在Makefile.am中的变量中。有(便携式)方法吗?
答案 0 :(得分:5)
在configure.ac
中获取此值。我认为pkg-config
的最新版本是0.28。我们假设0.25或以上就足够了:
configure.ac
...
PKG_PROG_PKG_CONFIG([0.25]) # check and set $PKG_CONFIG
PKG_CHECK_MODULES([GLADEUI],[gladeui-2.0],
[ac_gladeui_catdir=`$PKG_CONFIG --variable=catalogdir gladeui-2.0`],
[ac_gladeui_catdir=;])
# there's nothing special about the choice of variable names:
# GLADEUI or ac_gladeui_catdir - use whatever naming scheme you please.
if test "x$ac_gladeui_catdir" = x ; then
AC_MSG_ERROR([couldn't find Glade or catalog directory])
fi
# or if you prefer the AS_IF macro:
# AS_IF([test "x$ac_gladeui_catdir" = x],
# [AC_MSG_ERROR([couldn't find Glade or catalog directory])])
AC_SUBST(GLADEUI_CATDIR, $ac_gladeui_catdir)
您现在可以使用Makefile.am
$(GLADEUI_CATDIR)
中访问此值