我正在使用一个相当过时的 Ubuntu 18/RHEL6 系统和旧的构建工具,我正在尝试更新它,但不想破坏现有的工具安装。我创建了以下脚本作为替代方案安装,但我不确定如何将安装中的宏autoconf
带过来。autoconf
share
autoreconf --version
autoreconf (GNU Autoconf) 2.71
版权所有 (C) 2021 Free Software Foundation, Inc.
许可证 GPLv3+/Autoconf:GNU GPL 版本 3 或更高版本
https://gnu.org/licenses/gpl.html , https://gnu.org/licenses/exceptions.html
这是免费软件:您可以自由更改和重新分发它。
在法律允许的范围内,不提供任何保证。
由 David J. MacKenzie 和 Akim Demaille 编写。
然后,当我尝试运行时autoreconf --install --force
,它会告诉我找不到宏......
autoreconf --verbose --install --force
autoreconf: export WARNINGS=
autoreconf: Entering directory '.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force -I m4
autoreconf: configure.ac: tracing
autoreconf: running: libtoolize --copy --force
libtoolize: putting auxiliary files in '.'.
libtoolize: copying file './ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
libtoolize: copying file 'm4/libtool.m4'
libtoolize: copying file 'm4/ltoptions.m4'
libtoolize: copying file 'm4/ltsugar.m4'
libtoolize: copying file 'm4/ltversion.m4'
libtoolize: copying file 'm4/lt~obsolete.m4'
autoreconf: configure.ac: not using Intltool
autoreconf: configure.ac: not using Gtkdoc
autoreconf: running: aclocal --force -I m4
autoreconf: running: /opt/autoconf/bin/autoconf --force
configure.ac:1040: error: possibly undefined macro: m4_ifdef
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
autoreconf: error: /opt/autoconf/bin/autoconf failed with exit status: 1
有没有什么方法可以完成我想做的事情?有、、automake
等替代方案吗?autoconf
libtool
脚本(我有一个类似的脚本automake
,pkgconf
等等):
#!/bin/bash
set -e
WHAT=autoconf
VERSION=2.71
function install() {
[ $# -eq 0 ] && { run_error "Usage: install <version>"; exit; }
local VERSION=${1}
local TARBALL=${WHAT}-${VERSION}.tar.xz
local URL=ftp://ftp.gnu.org/gnu/${WHAT}/${TARBALL}
local WHERE=/tmp/update-${WHAT}
echo "Downloading ${URL}"
mkdir -p ${WHERE}
cd ${WHERE}
curl -L --create-dirs -o ${TARBALL} ${URL}
if [ -f "${TARBALL}" ]; then
tar -xf ${TARBALL}
cd ${WHAT}-${VERSION}/
./configure --prefix="/opt/${WHAT}"
make
echo "Installing..."
sudo make install
echo -e "${TARBALL} installed \e[1;32mOK\e[39m"
else
echo -e "Cannot download ${URL}"
exit 1
fi
}
function install_alternatives() {
for fullpath in /opt/${WHAT}/bin/* ; do
local NAME="$(basename ${fullpath})"
#echo "sudo update-alternatives --install /usr/local/bin/${NAME} ${NAME} ${fullpath} 50"
sudo update-alternatives --install /usr/local/bin/${NAME} ${NAME} ${fullpath} 50
. ~/.profile
done
}
function remove_alternatives() {
for fullpath in /opt/${WHAT}/bin/* ; do
local NAME="$(basename ${fullpath})"
#echo "sudo update-alternatives --remove ${NAME} ${fullpath}"
sudo update-alternatives --remove ${NAME} ${fullpath}
. ~/.profile
done
}
if declare -f "$1" > /dev/null
then
"$@"
else
install ${VERSION}
install_alternatives
fi
经过尝试和详细调试,我解决了我的问题。我的脚本基本正确,只是在
install_alternatives
本质上,我将新版本放在下面,
/usr/share
以便系统可以搜索它。后来我遇到了一些其他警告,编译告诉我它找不到某些文件或 PKG_CHECK_MODULES 失败,这些问题已在我的脚本中修复。以下 3 个脚本允许我获得最新的
automake
和作为替代方案安装autoconf
,pkgconf
而不会破坏/改变现有的系统安装。更新-automake.sh
更新 autoconf.sh
更新-pkgconf.sh
希望这可以帮助到别人。