Discussion:
autoreconf error: possibly undefine macro: AC_DEFINE
Carlos Eduardo Rodrigues Diogenes
2005-08-25 19:26:47 UTC
Permalink
Hi,

I'm running autoreconf and I'm getting the following error:

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

Anyone know why this is ocurring and, in the perfect fashion, how to
solve it?

Here is the configure.ac file that I have, a peace of it:


dnl Copyright 2005 Red Hat, Inc.
dnl
dnl Permission to use, copy, modify, distribute, and sell this software
and its
dnl documentation for any purpose is hereby granted without fee,
provided that
dnl the above copyright notice appear in all copies and that both that
dnl copyright notice and this permission notice appear in supporting
dnl documentation, and that the name of Red Hat not be used in
dnl advertising or publicity pertaining to distribution of the software
without
dnl specific, written prior permission. Red Hat makes no
dnl representations about the suitability of this software for any
purpose. It
dnl is provided "as is" without express or implied warranty.
dnl
dnl RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
dnl INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
dnl EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
dnl CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
OF USE,
dnl DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
dnl TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
dnl PERFORMANCE OF THIS SOFTWARE.
dnl
dnl Process this file with autoconf to create configure.

AC_PREREQ([2.57])
AC_INIT(xdm,[0.99.1],
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],xdm)
AM_INIT_AUTOMAKE([dist-bzip2])
AM_MAINTAINER_MODE

AM_CONFIG_HEADER(config.h)

AC_PROG_CC
AC_PROG_INSTALL
AC_CANONICAL_HOST

XORG_PROG_RAWCPP

AC_FUNC_FORK
AC_CHECK_FUNC(mkstemp, AC_DEFINE(HAS_MKSTEMP,1, <== the error
occur here
[Define to 1 if you have the 'mkstemp' function.]))
AC_CHECK_FUNC(getifaddrs, AC_DEFINE(HAS_GETIFADDRS,1,
[Define to 1 if you have the 'getifaddrs' function.]))
AC_CHECK_FUNC(getspnam, AC_DEFINE(USESHADOW,1,
[Define to 1 if you have the shadow password functions.]))

Thanks,
Carlos.
Ralf Wildenhues
2005-08-26 07:51:57 UTC
Permalink
Hi Carlos,
Post by Carlos Eduardo Rodrigues Diogenes
configure.ac:38: error: possibly undefined macro: AC_DEFINE
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
Anyone know why this is ocurring and, in the perfect fashion, how to
solve it?
Hmm. I cannot reproduce it.
I saved this snippet, added AC_OUTPUT at the end, removed your error
mark, ran aclocal, automake --add, autoconf, autoheader, ./configure.
Beside the missing definition for XORG_PROG_RAWCPP (which I suppose is
present in your environment) I could not see any problems.

Please try to describe a way to reproduce the issue. Which versions of
the respective autotools did you use?

Cheers,
Ralf

*snip*
Post by Carlos Eduardo Rodrigues Diogenes
AC_PREREQ([2.57])
AC_INIT(xdm,[0.99.1],
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],xdm)
AM_INIT_AUTOMAKE([dist-bzip2])
AM_MAINTAINER_MODE
AM_CONFIG_HEADER(config.h)
AC_PROG_CC
AC_PROG_INSTALL
AC_CANONICAL_HOST
XORG_PROG_RAWCPP
AC_FUNC_FORK
AC_CHECK_FUNC(mkstemp, AC_DEFINE(HAS_MKSTEMP,1, <== the error
occur here
[Define to 1 if you have the 'mkstemp' function.]))
AC_CHECK_FUNC(getifaddrs, AC_DEFINE(HAS_GETIFADDRS,1,
[Define to 1 if you have the 'getifaddrs' function.]))
AC_CHECK_FUNC(getspnam, AC_DEFINE(USESHADOW,1,
[Define to 1 if you have the shadow password functions.]))
Ralf Wildenhues
2005-08-26 12:35:53 UTC
Permalink
Hi Carlos,

Please keep the mailing list in Cc:. Thanks!
* Carlos Eduardo Rodrigues Diogenes wrote on Thu, Aug 25, 2005 at
Where is defined the AC_DEFINE macro?
This macro is internal to Autoconf. autoconf should be able to find it
in any case.
I saved this snippet, added AC_OUTPUT at the end, removed your error
mark, ran aclocal, automake --add, autoconf, autoheader, ./configure.
(side note: running "aclocal; automake --add; autoconf; autoheader" is
roughly equivalent to running autoreconf for this example.)
Beside the missing definition for XORG_PROG_RAWCPP (which I suppose is
present in your environment) I could not see any problems.
Please try to describe a way to reproduce the issue. Which versions of
the respective autotools did you use?
I'm new to the autotools, so I don't understand very well how to
reproduce the error.
Well, easy: I told you what I tried to do to reproduce it: it did not
show the error. Please do the same steps, in an empty directory, and
see if the error shows up on your system. Report back here.

If the error does not show up, then try to find out the difference
between what you did in you package, and what we tried, so an error
source can be isolated. Clear now?
Do you have any idea of what could be wrong in my system?
Vaguely. But I need your help to make sure.
I have autoconf 2.59, autoheader 2.59, automake 1.9.4 e aclocal 1.9.4
Do you have them installed under the same prefix? What does
type autoconf automake autoheader aclocal
say?

Cheers,
Ralf
Carlos Eduardo Rodrigues Diogenes
2005-08-26 16:37:56 UTC
Permalink
Post by Ralf Wildenhues
Hi Carlos,
Please keep the mailing list in Cc:. Thanks!
* Carlos Eduardo Rodrigues Diogenes wrote on Thu, Aug 25, 2005 at
Where is defined the AC_DEFINE macro?
This macro is internal to Autoconf. autoconf should be able to find it
in any case.
I saved this snippet, added AC_OUTPUT at the end, removed your error
mark, ran aclocal, automake --add, autoconf, autoheader, ./configure.
(side note: running "aclocal; automake --add; autoconf; autoheader" is
roughly equivalent to running autoreconf for this example.)
Beside the missing definition for XORG_PROG_RAWCPP (which I suppose is
present in your environment) I could not see any problems.
Please try to describe a way to reproduce the issue. Which versions of
the respective autotools did you use?
I'm new to the autotools, so I don't understand very well how to
reproduce the error.
Well, easy: I told you what I tried to do to reproduce it: it did not
show the error. Please do the same steps, in an empty directory, and
see if the error shows up on your system. Report back here.
If the error does not show up, then try to find out the difference
between what you did in you package, and what we tried, so an error
source can be isolated. Clear now?
In the piece of code that I send to you the error realy don't occur, so
I'm sending you the entirely file atached. I put it in a clean an
separated directory and execute the lines that are equivalent to
autoreconf and get the same error.
Post by Ralf Wildenhues
Do you have any idea of what could be wrong in my system?
Vaguely. But I need your help to make sure.
I have autoconf 2.59, autoheader 2.59, automake 1.9.4 e aclocal 1.9.4
Do you have them installed under the same prefix? What does
type autoconf automake autoheader aclocal
say?
Yes, they are unde the same prefix /usr/bin. If I type autoconf automake
autoheader aclocal in the configure.ac directory everything goes ok.

PS.: Stepan Kasal commented that the error could be in the XORG_...
macro, but I commented it and continue getting the same error.

Thanks,
Carlos.
Stepan Kasal
2005-08-26 17:39:14 UTC
Permalink
Hello,
Post by Carlos Eduardo Rodrigues Diogenes
I'm sending you the entirely file atached. I put it in a clean an
separated directory and execute the lines that are equivalent to
autoreconf and get the same error.
well, first time I tried, I observed the same problem.
Then I upgraded pkg-config, to get new pkg.m4, which defines PKG_CHECK_EXISTS,
And the problem was solved.

The error message was misleading, sorry.

BTW: Carlos, when I told the AC_DEFINE parameter should be quoted, I meant
all the three instances, not only the first one. ;-)

Here are technical details, of any of the Autoconf developers have any idea
how this should be fixed. The problem was caused by this

PKG_CHECK_EXISTS(xinerama, [
AC_DEFINE([USE_XINERAMA], 1,
[Define to 1 to use XINERAMA in greeter & chooser])
PKG_CHECK_MODULES(XINERAMA, xinerama)
])

Because PKG_CHECK_EXISTS was not defined, the expansion was:

PKG_CHECK_EXISTS(xinerama,
AC_DEFINE([USE_XINERAMA], 1,
[Define to 1 to use XINERAMA in greeter & chooser])
PKG_CHECK_MODULES(XINERAMA, xinerama)
)

... ie. almost the same, only two quotes removed.
And this was written to configure. Autoconf saw three forbidden
tokens: PKG_CHECK_EXISTS AC_DEFINE PKG_CHECK_MODULES.

So it reported them as ``possibly undefined macros''.
For each of the symbols, autoconf found a line number (the first occurence)
and then sorted it according the line numbers:

configure.ac:39: error: possibly undefined macro: AC_DEFINE
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
configure.ac:150: error: possibly undefined macro: PKG_CHECK_EXISTS
configure.ac:153: error: possibly undefined macro: PKG_CHECK_MODULES

Line 39 is the first occurrence of AC_DEFINE, but that occurrence was
expanded. And PKG_CHECK_MODULES was also defined, it was only overquoted
here.

Since the forbidden token can be caused by overquoting, Autoconf should
not report it this way. I think it should report the symbols in the
order of appearance, at least. The line numbers should perhaps be omitted,
they are not reliable.
And perhaps there is a way to find out whether this symbol is defined or
not; that would enable different messages for "undefined" and "overquoted".

Anyone willing to fix this?

Have a nice day,
Stepan Kasal

Stepan Kasal
2005-08-26 16:30:46 UTC
Permalink
Hi Carlos,

you asked twice, so you get two answers from me. ;-)
Post by Ralf Wildenhues
Hmm. I cannot reproduce it.
Neither can I. I commented out the XORG_... macro, ran aclocal
and then autoconf. It works.

Perhaps the problem is in the XORG macro. Does the problem disappear
if you comment out the line with XORG_... ?
If yes, we have found the guilty one.


The xorg macro is defined in a file installed with xorg, I guess.
Search for such a file under /usr/share/aclocal/ .

Then go to the xorg for a fixed version. Or report it to them
as a bug. If they don't know how to fix it, send the macro here,
we'll look at it.

Hope this helps,
Stepan Kasal
Loading...