autoconf
[Top][All Lists]
Advanced

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

Searching headers mapping to the same HAVE_header variable


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

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?

Using:

AC_CHECK_HEADERS([gdbm/ndbm.h gdbm-ndbm.h], [break])

does not help much.
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?


AC_CHECK_HEADER([gdbm/ndbm.h])
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,

-- 
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]