@@ -31,7 +31,6 @@ AC_PROG_CXX
3131AX_CXX_COMPILE_STDCXX ( 17 , [ noext] , [ mandatory] )
3232AC_PROG_RANLIB
3333
34- dnl check for HTSLib if requested
3534hts_fail_msg="
3635
3736Failed to locate HTSLib on your system. Please use the LDFLAGS and
@@ -40,25 +39,53 @@ and headers can be found.
4039
4140If you want to disable HTSLib when building preseq, use the --disable-htslib
4241argument to the configure script.
42+
43+ "
44+
45+ libdeflate_fail_msg="
46+
47+ Failed to locate libdeflate on your system. This is a common dependency of
48+ HTSLib. If your HTSLib might have been built without requiring libdeflate,
49+ please use the --without-libdeflate argument to configure. If you do not need
50+ to directly process SAM/BAM files with preseq, then you might consider using
51+ the argument --without-htslib to build preseq without support for reading
52+ SAM/BAM.
53+
54+ If you need libdeflate, please use the LDFLAGS and CPPFLAGS variables to
55+ specify the directories where the library and headers can be found on your
56+ system.
57+
4358"
59+
4460AC_ARG_ENABLE ( [ hts] ,
45- [ AS_HELP_STRING ( [ --disable-htslib] , [ Enable HTSLib @<:@ yes@:>@ ] ) ] ,
46- [ enable_hts=no] , [ enable_hts=yes] )
47- AS_IF ( [ test "x$enable_hts" = "xyes"] ,
48- [ AC_CHECK_LIB ( [ hts] , [ hts_version] , [ ] ,
49- [ AC_MSG_FAILURE ( [ $hts_fail_msg] ) ] ) ]
61+ [ AS_HELP_STRING ( [ --disable-htslib] ,
62+ [ Disable HTSLib (needed for BAM/SAM input) @<:@ no@:>@ ] ) ] ,
63+ [ enable_htslib=no] , [ enable_htslib=yes]
64+ )
65+
66+ AC_ARG_ENABLE ( [ deflate] ,
67+ [ AS_HELP_STRING ( [ --disable-libdeflate] ,
68+ [ Disable libdeflate (might be needed by HTSLib) @<:@ no@:>@ ] ) ] ,
69+ [ enable_libdeflate=no] , [ enable_libdeflate=yes]
5070)
51- AM_CONDITIONAL([ ENABLE_HTS] , [ test "x$enable_hts" = "xyes"] )
52-
53- dnl arg for using libdeflate, which might happen by default anyway
54- AC_ARG_WITH ( [ libdeflate] ,
55- [ AS_HELP_STRING ( [ --with-libdeflate] , [ use libdeflate for reading BAM files] ) ] ,
56- [ with_libdeflate=yes] , [ with_libdeflate=no] )
57- AS_IF ( [ test "x$with_libdeflate" = "xyes"] ,
58- [
71+
72+ AS_IF ( [ test "x$enable_htslib" = xyes] , [
73+ AX_PTHREAD ( [ ] ,
74+ [ AC_MSG_ERROR ( [ Threads required for HTSLib but threads library not found] ) ]
75+ )
76+ AC_SEARCH_LIBS (
77+ [ gzopen] , [ z] , [ ] ,
78+ [ AC_MSG_FAILURE ( [ "ZLib required for HTSLib but not found"] ) ]
79+ )
80+ AS_IF ( [ test "x$enable_libdeflate" = xyes] , [
5981 AC_SEARCH_LIBS ( [ libdeflate_deflate_compress] , [ deflate] , [ ] ,
60- [ AC_MSG_ERROR ( [ --with-libdeflate specified but libdeflate not found] ) ] )
61- ] )
82+ [ AC_MSG_ERROR ( [ $libdeflate_fail_msg] ) ] , [ ] ) ]
83+ )
84+ AC_CHECK_LIB ( [ hts] , [ hts_version] , [ ] ,
85+ [ AC_MSG_FAILURE ( [ $hts_fail_msg] ) ] , [ -pthread -lz -ldeflate] )
86+ ]
87+ )
88+ AM_CONDITIONAL([ ENABLE_HTSLIB] , [ test "x$enable_htslib" = "xyes"] )
6289
6390AC_CONFIG_FILES ( [ Makefile] )
6491
0 commit comments