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: https://github.com/TravaOpenJDK/trava-jdk-11-dcevm:

    - 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:

before_install:
- "${TRAVIS_BUILD_DIR}/travis/${TRAVIS_OS_NAME}.${TARGET_OS}.before_install"
install:
- "${TRAVIS_BUILD_DIR}/travis/${TRAVIS_OS_NAME}.${TARGET_OS}.install"
script:
- "${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 https://tukaani.org/xz/xz-5.2.4-windows.zip
unzip -q -d / xz-5.2.4-windows.zip

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

set -e

PATH=$PATH:/bin_x86-64/

# Msys base and m4
wget -nv https://master.dl.sourceforge.net/project/mingw/MSYS/Base/msys-core/msys-1.0.19-1/msysCORE-1.0.19-1-msys-1.0.19-bin.tar.xz
wget -nv https://master.dl.sourceforge.net/project/mingw/MSYS/Extension/m4/m4-1.4.16-2/m4-1.4.16-2-msys-1.0.17-bin.tar.lzma

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 https://master.dl.sourceforge.net/project/mingw/MinGW/Extension/autoconf/autoconf2.5/autoconf2.5-2.68-1/autoconf2.5-2.68-1-mingw32-bin.tar.lzma
wget -nv https://master.dl.sourceforge.net/project/mingw/MinGW/Extension/automake/automake1.11/automake1.11-1.11.1-1/automake1.11-1.11.1-1-mingw32-bin.tar.lzma
wget -nv https://master.dl.sourceforge.net/project/mingw/MinGW/Extensionlibtool/libtool-2.4-1/libtool-2.4-1-mingw32-bin.tar.lzma

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 (https://travis-ci.org/mchehab/zbar/builds/534546389):

configure.ac:1: error: possibly undefined macro: dnl
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
configure.ac:8: error: possibly undefined macro: AM_INIT_AUTOMAKE
configure.ac:75: error: possibly undefined macro: AM_CONDITIONAL
configure.ac:80: error: possibly undefined macro: AM_PROG_CC_C_O
configure.ac:142: error: possibly undefined macro: AS_IF
configure.ac:165: error: possibly undefined macro: AC_MSG_FAILURE
configure.ac:382: error: possibly undefined macro: AC_MSG_NOTICE
configure.ac:562: 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
PATH=$PATH:/c/tools/msys64/usr/bin/

# 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/

PATH=$PATH:/c/tools/msys64/usr/bin/
export CONFIG_SHELL=/usr/bin/bash.exe

autoreconf -vfi

./configure 
# HACK: Ensure that msys64 comes first, as otherwise libtool won't work
PATH=/c/tools/msys64/usr/bin/:$PATH

make

Tricky!

2 Likes

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.

1 Like

Not sure if this has been resolved or not.
I have used both method by creating the software link
https://travis-ci.com/github/doublechiang/ipmitool/jobs/346312522

or the later method since Windows msys2 is supported.
https://travis-ci.com/github/doublechiang/ipmitool/jobs/346777393

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.)

2 Likes

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