diff --git a/ChangeLog b/ChangeLog index 90760569..720faf42 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2000-07-10 Akim Demaille + + * autoreconf.sh: You too can have a $tmp dir if you wish. + (alflags.sed): New sub sed program. + Compute the flags of aclocal from Makefile.am instead of + Makefile.in, it is unlikely that aclocal be used but not automake, + while it is convenient to be able to run autoreconf even if + automake was not run yet. + Use `autoconf --trace' to get the list of configuration headers. + 2000-07-10 Akim Demaille * acgeneral.m4 (AC_PLAIN_SCRIPT): New macro. diff --git a/autoreconf.in b/autoreconf.in index df225f85..42078126 100644 --- a/autoreconf.in +++ b/autoreconf.in @@ -170,6 +170,37 @@ automake="$automake `$verbose --verbose`" aclocal="$aclocal `$verbose --verbose`" export AC_MACRODIR +# Trap on 0 to stop playing with `rm'. +$debug || +{ + trap 'status=$?; rm -rf $tmp && exit $status' 0 + trap 'exit $?' 1 2 13 15 +} + +# Create a (secure) tmp directory for tmp files. +: ${TMPDIR=/tmp} +{ + tmp=`(umask 077 && mktemp -d -q "$TMPDIR/arXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=$TMPDIR/ac$$ && (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in $TMPDIR" >&2 + exit 1; +} + +# alflags.sed -- Fetch the aclocal flags. + +cat >$tmp/alflags.sed </dev/null` + # If there are flags for aclocal in Makefile.am, use them. + aclocal_flags=`sed -f $tmp/alflags.sed Makefile.am 2>/dev/null` if $force && ls -lt configure.in $aclocal_m4 $aclocal_dir/acinclude.m4 2>/dev/null | sed 1q | @@ -228,13 +257,22 @@ while read dir; do fi fi - # Re-run automake if required. Assumes that there is a Makefile.am - # in the topmost directory. + + # ------------------ # + # Running automake. # + # ------------------ # + + # Assumes that there is a Makefile.am in the topmost directory. if test -f Makefile.am; then $verbose running $automake in $dir $automake fi + + # ------------------ # + # Running autoconf. # + # ------------------ # + test ! -f $aclocal_m4 && aclocal_m4= if $force && @@ -246,12 +284,14 @@ while read dir; do $autoconf $localdir_opt fi - if grep '^[ ]*A[CM]_CONFIG_HEADER' configure.in >/dev/null; then - templates=`sed -n '/A[CM]_CONFIG_HEADER/ { - s%[^#]*A[CM]_CONFIG_HEADER[ ]*(\([^)]*\).*%\1% - p - q - }' configure.in` + + # -------------------- # + # Running autoheader. # + # -------------------- # + + # templates -- arguments of AC_CONFIG_HEADERS. + templates=`$autoconf $localdir_opt -t 'AC_CONFIG_HEADERS:$1'` + if test -n "$templates"; then tcount=`set -- $templates; echo $#` template=`set -- $templates; echo $1 | sed ' s/.*:// diff --git a/autoreconf.sh b/autoreconf.sh index df225f85..42078126 100644 --- a/autoreconf.sh +++ b/autoreconf.sh @@ -170,6 +170,37 @@ automake="$automake `$verbose --verbose`" aclocal="$aclocal `$verbose --verbose`" export AC_MACRODIR +# Trap on 0 to stop playing with `rm'. +$debug || +{ + trap 'status=$?; rm -rf $tmp && exit $status' 0 + trap 'exit $?' 1 2 13 15 +} + +# Create a (secure) tmp directory for tmp files. +: ${TMPDIR=/tmp} +{ + tmp=`(umask 077 && mktemp -d -q "$TMPDIR/arXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=$TMPDIR/ac$$ && (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in $TMPDIR" >&2 + exit 1; +} + +# alflags.sed -- Fetch the aclocal flags. + +cat >$tmp/alflags.sed </dev/null` + # If there are flags for aclocal in Makefile.am, use them. + aclocal_flags=`sed -f $tmp/alflags.sed Makefile.am 2>/dev/null` if $force && ls -lt configure.in $aclocal_m4 $aclocal_dir/acinclude.m4 2>/dev/null | sed 1q | @@ -228,13 +257,22 @@ while read dir; do fi fi - # Re-run automake if required. Assumes that there is a Makefile.am - # in the topmost directory. + + # ------------------ # + # Running automake. # + # ------------------ # + + # Assumes that there is a Makefile.am in the topmost directory. if test -f Makefile.am; then $verbose running $automake in $dir $automake fi + + # ------------------ # + # Running autoconf. # + # ------------------ # + test ! -f $aclocal_m4 && aclocal_m4= if $force && @@ -246,12 +284,14 @@ while read dir; do $autoconf $localdir_opt fi - if grep '^[ ]*A[CM]_CONFIG_HEADER' configure.in >/dev/null; then - templates=`sed -n '/A[CM]_CONFIG_HEADER/ { - s%[^#]*A[CM]_CONFIG_HEADER[ ]*(\([^)]*\).*%\1% - p - q - }' configure.in` + + # -------------------- # + # Running autoheader. # + # -------------------- # + + # templates -- arguments of AC_CONFIG_HEADERS. + templates=`$autoconf $localdir_opt -t 'AC_CONFIG_HEADERS:$1'` + if test -n "$templates"; then tcount=`set -- $templates; echo $#` template=`set -- $templates; echo $1 | sed ' s/.*:// diff --git a/bin/autoreconf.in b/bin/autoreconf.in index df225f85..42078126 100644 --- a/bin/autoreconf.in +++ b/bin/autoreconf.in @@ -170,6 +170,37 @@ automake="$automake `$verbose --verbose`" aclocal="$aclocal `$verbose --verbose`" export AC_MACRODIR +# Trap on 0 to stop playing with `rm'. +$debug || +{ + trap 'status=$?; rm -rf $tmp && exit $status' 0 + trap 'exit $?' 1 2 13 15 +} + +# Create a (secure) tmp directory for tmp files. +: ${TMPDIR=/tmp} +{ + tmp=`(umask 077 && mktemp -d -q "$TMPDIR/arXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=$TMPDIR/ac$$ && (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in $TMPDIR" >&2 + exit 1; +} + +# alflags.sed -- Fetch the aclocal flags. + +cat >$tmp/alflags.sed </dev/null` + # If there are flags for aclocal in Makefile.am, use them. + aclocal_flags=`sed -f $tmp/alflags.sed Makefile.am 2>/dev/null` if $force && ls -lt configure.in $aclocal_m4 $aclocal_dir/acinclude.m4 2>/dev/null | sed 1q | @@ -228,13 +257,22 @@ while read dir; do fi fi - # Re-run automake if required. Assumes that there is a Makefile.am - # in the topmost directory. + + # ------------------ # + # Running automake. # + # ------------------ # + + # Assumes that there is a Makefile.am in the topmost directory. if test -f Makefile.am; then $verbose running $automake in $dir $automake fi + + # ------------------ # + # Running autoconf. # + # ------------------ # + test ! -f $aclocal_m4 && aclocal_m4= if $force && @@ -246,12 +284,14 @@ while read dir; do $autoconf $localdir_opt fi - if grep '^[ ]*A[CM]_CONFIG_HEADER' configure.in >/dev/null; then - templates=`sed -n '/A[CM]_CONFIG_HEADER/ { - s%[^#]*A[CM]_CONFIG_HEADER[ ]*(\([^)]*\).*%\1% - p - q - }' configure.in` + + # -------------------- # + # Running autoheader. # + # -------------------- # + + # templates -- arguments of AC_CONFIG_HEADERS. + templates=`$autoconf $localdir_opt -t 'AC_CONFIG_HEADERS:$1'` + if test -n "$templates"; then tcount=`set -- $templates; echo $#` template=`set -- $templates; echo $1 | sed ' s/.*://