NetBSD Problem Report #39737

From apb@cequrux.com  Sun Oct 12 16:49:32 2008
Return-Path: <apb@cequrux.com>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id 88A3863B88A
	for <gnats-bugs@gnats.NetBSD.org>; Sun, 12 Oct 2008 16:49:32 +0000 (UTC)
Message-Id: <20081012164647.0E222E93433@apb-laptoy.apb.alt.za>
Date: Sun, 12 Oct 2008 16:46:47 +0000 (UTC)
From: apb@cequrux.com
To: gnats-bugs@gnats.NetBSD.org
Subject: the build attempts to run autoconf/automake/autoheader
X-Send-Pr-Version: 3.95

>Number:         39737
>Category:       misc
>Synopsis:       the build attempts to run autoconf/automake/autoheader
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    misc-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Oct 12 16:50:00 +0000 2008
>Originator:     Alan Barrett
>Release:        NetBSD 4.99.72
>Organization:
Not much
>Environment:
System: NetBSD 4.99.72
Architecture: i386
Machine: i386
>Description:
        Some makefiles contain rules that attempt to run autoconf,
        automake, autoheader, and similar tools, depending on the time
        stamps of various files.  If the source tree is read-only, this
        will fail.  If the source tree is writable, it will cause files
        to be overwritten, or unwanted files to be created.

>How-To-Repeat:
	check out a clean tree.

	cd src
	touch dist/file/configure.ac
	sh ./build.sh tools

	Notice that it wants to run autoconf in the dist/file directory,
	which will overwrite or create files in the source tree.

        Of course "dist/file" is not the only subdirectory that suffers
        from this problem.

>Fix:
        A proper fix would involve changes to autoconf to prevent it
        from adding unwanted rules to the Makefiles.  Note that some
        programs in the source tree already use a version of autoconf
        that makes such rules conditional on "maintainer mode", which is
        good enough.

	For a workaround, run the following script and commit the results.

[begin script]
#!/bin/sh

perlscript="$( cat <<\EOF 
    #
    # For all values of target and exclude in the lists below,
    # for each Makefile line of the form "...target:[whitespace]...
    # change it to "...target: comment ...",
    # except if it was of the form "...target:[whitespace]exclude...",
    # in which case leave it unchanged.
    #
    $comment = '#';
    @targets = (
                'configure', 'config.status',
                'ACLOCAL_M4)', 'aclocal.m4',
                'Makefile',
                '.am', '.ac', '.in', '.hin'
               );
    @excludes = ('#', '@MAINT');
    $target_re = '(?:' . join('|', map {quotemeta($_)} @targets) . ')';
    $exclude_re = '(?:' . join('|', map {quotemeta($_)} @excludes) . ')';
    while (<>) {
	s/(${target_re}:)\s*(?!${exclude_re})(\S)/$1 ${comment} $2/o;
	print;
	if (eof) {
	    print STDERR "$ARGV\n";
	}
    }
EOF
)"

find . -name '*[Mm]akefile*' -print0 \
| xargs -0 perl -i -e "$perlscript"

[end script]

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.