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 | # |
---|
27 | AC_DEFUN([YAT_CHECK_LIBBAM], |
---|
28 | [ |
---|
29 | BAM_LIBS=no |
---|
30 | AC_MSG_CHECKING([for library containing bam_header_destroy]) |
---|
31 | for 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 | ]) |
---|
35 | done |
---|
36 | AS_IF([test x"$BAM_LIBS" = x""], [ |
---|
37 | AC_MSG_RESULT([none required]) |
---|
38 | ],[ |
---|
39 | AC_MSG_RESULT([$BAM_LIBS]) |
---|
40 | ]) |
---|
41 | AS_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 |
---|
49 | AC_DEFUN([YAT_LINK_BAM_IFELSE], |
---|
50 | [ |
---|
51 | save_LIBS=$LIBS |
---|
52 | LIBS="$1 $LIBS" |
---|
53 | AC_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]) |
---|
58 | LIBS=$save_LIBS |
---|
59 | ]) # YAT_LINK_BAM_IFELSE |
---|