configuring autoconf to have --with options to customise build

喜你入骨 提交于 2019-12-22 11:28:42

问题


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?


回答1:


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


来源:https://stackoverflow.com/questions/5684714/configuring-autoconf-to-have-with-options-to-customise-build

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!