我想了解configure.ac
文件爲libXrender
包:從configure.ac中的變量替換?
...
AC_INIT(libXrender, [0.9.8], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [libXrender])
AC_CONFIG_SRCDIR([Makefile.am])
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE([foreign dist-bzip2])
AC_PROG_LIBTOOL
# Require X.Org macros 1.8 or later for AC_PROG_INSTALL
m4_ifndef([XORG_MACROS_VERSION], [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])])
XORG_MACROS_VERSION(1.8)
XORG_DEFAULT_OPTIONS
XORG_CHECK_MALLOC_ZERO
# Check render configuration, strip extra digits from package version to
# find the required protocol version
if test "$VERSION" = "" ; then
VERSION=$PACKAGE_VERSION;
fi
RENDER_VERSION=[`echo $VERSION | sed 's/^\([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/'`]
AC_SUBST(RENDER_VERSION)
# Obtain compiler/linker options for depedencies
PKG_CHECK_MODULES(RENDER, x11 renderproto >= $RENDER_VERSION)
# Check for _XEatDataWords function that may be patched into older Xlib release
SAVE_LIBS="$LIBS"
LIBS="$RENDER_LIBS"
AC_CHECK_FUNCS([_XEatDataWords])
LIBS="$SAVE_LIBS"
AC_CONFIG_FILES([Makefile
src/Makefile
xrender.pc])
AC_OUTPUT
我明白AC_INIT
和AM_INIT_AUTOMAKE
等是在GNU自動安裝目錄中指定宏和XORG_MACROS_VERSION
等被在X.org軟件包安裝目錄中指定(我認爲)。
我不明白的是,像$VERSION
,$PACKAGE_VERSION
和$LIBS
這樣的變量會從哪裏獲得它們的值?不是configure.ac
應該是「頂級」輸入文件嗎?
謝謝您的詳細解答!我相信你指出了我的困惑。我從功能的角度思考,即從哪裏調用「configure」,以便可以傳入這些變量的值。現在我意識到它只是宏擴展 - autoconf只是擴展了所有的宏configure.ac使用在其他地方找到的定義,在這些定義中也會有一些變量定義,它們以「configure」結尾。正是在上面所示的configure.ac中引用了這些間接定義的變量。 –
在configure.ac中對這些變量的引用也將以「configure」結尾,但在*之前*之前的宏的擴展版本(如AC_INIT)將包含這些變量的定義。 –