Tag Archives: configure. AC: error: possibly undefined macro

Configure. AC: error: possibly undefined macro [How to Solve]

When compiling libzmq on ubuntu, an error is reported during configure and makefile generation.

libzmq-master$ ./autogen.sh
autoreconf: Entering directory `.’
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal -I config --force -I config
autoreconf: configure.ac: tracing
autoreconf: configure.ac: not using Libtool
autoreconf: running: /usr/bin/autoconf --include=config --force
configure.ac:28: error: possibly undefined macro: AC_SUBST
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
configure.ac:74: error: missing some pkg-config macros (pkg-config package)
configure.ac:83: error: possibly undefined macro: AC_LIBTOOL_WIN32_DLL
configure.ac:84: error: possibly undefined macro: AC_PROG_LIBTOOL
configure.ac:132: error: possibly undefined macro: AC_MSG_RESULT
configure.ac:145: error: possibly undefined macro: AC_DEFINE
configure.ac:253: error: possibly undefined macro: AC_CHECK_LIB
configure.ac:335: error: possibly undefined macro: AC_CHECK_HEADERS
configure.ac:337: error: possibly undefined macro: AC_MSG_ERROR
configure.ac:521: error: missing some pkg-config macros (pkg-config package)
configure.ac:526: error: possibly undefined macro: AC_SEARCH_LIBS
configure.ac:555: error: possibly undefined macro: AC_MSG_NOTICE
configure.ac:831: error: possibly undefined macro: AC_MSG_WARN
configure:6458: error: possibly undefined macro: AC_DISABLE_STATIC
configure:6462: error: possibly undefined macro: AC_ENABLE_STATIC
autoreconf: /usr/bin/autoconf failed with exit status: 1
autogen.sh: error: autoreconf exited with status 1

As suggested by the webmaster
sudo apt install automake libtool m4 autoconf
I found that all of them are installed. Try other solutions:
The software installed by apt-get is usually in the /usr directory. Since it is prompted that AC_PROG_LIBTOOL cannot be found, there are two general reasons for the analysis.
1. failure to install the package or other reasons such as version problems resulting in no definition of AC_PROG_LIBTOOL.
2. there is a problem finding the path.
From these two points, you can look for AC_PROG_LIBTOOL globally in the /usr directory


can see that AC_PROG_LIBTOOL can be found in the m4 file, then it may be a path issue.
Most m4 files are in the /usr/share/aclocal/ directory, but the default aclocal path for configure is actually /usr/local/share/aclocal.
Then there can be two ways to do it.
First, copy all the *.m4 files under /usr/share/aclocal/ to the usr/local/share/aclocal/ directory.
Second, specify the installation path of aclocal.
sudo cp /usr/share/aclocal/*.m4 /usr/local/share/aclocal/
Again . /autogen.sh, and it passes.