Install Autoconf / automake

I’m trying to build AdoptOpenJDK-hotswap for windows using os:windows and have problems with missing automake/autoconf. How can I install it using msys2 ?

OK, for anyone having the same problem, we have solved it in following project:

    - choco install cygwin
    - C:\\tools\\cygwin\\cygwinsetup.exe -q -P make,unzip,automake,autoconf,zip

Continuing the discussion from Autoconf / automake:

It seems that only msys work out of the box. After literally hundreds of different trials, I managed to make autoconf/automake to work there with a mix of chocoley and direct downloads.

my .travis.yml start separate scripts for the building phases:

- "${TRAVIS_BUILD_DIR}/travis/${TRAVIS_OS_NAME}.${TARGET_OS}.before_install"
- "${TRAVIS_BUILD_DIR}/travis/${TRAVIS_OS_NAME}.${TARGET_OS}.install"
- "${TRAVIS_BUILD_DIR}/travis/${TRAVIS_OS_NAME}.${TARGET_OS}.script"

The windows before_install script has:

choco install -r --no-progress -y zip

# xz is needed for msys base
wget -nv
unzip -q -d /

Basically, its goal is to install xz, with will be needed for msys. The actual work is done by the install script:

set -e


# Msys base and m4
wget -nv
wget -nv

mkdir /mingw
xz -d msysCORE-1.0.19-1-msys-1.0.19-bin.tar.xz
tar -C /mingw -xf msysCORE-1.0.19-1-msys-1.0.19-bin.tar

xz -d  m4-1.4.16-2-msys-1.0.17-bin.tar.lzma
tar -C /mingw -xf m4-1.4.16-2-msys-1.0.17-bin.tar

# Msys autoconf, automake, libtool

+wget -nv
wget -nv
wget -nv

xz -d autoconf2.5-2.68-1-mingw32-bin.tar.lzma
xz -d automake1.11-1.11.1-1-mingw32-bin.tar.lzma
xz -d libtool-2.4-1-mingw32-bin.tar.lzma

tar -C /mingw -xf autoconf2.5-2.68-1-mingw32-bin.tar
tar -C /mingw -xf automake1.11-1.11.1-1-mingw32-bin.tar
tar -C /mingw -xf libtool-2.4-1-mingw32-bin.tar

# Add aliases to standard names
ln -sf /mingw/bin/aclocal-1.11 /mingw/bin/aclocal
ln -sf /mingw/bin/automake-1.11 /mingw/bin/automake
ln -sf /mingw/bin/autoconf-2.68 /mingw/bin/autoconf
ln -sf /mingw/bin/autoheader-2.68 /mingw/bin/autoheader
ln -sf /mingw/bin/autom4te-2.68 /mingw/bin/autom4te
ln -sf /mingw/bin/autoreconf-2.68 /mingw/bin/autoreconf
ln -sf /mingw/bin/autoscan-2.68 /mingw/bin/autoscan
ln -sf /mingw/bin/autoupdate-2.68 /mingw/bin/autoupdate
ln -sf /mingw/bin/ifnames-2.68 /mingw/bin/ifnames
ln -sf /mingw/bin/m4 /usr/bin/m4

With that, autoconf works, but it still misses several dependencies,like pkg-config m4 scripts, causing it to fail, at least with the project I’m trying to build on Windows, while it runs, it still has issues ( error: possibly undefined macro: dnl
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation. error: possibly undefined macro: AM_INIT_AUTOMAKE error: possibly undefined macro: AM_CONDITIONAL error: possibly undefined macro: AM_PROG_CC_C_O error: possibly undefined macro: AS_IF error: possibly undefined macro: AC_MSG_FAILURE error: possibly undefined macro: AC_MSG_NOTICE error: possibly undefined macro: AM_PATH_PYTHON

Before the above attempt, I tried to use msys2, but there’s an issue there too:

I’m returning back to try using msys2, calling pacman from a powershell script.

After literally hundreds of builds, I was able to successfully make autoconf to work. Basically, at the build scripts, I added:

set -e

choco install -r --no-progress -y msys2 make

# Calling pacman via a powershell script
powershell -executionpolicy bypass "pacman -Syu --noconfirm autoconf libtool automake make autoconf-archive pkg-config"

# Fix the environment for autotools to actually work
ln -s /c/tools/msys64/usr/share/autoconf* /usr/share/
ln -s /c/tools/msys64/usr/share/automake* /usr/share/
ln -s /c/tools/msys64/usr/share/aclocal* /usr/share/
ln -s /c/tools/msys64/usr/share/libtool* /usr/share/
ln -s /c/tools/msys64/usr/share/pkgconfig /usr/share/
ln -s /c/tools/msys64/usr/bin/autom4te /usr/bin/
ln -s /c/tools/msys64/usr/bin/autoconf /usr/bin/
ln -s /c/tools/msys64/usr/bin/autoheader /usr/bin/
ln -s /c/tools/msys64/usr/bin/m4 /usr/bin/

export CONFIG_SHELL=/usr/bin/bash.exe

autoreconf -vfi

# HACK: Ensure that msys64 comes first, as otherwise libtool won't work




You’re risking mismatched Cygwin/MSYS DLLs (and other issues) unless you go via msys2_shell.cmd to prepare the environment correctly. My method is here.

Not sure if this has been resolved or not.
I have used both method by creating the software link

or the later method since Windows msys2 is supported.

Does anyone has success sample which autotools works in windows build?

I’ve successfully built the Hunspell library, which uses Autotools, on Windows. (The invocation to autoreconf and ./configure are in the prepare_deps script in my repo.)

1 Like

Thank you for your sample, it helps me figure out some of the problem.