7

i've been googling and installing libraries for a while, but I couldn't quite handle this problem with autoconf.

i have downloaded a program that i want to compile, made a few changes, and need to run autogen.sh and ./configure and make install respectively.

however, when i try to run autogen.sh, i get the following error;

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

so i went on, downloaded autoconf-2.68, automake-1.11, m4-1.4.16, and tried sudo apt-get install libgtk2.0-dev, none of which changed the outcome. when i try aclocal, i again get the error

configure.ac:225: warning: macro `AM_PATH_GTK_2_0' not found in library

i'm currently stuck, and got nowhere to go. so i'd be glad for any suggestion.

fizboz
  • 127
  • 2
  • 7

3 Answers3

15

I know it's a bit late, but you just have to install the library libgtk2.0-dev:

sudo apt-get install libgtk2.0-dev

If you get errors about something related to GLIB, then install libglib2.0-dev as well:

sudo apt-get install libglib2.0-dev
5

Given the name AM_PATH_GTK_2_0, one makes the following sequence of observations: 1) "AM_" is in automake's namespace, so that m4 macro must come from automake. 2) Hmmm, it isn't in automake. 3) It probably comes from gtk, so the gtk developer's have made an error in naming their m4 macro in conflict with automake. That's a bug in gtk, but I'll probably need to download the newest version of gtk to get the macro.

The problem is that you don't have the m4 macro that gtk expects you to have. You probably need to install libgtk-devel (or something like that). If I am correct and libgtk is indeed installing an m4 macro named AM_..., please report that as a bug to the developers. They are stomping on automakes' namespace (this is, unfortunately, an extremely common error.)

Since you mention downloading automake, I think the problem is that you are running aclocal that is not looking in /usr/share/aclocal, but in a different location (ie, you installed automake in /usr/local) When you installed libgtk-dev, it probably installed the *.m4 file in /usr/share/aclocal, but you need that file in /usr/local/share/aclocal (or $prefix/share/aclocal, where prefix is what you used to install automake.) The simplest solution is to copy that file to $(aclocal --print) That is, run "aclocal --print" to see where aclocal is looking for m4 files, then find the file that libgtk-dev installed that defines the improperly named m4 macro and copy that file to the appropriate location. Alternatively (and probably a better solution) you can put a file named dirlist in $(aclocal --print) that contains the single line "/usr/share/aclocal", so that your hand installed aclocal will always look for m4 files that are installed in /usr/share.

William Pursell
  • 204,365
  • 48
  • 270
  • 300
  • but I do have libgtk2.0-dev installed. so you do believe this error comes from the developers of the program that i'm trying to compile ? – fizboz Oct 18 '11 at 10:40
  • that was totally it! 'sudo cp /usr/share/aclocal/*.m4 /usr/local/share/aclocal-1.11/' solved the problem. thank you for your help :) – fizboz Oct 18 '11 at 10:50
  • 1
    @fizboz: with `sudo cp /usr/share/aclocal/*.m4 /usr/local/share/aclocal-1.11/` you have put your installation in jeopardy. The next time you upgrade any package that puts some macro in `/usr/share/aclocal/`, you will still be using the out-of-date version of this macro that you put into the other directory. Also the directory `/usr/local/share/aclocal-1.11/` should contain only the Automake macros. The better fix was `echo /usr/share/aclocal > /usr/local/share/aclocal/dirlist`, as suggested by William. – adl Oct 18 '11 at 12:42
  • @adl -- I think 'put your installation in jeopardy' is too strong. True, any time /usr/local/bin/aclocal is run, installed macros will be missed, but I think the proper solution is to uninstall automake from the system! – William Pursell Oct 18 '11 at 12:58
  • @WilliamPursell: too me it is similar to copying some header files into `/usr/lib/i386-linux-gnu/gcc/i486-linux-gnu/4.6.1/include` because `gcc` did not find them: nobody would do that. `.../share/aclocal-1.11/` is a private directory that should not be tampered with. Still, I agree with you that uninstalling all manually installed packages would be cleaner. – adl Oct 18 '11 at 13:26
0

In case of same issue on CenOS/RedHat:

sudo yum install gtk2-devel
Nikolay
  • 523
  • 5
  • 7