autotoolsautoconf

possibly undefined macro: AC_MSG_ERROR


I have the following in configure.ac:

AC_CHECK_PROGS(MAKE,$MAKE make gmake,error)
if test "x$MAKE" = "xerror" ;then
  AC_MSG_ERROR([cannot find a make command])
fi

This has been in our project for a long time, but in some set ups, I get this error:

configure.ac:45: error: possibly undefined macro: AC_MSG_ERROR
  If this token and others are legitimate, please use m4_pattern_allow.
  See the Autoconf documentation.

The lines that were recently added above this:

AC_CONFIG_MACRO_DIR([m4])
LT_INIT

Can anyone explain what causes this error and how to track down the problem?

EDIT: Adding details about the differences.

Box that works:

uname -a Linux host1 2.6.38-13-generic #53-Ubuntu SMP Mon Nov 28 19:33:45 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux

automake: 1.11.1
autoconf: 2.67
m4: 1.4.14
libtoolize: 2.2.6b

Box that doesn't work:

Linux host2 2.6.32-35-generic-pae #78-Ubuntu SMP Tue Oct 11 17:01:12 UTC 2011 i686 GNU/Linux

automake: 1.11.1
autoconf: 2.65
m4: 1.4.13
libtoolize: 2.2.6b

NEW EDIT: only 32 bit machines experience this difficulty.

UPDATED I am able to reproduce the problem on a CentOS machine with autoconf 2.67, automake 1.11.1, libtool 2.2.6b, and m4 1.4.14. Is this just a bug with 32-bit machines?


Solution

  • It is a matter of missing packages. For example, installing pkg-config may or may not fix your problem, as some commenters pointed out.

    In one scenario, installing all of the following worked for @trusktr on macOS when building the ntfs-3g project (being sure to add some of those packages' bins to PATH):

    brew install gcc make autoconf automake libtool libgcrypt autoconf-archive
    

    Pay attention to any other message, for example if you see something like

    configure.ac:337: error: possibly undefined macro: AM_PATH_LIBGCRYPT
    

    then you may need to install libgcrypt.

    Another thing you can do is lookinside configure.ac of the project, and look for statements using PKG_CHECK_MODULES. This may show you what additional packages you need to install. For example this,

        PKG_CHECK_MODULES(GNUTLS, gnutls >= 1.4.4, [ have_libgnutls=true ],
    

    means you may need gnutls.

    Other answers list some other packages to try installing. It depends on your case.