pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/mk/configure Added a new compile-time check that detec...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/a9e35a6f4378
branches:  trunk
changeset: 519374:a9e35a6f4378
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Mon Oct 02 15:42:47 2006 +0000

description:
Added a new compile-time check that detects the usage of the "=="
operator in test(1). It is enabled by default when PKG_DEVELOPER is
selected.

In my private bulk build of about 3700 packages, there had been no false
positive.

diffstat:

 mk/configure/check-portability.mk |  63 +++++++++++++++++++++++++++++++++++++++
 mk/configure/configure.mk         |   5 ++-
 2 files changed, 67 insertions(+), 1 deletions(-)

diffs (86 lines):

diff -r 6f454ab4b9ca -r a9e35a6f4378 mk/configure/check-portability.mk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/mk/configure/check-portability.mk Mon Oct 02 15:42:47 2006 +0000
@@ -0,0 +1,63 @@
+# $NetBSD: check-portability.mk,v 1.1 2006/10/02 15:42:47 rillig Exp $
+#
+# This file contains some checks that are applied to the configure
+# scripts to check for certain constructs that are known to cause
+# problems on some platforms.
+#
+# The following variables may be set by the pkgsrc user in mk.conf:
+#
+# CHECK_PORTABILITY: YesNo
+#      Whether to enable some portability checks for the configure
+#      scripts before they are run.
+#
+#      Default value: yes for PKG_DEVELOPERs, no otherwise.
+#
+# The following variables may be set by the package:
+#
+# SKIP_PORTABILITY_CHECKS: YesNo
+#      Whether the above checks should be skipped for the current
+#      package.
+#
+#      Default value: no
+#
+
+.if !empty(PKG_DEVELOPER:M[Yy][Ee][Ss])
+CHECK_PORTABILITY?=            yes
+.endif
+CHECK_PORTABILITY?=            no
+SKIP_PORTABILITY_CHECK?=       no
+
+_RE_TEST=      -e "test[       ]*[^     ].*=="
+_RE_TEST+=     -e "\\[[        ].*==.*[        ]\\]"
+
+.if ${CHECK_PORTABILITY:M[Yy][Ee][Ss]} != "" && \
+    ${SKIP_PORTABILITY_CHECK:M[Yy][Ee][Ss]} == ""
+do-configure-pre-hook: _configure-check-for-test
+.endif
+.PHONY: _configure-check-for-test
+_configure-check-for-test:
+       @${STEP_MSG} "Checking for \"test ... == ...\" in configure scripts"
+.for d in ${CONFIGURE_DIRS}
+       ${_PKG_SILENT}${_PKG_DEBUG}set -e;                              \
+       cd ${WRKSRC}; cd ${d};                                          \
+       case `sed '1q' < ${CONFIGURE_SCRIPT}` in                        \
+       "#!"*"/bin/sh")                                                 \
+               found=no;                                               \
+               while read line; do                                     \
+                       set args $$line; shift;                         \
+                       while [ $$# -ge 3 ]; do                         \
+                               if [ ":$$1" = ":test" ] && [ ":$$3" = ":==" ]; then \
+                                       found=yes;                      \
+                                       ${ERROR_MSG} "[configure.mk] $$line"; \
+                               fi;                                     \
+                               shift;                                  \
+                       done;                                           \
+                       if [ "$$found" = "yes" ]; then                  \
+                               ${ERROR_MSG} "[configure.mk] Found test ... == ... in configure script."; \
+                               exit 1;                                 \
+                       fi;                                             \
+               done < ${CONFIGURE_SCRIPT};                             \
+               ;;                                                      \
+       esac
+.endfor
+
diff -r 6f454ab4b9ca -r a9e35a6f4378 mk/configure/configure.mk
--- a/mk/configure/configure.mk Mon Oct 02 15:29:36 2006 +0000
+++ b/mk/configure/configure.mk Mon Oct 02 15:42:47 2006 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: configure.mk,v 1.9 2006/07/27 13:47:29 jlam Exp $
+# $NetBSD: configure.mk,v 1.10 2006/10/02 15:42:47 rillig Exp $
 #
 # CONFIGURE_SCRIPT is the path to the script to run in order to
 #      configure the software for building.  If the path is relative,
@@ -32,6 +32,9 @@
 .if defined(USE_PKGLOCALEDIR)
 .  include "${PKGSRCDIR}/mk/configure/replace-localedir.mk"
 .endif
+.if defined(HAS_CONFIGURE)
+.  include "${.PARSEDIR}/check-portability.mk"
+.endif
 
 ######################################################################
 ### configure (PUBLIC)



Home | Main Index | Thread Index | Old Index