Re: Searching headers mapping to the same HAVE_header variable

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

 



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)

_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
https://lists.gnu.org/mailman/listinfo/autoconf





[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux