Changeset 2928


Ignore:
Timestamp:
Dec 26, 2012, 12:20:10 AM (11 years ago)
Author:
Peter
Message:

Support different styles of including bam header files: <bam.h>,
<bam/bam.h>, and <samtools/bam.h>. Style is identified at configure
time and stored in generated 'config_public.h' by defining either
HAVE_BAM_H, HAVE_BAM_BAM_H or HAVE_SAMTOOLS_BAM_H. For convenience,
macros YAT_[B|S]AM_HEADER are defined in 'config_bam.h' that can be
used as '#include YAT_[B|S]AB_HEADER' rather than '#include
<[b|s]am.h'.

Location:
branches/0.10-stable
Files:
1 added
13 edited

Legend:

Unmodified
Added
Removed
  • branches/0.10-stable/README.developer

    r2787 r2928  
    5959way but there is still some work to do before we do exceptions in a neutral way.
    6060
     61=== Samtools ===
     62
     63Code that depends on samtools API should be excluded from the build
     64when configured --without-samtools, i.e., put files within
     65`HAVE_LIBBAM` conditionals (or alternatively put code inside `#ifdef
     66HAVE_SAMTOOL` preprocessor conditionals). In order to support multiple
     67inclusion styles we do not include <bam.h> directly, but `#include
     68<config_bam.h>` and `#include YAT_BAM_HEADER`. Similarly, for `<sam.h>`
     69include `YAT_SAM_HEADER`. For more details on this, refer to
     70`yat/omic/config_bam.h`.
     71
    6172=== Doxygen ===
    6273We generate our documentation using [http://www.doxygen.org Doxygen]
  • branches/0.10-stable/configure.ac

    r2891 r2928  
    289289  AC_CHECK_LIB([z], [inflateEnd], [],
    290290    [YAT_MSG_ERROR([Library 'libz' was not found])])
    291   AC_CHECK_HEADER([bam.h], [],
    292     [YAT_MSG_ERROR([Header file 'bam.h' was not found])])
     291  YAT_CHECK_HEADER_BAM([],[YAT_MSG_ERROR([Header file 'bam.h' was not found])])
    293292  # try link against libbam
    294   YAT_CHECK_LIBBAM([LIBS="$BAM_LIBS $LIBS"],
     293  YAT_CHECK_LIBBAM([LIBS="$BAM_LIBS $LIBS"
     294                    AC_DEFINE([HAVE_LIBBAM], [1],
     295                              [Define to 1 if libbam is available])],
    295296    [YAT_MSG_ERROR([Library 'libbam' was not found])])
    296297  AC_PATH_PROG([SAMTOOLS], [samtools], [false])
  • branches/0.10-stable/m4/yat_check_libbam.m4

    r2919 r2928  
    2121#   along with yat. If not, see <http://www.gnu.org/licenses/>.
    2222
     23# YAT_CHECK_HEADER_BAM([action-if-found], [action-if-not-found])
     24# ==============================================================
     25#
     26AC_DEFUN([YAT_CHECK_HEADER_BAM],
     27[
     28yat_bam_header=no
     29# check how to #include <bam.h>
     30AC_CHECK_HEADERS([bam/bam.h bam.h samtools/bam.h bam.h],
     31                 [yat_bam_header=yes; break])
     32AS_IF([test x$yat_bam_header = xyes], [$1], [$2])
     33]) # YAT_CHECK_HEADER_BAM
     34
    2335
    2436# YAT_CHECK_LIBBAM([action-if-found], [action-if-not-found])
     
    2739AC_DEFUN([YAT_CHECK_LIBBAM],
    2840[
     41AC_REQUIRE([YAT_CHECK_HEADER_BAM])
    2942BAM_LIBS=no
    3043AC_MSG_CHECKING([for library containing bam_header_destroy])
     
    3952  AC_MSG_RESULT([$BAM_LIBS])
    4053])
    41 AS_IF([test x"$BAM_LIBS" = false], [$2], [$1])
     54AS_IF([test x"$BAM_LIBS" = xno], [$2], [$1])
    4255]) # YAT_CHECK_LIBBAM
    4356
     
    5164save_LIBS=$LIBS
    5265LIBS="$1 $LIBS"
    53 AC_LINK_IFELSE([AC_LANG_PROGRAM([@%:@include <bam.h>],
    54                                 [bam_header_t* hdr = bam_header_init();
     66AC_LINK_IFELSE([AC_LANG_PROGRAM([@%:@if HAVE_BAM_H
     67                                 @%:@ include <bam.h>
     68                                 @%:@elif HAVE_BAM_BAM_H
     69                                 @%:@ include <bam/bam.h>
     70                                 @%:@elif HAVE_SAMTOOLS_BAM_H
     71                                 @%:@ include <samtools/bam.h>
     72                                 @%:@endif
     73                                ],[
     74                                 bam_header_t* hdr = bam_header_init();
    5575                                 bam_header_destroy(hdr);
    5676                                ])],
  • branches/0.10-stable/test/bam_region_iterator.cc

    r2895 r2928  
    2222#include "yat/omic/BamReadIterator.h"
    2323#include "yat/omic/BamWriteIterator.h"
     24#include "yat/omic/config_bam.h"
    2425
    25 #include <bam.h>
     26#include YAT_BAM_HEADER
    2627
    2728#include <algorithm>
  • branches/0.10-stable/yat/omic/BamFile.cc

    r2897 r2928  
    2020#include "BamFile.h"
    2121#include "BamHeader.h"
     22#include "config_bam.h"
    2223
    2324#include "yat/utility/Exception.h"
    2425
    25 #include <bam.h>
     26#include YAT_BAM_HEADER
    2627
    2728#include <stdexcept>
  • branches/0.10-stable/yat/omic/BamFile.h

    r2897 r2928  
    2121#include "BamHeader.h"
    2222#include "BamRead.h"
     23#include "config_bam.h"
    2324
    2425#include "yat/utility/Exception.h"
    2526
    26 #include <sam.h>
     27#include YAT_SAM_HEADER
    2728
    2829#include <boost/utility.hpp>
  • branches/0.10-stable/yat/omic/BamHeader.h

    r2884 r2928  
    1919// along with this program. If not, see <http://www.gnu.org/licenses/>.
    2020
    21 #include <bam.h>
     21#include "config_bam.h"
     22
     23#include YAT_BAM_HEADER
    2224
    2325namespace theplu {
  • branches/0.10-stable/yat/omic/BamRead.cc

    r2886 r2928  
    1919
    2020#include "BamRead.h"
    21 
    22 #include <bam.h>
     21#include "config_bam.h"
     22
     23#include YAT_BAM_HEADER
    2324
    2425#include <algorithm>
  • branches/0.10-stable/yat/omic/BamRead.h

    r2911 r2928  
    1919// along with this program. If not, see <http://www.gnu.org/licenses/>.
    2020
    21 #include <sam.h>
    22 #include <bam.h>
     21#include "config_bam.h"
     22
     23#include YAT_BAM_HEADER
     24#include YAT_SAM_HEADER
    2325
    2426#include <functional>
  • branches/0.10-stable/yat/omic/BamReadIterator.h

    r2896 r2928  
    2121#include "BamFile.h"
    2222#include "BamRead.h"
     23#include "config_bam.h"
    2324
    24 #include <sam.h>
     25#include YAT_SAM_HEADER
    2526
    2627#include <boost/iterator/iterator_facade.hpp>
  • branches/0.10-stable/yat/omic/BamWriteIterator.cc

    r2883 r2928  
    1919
    2020#include "BamFile.h"
     21#include "config_bam.h"
    2122
    22 #include <sam.h>
     23#include YAT_SAM_HEADER
    2324
    2425#include <cassert>
  • branches/0.10-stable/yat/omic/Makefile.am

    r2899 r2928  
    4141nobase_include_HEADERS += $(srcdir)/yat/omic/BamReadIterator.h
    4242nobase_include_HEADERS += $(srcdir)/yat/omic/BamWriteIterator.h
     43nobase_include_HEADERS += $(srcdir)/yat/omic/config_bam.h
    4344endif
    4445nobase_include_HEADERS += $(srcdir)/yat/omic/Codon.h
  • branches/0.10-stable/yat/utility/config_public.h.in

    r2673 r2928  
    2828///
    2929
     30/// Define to 1 if you have the <bam/bam.h> header file.
     31#undef HAVE_BAM_BAM_H
     32
     33/// Define to 1 if you have the <bam.h> header file.
     34#undef HAVE_BAM_H
     35
     36/// Define if samtools executable is available
     37#undef HAVE_SAMTOOLS
     38
    3039/// Define if compiler supports deprecated attribute, as in g++ 4.0
    3140#undef YAT_HAVE_GCC_DEPRECATED
Note: See TracChangeset for help on using the changeset viewer.