From 28193db46929b053b348db598f5761c97e0421cd Mon Sep 17 00:00:00 2001 From: zhangxianting Date: Tue, 9 Apr 2024 16:41:31 +0800 Subject: [PATCH] fix build error, because of remove libbam.a after samtools upgrade (cherry picked from commit ad11b6f2f7cb88d31cae07408bcebe024d21eef0) --- cufflinks.spec | 9 +- fix-build-error-of-sam.h.patch | 359 +++++++++++++++++ ...tead-of-bam-because-samtools-upgrade.patch | 360 ++++++++++++++++++ 3 files changed, 726 insertions(+), 2 deletions(-) create mode 100644 fix-build-error-of-sam.h.patch create mode 100644 hts-instead-of-bam-because-samtools-upgrade.patch diff --git a/cufflinks.spec b/cufflinks.spec index d8e4edc..10d39d7 100644 --- a/cufflinks.spec +++ b/cufflinks.spec @@ -1,6 +1,6 @@ Name: cufflinks Version: 2.2.1 -Release: 3 +Release: 4 Summary: Transcriptome assembly and differential expression analysis for RNA-Seq. License: GPL-3.0-only and BSL-1.0 @@ -17,6 +17,8 @@ Patch6: 0007-py2to3.patch Patch7: 0008-boost_bind_header.patch Patch8: multiple-definition-linker-error.patch Patch9: no_svnversion.patch +Patch10: hts-instead-of-bam-because-samtools-upgrade.patch +Patch11: fix-build-error-of-sam.h.patch BuildRequires: boost boost-serialization boost-system boost-thread boost-devel samtools samtools-devel htslib htslib-devel BuildRequires: gcc gcc-c++ gcc-gfortran make autoconf gmp mpfr openmpi java-1.8.0-openjdk-headless @@ -42,7 +44,7 @@ if ! ./configure \ %ifarch aarch64 --build=arm \ %endif - --with-boost --with-eigen --with-bam \ + --with-boost --with-eigen --with-hts \ LIBS="-lboost_system -lboost_thread -lboost_serialization" \ PYTHON="$(command -v python3)"; then : cat log @@ -63,6 +65,9 @@ find %{buildroot}/%{_bindir}/ -type f -name gffread -delete %changelog +* Wed Apr 10 2024 zhangxianting - 2.2.1-4 +- fix build error, because of remove libbam.a after samtools upgrade + * Thu Feb 10 2022 herengui - 2.2.1-3 - fix build issue. diff --git a/fix-build-error-of-sam.h.patch b/fix-build-error-of-sam.h.patch new file mode 100644 index 0000000..9d43442 --- /dev/null +++ b/fix-build-error-of-sam.h.patch @@ -0,0 +1,359 @@ +From 9be41e572e5a983286c1520e713397dfa481df4f Mon Sep 17 00:00:00 2001 +From: zhangxianting +Date: Wed, 10 Apr 2024 14:38:30 +0800 +Subject: [PATCH 2/2] fix build error of sam.h + + error: reference to 'byte' is ambiguous + /usr/include/c++/12/cstddef:69:14: note: candidates are: 'enum class std::byte' + error: 'samread' was not declared in this scope; did you mean 'sam_read1'? + error: 'bam_header_t' was not declared in this scope; did you mean 'bam_hdr_t'? + error: 'bam1_qname' was not declared in this scope; did you mean 'basename'? + error: 'bam1_cigar' was not declared in this scope; did you mean 'bam_cigar_op'? + error: 'samopen' was not declared in this scope; did you mean 'sam_open'? + error: 'samclose' was not declared in this scope; did you mean 'sam_close'? + error: '_hit_file' was not declared in this scope; did you mean 'htsFile'? + + src/GBase.h: + rename byte to gbase_byte + src/hits.cpp: + sam_read1 instead of samread + bam_hdr_t instead of bam_header_t + bam_get_qname instead of bam1_qname + bam_get_cigar instead of bam1_cigar + src/hits.h: + sam_open instead of samopen + sam_close instead of samclose + samFile instead of samfile_t + fp.bgzf instead of x.bam + +--- + src/GBase.h | 2 +- + src/codons.cpp | 8 ++++---- + src/gdna.cpp | 12 ++++++------ + src/gdna.h | 4 ++-- + src/gff.cpp | 2 +- + src/gff.h | 11 +++++------ + src/hits.cpp | 24 ++++++++++++------------ + src/hits.h | 21 +++++++++++---------- + 8 files changed, 42 insertions(+), 42 deletions(-) + +diff --git a/src/GBase.h b/src/GBase.h +index fc3c5ba..1d31e9d 100644 +--- a/src/GBase.h ++++ b/src/GBase.h +@@ -72,7 +72,7 @@ typedef int16_t int16; + typedef uint16_t uint16; + + typedef unsigned char uchar; +-typedef unsigned char byte; ++typedef unsigned char gbase_byte; + + #ifndef MAXUINT + #define MAXUINT ((unsigned int)-1) +diff --git a/src/codons.cpp b/src/codons.cpp +index a459250..4efe055 100644 +--- a/src/codons.cpp ++++ b/src/codons.cpp +@@ -48,9 +48,9 @@ static bool isCodonTableReady=codonTableInit(); + + unsigned short packCodon(char n1, char n2, char n3) { + //assumes they are uppercase already! +- byte b1=n1-'A'; +- byte b2=n2-'A'; +- byte b3=n3-'A'; ++ gbase_byte b1=n1-'A'; ++ gbase_byte b2=n2-'A'; ++ gbase_byte b3=n3-'A'; + b1 |= (b2 << 5); + b2 = (b2 >> 3) | (b3 << 2); + return ( ((unsigned short)b2) << 8) + b1; +@@ -68,7 +68,7 @@ bool codonTableInit() { + + + char Codon::translate() { +- for (byte i=0;i<3;i++) nuc[i]=toupper(nuc[i]); ++ for (gbase_byte i=0;i<3;i++) nuc[i]=toupper(nuc[i]); + unsigned short aacode=packCodon(nuc[0], nuc[1], nuc[2]); + return codonTable[aacode]; + } +diff --git a/src/gdna.cpp b/src/gdna.cpp +index 4d8a4b0..f7873be 100644 +--- a/src/gdna.cpp ++++ b/src/gdna.cpp +@@ -11,8 +11,8 @@ const char* IUPAC_COMP ="TtGgAaCcAaKkYyWwSsRrMmBbDdHhVvNnXx-*"; + #define G_2BIT 2 // 10 + #define T_2BIT 3 // 11 + +-static byte ntCompTable[256]; +-static byte nt2bit[256]; //maps any character to a 2bit base value (with N = A) ++static gbase_byte ntCompTable[256]; ++static gbase_byte nt2bit[256]; //maps any character to a 2bit base value (with N = A) + static char v_2bit2nt[4] = {'A','C','G','T'}; + + //---------------------- +@@ -21,9 +21,9 @@ static bool gdna_Ready=gDnaInit(); + + //---------------------- + +-byte gdna2bit(char* &nt, int n) { +-// Pack n bases into a byte (n can be 1..4) +-byte out = 0; ++gbase_byte gdna2bit(char* &nt, int n) { ++// Pack n bases into a gbase_byte (n can be 1..4) ++gbase_byte out = 0; + while (n && *nt) { + n--; + out <<= 2; +@@ -43,7 +43,7 @@ char ntComplement(char c) { + return ntCompTable[(int)c]; + } + +-char g2bit2base(byte v2bit) { ++char g2bit2base(gbase_byte v2bit) { + return v_2bit2nt[v2bit & 0x03 ]; + } + +diff --git a/src/gdna.h b/src/gdna.h +index 1f923ed..6871a34 100644 +--- a/src/gdna.h ++++ b/src/gdna.h +@@ -9,7 +9,7 @@ char* reverseComplement(char* seq, int slen=0); + + bool gDnaInit(); + +-byte gdna2bit(char* &nt, int n=4); //pack n bases into a byte (n can be 1..4) +-char g2bit2base(byte v2bit); //convert the 2-bit value into 'A', 'C', 'G' or 'T' ++gbase_byte gdna2bit(char* &nt, int n=4); //pack n bases into a gbase_byte (n can be 1..4) ++char g2bit2base(gbase_byte v2bit); //convert the 2-bit value into 'A', 'C', 'G' or 'T' + + #endif +diff --git a/src/gff.cpp b/src/gff.cpp +index 17103ff..1b7fa5b 100644 +--- a/src/gff.cpp ++++ b/src/gff.cpp +@@ -21,7 +21,7 @@ const uint gfo_flag_BY_EXON = 0x00000020; //created by subfeature (exon + const uint gfo_flag_DISCARDED = 0x00000100; + const uint gfo_flag_LST_KEEP = 0x00000200; + const uint gfo_flag_LEVEL_MSK = 0x00FF0000; +-const byte gfo_flagShift_LEVEL = 16; ++const gbase_byte gfo_flagShift_LEVEL = 16; + + void gffnames_ref(GffNames* &n) { + if (n==NULL) n=new GffNames(); +diff --git a/src/gff.h b/src/gff.h +index db2f87e..483b9d0 100644 +--- a/src/gff.h ++++ b/src/gff.h +@@ -22,7 +22,6 @@ const byte exMskMinSpliceL = 0x04; + const byte exMskMinSpliceR = 0x08; + const byte exMskTag = 0x80; + */ +- + //reserved Gffnames::feats entries -- basic feature types + extern const int gff_fid_mRNA; // "mRNA" feature name + extern const int gff_fid_transcript; // *RNA, *transcript feature name +@@ -43,7 +42,7 @@ extern const uint gfo_flag_DISCARDED; //should not be printed under the "transcr + extern const uint gfo_flag_LST_KEEP; //GffObj from GffReader::gflst is to be kept (not deallocated) + //when GffReader is destroyed + extern const uint gfo_flag_LEVEL_MSK; //hierarchical level: 0 = no parent +-extern const byte gfo_flagShift_LEVEL; ++extern const gbase_byte gfo_flagShift_LEVEL; + + extern bool gff_show_warnings; + +@@ -502,18 +501,18 @@ public: + if (v) flags |= gfo_flag_CHILDREN_PROMOTED; + else flags &= ~gfo_flag_CHILDREN_PROMOTED; + } +- void setLevel(byte v) { ++ void setLevel(gbase_byte v) { + if (v==0) flags &= ~gfo_flag_LEVEL_MSK; + else flags &= ~(((uint)v) << gfo_flagShift_LEVEL); + } +- byte incLevel() { ++ gbase_byte incLevel() { + uint v=((flags & gfo_flag_LEVEL_MSK) >> gfo_flagShift_LEVEL); + v++; + flags &= ~(v << gfo_flagShift_LEVEL); + return v; + } +- byte getLevel() { +- return ((byte)((flags & gfo_flag_LEVEL_MSK) >> gfo_flagShift_LEVEL)); ++ gbase_byte getLevel() { ++ return ((gbase_byte)((flags & gfo_flag_LEVEL_MSK) >> gfo_flagShift_LEVEL)); + } + + bool isValidTranscript() { +diff --git a/src/hits.cpp b/src/hits.cpp +index 4cac1f1..068bb67 100644 +--- a/src/hits.cpp ++++ b/src/hits.cpp +@@ -398,7 +398,7 @@ bool BAMHitFactory::next_record(const char*& buf, size_t& buf_size) + + memset(&_next_hit, 0, sizeof(_next_hit)); + +- int bytes_read = samread(_hit_file, &_next_hit); ++ int bytes_read = sam_read1(_hit_file, _hit_file->bam_header, &_next_hit); + if (bytes_read < 0) + { + _eof_encountered = true; +@@ -470,7 +470,7 @@ bool BAMHitFactory::get_hit_from_buf(const char* orig_bwt_buf, + if (sam_flag & 0x4 || target_id < 0) + { + //assert(cigar.size() == 1 && cigar[0].opcode == MATCH); +- bh = create_hit(bam1_qname(hit_buf), ++ bh = create_hit(bam_get_qname(hit_buf), + "*", + 0, // SAM files are 1-indexed + 0, +@@ -483,27 +483,27 @@ bool BAMHitFactory::get_hit_from_buf(const char* orig_bwt_buf, + sam_flag); + return true; + } +- if (target_id >= _hit_file->header->n_targets) ++ if (target_id >= _hit_file->bam_header->n_targets) + { +- fprintf (stderr, "BAM error: file contains hits to sequences not in header SQ records (%s)\n", bam1_qname(hit_buf)); ++ fprintf (stderr, "BAM error: file contains hits to sequences not in header SQ records (%s)\n", bam_get_qname(hit_buf)); + return false; + } + +- string text_name = _hit_file->header->target_name[target_id]; ++ string text_name = _hit_file->bam_header->target_name[target_id]; + + for (int i = 0; i < hit_buf->core.n_cigar; ++i) + { + //char* t; + +- int length = bam1_cigar(hit_buf)[i] >> BAM_CIGAR_SHIFT; ++ int length = bam_get_cigar(hit_buf)[i] >> BAM_CIGAR_SHIFT; + if (length <= 0) + { +- fprintf (stderr, "BAM error: CIGAR op has zero length (%s)\n", bam1_qname(hit_buf)); ++ fprintf (stderr, "BAM error: CIGAR op has zero length (%s)\n", bam_get_qname(hit_buf)); + return false; + } + + CigarOpCode opcode; +- switch(bam1_cigar(hit_buf)[i] & BAM_CIGAR_MASK) ++ switch(bam_get_cigar(hit_buf)[i] & BAM_CIGAR_MASK) + { + case BAM_CMATCH: opcode = MATCH; break; + case BAM_CINS: opcode = INS; break; +@@ -533,7 +533,7 @@ bool BAMHitFactory::get_hit_from_buf(const char* orig_bwt_buf, + { + if (mate_target_id == target_id) + { +- mrnm = _hit_file->header->target_name[mate_target_id]; ++ mrnm = _hit_file->bam_header->target_name[mate_target_id]; + // if (abs((int)text_mate_pos - (int)text_offset) > (int)max_intron_length) + // { + // //fprintf (stderr, "Mates are too distant, skipping\n"); +@@ -593,7 +593,7 @@ bool BAMHitFactory::get_hit_from_buf(const char* orig_bwt_buf, + //assert(_rg_props.strandedness() == STRANDED_PROTOCOL || source_strand == CUFF_STRAND_UNKNOWN); + + //assert(cigar.size() == 1 && cigar[0].opcode == MATCH); +- bh = create_hit(bam1_qname(hit_buf), ++ bh = create_hit(bam_get_qname(hit_buf), + text_name, + text_offset, // BAM files are 0-indexed + cigar, +@@ -614,7 +614,7 @@ bool BAMHitFactory::get_hit_from_buf(const char* orig_bwt_buf, + fprintf(stderr, "BAM record error: found spliced alignment without XS attribute\n"); + } + +- bh = create_hit(bam1_qname(hit_buf), ++ bh = create_hit(bam_get_qname(hit_buf), + text_name, + text_offset, // BAM files are 0-indexed + cigar, +@@ -739,7 +739,7 @@ static const unsigned MAX_HEADER_LEN = 64 * 1024 * 1024; // 4 MB + + bool BAMHitFactory::inspect_header() + { +- bam_header_t* header = _hit_file->header; ++ bam_hdr_t* header = _hit_file->bam_header; + + if (header == NULL) + { +diff --git a/src/hits.h b/src/hits.h +index 4072389..e63f9c1 100644 +--- a/src/hits.h ++++ b/src/hits.h +@@ -18,7 +18,8 @@ + + #include + +-#include ++#include ++#include + + #include "common.h" + #include "multireads.h" +@@ -724,16 +725,16 @@ public: + RefSequenceTable& reference_table) : + HitFactory(insert_table, reference_table) + { +- _hit_file = samopen(hit_file_name.c_str(), "rb", 0); ++ _hit_file = sam_open(hit_file_name.c_str(), "rb"); + + memset(&_next_hit, 0, sizeof(_next_hit)); + +- if (_hit_file == NULL || _hit_file->header == NULL) ++ if (_hit_file == NULL || _hit_file->bam_header == NULL) + { + throw std::runtime_error("Fail to open BAM file"); + } + +- _beginning = bgzf_tell(_hit_file->x.bam); ++ _beginning = bgzf_tell(_hit_file->fp.bgzf); + _eof_encountered = false; + + if (inspect_header() == false) +@@ -753,19 +754,19 @@ public: + { + if (_hit_file) + { +- samclose(_hit_file); ++ sam_close(_hit_file); + } + } + + void mark_curr_pos() + { +- _curr_pos = bgzf_tell(_hit_file->x.bam); ++ _curr_pos = bgzf_tell(_hit_file->fp.bgzf); + } + + + void undo_hit() + { +- bgzf_seek(_hit_file->x.bam, _curr_pos, SEEK_SET); ++ bgzf_seek(_hit_file->fp.bgzf, _curr_pos, SEEK_SET); + //--_line_num; + } + +@@ -776,9 +777,9 @@ public: + + void reset() + { +- if (_hit_file && _hit_file->x.bam) ++ if (_hit_file && _hit_file->fp.bgzf) + { +- bgzf_seek(_hit_file->x.bam, _beginning, SEEK_SET); ++ bgzf_seek(_hit_file->fp.bgzf, _beginning, SEEK_SET); + _eof_encountered = false; + } + } +@@ -795,7 +796,7 @@ public: + bool inspect_header(); + + private: +- samfile_t* _hit_file; ++ samFile* _hit_file; + int64_t _curr_pos; + int64_t _beginning; + +-- +2.33.0 + diff --git a/hts-instead-of-bam-because-samtools-upgrade.patch b/hts-instead-of-bam-because-samtools-upgrade.patch new file mode 100644 index 0000000..0a66584 --- /dev/null +++ b/hts-instead-of-bam-because-samtools-upgrade.patch @@ -0,0 +1,360 @@ +From d94b8582e580f7c110b64705b79aa6ae3748f0d1 Mon Sep 17 00:00:00 2001 +From: zhangxianting +Date: Wed, 10 Apr 2024 14:37:17 +0800 +Subject: [PATCH 1/2] hts instead of bam , because samtools upgrade, remove /usr/lib64/libbam.a + copy ax_hts.m4, base ax_bam.m4 + +--- + ax_hts.m4 | 203 ++++++++++++++++++++++++++++ + configure.ac | 6 +- + cufflinks.xcodeproj/project.pbxproj | 2 +- + make_bin.sh | 8 +- + src/Makefile.am | 32 ++--- + 5 files changed, 227 insertions(+), 24 deletions(-) + create mode 100644 ax_hts.m4 + +diff --git a/ax_hts.m4 b/ax_hts.m4 +new file mode 100644 +index 0000000..b5f7e78 +--- /dev/null ++++ b/ax_hts.m4 +@@ -0,0 +1,203 @@ ++# SYNOPSIS ++# ++# AX_HTS ++# ++# DESCRIPTION ++# ++# Test for the HTS libraries of a particular version (or newer) ++# ++# If no path to the installed hts library is given the macro searchs ++# under /usr, /usr/local, /opt and /opt/local and evaluates the ++# $HTS_ROOT environment variable. ++# Adapted from AX_BOOST_BASE ++# ++# This macro calls: ++# ++# AC_SUBST(HTS_CPPFLAGS) / AC_SUBST(HTS_LDFLAGS) ++# ++# And sets: ++# ++# HAVE_HTS ++# ++# LICENSE ++# ++# Copyright (c) 2010 Cole Trapnell ++# ++# Copying and distribution of this file, with or without modification, are ++# permitted in any medium without royalty provided the copyright notice ++# and this notice are preserved. ++ ++AC_DEFUN([AX_HTS], ++[ ++AC_ARG_WITH([hts], ++ AS_HELP_STRING([--with-hts@<:@=DIR@:>@], [use HTS libraries (default is yes) - it is possible to specify the root directory for HTS (optional)]), ++ [ ++ if test "$withval" = "no"; then ++ want_hts="no" ++ elif test "$withval" = "yes"; then ++ want_hts="yes" ++ ac_hts_path="" ++ else ++ want_hts="yes" ++ ac_hts_path="$withval" ++ fi ++ ], ++ [want_hts="yes"]) ++ ++ ++AC_ARG_WITH([hts-libdir], ++ AS_HELP_STRING([--with-hts-libdir=LIB_DIR], ++ [Force given directory for hts libraries. Note that this will overwrite library path detection, so use this parameter only if default library detection fails and you know exactly where your hts libraries are located.]), ++ [ ++ if test -d $withval ++ then ++ ac_hts_lib_path="$withval" ++ else ++ AC_MSG_ERROR(--with-hts-libdir expected directory name) ++ fi ++ ], ++ [ac_hts_lib_path=""] ++) ++ ++if test "x$want_hts" = "xyes"; then ++# hts_lib_version_req=ifelse([$1], ,1.20.0,$1) ++# hts_lib_version_req_shorten=`expr $hts_lib_version_req : '\([[0-9]]*\.[[0-9]]*\)'` ++# hts_lib_version_req_major=`expr $hts_lib_version_req : '\([[0-9]]*\)'` ++# hts_lib_version_req_minor=`expr $hts_lib_version_req : '[[0-9]]*\.\([[0-9]]*\)'` ++# hts_lib_version_req_sub_minor=`expr $hts_lib_version_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'` ++# if test "x$hts_lib_version_req_sub_minor" = "x" ; then ++# hts_lib_version_req_sub_minor="0" ++# fi ++# WANT_HTS_VERSION=`expr $htslib_version_req_major \* 100000 \+ $hts_lib_version_req_minor \* 100 \+ $hts_lib_version_req_sub_minor` ++ AC_MSG_CHECKING(for htslib) ++ succeeded=no ++ ++ dnl first we check the system location for hts libraries ++ if test "$ac_hts_path" != ""; then ++ HTS_LDFLAGS="-L$ac_hts_path/lib" ++ HTS_CPPFLAGS="-I$ac_hts_path/include" ++ else ++ for ac_hts_path_tmp in /usr /usr/local /opt /opt/local ; do ++ if test -d "$ac_hts_path_tmp/include/htslib" && test -r "$ac_hts_path_tmp/include/htslib"; then ++ HTS_LDFLAGS="-L$ac_hts_path_tmp/lib" ++ HTS_CPPFLAGS="-I$ac_hts_path_tmp/include" ++ break; ++ fi ++ done ++ fi ++ ++ dnl overwrite ld flags if we have required special directory with ++ dnl --with-hts-libdir parameter ++ if test "$ac_hts_lib_path" != ""; then ++ HTS_LDFLAGS="-L$ac_hts_lib_path" ++ fi ++ ++ CPPFLAGS_SAVED="$CPPFLAGS" ++ CPPFLAGS="$CPPFLAGS $HTS_CPPFLAGS" ++ export CPPFLAGS ++ ++ LDFLAGS_SAVED="$LDFLAGS" ++ LDFLAGS="$LDFLAGS $HTS_LDFLAGS" ++ export LDFLAGS ++ ++ AC_LANG_PUSH(C++) ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ++ @%:@include ++ ]], [[ ++ ]])],[ ++ AC_MSG_RESULT(yes) ++ succeeded=yes ++ found_system=yes ++ ],[ ++ ]) ++ AC_LANG_POP([C++]) ++ ++ dnl if we found no hts with system layout we search for hts libraries ++ dnl built and installed without the --layout=system option or for a staged(not installed) version ++ if test "x$succeeded" != "xyes"; then ++ _version=0 ++ if test "$ac_hts_path" != ""; then ++ if test -d "$ac_hts_path" && test -r "$ac_hts_path"; then ++ for i in `ls -d $ac_hts_path/include/hts* 2>/dev/null`; do ++ _version_tmp=`echo $i | sed "s#$ac_hts_path##" | sed 's/\/include\/hts-//' | sed 's/_/./'` ++ V_CHECK=`expr $_version_tmp \> $_version` ++ if test "$V_CHECK" = "1" ; then ++ _version=$_version_tmp ++ fi ++ VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'` ++ HTS_CPPFLAGS="-I$ac_hts_path/include/hts-$VERSION_UNDERSCORE" ++ done ++ fi ++ else ++ for ac_hts_path in /usr /usr/local /opt /opt/local ; do ++ if test -d "$ac_hts_path" && test -r "$ac_hts_path"; then ++ for i in `ls -d $ac_hts_path/include/hts-* 2>/dev/null`; do ++ _version_tmp=`echo $i | sed "s#$ac_hts_path##" | sed 's/\/include\/hts-//' | sed 's/_/./'` ++ V_CHECK=`expr $_version_tmp \> $_version` ++ if test "$V_CHECK" = "1" ; then ++ _version=$_version_tmp ++ best_path=$ac_hts_path ++ fi ++ done ++ fi ++ done ++ ++ VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'` ++ HTS_CPPFLAGS="-I$best_path/include/hts-$VERSION_UNDERSCORE" ++ if test "$ac_hts_lib_path" = "" ++ then ++ HTS_LDFLAGS="-L$best_path/lib" ++ fi ++ ++ if test "x$HTS_ROOT" != "x"; then ++ if test -d "$HTS_ROOT" && test -r "$HTS_ROOT" && test -d "$HTS_ROOT/stage/lib" && test -r "$HTS_ROOT/stage/lib"; then ++ version_dir=`expr //$HTS_ROOT : '.*/\(.*\)'` ++ stage_version=`echo $version_dir | sed 's/hts_//' | sed 's/_/./g'` ++ stage_version_shorten=`expr $stage_version : '\([[0-9]]*\.[[0-9]]*\)'` ++ V_CHECK=`expr $stage_version_shorten \>\= $_version` ++ if test "$V_CHECK" = "1" -a "$ac_hts_lib_path" = "" ; then ++ AC_MSG_NOTICE(We will use a staged hts library from $HTS_ROOT) ++ HTS_CPPFLAGS="-I$HTS_ROOT" ++ HTS_LDFLAGS="-L$HTS_ROOT/stage/lib" ++ fi ++ fi ++ fi ++ fi ++ ++ CPPFLAGS="$CPPFLAGS $HTS_CPPFLAGS" ++ export CPPFLAGS ++ LDFLAGS="$LDFLAGS $HTS_LDFLAGS" ++ export LDFLAGS ++ ++ AC_LANG_PUSH(C++) ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ++ @%:@include ++ ]], [[ ++ ]])],[ ++ AC_MSG_RESULT(yes) ++ succeeded=yes ++ found_system=yes ++ ],[ ++ ]) ++ AC_LANG_POP([C++]) ++ fi ++ ++ if test "$succeeded" != "yes" ; then ++ if test "$_version" = "0" ; then ++ AC_MSG_ERROR([[We could not detect the hts libraries (version $hts_lib_version_req_shorten or higher). If you have a staged hts library (still not installed) please specify \$HTS_ROOT in your environment and do not give a PATH to --with-hts option. If you are sure you have hts installed, then check your version number looking in . See http://randspringer.de/hts for more documentation.]]) ++ else ++ AC_MSG_NOTICE([Your hts libraries seem too old (version $_version).]) ++ fi ++ else ++ HTS_LIB="-lhts" ++ AC_SUBST(HTS_CPPFLAGS) ++ AC_SUBST(HTS_LDFLAGS) ++ AC_SUBST(HTS_LIB) ++ AC_DEFINE(HAVE_HTS,,[define if the HTS library is available]) ++ fi ++ ++ CPPFLAGS="$CPPFLAGS_SAVED" ++ LDFLAGS="$LDFLAGS_SAVED" ++fi ++ ++]) +diff --git a/configure.ac b/configure.ac +index ce9936f..eba4f7a 100755 +--- a/configure.ac ++++ b/configure.ac +@@ -2,7 +2,7 @@ m4_include([ax_boost_base.m4]) + m4_include([ax_boost_thread.m4]) + m4_include([ax_boost_system.m4]) + m4_include([ax_boost_serialization.m4]) +-m4_include([ax_bam.m4]) ++m4_include([ax_hts.m4]) + m4_include([ax_check_zlib.m4]) + m4_include([ax_check_eigen.m4]) + +@@ -33,7 +33,7 @@ AC_PROG_INSTALL + m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) + AM_PATH_PYTHON([2.4]) + AX_BOOST_BASE([1.47.0]) +-AX_BAM ++AX_HTS + AX_BOOST_SYSTEM + AX_BOOST_SERIALIZATION + AX_BOOST_THREAD +@@ -105,7 +105,7 @@ AC_ARG_ENABLE(profiling, [ --enable-profiling enable profiling with + + CFLAGS="${generic_CFLAGS} ${ext_CFLAGS} ${user_CFLAGS} ${debug_CFLAGS} ${OPENMP_CFLAGS}" + CXXFLAGS="$CFLAGS" +-CXXFLAGS="${CXXFLAGS} ${BOOST_CPPFLAGS} ${BAM_CPPFLAGS} ${EIGEN_CPPFLAGS}" ++CXXFLAGS="${CXXFLAGS} ${BOOST_CPPFLAGS} ${HTS_CPPFLAGS} ${EIGEN_CPPFLAGS}" + user_LDFLAGS="$LDFLAGS" + LDFLAGS="${ext_LDFLAGS} ${user_LDFLAGS}" + +diff --git a/cufflinks.xcodeproj/project.pbxproj b/cufflinks.xcodeproj/project.pbxproj +index ea9dce7..f021377 100644 +--- a/cufflinks.xcodeproj/project.pbxproj ++++ b/cufflinks.xcodeproj/project.pbxproj +@@ -748,7 +748,7 @@ + A2047A17191141C7007193FC /* libbam.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libbam.a; path = ../../../../opt/local/libIntel64/libbam.a; sourceTree = ""; }; + ED1C0C7111D7D9E500CFD663 /* ax_boost_base.m4 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ax_boost_base.m4; sourceTree = ""; }; + ED1C0C7211D7D9E500CFD663 /* ax_boost_thread.m4 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ax_boost_thread.m4; sourceTree = ""; }; +- ED1C0C7411D7DA3200CFD663 /* ax_bam.m4 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ax_bam.m4; sourceTree = ""; }; ++ ED1C0C7411D7DA3200CFD663 /* ax_hts.m4 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ax_hts.m4; sourceTree = ""; }; + ED1C0CAA11D7E52400CFD663 /* ax_check_zlib.m4 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ax_check_zlib.m4; sourceTree = ""; }; + ED1C0D7911D7F94900CFD663 /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; }; + ED41B838127602C60000B5A2 /* cufflinks_xcode */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = cufflinks_xcode; sourceTree = BUILT_PRODUCTS_DIR; }; +diff --git a/make_bin.sh b/make_bin.sh +index 32c2e6e..f4d3aa5 100755 +--- a/make_bin.sh ++++ b/make_bin.sh +@@ -2,11 +2,11 @@ + #simple script to pack up a precompiled binary package, with the boost thread + # library statically linked in; on x86_64 Linux, libstc++ and libgcc are linked statically also + if [[ -z "$2" ]]; then +- echo -e "Usage:\n./make_bin.sh [ []]" ++ echo -e "Usage:\n./make_bin.sh [ []]" + exit 1 + fi + +-echo "packing up $1.tar.gz, using boost in $2, linking against $3 and using BAM in $4, using Eigen in $5" ++echo "packing up $1.tar.gz, using boost in $2, linking against $3 and using HTS in $4, using Eigen in $5" + mkdir $1 + #make clean + make distclean +@@ -38,8 +38,8 @@ fi + # fi + + +-#./configure --enable-intel64 --with-boost=$l2 --with-boost-thread=$l3 --with-bam=$l4 --with-eigen=$l5 +-./configure --with-boost=$l2 --with-boost-thread=$l2/lib/libboost_thread.a --with-boost-system=$l2/lib/libboost_system.a --with-bam=$l3 --with-eigen=$l4 --with-boost-serialization=$l2/lib/libboost_serialization.a ++#./configure --enable-intel64 --with-boost=$l2 --with-boost-thread=$l3 --with-hts=$l4 --with-eigen=$l5 ++./configure --with-boost=$l2 --with-boost-thread=$l2/lib/libboost_thread.a --with-boost-system=$l2/lib/libboost_system.a --with-hts=$l3 --with-eigen=$l4 --with-boost-serialization=$l2/lib/libboost_serialization.a + make + cp src/cufflinks $1 + cp src/cuffcompare $1 +diff --git a/src/Makefile.am b/src/Makefile.am +index b46137d..a900f19 100644 +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -206,8 +206,8 @@ CLEANFILES = $(bin_SCRIPTS) + # (echo '#!$(PYTHON)'; sed '/^#!/d' $<) > $@ + + cufflinks_SOURCES = cufflinks.cpp +-cufflinks_LDADD = libcufflinks.a libgc.a $(BOOST_THREAD_LIB) $(BOOST_SYSTEM_LIB) $(BOOST_SERIALIZATION_LIB) $(BAM_LIB) +-cufflinks_LDFLAGS = $(LDFLAGS) $(BOOST_LDFLAGS) $(BAM_LDFLAGS) #$(ZLIB_LDFLAGS) ++cufflinks_LDADD = libcufflinks.a libgc.a $(BOOST_THREAD_LIB) $(BOOST_SYSTEM_LIB) $(BOOST_SERIALIZATION_LIB) $(HTS_LIB) ++cufflinks_LDFLAGS = $(LDFLAGS) $(BOOST_LDFLAGS) $(HTS_LDFLAGS) #$(ZLIB_LDFLAGS) + + cuffcompare_SOURCES = cuffcompare.cpp + cuffcompare_LDADD = libgc.a +@@ -216,30 +216,30 @@ gffread_SOURCES = gffread.cpp + gffread_LDADD = libgc.a + + cuffdiff_SOURCES = cuffdiff.cpp +-cuffdiff_LDADD = libcufflinks.a libgc.a $(BOOST_THREAD_LIB) $(BOOST_SYSTEM_LIB) $(BOOST_SERIALIZATION_LIB) $(BAM_LIB) +-cuffdiff_LDFLAGS = $(LDFLAGS) $(BOOST_LDFLAGS) $(BAM_LDFLAGS) ++cuffdiff_LDADD = libcufflinks.a libgc.a $(BOOST_THREAD_LIB) $(BOOST_SYSTEM_LIB) $(BOOST_SERIALIZATION_LIB) $(HTS_LIB) ++cuffdiff_LDFLAGS = $(LDFLAGS) $(BOOST_LDFLAGS) $(HTS_LDFLAGS) + + cuffquant_SOURCES = cuffquant.cpp +-cuffquant_LDADD = libcufflinks.a libgc.a $(BOOST_THREAD_LIB) $(BOOST_SYSTEM_LIB) $(BOOST_SERIALIZATION_LIB) $(BAM_LIB) +-cuffquant_LDFLAGS = $(LDFLAGS) $(BOOST_LDFLAGS) $(BAM_LDFLAGS) ++cuffquant_LDADD = libcufflinks.a libgc.a $(BOOST_THREAD_LIB) $(BOOST_SYSTEM_LIB) $(BOOST_SERIALIZATION_LIB) $(HTS_LIB) ++cuffquant_LDFLAGS = $(LDFLAGS) $(BOOST_LDFLAGS) $(HTS_LDFLAGS) + + cuffnorm_SOURCES = cuffnorm.cpp +-cuffnorm_LDADD = libcufflinks.a libgc.a $(BOOST_THREAD_LIB) $(BOOST_SYSTEM_LIB) $(BOOST_SERIALIZATION_LIB) $(BAM_LIB) +-cuffnorm_LDFLAGS = $(LDFLAGS) $(BOOST_LDFLAGS) $(BAM_LDFLAGS) ++cuffnorm_LDADD = libcufflinks.a libgc.a $(BOOST_THREAD_LIB) $(BOOST_SYSTEM_LIB) $(BOOST_SERIALIZATION_LIB) $(HTS_LIB) ++cuffnorm_LDFLAGS = $(LDFLAGS) $(BOOST_LDFLAGS) $(HTS_LDFLAGS) + + + gtf_to_sam_SOURCES = gtf_to_sam.cpp +-gtf_to_sam_LDADD = libcufflinks.a libgc.a $(BOOST_THREAD_LIB) $(BOOST_SYSTEM_LIB) $(BOOST_SERIALIZATION_LIB) $(BAM_LIB) +-gtf_to_sam_LDFLAGS = $(LDFLAGS) $(BOOST_LDFLAGS) $(BAM_LDFLAGS) ++gtf_to_sam_LDADD = libcufflinks.a libgc.a $(BOOST_THREAD_LIB) $(BOOST_SYSTEM_LIB) $(BOOST_SERIALIZATION_LIB) $(HTS_LIB) ++gtf_to_sam_LDFLAGS = $(LDFLAGS) $(BOOST_LDFLAGS) $(HTS_LDFLAGS) + + #cuffcluster_SOURCES = cuffcluster.cpp +-#cuffcluster_LDADD = libcufflinks.a libgc.a $(BOOST_THREAD_LIB) $(BOOST_SYSTEM_LIB) $(BOOST_SERIALIZATION_LIB) $(BAM_LIB) +-#cuffcluster_LDFLAGS = $(LDFLAGS) $(BOOST_LDFLAGS) $(BAM_LDFLAGS) ++#cuffcluster_LDADD = libcufflinks.a libgc.a $(BOOST_THREAD_LIB) $(BOOST_SYSTEM_LIB) $(BOOST_SERIALIZATION_LIB) $(HTS_LIB) ++#cuffcluster_LDFLAGS = $(LDFLAGS) $(BOOST_LDFLAGS) $(HTS_LDFLAGS) + + compress_gtf_SOURCES = compress_gtf.cpp +-compress_gtf_LDADD = libcufflinks.a libgc.a $(BOOST_THREAD_LIB) $(BOOST_SYSTEM_LIB) $(BOOST_SERIALIZATION_LIB) $(BAM_LIB) +-compress_gtf_LDFLAGS = $(LDFLAGS) $(BOOST_LDFLAGS) $(BAM_LDFLAGS) ++compress_gtf_LDADD = libcufflinks.a libgc.a $(BOOST_THREAD_LIB) $(BOOST_SYSTEM_LIB) $(BOOST_SERIALIZATION_LIB) $(HTS_LIB) ++compress_gtf_LDFLAGS = $(LDFLAGS) $(BOOST_LDFLAGS) $(HTS_LDFLAGS) + + #gtf_reads_SOURCES = gtf_reads.cpp +-#gtf_reads_LDADD = libcufflinks.a libgc.a $(BOOST_THREAD_LIB) $(BOOST_SYSTEM_LIB) $(BOOST_SERIALIZATION_LIB) $(BAM_LIB) +-#gtf_reads_LDFLAGS = $(LDFLAGS) $(BOOST_LDFLAGS) $(BAM_LDFLAGS) #$(ZLIB_LDFLAGS) ++#gtf_reads_LDADD = libcufflinks.a libgc.a $(BOOST_THREAD_LIB) $(BOOST_SYSTEM_LIB) $(BOOST_SERIALIZATION_LIB) $(HTS_LIB) ++#gtf_reads_LDFLAGS = $(LDFLAGS) $(BOOST_LDFLAGS) $(HTS_LDFLAGS) #$(ZLIB_LDFLAGS) +-- +2.33.0 +