Edit

kc3-lang/automake/bootstrap

Branch :

  • Show log

    Commit

  • Author : Ralf Wildenhues
    Date : 2008-10-26 19:29:25
    Hash : 937775c8
    Message : Parallel automake execution: AUTOMAKE_JOBS. * lib/Automake/Config.in (perl_threads): New global. * automake.in: Use it. If the perl supports interpreter-based threading, then use `threads' and `Thread::Queue'. (handle_makefile, handle_makefiles_serial): New functions, factored out from main. (get_number_of_threads): New function, compute number of threads to use, based on environment variable `AUTOMAKE_JOBS' and number of independent makefiles. (handle_makefiles_threaded): New function. Spawn threads, use thread queue to distribute handling the different makefiles. Collect $exit_code values from threads. (main): Use new functions. * aclocal.in: No threads here. * configure.ac: Substitute PERL_THREADS; enabled with perl >= 5.7.2 and when ithreads are available. * bootstrap (dosubst): Likewise. * Makefile.am (do_subst): Likewise. * lib/Automake/Makefile.am (do_subst): Likewise. * lib/Automake/ChannelDefs.pm: Use `Automake::Config' and `threads'. (verb): Prepend thread ID (tid) to verbose messages. * lib/Automake/Channels.pm (msg): Before exiting, flush stderr, needed for worker threads. * lib/Automake/tests/Makefile.am (TESTS_ENVIRONMENT): Also include the build tree path, so Config.pm is found. * tests/parallel-am.test: New test. * tests/Makefile.am: Update. * doc/automake.texi (Invoking Automake): Document AUTOMAKE_JOBS. * NEWS, THANKS: Update. Report about long execution times by Joakim Tjernlund and others. Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>

  • bootstrap
  • #! /bin/sh
    
    # This script helps bootstrap automake, when checked out from git.
    #
    # Copyright (C) 2002, 2003, 2004, 2007, 2008  Free Software Foundation,
    # Inc.
    # written by Pavel Roskin <proski@gnu.org> September 2002
    #
    # This program is free software; you can redistribute it and/or modify
    # it under the terms of the GNU General Public License as published by
    # the Free Software Foundation; either version 3, or (at your option)
    # any later version.
    #
    # This program is distributed in the hope that it will be useful,
    # but WITHOUT ANY WARRANTY; without even the implied warranty of
    # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # GNU General Public License for more details.
    #
    # You should have received a copy of the GNU General Public License
    # along with this program.  If not, see <http://www.gnu.org/licenses/>.
    
    # Find the path separator
    echo "#! /bin/sh" >boot$$.sh
    echo  "exit 0"   >>boot$$.sh
    chmod +x boot$$.sh
    if (PATH="/nonexistent;."; boot$$.sh) >/dev/null 2>&1; then
      PATH_SEPARATOR=';'
    else
      PATH_SEPARATOR=:
    fi
    rm -f boot$$.sh
    
    # Don't ignore failures
    set -e
    
    # Find perl.  Code based on Autoconf, but without non-POSIX support.
    if test -z "$PERL"; then
    	save_IFS=$IFS
    	IFS=$PATH_SEPARATOR
    	for dir in $PATH; do
    		IFS=$save_IFS
    		test -z "$dir" && dir=.
    		if test -x "$dir/perl" && test ! -d "$dir/perl"; then
    			PERL="$dir/perl"
    			break
    		fi
    	done
    fi
    
    if test -z "$PERL"; then
    	echo "Cannot find perl" >&2
    	exit 1
    fi
    
    # Variables to substitute
    VERSION=`sed -ne '/AC_INIT/s/^[^[]*\[[^[]*\[\([^]]*\)\].*$/\1/p' configure.ac`
    PACKAGE=automake
    datadir=.
    PERL_THREADS=0
    
    # Override SHELL.  This is required on DJGPP so that Perl's system()
    # uses bash, not COMMAND.COM which doesn't quote arguments properly.
    # It's not used otherwise.
    if test -n "$DJGPP"; then
        BOOTSTRAP_SHELL=/dev/env/DJDIR/bin/bash.exe
    else
        BOOTSTRAP_SHELL=/bin/sh
    fi
    
    # Read the rule for calculating APIVERSION and execute it
    apiver_cmd=`sed -ne 's/\[\[/[/g;s/\]\]/]/g;/^APIVERSION=/p' configure.ac`
    eval $apiver_cmd
    
    # Sanity checks
    if test -z "$VERSION"; then
    	echo "Cannot find VERSION" >&2
    	exit 1
    fi
    
    if test -z "$APIVERSION"; then
    	echo "Cannot find VERSION" >&2
    	exit 1
    fi
    
    # Make a dummy versioned directory for aclocal
    rm -rf aclocal-$APIVERSION
    mkdir aclocal-$APIVERSION
    if test -d automake-$APIVERSION; then
    	find automake-$APIVERSION -exec chmod u+wx '{}' ';'
    fi
    rm -rf automake-$APIVERSION
    # Can't use `ln -s lib automake-$APIVERSION',
    # that would create a lib.exe stub under DJGPP 2.03.
    mkdir automake-$APIVERSION
    cp -rf lib/* automake-$APIVERSION
    
    dosubst ()
    {
      rm -f $2
      in=`echo $1 | sed 's,^.*/,,'`
      sed -e "s%@APIVERSION@%$APIVERSION%g" \
          -e "s%@PACKAGE@%$PACKAGE%g" \
          -e "s%@PERL@%$PERL%g" \
          -e "s%@PERL_THREADS@%$PERL_THREADS%g" \
          -e "s%@SHELL@%$BOOTSTRAP_SHELL%g" \
          -e "s%@VERSION@%$VERSION%g" \
          -e "s%@datadir@%$datadir%g" \
          -e "s%@configure_input@%Generated from $in; do not edit by hand.%g" \
          $1 > $2
      chmod a-w $2
    }
    
    
    # Create temporary replacement for lib/Automake/Config.pm
    dosubst automake-$APIVERSION/Automake/Config.in \
    	automake-$APIVERSION/Automake/Config.pm
    
    # Create temporary replacement for aclocal
    dosubst aclocal.in aclocal.tmp
    
    # Overwrite amversion.m4
    dosubst m4/amversion.in m4/amversion.m4
    
    # Create temporary replacement for automake
    dosubst automake.in automake.tmp
    
    # Run the autotools.
    $PERL ./aclocal.tmp -I m4
    autoconf
    $PERL ./automake.tmp
    
    # Remove temporary files and directories
    rm -rf aclocal-$APIVERSION automake-$APIVERSION
    rm -f aclocal.tmp automake.tmp
    rm -f lib/Automake/Config.pm