NetBSD-Bugs archive

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

misc/39737: the build attempts to run autoconf/automake/autoheader

>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
Not much
System: NetBSD 4.99.72
Architecture: i386
Machine: i386
        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.

        check out a clean tree.

        cd src
        touch dist/file/
        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.

        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]

perlscript="$( cat <<\EOF 
    # For all values of target and exclude in the lists below,
    # for each Makefile line of the form "[whitespace]...
    # change it to " comment ...",
    # except if it was of the form "[whitespace]exclude...",
    # in which case leave it unchanged.
    $comment = '#';
    @targets = (
                'configure', 'config.status',
                'ACLOCAL_M4)', 'aclocal.m4',
                '.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;
        if (eof) {
            print STDERR "$ARGV\n";

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

[end script]

Home | Main Index | Thread Index | Old Index