[Top][All Lists]

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

Re: AC_CHECK_HEADER question

From: Peter Johansson
Subject: Re: AC_CHECK_HEADER question
Date: Mon, 18 Mar 2013 09:39:34 +1000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.12) Gecko/20130108 Thunderbird/10.0.12

Hi Jan,

On 03/18/2013 07:35 AM, Jan van Dijk wrote:
  It will also make the scripts less

Am I overlooking something? Is there a technical reason why that information
cannot be.communicated to the user?

It is not known where the header file is. The configure script tests if code which contains "#include <header.h>" compiles. If it compiles it proves that 'header.h' exist but not *where*.

I have a similar situation in one my projects in which we use a header file "bam.h" which is either installed in '<prefix>/include/', in '<prefix>/include/bam/' or in '<prefix>/include/samtools'. We solve it by having

AC_CHECK_HEADERS([bam/bam.h bam.h samtools/bam.h],
                 [found_bam_header=yes; break])

in which will AC_DEFINE HAVE_BAM_BAM_H, HAVE_BAM_H, HAVE_SAMTOOLS_BAM_H or neither. If header is not found shell variable found_bam_header equals "no" and one can error out based on that.

Then in you can include appropriately with something like
  #include <bam/bam.h>
#elif HAVE_BAM_H
  #include <bam.h>
  #include <samtools/bam.h>

or you can create a convenience header that use similar logic to #define a macro BAM_HEADER and then have

#include "convenience.h"
#include BAM_HEADER

Hope that helps.


If not, I suppose I could file a feature

Thanks again, Jan.

Autoconf mailing list

reply via email to

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