Skip to content

Commit c257e55

Browse files
ihnortonShelnutt2
andauthored
Patch htslib 1.10 to fix build with autoconf 2.70+ (#314)
* Patch htslib 1.10 to fix build with autoconf 2.70+ details in: samtools/htslib#1198 * Also autoreconf htslib after patching configure.ac * Add automake brew dependency to ci * Add patch to Dockerfile-cli Co-authored-by: Seth Shelnutt <[email protected]>
1 parent 813d422 commit c257e55

File tree

5 files changed

+45
-5
lines changed

5 files changed

+45
-5
lines changed

ci/azure-linux_mac.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ steps:
3232
sudo make install
3333
popd
3434
else
35-
brew install bcftools
35+
brew install bcftools automake
3636
fi
3737
3838
# Install autoconf/automake (required for htslib)

ci/native_libs-linux_osx.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ steps:
1313
sudo make install
1414
popd
1515
else
16-
brew install bcftools
16+
brew install bcftools automake
1717
fi
1818
1919
# Install autoconf/automake (required for htslib)

docker/Dockerfile-cli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ ENV AWS_EC2_METADATA_DISABLED true
55
# Install some dependencies
66
RUN yum -y install cmake3 which wget git tar gzip unzip gcc-c++ zlib-devel \
77
openssl-devel bzip2-devel libcurl-devel xz-devel make \
8-
automake autoconf \
8+
automake autoconf patch \
99
&& yum clean all
1010

1111
WORKDIR /tmp

libtiledbvcf/cmake/Modules/FindHTSlib_EP.cmake

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(HTSlib
6060
REQUIRED_VARS HTSLIB_LIBRARIES HTSLIB_INCLUDE_DIR
6161
)
6262

63+
6364
if (NOT HTSLIB_FOUND)
6465
if (SUPERBUILD)
6566
message(STATUS "Adding HTSlib as an external project")
@@ -74,6 +75,12 @@ if (NOT HTSLIB_FOUND)
7475
if (BUILD_TYPE STREQUAL "DEBUG")
7576
SET(CFLAGS "-g")
7677
endif()
78+
79+
# required to updated htslib configure.ac with autoconf 2.70
80+
# - see https://github.com/samtools/htslib/commit/680c0b8ef0ff133d3b572abc80fe66fc2ea965f0
81+
# - and https://github.com/samtools/htslib/pull/1198/commits/6821fc8ed88706e9282b561e74dfa45dac4d74c8
82+
find_program(AUTORECONF NAMES autoreconf REQUIRED)
83+
7784
ExternalProject_Add(ep_htslib
7885
PREFIX "externals"
7986
URL "https://github.com/samtools/htslib/archive/1.10.zip"
@@ -82,13 +89,15 @@ if (NOT HTSLIB_FOUND)
8289
CONFIGURE_COMMAND
8390
autoheader
8491
COMMAND
85-
autoconf
92+
${AUTORECONF} -i
8693
COMMAND
8794
./configure --prefix=${EP_INSTALL_PREFIX} LDFLAGS=${EXTRA_LDFLAGS} CFLAGS=${CFLAGS}
8895
BUILD_COMMAND
8996
$(MAKE)
9097
INSTALL_COMMAND
9198
$(MAKE) install
99+
PATCH_COMMAND
100+
patch -N -p1 < ${CMAKE_CURRENT_SOURCE_DIR}/cmake/patches/htslib-1.10-config.patch
92101
BUILD_IN_SOURCE TRUE
93102
LOG_DOWNLOAD TRUE
94103
LOG_CONFIGURE TRUE
@@ -114,4 +123,4 @@ endif()
114123
if (EP_HTSLIB_BUILT AND TARGET HTSlib::HTSlib)
115124
include(TileDBCommon)
116125
install_target_libs(HTSlib::HTSlib)
117-
endif()
126+
endif()
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
From 6821fc8ed88706e9282b561e74dfa45dac4d74c8 Mon Sep 17 00:00:00 2001
2+
From: John Marshall <[email protected]>
3+
Date: Fri, 1 Jan 2021 10:37:22 +0000
4+
Subject: [PATCH] Don't set $host_alias as that confuses autoconf 2.70
5+
6+
Autoconf 2.70 is more careful about cross compilation, so with this
7+
version using AC_FUNC_MMAP implies AC_CANONICAL_HOST and hence computes
8+
$build/build_alias/host/host_alias/etc. Setting $host_alias ourselves
9+
interferes with that. Hat tip Matthias Klose (via debbug#978835).
10+
11+
As autoconf 2.70 implicitly uses AC_CANONICAL_HOST, it requires (and its
12+
autoreconf --install installs) config.guess and config.sub. Ignore those,
13+
and ignore install-sh as well for good measure.
14+
---
15+
diff --git a/configure.ac b/configure.ac
16+
index 9bd1642d7..f473c97e5 100644
17+
--- a/configure.ac
18+
+++ b/configure.ac
19+
@@ -137,9 +137,9 @@ AC_ARG_ENABLE([s3],
20+
[support Amazon AWS S3 URLs])],
21+
[], [enable_s3=check])
22+
23+
-test -n "$host_alias" || host_alias=unknown-`uname -s`
24+
-AC_MSG_CHECKING([shared library type for $host_alias])
25+
-case $host_alias in
26+
+basic_host=${host_alias:-unknown-`uname -s`}
27+
+AC_MSG_CHECKING([shared library type for $basic_host])
28+
+case $basic_host in
29+
*-cygwin* | *-CYGWIN*)
30+
host_result="Cygwin DLL"
31+
PLATFORM=CYGWIN

0 commit comments

Comments
 (0)