| git.druid.rocks | index | druid520 | ports | ports/ | build-tools/ | gnu-m4/ | add.sh |
ports/build-tools/gnu-m4/add.sh
set -e
# build from the release tarball, which ships a pre-generated configure
# that needs only a C compiler (no autoconf). building from git would need
# ./bootstrap (autoconf/automake/libtool) which itself needs m4, so a
# tarball is the only way to bootstrap m4 from scratch.
curl -LO https://ftp.gnu.org/gnu/m4/m4-1.4.19.tar.gz
# -z explicit, not "tar xf" alone: this tree's own tar (sbase, not gnu
# tar) doesn't auto-detect gzip compression from magic bytes the way
# gnu tar/busybox tar both do -- confirmed for real, "tar xf x.tar.gz"
# fails outright ("malformed tar archive: not ustar format") on a
# genuinely valid, unmodified gzip archive, while the exact same file
# extracts fine once -z is given explicitly.
tar -x -z -f m4-1.4.19.tar.gz
mv m4-1.4.19 m4
cd m4
./configure --prefix=$MP_PREFIX
# m4 1.4.19's bundled gnulib predates gcc defaulting to C23 and
# misdetects/mishandles its [[nodiscard]] attribute syntax, breaking the
# build outright on any compiler defaulting to C23 (gcc 15+). -std=gnu17
# sidesteps the mismatch entirely without touching gnulib itself.
make CFLAGS="-std=gnu17 $CFLAGS" LDFLAGS="$LDFLAGS" -j$MP_JOBS
make install
make clean || true
cd ..
rm -rf m4 m4-1.4.19.tar.gz