Discussion:
Can you spot the error?
Philipp Thomas
2014-03-31 18:48:56 UTC
Permalink
I have a configure.ac as attached. If I run autoreconf -fi on this file it
stops with 'configure.ac:23: error: possibly undefined macro: AC_DEFINE'
but at least I see no error in that line. But if I remove the following
block beginning with 'AC_ARG_WITH([resolve-neigh],' everything runs without
problems. Can anyboy help me spot the error?

Thanks in advance
Philipp
Eric Blake
2014-03-31 18:55:27 UTC
Permalink
Post by Philipp Thomas
I have a configure.ac as attached. If I run autoreconf -fi on this file it
stops with 'configure.ac:23: error: possibly undefined macro: AC_DEFINE'
but at least I see no error in that line. But if I remove the following
block beginning with 'AC_ARG_WITH([resolve-neigh],' everything runs without
problems. Can anyboy help me spot the error?
AC_ARG_WITH([resolve-neigh],
AC_HELP_STRING([--with-resolve-neigh],
[Enable neighbour resolution in Ethernet (default YES)]))

Underquoted.

You meant to write:

AC_ARG_WITH([resolve-neigh],
[AC_HELP_STRING([--with-resolve-neigh],
[Enable neighbour resolution in Ethernet (default YES)])])
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
Eric Blake
2014-03-31 19:01:52 UTC
Permalink
Post by Philipp Thomas
Post by Philipp Thomas
I have a configure.ac as attached. If I run autoreconf -fi on this file it
stops with 'configure.ac:23: error: possibly undefined macro: AC_DEFINE'
but at least I see no error in that line. But if I remove the following
block beginning with 'AC_ARG_WITH([resolve-neigh],' everything runs without
problems. Can anyboy help me spot the error?
AC_ARG_WITH([resolve-neigh],
AC_HELP_STRING([--with-resolve-neigh],
[Enable neighbour resolution in Ethernet (default YES)]))
Underquoted.
AC_ARG_WITH([resolve-neigh],
[AC_HELP_STRING([--with-resolve-neigh],
[Enable neighbour resolution in Ethernet (default YES)])])
For that matter, AC_HELP_STRING is deprecated; why not use
AS_HELP_STRING like you did elsewhere in your file?
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
Philipp Thomas
2014-04-03 09:30:00 UTC
Permalink
Post by Eric Blake
For that matter, AC_HELP_STRING is deprecated; why not use
AS_HELP_STRING like you did elsewhere in your file?
Because, as I wrote in my last reply,I didn't write that code. Would I have
done so I would have used AS_HELP_STRING. As I will be at it now anyway
I'll also change that code.

Philipp
Philipp Thomas
2014-04-03 10:00:08 UTC
Permalink
Post by Philipp Thomas
AC_ARG_WITH([resolve-neigh],
[AC_HELP_STRING([--with-resolve-neigh],
[Enable neighbour resolution in Ethernet (default YES)])])
Even with that change I still get

[ 16s] configure.ac:23: error: possibly undefined macro: AC_DEFINE
[ 16s] If this token and others are legitimate, please use m4_pattern_allow.
[ 16s] See the Autoconf documentation.
[ 16s] configure.ac:48: error: possibly undefined macro: AC_CHECK_LIB
[ 16s] configure.ac:49: error: possibly undefined macro: AC_MSG_ERROR

in this code andthis is correctly quoted AFAICS.

Philipp
Eric Blake
2014-04-03 12:07:11 UTC
Permalink
Post by Philipp Thomas
Post by Philipp Thomas
AC_ARG_WITH([resolve-neigh],
[AC_HELP_STRING([--with-resolve-neigh],
[Enable neighbour resolution in Ethernet (default YES)])])
Even with that change I still get
[ 16s] configure.ac:23: error: possibly undefined macro: AC_DEFINE
[ 16s] If this token and others are legitimate, please use m4_pattern_allow.
[ 16s] See the Autoconf documentation.
[ 16s] configure.ac:48: error: possibly undefined macro: AC_CHECK_LIB
[ 16s] configure.ac:49: error: possibly undefined macro: AC_MSG_ERROR
in this code andthis is correctly quoted AFAICS.
Did you also fix the quoting in the other AC_ARG_WITH:

AC_ARG_WITH([valgrind],
AS_HELP_STRING([--with-valgrind],
[Enable Valgrind annotations (small runtime overhead, default NO)]))

In particular, since that version outputs a comma, it could very well be
the source of the problem if it is not quoted as:

AC_ARG_WITH([valgrind],
[AS_HELP_STRING([--with-valgrind],
[Enable Valgrind annotations (small runtime overhead, default NO)])])
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
Philipp Thomas
2014-04-03 13:35:46 UTC
Permalink
Here is the part in question, AFAICT I did fix the quoting:

dnl Process this file with autoconf to produce a configure script.

AC_ARG_WITH([valgrind],
[AS_HELP_STRING([--with-valgrind],
[Enable Valgrind annotations (small runtime overhead, default NO)])])
if test x$with_valgrind = x || test x$with_valgrind = xno; then
want_valgrind=no
AC_DEFINE([NVALGRIND], 1, [Define to 1 to disable Valgrind annotations.])
else
want_valgrind=yes
if test -d $with_valgrind; then
CPPFLAGS="$CPPFLAGS -I$with_valgrind/include"
fi
fi

AC_ARG_WITH([resolve-neigh],
[AS_HELP_STRING([--with-resolve-neigh],
[Enable neighbour resolution in Ethernet (default YES)])])
have_libnl=no
if test x$with_resolve_neigh = x || test x$with_resolve_neigh = xyes; then
PKG_CHECK_MODULES([LIBNL],[libnl-3.0],
[have_libnl=yes
AC_DEFINE([HAVE_LIBNL3], [1], [Use libnl-3.0])
AC_DEFINE([HAVE_LIBNL], [1], [Use libnl])
PKG_CHECK_MODULES([LIBNL_ROUTE3], [libnl-route-3.0])
LIBNL_CFLAGS="$LIBNL_CFLAGS $LIBNL_ROUTE3_CFLAGS"
LIBNL_LIBS="$LIBNL_LIBS $LIBNL_ROUTE3_LIBS"], [:]
)
if test "$have_libnl" = no; then
PKG_CHECK_MODULES([LIBNL], [libnl-1], [have_libnl=yes
AC_DEFINE([HAVE_LIBNL1], [1], [Use libnl-1])
AC_DEFINE([HAVE_LIBNL], [1], [Use libnl])
AC_CHECK_LIB(nl, rtnl_link_vlan_get_id, [],
AC_MSG_ERROR([rtnl_link_vlan_get_id not found. libibverbs requires libnl.]))
],[
AC_MSG_ERROR([libibverbs requires libnl.])
])
fi
else
AC_DEFINE([NRESOLVE_NEIGH], 1, [Define to 1 to disable resovle neigh annotations.])
fi
Eric Blake
2014-04-03 14:26:27 UTC
Permalink
Post by Philipp Thomas
if test "$have_libnl" = no; then
PKG_CHECK_MODULES([LIBNL], [libnl-1], [have_libnl=yes
AC_DEFINE([HAVE_LIBNL1], [1], [Use libnl-1])
AC_DEFINE([HAVE_LIBNL], [1], [Use libnl])
AC_CHECK_LIB(nl, rtnl_link_vlan_get_id, [],
AC_MSG_ERROR([rtnl_link_vlan_get_id not found. libibverbs requires libnl.]))
This AC_MSG_ERROR line is missing quoting.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
Philipp Thomas
2014-04-03 16:49:53 UTC
Permalink
Post by Eric Blake
This AC_MSG_ERROR line is missing quoting.
Found the reason and searching for a brown paper bag :-) I had forgotten to
add pkg-config to the BuildRequires of the package and thus PKG_CHECK_MODULE
was undefined. Sorry for the noise, but I did learn a bit more what to fix
in configure.ac's, so the time hasn't been all wasted.

Philipp
Eric Blake
2014-04-03 17:24:25 UTC
Permalink
Post by Philipp Thomas
Post by Eric Blake
This AC_MSG_ERROR line is missing quoting.
Found the reason and searching for a brown paper bag :-) I had forgotten to
add pkg-config to the BuildRequires of the package and thus PKG_CHECK_MODULE
was undefined. Sorry for the noise, but I did learn a bit more what to fix
in configure.ac's, so the time hasn't been all wasted.
Next time, add this to your configure.ac:

m4_pattern_forbid([^PKG_])

It will force failure to install pkg-config to be a much saner error
message.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
Philipp Thomas
2014-04-03 09:27:52 UTC
Permalink
Post by Philipp Thomas
Post by Philipp Thomas
I have a configure.ac as attached. If I run autoreconf -fi on this file it
stops with 'configure.ac:23: error: possibly undefined macro: AC_DEFINE'
but at least I see no error in that line. But if I remove the following
block beginning with 'AC_ARG_WITH([resolve-neigh],' everything runs without
problems. Can anyboy help me spot the error?
AC_ARG_WITH([resolve-neigh],
AC_HELP_STRING([--with-resolve-neigh],
[Enable neighbour resolution in Ethernet (default YES)]))
Underquoted.
AC_ARG_WITH([resolve-neigh],
[AC_HELP_STRING([--with-resolve-neigh],
[Enable neighbour resolution in Ethernet (default YES)])])
I didn'twrite that, it's from an OFED package I'm trying to package for
SUSE and in the course called 'autoreconf -fi' but thank you for the help!

Philipp
Loading...