On Tue, Jan 21, 2020 at 10:18 AM Zack Weinberg <za...@panix.com> wrote:
>
> The `aclocal` program (which is run by autoreconf) is supposed to
> generate aclocal.m4, though.  I strongly suspect the missing AC_INIT
> is the problem here.

Following up on this, if I run autoreconf -vif on Vincent's original
configure.ac+Makefile.am+m4 directory (also with dummy NEWS README
COPYING AUTHORS ChangeLog files), I get errors:

$ autoreconf --version
autoreconf (GNU Autoconf) 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
[etc]

$ autoreconf -vif
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Autoconf
autoreconf: Leaving directory `.'

[autoreconf should probably exit unsuccessfully when that happens, but
that's a side issue.]  Individual autotools commands also fail:

$ aclocal -I m4
configure.ac:8: error: AC_INIT should be called with package and
version arguments
/usr/share/aclocal-1.16/init.m4:29: AM_INIT_AUTOMAKE is expanded from...
configure.ac:8: the top level
autom4te: /usr/bin/m4 failed with exit status: 1
aclocal: error: echo failed with exit status: 1

(aclocal does exit unsuccessfully in this case, and aclocal.m4 is not created)

$ automake --add-missing
configure.ac:9: error: m4_defn: undefined macro: _AC_LANG
../../lib/autoconf/lang.m4:107: AC_LANG_POP is expanded from...
../../lib/autoconf/c.m4:448: AC_PROG_CC is expanded from...
configure.ac:9: the top level
autom4te: /usr/bin/m4 failed with exit status: 1
automake: error: autoconf failed with exit status: 1

(automake exits unsuccessfully and Makefile.in is not created)

$ autoconf
configure.ac:9: error: m4_defn: undefined macro: _AC_LANG
../../lib/autoconf/lang.m4:107: AC_LANG_POP is expanded from...
../../lib/autoconf/c.m4:448: AC_PROG_CC is expanded from...
configure.ac:9: the top level
autom4te: /usr/bin/m4 failed with exit status: 1

(autoconf exits unsuccessfully and configure is not created)

If I make this change to configure.ac, on the other hand, autoreconf
-vif completes successfully and the generated configure script runs
fine:

diff -u configure.ac.old configure.ac
--- configure.ac.old    2020-01-21 10:31:26.816736978 -0500
+++ configure.ac    2020-01-21 10:31:34.536537740 -0500
@@ -1,8 +1,5 @@
 AC_CONFIG_MACRO_DIRS([m4])
-m4_pattern_allow([AC_PROG_CC_C99])
-m4_include([m4/ax_check_compile_flag.m4])
-m4_include([m4/ax_cxx_compile_stdcxx.m4])
-m4_include([m4/ax_cxx_compile_stdcxx_11.m4])
+AC_INIT([demo],[1.0])
 AC_CONFIG_SRCDIR(configure.ac)
 AM_CONFIG_HEADER(config.h)
 AM_INIT_AUTOMAKE

So it appears to me that the whole problem really was the lack of an
AC_INIT, and that explicit m4_include invocations are *not* necessary.

(The warnings about use of obsolete macros AM_CONFIG_HEADER and
AC_PROG_LIBTOOL should still be fixed, but that's much less
important.)

zw

Reply via email to