1# -*- Autoconf -*- 2# Process this file with autoconf to produce a configure script. 3 4AC_PREREQ(2.59) 5AC_INIT([Stacks], [2.4]) 6AC_CONFIG_AUX_DIR([config]) 7AM_INIT_AUTOMAKE([-Wall -Werror foreign parallel-tests subdir-objects]) 8AC_CONFIG_SRCDIR([src/ustacks.cc]) 9AC_CONFIG_SRCDIR([htslib/hts.c]) 10AC_CONFIG_HEADERS([config.h]) 11m4_pattern_allow([AC_OPENMP]) 12 13# 14# Get BAM, aka HTSLib library and include locations if requested 15# 16#AC_ARG_ENABLE([bam], 17# AS_HELP_STRING([--disable-bam], [Disable use of BAM files through HTSLib.])) 18#AS_IF([test "x$enable_bam" != "xno"], [ 19#AC_DEFINE([HAVE_BAM], [1], [Enable compilation with Samtools BAM library]) 20#BAM_CFLAGS='-I./htslib/htslib' 21#AC_SUBST([BAM_CFLAGS]) 22#BAM_LIBS='./htslib/libhts.a' 23#AC_SUBST([BAM_LIBS]) 24#]) 25 26# Checks for programs. 27AC_PROG_CXX 28AM_PROG_CC_C_O 29AX_CXX_COMPILE_STDCXX(11,, [mandatory]) 30 31# Checks for ar-based static libs. 32AC_PROG_RANLIB 33m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) 34 35# Checks for libraries. 36AC_CHECK_LIB([gomp], [omp_set_num_threads],, [AC_MSG_WARN([Unable to locate OpenMP library, you should probably specify '--disable-openmp'.])]) 37AC_CHECK_LIB([z], [gzread],, [AC_MSG_ERROR([Zlib not found, reading gzipped files will not be possible.])]) 38 39# Checks for header files. 40AC_HEADER_DIRENT 41AC_HEADER_STDC 42AC_CHECK_HEADERS([float.h limits.h stdlib.h string.h]) 43AC_CHECK_HEADERS([unistd.h]) 44 45# Check for OpenMP parallel execution support 46AC_OPENMP 47 48# Checks for typedefs, structures, and compiler characteristics. 49AC_HEADER_STDBOOL 50AC_C_CONST 51AC_TYPE_SIZE_T 52 53# Checks for library functions. 54AC_FUNC_CLOSEDIR_VOID 55AC_FUNC_MALLOC 56AC_FUNC_REALLOC 57AC_CHECK_FUNCS([floor memset pow sqrt]) 58AC_CHECK_FUNCS([clock_gettime]) 59 60# `clock_gettime()`, declared in unistd.h, may be in librt (e.g. for glibc). 61if test $ac_cv_func_clock_gettime = no; then 62 AC_CHECK_LIB(rt, clock_gettime, 63 [LIBS="-lrt $LIBS" 64 AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [Define to 1 if you have the `clock_gettime' function.]) 65 ]) 66fi 67 68# 69# Test if regular expressions are functional. Early regex implementations have nonfunctional stubs, 70# so the check for C++11 succeeds, but the compiled code will throw an exception. 71# 72AC_LANG(C++) 73AC_DEFUN([AC_REGEX_FUNC], [ 74AC_CACHE_CHECK([for functional regular expressions], [stacks_cv_header_regex_func], 75[ 76stacks_cv_header_regex_func=no 77AC_RUN_IFELSE([AC_LANG_SOURCE([[ 78#include <regex> 79int main() { 80 const std::regex regex(".*"); 81 const std::string string = "This should match!"; 82 const auto result = std::regex_search(string, regex); 83 return result ? 0 : 1; 84} 85]])], 86 [stacks_cv_header_regex_func=yes], 87 [AC_MSG_ERROR([Regular expressions are not functional, you need g++ 4.9.0 or greater.])], 88 [AC_MSG_WARN([Requires g++ 4.9.0 or greater.])] 89)]) 90if test "$stacks_cv_header_regex_func" = yes; then 91 AC_DEFINE([REGEX_FUNCTIONAL], [1], [Regular expressions are defined and implemented]) 92fi 93]) 94 95AC_REGEX_FUNC 96 97# For test harness 98AC_PROG_AWK 99 100AC_CONFIG_FILES([Makefile htslib/Makefile]) 101AC_OUTPUT 102