76

I am trying reinstall pacman on my Arch Linux distribution. When I run the configure script "configure.ac", I get a bunch of undefined macros:

error: possibly undefined macro: AM_INIT_AUTOMAKE.
If this token and others are legitimate, please use m4_pattern_allow.
See the autoconf documentation.
error: possibly undefined macro: AC_PROG_LIBTOOL
error: possibly undefined macro: AM_GNU_GETTEXT 
error: possibly undefined macro: AM_GNU_GETTEXT_VERSION
error: possibly undefined macro: AM_CONDITIONAL

Does anyone know what would cause these macros to be undefined? Having come from Ubuntu (where everything just works, and is therefore boring), I don't really know about automake.

SirTasty
  • 903
  • Why are you building from source? Why don't you download the packages on another machine, copy them across and extract them to root as per https://wiki.archlinux.org/index.php/Pacman#Q:_pacman_is_completely_broken.21_How_do_I_reinstall_it.3F – jasonwryan Aug 13 '11 at 04:31
  • 1
    It appears that what? Is that the whole sequence of errors? How did you retrieve the source? – Gilles 'SO- stop being evil' Aug 13 '11 at 14:24
  • 2
    Jason, I do not have pacman on my other machine, and I would rather not download another package manager. Plus if I was not building from source I would not have this wonderful opportunity to learn about M4 and automake. Sorry about the bad edit, I removed it. Yes, that is the whole sequence of errors. I retrieved the source from the ArchLinux website at projects.archlinux.org/pacman.git with wget. – SirTasty Aug 13 '11 at 20:14
  • 2
    configure.ac is not a configure script and is not runnable. – qdii Apr 24 '13 at 23:19

6 Answers6

87

Try this, maybe it can help:

autoreconf --install

(See the manpage, there is a --force option also)

  • cvs program not found; autopoint failed with exit status 1. I am installing cvs from sources, will let you know how it goes. – SirTasty Aug 13 '11 at 19:41
  • 1
    @SirTasty: cvs?? hmm, maybe try to use autoconf and automake directly? – Stéphane Gimenez Aug 13 '11 at 19:53
  • Autoconf gives me the undefined macro warnings. automake gives me (semicolons separate lines):

    Makefile.am:2: WANT_DOC does not appear in AM_CONDITIONAL ; Makefile.am: required file ./ChangeLog not found ;configure.ac:57: required file config.h.in not found`

    – SirTasty Aug 13 '11 at 20:10
  • 1
    I'm not an autotools expert (or fan either). Maybe wait for one to show up… By chance, what about aclocal first? – Stéphane Gimenez Aug 13 '11 at 20:21
  • I had a similar autoconf error (on redhat fc19) and the autoreconf --install solved it. – gaoithe May 25 '15 at 11:14
  • might require sudo apt-get install autopoint – akiva Jul 04 '16 at 08:13
  • This worked for me with the exact same set of errors as in the original question. – M1ke Jan 04 '17 at 14:28
  • stackoverflow.com concurs with your solution (use autoreconf --install): https://stackoverflow.com/questions/10999549/how-do-i-create-a-configure-script – Trevor Boyd Smith May 03 '18 at 13:24
  • i'm not sure why but i saw somewhere on google someone suggesting to use autoconf to generate the configure script. of course i saw this on a website that doesn't have vetting/peer-review and so that is probably why i saw it. – Trevor Boyd Smith May 03 '18 at 13:26
30

The macros in the error message you posted are defined by automake and libtool; it looks like you need to install those packages.

Then try autoreconf --install

  • Both of those packages are installed, or at least "which automake" and "which libtool" return reasonable results. – SirTasty Aug 13 '11 at 08:51
  • 2
    @SirTasty Then you probably need to run "autoreconf" as Stéphane suggests. – Riccardo Murri Aug 13 '11 at 13:51
  • 6
    On my CentOS6.7 system, I had to do this: sudo yum install autoconf automake libtool cmake autoconf-archive gcc-c++ – Mark Hudson Mar 16 '17 at 17:54
  • 1
    For me, with the error configure.ac:118: error: possibly undefined macro: AC_MSG_ERROR on Manjaro Linux, installing autoconf-archive did the trick, although another error resulted which has also now been avoided. The other packages were installed. Just for information, further details on that start from https://github.com/NixOS/nix/pull/3154#issuecomment-545207139/. – James Ray Oct 23 '19 at 00:55
9

For anybody else looking: While automake and libtool are very likely candidates, some systems won't install gettext automatically. This is also required.

Matthew
  • 101
5

Install following packages that would solve the autoreconf issues.

$ sudo apt-get -y install autoconf automake libtool cmake autoconf-archive build-essential
AdminBee
  • 22,803
3

I was pretty confused when getting these errors, because I had everything installed and autoreconf --install wasn't helping. The problem was just corrupted aclocal.m4 and deleting it before autoreconf solved the problem.

tss
  • 31
0

The aclocal.m4 needs to be generated first. aclocal generates the aclocal.m4 file based on the contents of configure.ac

libtoolize --force
aclocal
autoheader
automake --force-missing --add-missing
autoconf
./configure
Fred
  • 335