~ubuntu-branches/debian/sid/pftools/sid

« back to all changes in this revision

Viewing changes to configure.ac

  • Committer: Package Import Robot
  • Author(s): Andreas Tille
  • Date: 2017-03-31 14:01:39 UTC
  • Revision ID: package-import@ubuntu.com-20170331140139-povxg86r196gejfa
Tags: upstream-3+dfsg
ImportĀ upstreamĀ versionĀ 3+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#                                               -*- Autoconf -*-
 
2
# Process this file with autoconf to produce a configure script.
 
3
AC_PREREQ([2.68])
 
4
AC_INIT([PfTools],[3.0],[thierry.schuepbach@isb-sib.ch],[pftools])
 
5
AC_LANG([C])
 
6
AC_MSG_NOTICE([Configuring PfTools for your system.])
 
7
AC_CANONICAL_TARGET
 
8
 
 
9
AC_CONFIG_HEADERS([src/C/include/config.h])
 
10
 
 
11
AM_INIT_AUTOMAKE
 
12
 
 
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/"
 
18
 
 
19
#-------------------------------------------------------------------------------------------------------
 
20
# Checks for programs.
 
21
#-------------------------------------------------------------------------------------------------------
 
22
AC_PROG_F77
 
23
AC_PROG_CC
 
24
AM_PROG_CC_C_O
 
25
AC_PROG_INSTALL
 
26
AX_COMPILER_VENDOR
 
27
 
 
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.])
 
33
fi
 
34
 
 
35
#-------------------------------------------------------------------------------------------------------
 
36
# Add features.
 
37
#-------------------------------------------------------------------------------------------------------
 
38
AC_ARG_ENABLE(mmap,
 
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)
 
45
 
 
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])
 
53
fi
 
54
AC_CHECK_LIB([m], [expf])
 
55
 
 
56
#-------------------------------------------------------------------------------------------------------
 
57
# Checks for header files.
 
58
#-------------------------------------------------------------------------------------------------------
 
59
AC_FUNC_ALLOCA
 
60
AC_CHECK_HEADERS([fcntl.h limits.h stdlib.h string.h sys/time.h unistd.h inttypes.h mm_malloc.h])
 
61
 
 
62
#-------------------------------------------------------------------------------------------------------
 
63
# Checks for typedefs, structures, and compiler characteristics.
 
64
#-------------------------------------------------------------------------------------------------------
 
65
AC_HEADER_STDBOOL
 
66
AC_PROG_CC_C99
 
67
if test "$ac_cv_prog_cc_c99" = "no"; then
 
68
  AC_MSG_ERROR([PfTools $PACKAGE_VERSION require a C compiler supporting C99 mode.])
 
69
fi
 
70
AC_C_INLINE
 
71
AC_C_VOLATILE
 
72
AC_C_CONST
 
73
AC_C_RESTRICT
 
74
 
 
75
AC_TYPE_OFF_T
 
76
AC_TYPE_SIZE_T
 
77
AC_TYPE_UID_T
 
78
#AC_SYS_LARGEFILE
 
79
 
 
80
#AC_HEADER_TIME
 
81
 
 
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])
 
85
#else
 
86
#  AC_CHECK_HEADERS([emmintrin.h],[], [AC_MSG_ERROR([Missing SSE 2 header file emmintrin.h])])
 
87
fi
 
88
AC_SUBST(SIMD_SSE2_CFLAGS)
 
89
 
 
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])
 
93
#else
 
94
#  AC_CHECK_HEADERS([smmintrin.h],[], [AC_MSG_ERROR([Missing SSE 4.1 header file smmintrin.h])])
 
95
fi
 
96
AC_SUBST(SIMD_SSE4_1_CFLAGS)
 
97
 
 
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.]))
 
102
 
 
103
# get the fortran preprocessor option
 
104
AC_MSG_CHECKING([for $F77 option to accept preprocessor commands])
 
105
case $F77 in
 
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.])
 
114
esac
 
115
#-------------------------------------------------------------------------------------------------------
 
116
# Checks for library functions.
 
117
#-------------------------------------------------------------------------------------------------------
 
118
AC_FUNC_MALLOC
 
119
 
 
120
if test $enable_mmap = "yes"; then 
 
121
  AC_FUNC_MMAP
 
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.])
 
124
  else
 
125
      AC_SUBST(USE_MMAP,[-D__USE_MMAP__])
 
126
  fi
 
127
fi
 
128
 
 
129
#-------------------------------------------------------------------------------------------------------
 
130
# Check for the Linux functions for controlling processor affinity.
 
131
#------------------------------------------------------------------------------------------------------- 
 
132
# LINUX: sched_setaffinity
 
133
# AIX:   bindprocessor
 
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
 
139
      AC_CACHE_CHECK(
 
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])
 
144
 
 
145
          AC_CACHE_CHECK(
 
146
            [whether the CPU_SET and CPU_ZERO macros are defined],
 
147
            pac_cv_cpu_set_defined,
 
148
            [
 
149
              AC_LINK_IFELSE(
 
150
                [AC_LANG_PROGRAM(
 
151
                  [[#define _GNU_SOURCE
 
152
                  #include <sched.h>]],
 
153
                [[ cpu_set_t t; CPU_ZERO(&t); CPU_SET(1,&t); ]]
 
154
                )
 
155
                ],
 
156
              [pac_cv_cpu_set_defined=yes],
 
157
              [pac_cv_cpu_set_defined=no]
 
158
              )
 
159
            ]
 
160
          )
 
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])
 
163
              #
 
164
              # Check for pthread_{,attr_}[sg]etaffinity_np.
 
165
              #
 
166
              ac_orig_LIBS="$LIBS"
 
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])
 
171
              AC_LINK_IFELSE(
 
172
                [AC_LANG_PROGRAM(
 
173
                  [#define _GNU_SOURCE
 
174
                   #include <pthread.h>],
 
175
                  [cpu_set_t cpuset;
 
176
                   pthread_attr_t attr;
 
177
                   pthread_getaffinity_np (pthread_self (), sizeof (cpu_set_t), &cpuset);
 
178
                   if (CPU_ISSET (0, &cpuset))
 
179
                      CPU_SET (1, &cpuset);
 
180
                   else
 
181
                      CPU_ZERO (&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);
 
186
                  ])
 
187
                ],
 
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])
 
190
                ],
 
191
                [AC_MSG_RESULT([no])
 
192
                 AC_MSG_NOTICE([pthread_attr_setaffinity_np not available, affinity cannot be used.])
 
193
                ]
 
194
              )
 
195
              LIBS="$ac_orig_LIBS"
 
196
              CFLAGS="$ac_orig_CFLAGS"
 
197
          else 
 
198
              AC_MSG_NOTICE([CPU_SET and CPU_ZERO not available, affinity cannot be used.])
 
199
          fi
 
200
      fi
 
201
  fi
 
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])
 
211
      fi
 
212
  fi
 
213
  
 
214
  
 
215
fi
 
216
 
 
217
AC_CHECK_FUNCS([gettimeofday memset munmap strtol memcpy fseek ftell],[],[AC_MSG_ERROR([Missing function.])])
 
218
 
 
219
 
 
220
AC_CONFIG_FILES([Makefile src/Fortran/Makefile src/C/Makefile])
 
221
AC_OUTPUT