source: trunk/yat/omic/config_bam.h @ 3415

Last change on this file since 3415 was 3415, checked in by Peter, 4 years ago

refs #794

Change logic in configure test looking for libhts/samtools headers and
libraries. Instead of looking whether both headers and libraries are
available, first look for both and <htslib/hts.h> and libhts. If found
use that. If not found, look if both <bam.h> and libbam are
available. If yes, use them. If not abort.

Only test for function bam_calend and global variable
bam_nt16_rev_table when building against libbam as they are irrelevant
in htslib mode.

yat/utility/config_public.h.in: change back to macros
YAT_HAVE_BAM_H
YAT_HAVE_BAM_BAM_H
YAT_HAVE_SAMTOOLS_BAM_H
as they were called in 0.12. Add a new macro YAT_HAVE_HTSLIB_SAM_H,
which is defined when builiding against htslib (just like
YAT_HAVE_HTSLIB).

yat/omic/config_bam.h: use new macro names in
'yat/utility/config_public.h' and avoid having nested if statements
and instead use style:

#if defined YAT_HAVE_HTSLIB_HTS_H
# define YAT_SAM_HEADER "htslib/sam.h"
#elif defined YAT_HAVE_BAM_H
# define YAT_BAM_HEADER "bam.h"
# define YAT_SAM_HEADER "sam.h"
#elif defined YAT_HAVE_BAM_BAM_H
# define YAT_BAM_HEADER "bam/bam.h"
# define YAT_SAM_HEADER "bam/sam.h"
#endif

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.0 KB
Line 
1#ifndef theplu_yat_omic_config_bam
2#define theplu_yat_omic_config_bam
3
4// $Id: config_bam.h 3415 2015-04-30 07:36:46Z peter $
5//
6// Copyright (C) 2012, 2013, 2014 Peter Johansson
7//
8// This program is free software; you can redistribute it and/or modify
9// it under the terms of the GNU General Public License as published by
10// the Free Software Foundation; either version 3 of the License, or
11// (at your option) any later version.
12//
13// This program is distributed in the hope that it will be useful, but
14// WITHOUT ANY WARRANTY; without even the implied warranty of
15// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16// General Public License for more details.
17//
18// You should have received a copy of the GNU General Public License
19// along with this program. If not, see <http://www.gnu.org/licenses/>.
20
21/*
22   The purpose of this file is to cater for different installation
23   styles. As samtools' Makefile contains no install rule, different
24   distributions have come up with different ideas where to put
25   samtools' header files. Red Hat put them in '/usr/include/bam'
26   whereas Ubuntu put them in '/usr/include/samtools/'. We could solve
27   this by #including <bam.h> and then add appropriate include path
28   (-I) flags to the compiler, but in order to support arbitrary
29   PREFIX we instead choose to #define macros BAM_HEADER and
30   SAM_HEADER depending on where we found the bam headers (at
31   configure time) as <bam.h>, <bam/bam.h>, or <samtools/bam.h>.
32 */
33
34#include "yat/utility/config_public.h"
35
36#if defined YAT_HAVE_HTSLIB_HTS_H
37#  define YAT_SAM_HEADER "htslib/sam.h"
38#elif defined YAT_HAVE_BAM_H
39#  define YAT_BAM_HEADER "bam.h"
40#  define YAT_SAM_HEADER "sam.h"
41#elif defined YAT_HAVE_BAM_BAM_H
42#  define YAT_BAM_HEADER "bam/bam.h"
43#  define YAT_SAM_HEADER "bam/sam.h"
44#elif defined YAT_HAVE_SAMTOOLS_BAM_H
45#  define YAT_BAM_HEADER "samtools/bam.h"
46#  define YAT_SAM_HEADER "samtools/sam.h"
47#endif
48
49#ifndef YAT_SAM_HEADER
50#error This file requires samtools header files and cannot be used when \
51yat was configured with switch '--without-samtools'.
52#endif
53
54#endif
Note: See TracBrowser for help on using the repository browser.