configuring autoconf to have --with options to customise build
I have a very basic understanding of how autoconf and automake work, gathered from various tutorials. However, as开发者_运维问答 I would like my libraries to be flexible during their builds, they need to have the --with-FEATURE
and --without-FEATURE
functionality commonly found in other programs. How do I implement this?
You'll want to use AC_ARG_WITH
, for example:
AC_ARG_WITH(editres,
[ --without-editres do not use editres])
if test "x${with_editres}" != "xno"; then
AC_CHECK_LIB(Xmu, _XEditResCheckMessages,
EDITRES_LIBS="-lXmu"
AC_DEFINE(HAVE_EDITRES, 1), AC_DEFINE(HAVE_EDITRES, 0),
${X_PRE_LIBS} ${XEXT_LIBS} ${XT_LIBS} ${XEXT_LIBS} ${X11_LIBS})
else
AC_DEFINE(HAVE_EDITRES, 0)
fi
精彩评论