public software.scamp

[/] [trunk/] [configure.ac] - Blame information for rev 334

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 247 bertin
#
2
#                               configure.ac
3
#
4 248 bertin
# Process this file with autoconf to generate a configure script.
5
#
6 247 bertin
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7
#
8
#       This file part of:      SCAMP
9
#
10 331 bertin
#       Copyright:              (C) 2002-2015 IAP/CNRS/UPMC
11 247 bertin
#
12 249 bertin
#       License:                GNU General Public License
13
#
14 247 bertin
#       SCAMP is free software: you can redistribute it and/or modify
15
#       it under the terms of the GNU General Public License as published by
16
#       the Free Software Foundation, either version 3 of the License, or
17
#       (at your option) any later version.
18
#       SCAMP is distributed in the hope that it will be useful,
19
#       but WITHOUT ANY WARRANTY; without even the implied warranty of
20
#       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
#       GNU General Public License for more details.
22
#       You should have received a copy of the GNU General Public License
23
#       along with SCAMP.  If not, see .
24
#
25 334 bertin
#       Last modified:          29/06/2015
26 247 bertin
#
27
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
28
 
29 2 bertin
# First, disable the annoying config.cache
30
define([AC_CACHE_LOAD],)
31
define([AC_CACHE_SAVE],)
32
 
33
# This is your standard Bertin source code...
34 334 bertin
AC_INIT([scamp],[2.2.1],[bertin@iap.fr])
35 331 bertin
AC_CONFIG_MACRO_DIR([m4])
36 2 bertin
AC_CONFIG_SRCDIR(src/makeit.c)
37
AC_CONFIG_AUX_DIR(autoconf)
38 11 bertin
AC_CONFIG_HEADERS(config.h)
39 2 bertin
AM_INIT_AUTOMAKE
40
date=`date +%Y-%m-%d`
41
date2=`date +"%a %b %d %Y"`
42
date3=`date +"%B %Y"`
43
AC_DEFINE_UNQUOTED(DATE, "$date", [Archive creation date])
44
AC_SUBST(PACKAGER, "Emmanuel Bertin")
45
AC_SUBST(DATE2, "$date2")
46
AC_SUBST(DATE3, "$date3")
47
 
48
# Include macros
49 10 bertin
sinclude(acx_atlas.m4)
50 331 bertin
sinclude(acx_curl.m4)
51 10 bertin
sinclude(acx_fftw.m4)
52 294 bertin
sinclude(acx_mkl.m4)
53 10 bertin
sinclude(acx_plplot.m4)
54
sinclude(acx_prog_cc_optim.m4)
55
sinclude(acx_pthread.m4)
56 133 bertin
sinclude(acx_urbi_resolve_dir.m4)
57 2 bertin
 
58
# Display pakage and version number
59
AC_MSG_RESULT([******** Configuring:  $PACKAGE_NAME $VERSION ($date) ********])
60
 
61 268 bertin
AC_MSG_CHECKING([if compilation flags should be set automatically])
62 216 bertin
AC_ARG_ENABLE(auto-flags,
63 268 bertin
        [AS_HELP_STRING([--enable-auto-flags],
64 216 bertin
        [Let the configure script choose the compilation flags \
65 295 bertin
(off by default)])])
66 216 bertin
 
67 2 bertin
# Provide special option for the Linux Intel C compiler
68 268 bertin
AC_MSG_CHECKING([whether we should use the INTEL compiler])
69 2 bertin
AC_ARG_ENABLE(icc,
70 268 bertin
        [AS_HELP_STRING([--enable-icc],
71
        [Use the Intel compiler (off by default)])],
72
        CC="icc"
73 2 bertin
        AC_MSG_RESULT([yes]),
74
        AC_MSG_RESULT([no]))
75
 
76 268 bertin
# Provide special options for INTEL MKL
77
# We force the use of icc
78
AC_MSG_CHECKING([whether we should use INTEL's MKL])
79
AC_ARG_ENABLE(mkl,
80
        [AS_HELP_STRING([--enable-mkl],
81
        [Use INTEL's MKL for solvers and FFTs (off by default)])],
82 295 bertin
        enable_icc="yes"
83 268 bertin
        CC="icc"
84
        AC_MSG_RESULT([yes]),
85
        AC_MSG_RESULT([no]))
86
 
87 2 bertin
# Checks for programs.
88
AC_LANG(C)
89 268 bertin
 
90
AC_SEARCH_LIBS([strerror],[cposix])
91 295 bertin
if test "$enable_auto_flags" = "yes"; then
92 216 bertin
  CFLAGS=""
93 273 bertin
  LDFLAGS=""
94 216 bertin
  ACX_PROG_CC_OPTIM
95
fi
96 268 bertin
LT_INIT
97 2 bertin
AC_PROG_INSTALL
98
 
99
# Checks for libraries.
100
AC_CHECK_LIB(m, sin)
101
 
102
# Checks for header files.
103
AC_HEADER_STDC
104 295 bertin
AC_CHECK_HEADERS([dlfcn.h stdlib.h string.h sys/mman.h unistd.h])
105
if test "$enable_icc" = "yes"; then
106 218 bertin
  AC_CHECK_HEADERS(mathimf.h)
107
fi
108 216 bertin
 
109 2 bertin
# Checks for typedefs, structures, and compiler characteristics.
110
AC_C_CONST
111
AC_TYPE_OFF_T
112
AC_TYPE_SIZE_T
113 229 bertin
AC_TYPE_LONG_LONG_INT
114
AC_TYPE_UNSIGNED_LONG_LONG_INT
115 2 bertin
AC_STRUCT_TM
116
AC_TYPE_UID_T
117
 
118
# Checks for library functions.
119
AC_FUNC_ERROR_AT_LINE
120
AC_FUNC_MMAP
121
AC_FUNC_STAT
122
AC_FUNC_STRFTIME
123 293 bertin
AC_CHECK_FUNCS([atexit getenv mallopt memcpy memmove memset mkdir munmap \
124 295 bertin
        setlinebuf strstr sysconf])
125 168 bertin
AC_CHECK_FUNC([isnan], AC_DEFINE_UNQUOTED([HAVE_ISNAN2], 1,
126
                [Second isnan check]))
127 2 bertin
 
128 183 bertin
# Check support for large files
129
AC_SYS_LARGEFILE
130
AC_FUNC_FSEEKO
131
 
132 331 bertin
# Provide special options for the MKL library
133
AC_ARG_WITH(mkl-dir,
134
        [AS_HELP_STRING([--with-mkl-dir=],
135
        [Provide an alternative path to the MKL library])])
136 2 bertin
 
137 161 bertin
# Provide special options for ATLAS
138 268 bertin
AC_ARG_WITH(atlas-libdir,
139
        [AS_HELP_STRING([--with-atlas-libdir=],
140 295 bertin
        [Alternative directory for the ATLAS library])])
141 161 bertin
AC_ARG_WITH(atlas-incdir,
142 268 bertin
        [AS_HELP_STRING([--with-atlas-incdir=],
143 295 bertin
        [Alternative directory for ATLAS include files])])
144 84 bertin
 
145 161 bertin
# Provide special options for FFTW
146 268 bertin
AC_ARG_WITH(fftw-libdir,
147
        [AS_HELP_STRING([--with-fftw-libdir=],
148 295 bertin
        [Alternative directory for the FFTW library])])
149 161 bertin
AC_ARG_WITH(fftw-incdir,
150 268 bertin
        [AS_HELP_STRING([--with-fftw-incdir=],
151 295 bertin
        [Alternative directory for FFTW include files])])
152 161 bertin
 
153 331 bertin
# Provide special options for cURL
154
AC_ARG_WITH(curl-libdir,
155
        [AS_HELP_STRING([--with-curl-libdir=],
156
        [Alternative directory for the cURL library])])
157
AC_ARG_WITH(curl-incdir,
158
        [AS_HELP_STRING([--with-atlas-incdir=],
159
        [Alternative directory for cURL include files])])
160 309 bertin
 
161 331 bertin
# Provide special options for PLPlot
162
AC_MSG_CHECKING([whether we should use PLPlot])
163
AC_ARG_ENABLE(plplot,
164
        [AS_HELP_STRING([--enable-plplot],
165
        [Activate PLPlot library (default = yes)])],
166
        AC_MSG_RESULT([yes]),
167
        AC_MSG_RESULT([no]))
168
AC_ARG_WITH(plplot-libdir,
169
        [AS_HELP_STRING([--with-plplot-libdir=],
170
        [Provide an alternative path to the PLPlot library])])
171
AC_ARG_WITH(plplot-incdir,
172
        [AS_HELP_STRING([--with-plplot-incdir=],
173
        [Provide an alternative path to the PLPlot include directory])])
174 117 bertin
 
175 127 bertin
# Provide a special option for the default XSLT URL
176 295 bertin
with_xsl_url="file://"$(URBI_RESOLVE_DIR([$datadir]))"/$PACKAGE_NAME/$PACKAGE_NAME.xsl"
177 127 bertin
AC_ARG_WITH(xsl_url,
178 268 bertin
        [AS_HELP_STRING([--with-xsl_url=],
179 295 bertin
        [Provide an alternative default URL of the XSLT filter])])
180 127 bertin
 
181 295 bertin
AC_DEFINE_UNQUOTED([XSL_URL], "$with_xsl_url",[Default URL of the XSLT filter])
182 127 bertin
 
183
# Set flags for multithreading
184 283 bertin
n_pthreads=1024
185 127 bertin
AC_ARG_ENABLE(threads,
186 268 bertin
        [AS_HELP_STRING([--enable-threads@<:@=@:>@],
187 283 bertin
        [Enable multhreading (on with up to 1024 threads by default)])],
188 181 bertin
    if test "$enableval" = "no"; then
189
      use_pthreads="no"
190 127 bertin
    else
191 181 bertin
      use_pthreads="yes"
192
      if test "$enableval" != "yes"; then
193
        n_pthreads=$enableval
194
      fi
195
    fi,
196
    use_pthreads=yes
197 127 bertin
    )
198
 
199 2 bertin
# Provide special option for profiling
200 268 bertin
AC_MSG_CHECKING([for profiler mode])
201
AC_ARG_ENABLE(profiling,
202
        [AS_HELP_STRING([--enable-profiling],
203 295 bertin
        [Enable special mode for profiling (off by default)])]
204 2 bertin
        AC_MSG_RESULT([yes]),
205
        AC_MSG_RESULT([no]))
206
 
207 216 bertin
# Enable linking options for making the executable as portable as possible.
208
AC_MSG_CHECKING([best linking option])
209
AC_ARG_ENABLE(best-link,
210 268 bertin
        [AS_HELP_STRING([--enable-best-link],
211 216 bertin
        [Choose the right combination of static and dynamic linking to make \
212 295 bertin
the executable as portable as possible (off by default)])])
213 2 bertin
 
214
################# Actions to complete in case of multhreading ################
215
AC_DEFINE_UNQUOTED(THREADS_NMAX, $n_pthreads,[Maximum number of POSIX threads])
216
if test "$use_pthreads" = "yes"; then
217
  AC_MSG_CHECKING([for multithreading])
218
  AC_MSG_RESULT([maximum of $n_pthreads thread(s)])
219
  AC_DEFINE(USE_THREADS, 1, [Triggers multhreading])
220
# CC, CFLAGS and LIBS are system and compiler-dependent
221
  ACX_PTHREAD
222
  CC="$PTHREAD_CC"
223 216 bertin
  [AM_CFLAGS="$AM_CFLAGS $PTHREAD_CFLAGS -D_REENTRANT"]
224 308 bertin
  LIBS="$LIBS $PTHREAD_LIBS"
225 2 bertin
fi
226
AM_CONDITIONAL(USE_THREADS, test $use_pthreads = "yes")
227
 
228 294 bertin
############ handle the INTEL MKL library (FFTW + LAPACKe) ###########
229 295 bertin
if test "$enable_mkl" = "yes"; then
230 308 bertin
  convlibs="${srcdir}/wcs/libwcs_c.a"
231 309 bertin
  ACX_MKL($with_mkl_dir,yes,$enable_best_link,$convlibs)
232 294 bertin
  if test "$MKL_WARN" != ""; then
233 308 bertin
    AC_MSG_WARN([$MKL_WARN])
234 268 bertin
  fi
235 294 bertin
  AM_CFLAGS="$AM_CFLAGS $MKL_CFLAGS "
236 308 bertin
  AM_LDFLAGS="$AM_LDFLAGS $MKL_LDFLAGS "
237
  LIBS="$LIBS $MKL_LIBS"
238 268 bertin
else
239 163 bertin
################ handle the FFTW library (Fourier transforms) ################
240 295 bertin
  ACX_FFTW($with_fftw_libdir,$with_fftw_incdir,$use_pthreads,yes,
241
        [LIBS="$FFTW_LIBS $LIBS"]
242
        if test "$FFTW_WARN" != ""; then
243
          AC_MSG_WARN([$FFTW_WARN])
244
        fi,
245
        AC_MSG_ERROR([$FFTW_ERROR Exiting.]))
246
################# handle the ATLAS library (linear algebra) ##################
247
  ACX_ATLAS($with_atlas_libdir,$with_atlas_incdir,$use_pthreads,
248
        [LIBS="$ATLAS_LIBS $LIBS"]
249
        if test "$ATLAS_WARN" != ""; then
250
          AC_MSG_WARN([$ATLAS_WARN])
251
        fi,
252
        AC_MSG_ERROR([$ATLAS_ERROR Exiting.]))
253 308 bertin
fi
254
 
255
################# handle the PLPlot library (graphic plots) ##################
256 311 bertin
if test "$enable_plplot" != "no"; then
257 308 bertin
  ACX_PLPLOT($with_plplot_libdir,$with_plplot_incdir,
258
    [use_plplot="yes"]
259
    [AM_CPPFLAGS="$AM_CPPFLAGS $PLPLOT_CFLAGS"]
260
    [LIBS="$LIBS $PLPLOT_LIBS"],
261
    [use_plplot="no"]
262
    AC_MSG_WARN([PLPlot library not found/incomplete! Plotting deactivated.]))
263
else
264
  AC_MSG_WARN([Plotting deactivated by user.])
265 2 bertin
fi
266 308 bertin
AM_CONDITIONAL(USE_PLPLOT, test "$use_plplot" = "yes")
267 2 bertin
 
268 331 bertin
################# handle the ATLAS library (linear algebra) ##################
269
ACX_CURL($with_curl_libdir,$with_curl_incdir,
270
        [LIBS="$CURL_LIBS $LIBS"]
271
        if test "$CURL_WARN" != ""; then
272
          AC_MSG_WARN([$CURL_WARN])
273 295 bertin
        fi,
274 331 bertin
        AC_MSG_ERROR([$CURL_ERROR Exiting.]))
275 2 bertin
 
276 296 bertin
# Compile with profiling option
277
if test "$enable_profiling" = "yes"; then
278 295 bertin
  if test "$enable_icc" = "yes"; then
279 216 bertin
    AM_CFLAGS="$AM_CFLAGS -pq"
280 184 bertin
  else
281 216 bertin
    AM_CFLAGS="$AM_CFLAGS -pg"
282 184 bertin
  fi
283 295 bertin
  enable_best_link="no"
284 2 bertin
fi
285
 
286 216 bertin
# "Best" linking option
287 295 bertin
if test "$enable_best_link" = "yes"; then
288
  if test "$enable_icc" = "yes"; then
289 294 bertin
    AM_LDFLAGS="-static-intel -openmp-link static -shared-libgcc \
290 308 bertin
        -static-libtool-libs -no-intel-extensions -avoid-version $AM_LDFLAGS"
291 294 bertin
  else
292
    AM_LDFLAGS="-shared-libgcc -static-libtool-libs -avoid-version $AM_LDFLAGS"
293
  fi
294 2 bertin
fi
295
 
296 216 bertin
AC_SUBST(AM_CFLAGS)
297
AC_SUBST(AM_CPPFLAGS)
298
AC_SUBST(AM_LDFLAGS)
299
 
300 2 bertin
# Display compiler and linker flags
301 127 bertin
AC_MSG_RESULT([***************************************************************])
302 216 bertin
AC_MSG_RESULT([Compile cmdline:  $CC $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS])
303
AC_MSG_RESULT([Link    cmdline:  $CC $AM_LDFLAGS $LDFLAGS $LIBS])
304 127 bertin
AC_MSG_RESULT([Default XSLT URL: $xsl_url])
305
AC_MSG_RESULT([***************************************************************])
306 216 bertin
 
307 127 bertin
AC_CONFIG_FILES([
308
Makefile
309
man/Makefile
310
src/Makefile
311
src/fits/Makefile
312
src/wcs/Makefile
313
scamp.spec
314
man/scamp.1])
315 2 bertin
AC_OUTPUT