[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-gnulib] Re: gnulib-tool --import
From: |
Gary V. Vaughan |
Subject: |
Re: [Bug-gnulib] Re: gnulib-tool --import |
Date: |
Mon, 16 Aug 2004 15:06:33 +0100 |
User-agent: |
Mozilla Thunderbird 0.7 (X11/20040615) |
Simon Josefsson wrote:
> I don't think it should use 'autoconf --trace', though, as it
> is too unreliable (it is also quite slow). You typically want to do
> gnulib --import _before_ you do 'autoreconf', or at least I do. I'll
> send a patch to use sed or something instead later on.
For the record, I hit the same problem when I rewrote libtoolize: the
autotools start to break in mysterious ways if you use autoconf --trace
from any tool that may change the contents of aclocal.m4 (e.g. autopoint,
libtoolize, gnulib-tool). Here is what the new libtoolize does in lieu
of autoconf --trace:
# func_scan_files
# Scan configure.(ac|in) and aclocal.m4 (if present) for use of libltdl
# and libtool. Possibly running some of these tools if necessary.
# Libtoolize affects the contents of aclocal.m4, and should be run before
# aclocal, so we can't use configure --trace which relies on a consistent
# configure.(ac|in) and aclocal.m4.
func_scan_files ()
{
# Prefer configure.ac to configure.in
test -f configure.ac && configure_ac=configure.ac
test -f "$configure_ac" \
|| func_fatal_help "\`$configure_ac' does not exist"
test -n "`cd $pkgdatadir && ls`" \
|| func_fatal_error "can not list files in \`$pkgdatadir'"
# Set local variables to reflect contents of configure.ac
my_uses_autoconf=false
my_sed_scan_configure_ac='s,#.*$,,; s,^dnl .*$,,; s, dnl .*$,,;
/AC_INIT/ { s,^.*$,my_uses_autoconf=:,; p; };
d'
eval `$SED "$my_sed_scan_configure_ac" "$configure_ac"`
$my_uses_autoconf || {
func_verbose "$configure_ac: not using Autoconf"
return
}
# ---------------------------------------------------- #
# Probe macro usage in configure.ac and/or aclocal.m4. #
# ---------------------------------------------------- #
my_sed_traces='s,#.*$,,; s,^dnl .*$,,; s, dnl .*$,,;
/AC_CONFIG_AUX_DIR[^_]/ {
s,^.*AC_CONFIG_AUX_DIR([[ ]*\([^])]*\).*$,auxdir=\1,; p;
};
/AC_CONFIG_MACRO_DIR/ {
s,^.*AC_CONFIG_MACRO_DIR([[ ]*\([^])]*\).*$,m4dir=\1,; p;
};
/A[CM]_PROG_LIBTOOL/ { s,^.*$,seen_libtool=:,; p; };
/LT_INIT/ { s,^.*$,seen_libtool=:,; p; };
/AC_LIB_LTDL/ { s,^.*$,seen_ltdl=:,; p; };
d;'
eval `cat aclocal.m4 "$configure_ac" 2>/dev/null | $SED "$my_sed_traces"`
# ---------------- #
# Validate auxdir. #
# ---------------- #
if test -n "$auxdir"; then
# If $configure_ac contains AC_CONFIG_AUX_DIR, check that it was
# not given in terms of a shell variable!
case "$auxdir" in
*\$*)
func_fatal_error "can not handle variables in AC_CONFIG_AUX_DIR"
;;
*);;
esac
else
# Try to discover auxdir the same way it is discovered by configure.
# Note that we default to the current directory.
for dir in . .. ../..; do
if test -f "$dir/install-sh"; then
auxdir=$dir
break
elif test -f "$dir/install.sh"; then
auxdir="$dir"
break
fi
done
fi
# Just use the current directory if all else fails.
test -n "$auxdir" || auxdir=.
# ------------------------------ #
# Find local m4 macro directory. #
# ------------------------------ #
# If AC_CONFIG_MACRO_DIR turned nothing up, we hunt for ACLOCAL_AMFLAGS
# in `Makefile.am' for a `-I' argument.
my_sed_aclocal_flags='/^[ ]*ACLOCAL_[A-Z_]*FLAGS[ ]*=/ {
s,^[^=]*=[ ]*\(.*\), \1,; q; }; d'
if test ! -n "$m4dir" && test -f Makefile.am; then
my_m4dir_is_next=false
for arg in `$SED "$my_sed_aclocal_flags" Makefile.am`; do
if $my_m4dir_is_next; then
m4dir="$arg"
break
else
if test "X$arg" = "X-I"; then
my_m4dir_is_next=:
else
my_m4dir_is_next=false
fi
fi
done
fi
# Just use the current directory if all else fails.
test -n "$m4dir" || m4dir=.
}
HTH,
Gary.
--
Gary V. Vaughan ())_. address@hidden,gnu.org}
Research Scientist ( '/ http://tkd.kicks-ass.net
GNU Hacker / )= http://www.gnu.org/software/libtool
Technical Author `(_~)_ http://sources.redhat.com/autobook
signature.asc
Description: OpenPGP digital signature