poke-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[COMMITTED] build: do not require a modern AWK at configure time


From: Jose E. Marchesi
Subject: [COMMITTED] build: do not require a modern AWK at configure time
Date: Sat, 20 Feb 2021 20:09:51 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

commit 73362cd91ff6fad216f724f688121a1b37db0eb2 (HEAD -> master, origin/master, 
origin/HEAD)
Author: Jose E. Marchesi <jose.marchesi@oracle.com>
Date:   Sat Feb 20 20:04:16 2021 +0100

    build: do not require a modern AWK at configure time
    
    RAS requires a powerful AWK with support for gensub().  Therefore we
    had a check in place in configure.ac that errored out in case no such
    an AWK implementation was found in the build host.
    
    However, we are now distributing the RAS-generated .pkc files in the
    release tarballs, and therefore this is no longer a concern for users.
    
    This patch moves the check for a RAS suitable AWK implementation from
    configure time to build time.  It is the .pkc.pks rule in
    libpoke/Makefile.am that emits an error in case the AWK found in the
    system is not powerful enough.  Therefore, building from a release
    tarball (without modifying any of the .pks files) becomes possible
    without having that AWK installed.
    
    2021-02-20  Jose E. Marchesi  <jemarch@gnu.org>
    
            * configure.ac: Set POKE_AWK and do not error out at configure
            time if no suitable awk is found.
            * libpoke/Makefile.am (.pks.pkc): Check that AWK is powerful
            enough for RAS.  Error out otherwise.

diff --git a/ChangeLog b/ChangeLog
index c90b35d0..4ea6fee7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2021-02-20  Jose E. Marchesi  <jemarch@gnu.org>
+
+       * configure.ac: Set POKE_AWK and do not error out at configure
+       time if no suitable awk is found.
+       * libpoke/Makefile.am (.pks.pkc): Check that AWK is powerful
+       enough for RAS.  Error out otherwise.
+
 2021-02-20  Mohammad-Reza Nabipoor  <m.nabipoor@yahoo.com>
 
        * testsuite/poke.mi-json/mi-json.c (test_json_pk_sct): Remove unused
diff --git a/configure.ac b/configure.ac
index d4ced73b..f29553c8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -80,8 +80,17 @@ dnl i18n with gettext
 AM_GNU_GETTEXT_VERSION([0.19.8])
 AM_GNU_GETTEXT([external])
 
-# Poke requires a version of awk that supports gensub()
-AX_CHECK_AWK_GENSUB([], AC_MSG_ERROR([$AWK does not support gensub.]))
+dnl RAS requires a version of awk that supports gensub().  However,
+dnl since we are including the RAS-generated .pkc files in the
+dnl tarball, this should not be a hard dependency here: people
+dnl building poke from released tarballs are not required to have any
+dnl particular version of awk installed.  We therefore set POKE_AWK
+dnl here, using the value ':' for when no suitable awk is found.  Then
+dnl in the `.pkc : .pks' rule in Makefile.am an error message is
+dnl emitted in case no proper AWK is present.
+
+AX_CHECK_AWK_GENSUB([RAS_AWK=$AWK], [RAS_AWK=:])
+AC_SUBST([RAS_AWK])
 
 dnl The Boehm-Weiser garbage collector
 
diff --git a/libpoke/Makefile.am b/libpoke/Makefile.am
index ca2d9cfb..a42938cf 100644
--- a/libpoke/Makefile.am
+++ b/libpoke/Makefile.am
@@ -69,9 +69,14 @@ endif NBD
 # Generate them in $(srcdir), since they are distributed in tarballs
 # (see <https://www.gnu.org/prep/standards/html_node/Makefile-Basics.html>).
 .pks.pkc:
+       if test "x$(RAS_AWK)" = ":"; then \
+         echo "your AWK is not powerful enough.  Please install gawk" \
+          1>&2 && exit 1 || : ; \
+       fi
        outfile=`basename "$@"`; \
-       srcdir=$(srcdir) $(AWK) -f $(srcdir)/ras $< > $$outfile.tmp \
+       srcdir=$(srcdir) $(RAS_AWK) -f $(srcdir)/ras $< > $$outfile.tmp \
        && mv $$outfile.tmp $(srcdir)/$$outfile
+
 pkl-gen.pkc pkl-asm.pkc: $(srcdir)/ras $(srcdir)/pkl-insn.def
 MOSTLYCLEANFILES += pkl-gen.pkc.tmp pkl-asm.pkc.tmp



reply via email to

[Prev in Thread] Current Thread [Next in Thread]