xfce4 dev tools的一些说明

xfce4 dev tools实际上基本是封装了一些autoconf的宏函数

比如XDT_I18N:

AC_DEFUN([XDT_I18N],
[
dnl Substitute GETTEXT_PACKAGE variable
GETTEXT_PACKAGE=m4_default([$], [AC_PACKAGE_TARNAME()])
AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], ["$GETTEXT_PACKAGE"], [Name of default gettext domain])
AC_SUBST([GETTEXT_PACKAGE]) dnl gettext and stuff
ALL_LINGUAS="$1"
AM_GLIB_GNU_GETTEXT() dnl This is required on some Linux systems
AC_CHECK_FUNC([bind_textdomain_codeset]) dnl Determine where to install locale files
AC_MSG_CHECKING([for locales directory])
AC_ARG_WITH([locales-dir],
[
AC_HELP_STRING([--with-locales-dir=DIR], [Install locales into DIR])
], [localedir=$withval],
[
if test x"$CATOBJEXT" = x".mo"; then
localedir=$libdir/locale
else
localedir=$datadir/locale
fi
])
AC_MSG_RESULT([$localedir])
AC_SUBST([localedir]) dnl Determine additional xgettext flags
AC_MSG_CHECKING([for additional xgettext flags])
if test x"$XGETTEXT_ARGS" = x""; then
XGETTEXT_ARGS="--keyword=Q_ --from-code=UTF-8";
else
XGETTEXT_ARGS="$XGETTEXT_ARGS --keyword=Q_ --from-code=UTF-8";
fi
AC_SUBST([XGETTEXT_ARGS])
AC_MSG_RESULT([$XGETTEXT_ARGS])
])

主要内容就在前面五行的实现:

  GETTEXT_PACKAGE=m4_default([$], [AC_PACKAGE_TARNAME()])
AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], ["$GETTEXT_PACKAGE"], [Name of default gettext domain])
AC_SUBST([GETTEXT_PACKAGE])
ALL_LINGUAS="$1"
AM_GLIB_GNU_GETTEXT()

定义了GETTEXT_PACKAGE宏,然后将参数1传递给ALL_LINGUAS

而XDT_CHECK_PACKAGE的实现也很简单,基本上就是封装PKG_CONFIG

AC_DEFUN([XDT_CHECK_PACKAGE],
[
XDT_PROG_PKG_CONFIG() AC_MSG_CHECKING([for $ >= $])
if $PKG_CONFIG "--atleast-version=$3" "$2" >/dev/null >&; then
$1_VERSION=`$PKG_CONFIG --modversion "$2"`
AC_MSG_RESULT([$$1_VERSION]) AC_MSG_CHECKING([$1_CFLAGS])
$1_CFLAGS=`$PKG_CONFIG --cflags "$2"`
AC_MSG_RESULT([$$1_CFLAGS]) AC_MSG_CHECKING([$1_LIBS])
$1_LIBS=`$PKG_CONFIG --libs "$2"`
AC_MSG_RESULT([$$1_LIBS]) $1_REQUIRED_VERSION=$ AC_SUBST([$1_VERSION])
AC_SUBST([$1_CFLAGS])
AC_SUBST([$1_LIBS])
AC_SUBST([$1_REQUIRED_VERSION]) ifelse([$], , , [$])
elif $PKG_CONFIG --exists "$2" >/dev/null >&; then
xdt_cv_version=`$PKG_CONFIG --modversion "$2"`
AC_MSG_RESULT([found, but $xdt_cv_version]) ifelse([$], ,
[
echo "*** The required package $2 was found on your system,"
echo "*** but the installed version ($xdt_cv_version) is too old."
echo "*** Please upgrade $2 to atleast version $3, or adjust"
echo "*** the PKG_CONFIG_PATH environment variable if you installed"
echo "*** the new version of the package in a nonstandard prefix so"
echo "*** pkg-config is able to find it."
exit
], [$])
else
AC_MSG_RESULT([not found]) ifelse([$], ,
[
echo "*** The required package $2 was not found on your system."
echo "*** Please install $2 (atleast version $3) or adjust"
echo "*** the PKG_CONFIG_PATH environment variable if you"
echo "*** installed the package in a nonstandard prefix so that"
echo "*** pkg-config is able to find it."
exit
], [$])
fi
])

XDT_PROG_PKG_CONFIG检测系统中是否存在PKG_CONFIG,如果

存在,则通过pkg-config来配置CFLAGS/LIBS等4个变量

上一篇:UVALive 7077 - Song Jiang's rank list(模拟)


下一篇:C#获取C++中修改过的float数组(指针),dll