source: trunk/m4/yat_check_libbam.m4 @ 2919

Last change on this file since 2919 was 2919, checked in by Peter, 9 years ago

update copyright years

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Date
File size: 1.9 KB
Line 
1## $Id: yat_check_libbam.m4 2919 2012-12-19 06:54:23Z peter $
2#
3# serial 1 (yat 0.10)
4#
5#
6#   Copyright (C) 2012 Peter Johansson
7#
8#   This file is part of the yat library, http://dev.thep.lu.se/yat
9#
10#   The yat library is free software; you can redistribute it and/or
11#   modify it under the terms of the GNU General Public License as
12#   published by the Free Software Foundation; either version 3 of the
13#   License, or (at your option) any later version.
14#
15#   The yat library is distributed in the hope that it will be useful,
16#   but WITHOUT ANY WARRANTY; without even the implied warranty of
17#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18#   General Public License for more details.
19#
20#   You should have received a copy of the GNU General Public License
21#   along with yat. If not, see <http://www.gnu.org/licenses/>.
22
23
24# YAT_CHECK_LIBBAM([action-if-found], [action-if-not-found])
25# ==========================================================
26#
27AC_DEFUN([YAT_CHECK_LIBBAM],
28[
29BAM_LIBS=no
30AC_MSG_CHECKING([for library containing bam_header_destroy])
31for libs in "" "-lbam" "-lbam -lpthread"; do
32  AS_IF([test x"$BAM_LIBS" = x"no"], [
33    YAT_LINK_BAM_IFELSE([$libs], [BAM_LIBS=$libs])
34  ])
35done
36AS_IF([test x"$BAM_LIBS" = x""], [
37  AC_MSG_RESULT([none required])
38],[
39  AC_MSG_RESULT([$BAM_LIBS])
40])
41AS_IF([test x"$BAM_LIBS" = false], [$2], [$1])
42]) # YAT_CHECK_LIBBAM
43
44
45
46# YAT_LINK_BAM_IFELSE([lib], [action-if-found], [action-if-not-found])
47# ====================================================================
48# Add lib to LIBS and try to link some code using libbam
49AC_DEFUN([YAT_LINK_BAM_IFELSE],
50[
51save_LIBS=$LIBS
52LIBS="$1 $LIBS"
53AC_LINK_IFELSE([AC_LANG_PROGRAM([@%:@include <bam.h>],
54                                [bam_header_t* hdr = bam_header_init();
55                                 bam_header_destroy(hdr);
56                                ])],
57               [$2], [$3])
58LIBS=$save_LIBS
59]) # YAT_LINK_BAM_IFELSE
Note: See TracBrowser for help on using the repository browser.