Ran into a problem with autotools today, thought I’d share my solution. First, the error only happened on an old system:
$ bash autogen.sh Found libtoolize Remember to add `AC_PROG_LIBTOOL' to `configure.ac'. libtoolize: `config.guess' exists: use `--force' to overwrite libtoolize: `config.sub' exists: use `--force' to overwrite libtoolize: `ltmain.sh' exists: use `--force' to overwrite autoreconf: Entering directory `.' autoreconf: configure.ac: not using Gettext autoreconf: running: aclocal --force -I m4 configure.ac:1: error: m4_defn: undefined macro: _m4_divert_diversion configure.ac:1: the top level autom4te: /usr/bin/m4 failed with exit status: 1 aclocal: autom4te failed with exit status: 1 autoreconf: aclocal failed with exit status: 1
The autogen.sh file is this one: https://github.com/inliniac/suricata/blob/master/autogen.sh
First lines of configure.ac:
AC_CONFIG_HEADERS([config.h]) AC_INIT(suricata, 2.0dev) AC_CONFIG_SRCDIR([src/suricata.c]) AC_CONFIG_MACRO_DIR(m4)
Solution? Move AC_CONFIG_HEADERS to below AC_INIT, like so:
AC_INIT(suricata, 2.0dev) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_SRCDIR([src/suricata.c]) AC_CONFIG_MACRO_DIR(m4)
THANK YOU!