[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to test if a autoconf macro exists?

From: Bernd Jendrissek
Subject: Re: How to test if a autoconf macro exists?
Date: Mon, 4 Feb 2008 13:51:27 +0200

[This is actually an autoconf question...]

On Feb 4, 2008 12:35 PM, Santiago Capel Torres <address@hidden> wrote:
> I am using the macro  AM_PATH_XML2(2.5.0) in my which works
> fine provided the libxml2-devel package is installed. But when this
> package is not installed, I get errors:
> aclocal
> warning: macro `AM_PATH_XML2' not found in library
> autoheader
> automake
> autoconf
> error: possibly undefined macro: AM_PATH_XML2
>      If this token and others are legitimate, please use m4_pattern_allow.
>      See the Autoconf documentation.
> So, it looks like I can not use AM_PATH_XML2 before installing
> libxml2-devel, so I can not test if it is installed :(
> I think I can try the following workarounds:
> a) Copy the contents of AM_PATH_XML2 to my acinclude.m4 and redistribute it

aclocal does that for the users of your tarball.  That's why you as
the package maintainer need to have AM_PATH_XML2 installed where
aclocal can find it.  As long as you don't ask your users to run
aclocal, they won't have to have the macro installed as the
distributed aclocal.m4 will already contain it.

> b) Create a customized test that checks if AM_PATH_XML2 is installed
> But I don't like any of them. I would prefer to have something in
> autoconf like
> if EXISTS_MACRO( [AM_PATH_XML2] ) ; then
> Does anything like this exists yet?

Here's a solution from gEDA:

dnl This macro checks that a m4 macro is define.  The primary use of
dnl this macro is to inform users that they haven't installed required
dnl -devel packages at time.  This macro is based on a
dnl prototype macro created by Peter Brett.

  ifdef(  [$1],
          true,   dnl NOP
                      [m4 macro `$1' is not defined.  Ensure that `$2'
is installed in your aclocal search path.  Maybe you are missing a
-dev package?],

> Thanks a lot
> -- santilin

reply via email to

[Prev in Thread] Current Thread [Next in Thread]