Counterbodge a bodgy warning from 'aclocal'.

For ages, when rebuilding the configure script, I've had the
mysterious warning "configure.ac:120: warning: macro 'AM_PATH_GTK' not
found in library". The reason it was mysterious was that that use of
AM_PATH_GTK was inside an ifdef that checked whether it was defined,
and it actually wasn't being run!

Turns out the warning comes from 'aclocal', which is a Perl script
that (among other things) does bodgy text-matching to detect
unsupported autoconf/automake macros in your configure script. The
warning comes from the function scan_configure_dep() in that file, as
of aclocal-1.15. And, indeed, it ignores the ifdef structure, so it
doesn't notice that I've carefully guarded the use of that possibly-
undefined macro! (Though a comment in aclocal does acknowledge the
possibility, which is why it's only a warning.)

Against that bodgy and unreliable check, I've deployed an equally
bodgy and unreliable countermeasure, by changing the line spacing so
that AM_PATH_GTK appears in a context (specifically, not immediately
following a newline or space) where the regex will be confident that
it's a macro invocation. So that should squelch the warning.
This commit is contained in:
Simon Tatham 2019-03-26 20:59:31 +00:00
Родитель f5c1753244
Коммит 399603fd95
1 изменённых файлов: 5 добавлений и 9 удалений

Просмотреть файл

@ -100,25 +100,21 @@ gtk=none
case "$gtk_version_desired:$gtk" in case "$gtk_version_desired:$gtk" in
3:none | any:none) 3:none | any:none)
ifdef([AM_PATH_GTK_3_0],[ ifdef([AM_PATH_GTK_3_0],[AM_PATH_GTK_3_0([3.0.0], [gtk=3], [])],
AM_PATH_GTK_3_0([3.0.0], [gtk=3], []) [AC_WARNING([generating configure script without GTK 3 autodetection])])
],[AC_WARNING([generating configure script without GTK 3 autodetection])])
;; ;;
esac esac
case "$gtk_version_desired:$gtk" in case "$gtk_version_desired:$gtk" in
2:none | any:none) 2:none | any:none)
ifdef([AM_PATH_GTK_2_0],[ ifdef([AM_PATH_GTK_2_0],[AM_PATH_GTK_2_0([2.0.0], [gtk=2], [])],
AM_PATH_GTK_2_0([2.0.0], [gtk=2], []) [AC_WARNING([generating configure script without GTK 2 autodetection])])
],[AC_WARNING([generating configure script without GTK 2 autodetection])])
;; ;;
esac esac
case "$gtk_version_desired:$gtk" in case "$gtk_version_desired:$gtk" in
1:none | any:none) 1:none | any:none)
ifdef([AM_PATH_GTK],[ ifdef([AM_PATH_GTK],[AM_PATH_GTK([1.2.0], [gtk=1], [])],[
AM_PATH_GTK([1.2.0], [gtk=1], [])
],[
# manual check for gtk1 # manual check for gtk1
AC_PATH_PROG(GTK1_CONFIG, gtk-config, absent) AC_PATH_PROG(GTK1_CONFIG, gtk-config, absent)
if test "$GTK1_CONFIG" != "absent"; then if test "$GTK1_CONFIG" != "absent"; then