Sample Header Ad - 728x90

How to install autoconf as alternative in the system?

1 vote
1 answer
523 views
I am using a fairly dated Ubuntu 18/RHEL6 system with old build tools, I'm trying to update it but don't want to crush the existing tools installation. I created the following script which installed autoconf as an alternative, but I am unsure how to bring over the autoconf macros in the installed share. > autoreconf --version
autoreconf (GNU Autoconf) 2.71
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+/Autoconf: GNU GPL version 3 or later
,
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by David J. MacKenzie and Akim Demaille. Then when I try to run autoreconf --install --force, it would tell me it couldn't find the macro...
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
Is there a way to accomplish what I'm trying to do? Having automake, autoconf, libtool, etc as alternatives? The script (I have a similar script for automake, pkgconf, etc):
#!/bin/bash
set -e

WHAT=autoconf
VERSION=2.71

function install() {
    [ $# -eq 0 ] && { run_error "Usage: install "; 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
Asked by codenamezero (111 rep)
Jun 28, 2024, 07:18 PM
Last activity: Jul 3, 2024, 01:28 AM