2
# Process this file with autoconf to produce a configure script.
4
AC_INIT([PfTools],[3.0],[thierry.schuepbach@isb-sib.ch],[pftools])
6
AC_MSG_NOTICE([Configuring PfTools for your system.])
9
AC_CONFIG_HEADERS([src/C/include/config.h])
13
PfTools_DATE="November 2012"
14
PfTools_COPYRIGHT="Copyright (C) 2012 Swiss Institute of Bioinformatics."
15
PfTools_LICENSE="Freely distributed under the GNU General Public License (GPLv3)."
16
PfTools_VERSION=$PACKAGE_VERSION
17
PfTools_URL="http://www.isb-sib.ch/"
19
#-------------------------------------------------------------------------------------------------------
20
# Checks for programs.
21
#-------------------------------------------------------------------------------------------------------
28
#-------------------------------------------------------------------------------------------------------
29
# Checks for target system
30
#-------------------------------------------------------------------------------------------------------
31
if test $target_cpu != "x86_64" ; then
32
AC_MSG_ERROR([Currently pftools only runs on 64 bit architectures.])
35
#-------------------------------------------------------------------------------------------------------
37
#-------------------------------------------------------------------------------------------------------
39
[AS_HELP_STRING([--enable-mmap],
40
[use memory mapping of files rather than libc fopen, default is yes])],
41
enable_mmap=$enableval, enable_mmap=yes)
42
AC_ARG_ENABLE(thread-affinity,
43
[AS_HELP_STRING([--enable-thread-affinity],[Enforce affinity on threads, default is yes])],
44
enable_thread_affinity=$enableval, enable_thread_affinity=yes)
46
#-------------------------------------------------------------------------------------------------------
47
# Checks for libraries.
48
#-------------------------------------------------------------------------------------------------------
49
if test $ax_cv_c_compiler_vendor = "intel"; then
50
AC_CHECK_HEADERS([mathimf.h])
51
AC_SUBST([INTEL_IMF],[-limf])
52
AC_MSG_NOTICE([Intel IMF library will be used])
54
AC_CHECK_LIB([m], [expf])
56
#-------------------------------------------------------------------------------------------------------
57
# Checks for header files.
58
#-------------------------------------------------------------------------------------------------------
60
AC_CHECK_HEADERS([fcntl.h limits.h stdlib.h string.h sys/time.h unistd.h inttypes.h mm_malloc.h])
62
#-------------------------------------------------------------------------------------------------------
63
# Checks for typedefs, structures, and compiler characteristics.
64
#-------------------------------------------------------------------------------------------------------
67
if test "$ac_cv_prog_cc_c99" = "no"; then
68
AC_MSG_ERROR([PfTools $PACKAGE_VERSION require a C compiler supporting C99 mode.])
82
AX_CHECK_COMPILE_FLAG(-msse2,[SIMD_SSE2_CFLAGS="-msse2"], SIMD_SSE2_CFLAGS="")
83
if test $SIMD_SSE2_CFLAGS != "-msse2"; then
84
AC_MSG_ERROR([Compiler cannot generate SSE 2 code])
86
# AC_CHECK_HEADERS([emmintrin.h],[], [AC_MSG_ERROR([Missing SSE 2 header file emmintrin.h])])
88
AC_SUBST(SIMD_SSE2_CFLAGS)
90
AX_CHECK_COMPILE_FLAG(-msse4.1,[SIMD_SSE4_1_CFLAGS="-msse4.1"], SIMD_SSE4_1_CFLAGS="")
91
if test $SIMD_SSE4_1_CFLAGS != "-msse4.1"; then
92
AC_MSG_ERROR([Compiler cannot generate SSE 4.1 code])
94
# AC_CHECK_HEADERS([smmintrin.h],[], [AC_MSG_ERROR([Missing SSE 4.1 header file smmintrin.h])])
96
AC_SUBST(SIMD_SSE4_1_CFLAGS)
98
AX_PTHREAD([AC_MSG_NOTICE([Posix thread found.])
99
AC_SUBST(PTHREAD_LIBS)
100
AC_SUBST(PTHREAD_CFLAGS) ],
101
AC_MSG_ERROR([Posix thread not found.]))
103
# get the fortran preprocessor option
104
AC_MSG_CHECKING([for $F77 option to accept preprocessor commands])
106
gfortran) AC_SUBST(FPP_OPTION,[-cpp])
107
AC_MSG_RESULT($FPP_OPTION);;
108
g77) AC_SUBST(FPP_OPTION,[-cpp])
109
AC_MSG_RESULT($FPP_OPTION);;
110
ifort) AC_SUBST(FPP_OPTION,[-fpp])
111
AC_MSG_RESULT($FPP_OPTION);;
112
*) AC_MSG_RESULT([unknown])
113
AC_MSG_NOTICE([You may encounter preprocessor statement warnings.])
115
#-------------------------------------------------------------------------------------------------------
116
# Checks for library functions.
117
#-------------------------------------------------------------------------------------------------------
120
if test $enable_mmap = "yes"; then
122
if test "$ac_cv_func_mmap_fixed_mmaped" = "no"; then
123
AC_MSG_NOTICE([The system does not support file memory mapping, option removed.])
125
AC_SUBST(USE_MMAP,[-D__USE_MMAP__])
129
#-------------------------------------------------------------------------------------------------------
130
# Check for the Linux functions for controlling processor affinity.
131
#-------------------------------------------------------------------------------------------------------
132
# LINUX: sched_setaffinity
134
# OSX (Leopard): thread_policy_set
135
if test $enable_thread_affinity = "yes"; then
136
AC_CHECK_FUNCS(sched_setaffinity sched_getaffinity bindprocessor thread_policy_set)
137
if test "$ac_cv_func_sched_setaffinity" = "yes" ; then
138
# Test for the cpu process set type
140
[whether cpu_set_t available],pac_cv_have_cpu_set_t,[
141
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sched.h>]], [[ cpu_set_t t; ]])],[pac_cv_have_cpu_set_t=yes],[pac_cv_have_cpu_set_t=no])])
142
if test "$pac_cv_have_cpu_set_t" = yes ; then
143
AC_DEFINE(HAVE_CPU_SET_T,1,[Define if cpu_set_t is defined in sched.h])
146
[whether the CPU_SET and CPU_ZERO macros are defined],
147
pac_cv_cpu_set_defined,
151
[[#define _GNU_SOURCE
152
#include <sched.h>]],
153
[[ cpu_set_t t; CPU_ZERO(&t); CPU_SET(1,&t); ]]
156
[pac_cv_cpu_set_defined=yes],
157
[pac_cv_cpu_set_defined=no]
161
if test "$pac_cv_cpu_set_defined" = "yes" ; then
162
AC_DEFINE(HAVE_CPU_SET_MACROS,1,[Define if CPU_SET and CPU_ZERO defined])
164
# Check for pthread_{,attr_}[sg]etaffinity_np.
167
ac_orig_CFLAGS="$CFLAGS"
168
LIBS="$ac_orig_LIBS $PTHREAD_LIBS"
169
CFLAGS="$ac_orig_CFLAGS $PTHREAD_CFLAGS"
170
AC_MSG_CHECKING([pthread_attr_setaffinity_np])
174
#include <pthread.h>],
177
pthread_getaffinity_np (pthread_self (), sizeof (cpu_set_t), &cpuset);
178
if (CPU_ISSET (0, &cpuset))
179
CPU_SET (1, &cpuset);
182
pthread_setaffinity_np (pthread_self (), sizeof (cpu_set_t), &cpuset);
183
pthread_attr_init (&attr);
184
pthread_attr_getaffinity_np (&attr, sizeof (cpu_set_t), &cpuset);
185
pthread_attr_setaffinity_np (&attr, sizeof (cpu_set_t), &cpuset);
188
[AC_DEFINE(HAVE_PTHREAD_AFFINITY_NP, 1,[ Define if pthread_{,attr_}{g,s}etaffinity_np is supported.])
189
AC_SUBST(USE_AFFINITY,[-D__USE_AFFINITY__]) AC_MSG_RESULT([yes])
192
AC_MSG_NOTICE([pthread_attr_setaffinity_np not available, affinity cannot be used.])
196
CFLAGS="$ac_orig_CFLAGS"
198
AC_MSG_NOTICE([CPU_SET and CPU_ZERO not available, affinity cannot be used.])
202
if test "$ac_cv_func_thread_policy_set" = yes ; then
203
AC_CACHE_CHECK([whether thread affinity macros defined],
204
pac_cv_have_thread_affinity_policy,[
205
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <mach/thread_policy.h>]], [[
206
#if !defined(THREAD_AFFINITY_POLICY) || !defined(THREAD_AFFINITY_TAG_NULL)
207
:'thread macros not defined
208
]])],[pac_cv_have_thread_affinity_policy=yes],[pac_cv_have_thread_affinity_policy=no])])
209
if test "$pac_cv_have_thread_affinity_policy" = yes ; then
210
AC_DEFINE(HAVE_OSX_THREAD_AFFINITY,1,[Define is the OSX thread affinity policy macros defined])
217
AC_CHECK_FUNCS([gettimeofday memset munmap strtol memcpy fseek ftell],[],[AC_MSG_ERROR([Missing function.])])
220
AC_CONFIG_FILES([Makefile src/Fortran/Makefile src/C/Makefile])