Source-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc mk/configure: fix check for unknown configure options



details:   https://anonhg.NetBSD.org/pkgsrc/rev/e08e1a7b9ce1
branches:  trunk
changeset: 432467:e08e1a7b9ce1
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Fri May 22 15:21:15 2020 +0000

description:
mk/configure: fix check for unknown configure options

diffstat:

 mk/configure/gnu-configure.mk                   |   4 +-
 regress/infra-unittests/gnu-configure-strict.sh |  27 ++++++++++++------------
 2 files changed, 15 insertions(+), 16 deletions(-)

diffs (69 lines):

diff -r b5e51b5a5ef0 -r e08e1a7b9ce1 mk/configure/gnu-configure.mk
--- a/mk/configure/gnu-configure.mk     Fri May 22 15:10:17 2020 +0000
+++ b/mk/configure/gnu-configure.mk     Fri May 22 15:21:15 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: gnu-configure.mk,v 1.26 2020/05/21 21:05:51 rillig Exp $
+# $NetBSD: gnu-configure.mk,v 1.27 2020/05/22 15:21:15 rillig Exp $
 #
 # Package-settable variables:
 #
@@ -238,7 +238,7 @@
                                -e 's,^disable_,enable_,' \
                                -e 's,^without_,with_,'); \
                [ "$$optvar" = 'enable_option_checking' ] && continue; \
-               ${GREP} "^$$optvar$$" $$configures 1>/dev/null || { \
+               ${GREP} -e "^$$optvar$$" -e "{$$optvar+set}" $$configures 1>/dev/null || { \
                        ${ERROR_MSG} "[gnu-configure.mk] option $$opt not found in $$configures"; \
                        exitcode=1; \
                }; \
diff -r b5e51b5a5ef0 -r e08e1a7b9ce1 regress/infra-unittests/gnu-configure-strict.sh
--- a/regress/infra-unittests/gnu-configure-strict.sh   Fri May 22 15:10:17 2020 +0000
+++ b/regress/infra-unittests/gnu-configure-strict.sh   Fri May 22 15:21:15 2020 +0000
@@ -1,5 +1,5 @@
 #! /bin/sh
-# $NetBSD: gnu-configure-strict.sh,v 1.2 2020/05/22 15:10:17 rillig Exp $
+# $NetBSD: gnu-configure-strict.sh,v 1.3 2020/05/22 15:21:15 rillig Exp $
 #
 # Tests for GNU_CONFIGURE_STRICT handling in mk/configure/gnu-configure.mk.
 #
@@ -407,13 +407,18 @@
        #
        # The word --enable-http appears twice in that file.  Once in the
        # --help text, and once in a shell comment saying "Check whether
-       # --enable-http or --disable-http was given".  Therefore, detect
-       # the available options using the --help text.
+       # --enable-http or --disable-http was given".  The shell comment
+       # is too unreliable, and the help text only contains either enable
+       # or disable, but not both.  Therefore the simplest solution is to
+       # scan for the common pattern ${enable_http+set}.
 
        create_file 'configure' <<-EOF
-               Optional features:
-                 --disable-nls            do not use Native Language Support
-                 --enable-http            include support for http
+               if test "\${enable_http+set}" = set; then
+                       :
+               fi
+               if test "\${enable_nls+set}" = set; then
+                       :
+               fi
        EOF
        create_file 'testcase.mk' <<-EOF
                GNU_CONFIGURE_STRICT=   yes
@@ -430,14 +435,8 @@
                1> "$tmpdir/output" 2>&1 \
        && exitcode=0 || exitcode=$?
 
-       assert_that "$exitcode" --equals '1'
-       assert_that "$tmpdir/output" --file-is-lines \
-               'error: [gnu-configure.mk] option --enable-http not found in ./configure' \
-               'error: [gnu-configure.mk] option --enable-nls not found in ./configure' \
-               '*** Error code 1' \
-               '' \
-               'Stop.' \
-               "$make: stopped in $PWD"
+       assert_that "$exitcode" --equals '0'
+       assert_that "$tmpdir/output" --file-is-empty
 
        test_case_end
 fi



Home | Main Index | Thread Index | Old Index