autoconf
[Top][All Lists]
Advanced

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

Re: Searching headers mapping to the same HAVE_header variable


From: Julien ÉLIE
Subject: Re: Searching headers mapping to the same HAVE_header variable
Date: Thu, 12 Dec 2013 22:42:26 +0100
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.1.1

Hi Eric,

I have a question about how to deal with looking for two different headers that
lead to the same HAVE_FILENAME variable.
For instance:  how to properly search for gdbm/ndbm.h and gdbm-ndbm.h?

Ugh, there's no clean way to do that with the standard macros.  Who
named these header files, and can they be convinced to improve their
naming in the future?

Well, for instance libgdbm-dev in Debian provides /usr/include/gdbm-ndbm.h whereas gdbm-devel in Red Hat provides /usr/include/gdbm/ndbm.h...
Maybe other distributions are using other names.  (I have not checked.)



AC_CHECK_HEADER([gdbm/ndbm.h])

Unfortunately, AC_CHECK_HEADER short-circuits if the cache is already
populated.  And since the collision is not just on the HAVE_GDBM_NDBM_H
preprocessor name, but ALSO on the $ac_cv_header_gdbm_ndbm_h shell
variable, you are liable to get wrong behavior on secondary runs when
caching is enabled ('./configure -C').  To properly distinguish between
the two names, you'll have to completely ignore the pre-set cache names,
and instead wrap the check inside a cache name that you control.

Oh, that's a pretty good point.  Thanks for hinting at it.

Isn't calling AS_UNSET([ac_cv_header_gdbm_ndbm_h]) enough before the two AC_CHECK_HEADER calls? I do not understand well what you mean by wrapping the check inside a cache name that I control.

Do I also have to unset HAVE_GDBM_NDBM_H and HAVE_GDBM_NDBM_H_DASH? (Are they also cached values when set with AC_DEFINE?)

If all these removals are not enough, what more should I do?



AS_IF([test x"$ac_cv_header_gdbm_ndbm_h" != xno],
     [AC_DEFINE([HAVE_GDBM_NDBM_H], [1],
         [Define if you have the <gdbm/ndbm.h> header file.])],
     [AS_UNSET([ac_cv_header_gdbm_ndbm_h])
      AC_CHECK_HEADER([gdbm-ndbm.h])
      AS_IF([test x"$ac_cv_header_gdbm_ndbm_h" != xno],
          [AC_DEFINE([HAVE_GDBM_NDBM_H_DASH], [1],
              [Define if you have the <gdbm-ndbm.h> header file.])])])

--
Julien ÉLIE

« – Nous ne connaissons pas leur langue, donc, sous aucun prétexte
    il ne faut parler aux Goths !
  – Mais on peut leur taper dessus ? » (Astérix)



reply via email to

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