#!/bin/sh ######################################################################## # bootstrap script for UPC runtime autoconf/automake framework # # Assumes you wish to store autoconf temp files in a 'config-aux' # subdirectory: make sure you add # # AC_CONFIG_AUX_DIR(config-aux) # # to your configure.in files (or nothing works), and # # EXTRA_DIST = $(top_builddir)/config-aux # # to your Makefile.am (or 'make dist' won't work). # ######################################################################## TIME= NOTOOLCHECK=0 autofilter="perl -0 -pe 's/^(autoheader.*?: )?WARN.+auxiliary files(.|\n)+WARN.+documentation.\n//m' \ | perl -pe 's/^.*?AC_PROG_LEX invoked multiple times.*?\n?$//g' \ | perl -0 -pe 's/^((.*?AC_CONFIG_SUBDIRS.*?\n)+([^ ]* the top level\n)?)*//g'" srcdir=`dirname $0` for arg in "$@"; do case "$arg" in -h) echo "Usage: $0 [options]" echo " -v verbose mode: don't filter benign warnings from autotool output" echo " -t time autotool commands" echo " -n no checks for autotool presence and versions" echo " -T touch Bootstrap-generated files to make them appear up-to-date" exit 1 ;; -v) autofilter=cat ;; -n) NOTOOLCHECK=1 ;; -T) DOTOUCH=1 ;; -t) TIME='/usr/bin/time' if test ! -x "$TIME" ; then TIME= fi ;; *) ;; # ignore unrecognized args esac done DOIT='echo "+ $CMD | \$autofilter" ; ( eval $TIME $CMD 2>&1 || kill $$ ) | eval $autofilter' # ; if test "$PIPESTATUS" != "" -a "$PIPESTATUS" != "0" ; then exit 1 ; fi' if [ "$DOTOUCH" = 1 ]; then if [ -r $srcdir/upcr_config.h.in \ -a -r $srcdir/Makefile.in \ -a -r $srcdir/aclocal.m4 \ -a -r $srcdir/configure \ ]; then $srcdir/gasnet/Bootstrap -T || exit 1 echo "Touching Bootstrap-generated files in $srcdir to make them appear up-to-date" cd $srcdir touch aclocal.m4 sleep 2 touch configure upcr_config.h.in sleep 2 perl -ane 'utime undef, undef, (grep {m/\bMakefile\.in$/ && -f $_} @F);' -- unBootstrap exit 0; else echo "Can't touch generated files because this tree does not appear to be Bootstrapped" exit 1; fi fi if test "$NOTOOLCHECK" != "1" ; then missing= for autotool in autoconf autoheader automake aclocal m4 ; do info=`( $autotool --version 2>/dev/null < /dev/null || echo 'Not found' ) | head -1` if test "$info" != "Not found" ; then info="$info, in `which $autotool`" elif test "$autotool" != "m4" ; then missing="$missing$autotool " fi echo "$autotool: $info" done if test "$missing" != ""; then echo "The following GNU autotools are missing from your PATH:" echo " $missing" if test -r $srcdir/upcr_config.h.in \ -a -r $srcdir/Makefile.in \ -a -r $srcdir/aclocal.m4 \ -a -r $srcdir/configure ; then echo "However, it appears this directory has already been Bootstrapped." echo "You should skip Bootstrap and instead do: configure ; gmake" else echo "Please download them from ftp://ftp.gnu.org/gnu" fi exit 1 fi fi set -e set -x cd $srcdir ./unBootstrap # Bootstrap gasnet first to ensure correct timestamps for the m4 macro files we rely upon echo ------------ running GASNet Bootstrap -------------- ( cd gasnet && ./Bootstrap -y -n "$@" || kill $$ ) echo ----------------------------------------------------- set +x CMD="aclocal -I gasnet" ; eval $DOIT CMD="autoheader" ; eval $DOIT set -x # autoheader omits updating the header if it thinks nothing has changed, # but automake's dependency checks are stronger (include aclocal.m4, which just changed) # ensure the header looks up-to-date (autoheader -f option not version portable) touch upcr_config.h.in set +x CMD="autoconf" ; eval $DOIT set -x # Perform some postprocessing to fix bugs in the configure script: # 1) caching: # Our configure script requires caching, and autoconf 2.5 stupidly disables # caching by default. Caching may open some dangers of stale values, but # the alternative is worse - automake reconfiguring in the absence of # precious environment variables leads to silent incorrect behavior that # can't be detected or fixed because there's no cache! # Restore ./config.cache as the default cache # 2) recursive configure: # When $top_builddir contains a space, the configure script tries to cd # back to $top_builddir w/o quoting it. # Add quotes around the offending command. mv configure .configure-orig perl -pe 's@^cache_file=/dev/null$@cache_file=./config.cache@; s/cd \$ac_popdir/cd "\$ac_popdir"/;' \ .configure-orig > configure chmod +x configure rm -f .configure-orig set +x # do NOT use automake -i: the meaning of that automake option recently changed CMD="automake -a" ; eval $DOIT set -x # Perform some postprocessing to fix bugs in automake: # 1) Overrides: Automake is too stupid to notice several overrides we intentionally perform, # leading to spam of harmless warnings of the form: # warning: overriding commands for target X # warning: ignoring old commands for target X # Remove the earlier, overridden rule to silence the warning AND remove unwanted dependencies # top-level: Makefile and distclean targets, remove all but the last rule (ours) perl -0777 -i.bak -pe 's/^(distclean|Makefile):[^\n]*\n(?:\t[^\n]*\n)*(?=.*\n\1:)//msg' Makefile.in rm -f Makefile.in.bak rm -Rf autom4te*.cache