[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [pygnulib] simplify cache configure.ac parsing
From: |
Bruno Haible |
Subject: |
Re: [pygnulib] simplify cache configure.ac parsing |
Date: |
Tue, 12 Sep 2017 19:08:55 +0200 |
User-agent: |
KMail/5.1.3 (Linux/4.4.0-93-generic; KDE/5.18.0; x86_64; ; ) |
Hi Dmitry,
> BTW, the version from the pygnulib differs a bit already from the
> gnulib-tool shell script
The shell script contains this code (unchanged since 2009):
guessed_auxdir="."
guessed_libtool=false
my_sed_traces='
s,#.*$,,
s,^dnl .*$,,
s, dnl .*$,,
/AC_CONFIG_AUX_DIR/ {
s,^.*AC_CONFIG_AUX_DIR([[ ]*\([^]"$`\\)]*\).*$,guessed_auxdir="\1",p
}
/A[CM]_PROG_LIBTOOL/ {
s,^.*$,guessed_libtool=true,p
}'
eval `sed -n -e "$my_sed_traces" < "$configure_ac"`
The first 3 lines of the sed script remove comments; I guess gnulib-tool.py
ought to do the same, because we really don't be fooled by invocations that
have been commented out.
> "hello([AC_PREREQ([2.67])])"
> " AC_PREREQ([2.67])"
> "helloAC_PREREQ([2.67])world"
You can reasonably assume that a configure.ac will not contain the first
or third of these lines, because AC_PREREQ (and likewise A[CM]_PROG_LIBTOOL)
are usually used at the top-level only. The second line can occur, though,
as there is no pressure on the programmers to use no indentation.
Bruno