On 12/12/2013 02:02 PM, Julien ÉLIE wrote: > Hi all, > > When using AC_CHECK_HEADERS([filename]), a HAVE_FILENAME (with uppercase chars) > variable is defined to 1 if the filename header is found. > Characters not suitable for a variable name in filename are mapped to underscores. > > 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? > > Using: > > AC_CHECK_HEADERS([gdbm/ndbm.h gdbm-ndbm.h], [break]) > > does not help much. Unfortunately true. > As the result of the search is cached in $ac_cv_header_filename, maybe > using the following piece of code is the expected way to deal with the issue? Yep, multiple AC_CHECK_HEADER with manual actions on success is the best you can do, rather than AC_CHECK_HEADERS and its automatic actions. > > > 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. > 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.])])]) > > > > If you know a better way to do that, I would be interested in hearing it. > Thanks beforehand, > -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Attachment:
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Autoconf mailing list Autoconf@xxxxxxx https://lists.gnu.org/mailman/listinfo/autoconf