configure.ac 11 KB
Newer Older
1
2
3
4
5
6
7
8
9
#
#				configure.ac
#
# Process this file with autoconf to generate a configure script.
#
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#
#	This file part of:	SExtractor
#
10
#	Copyright:		(C) 2002-2018 IAP/CNRS/SorbonneU
11
#
Emmanuel Bertin's avatar
Emmanuel Bertin committed
12
#	License:		GNU General Public License
13
14
15
16
17
18
19
20
21
22
23
24
#
#	SExtractor is free software: you can redistribute it and/or modify
#	it under the terms of the GNU General Public License as published by
#	the Free Software Foundation, either version 3 of the License, or
# 	(at your option) any later version.
#	SExtractor is distributed in the hope that it will be useful,
#	but WITHOUT ANY WARRANTY; without even the implied warranty of
#	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#	GNU General Public License for more details.
#	You should have received a copy of the GNU General Public License
#	along with SExtractor. If not, see <http://www.gnu.org/licenses/>.
#
25
#	Last modified:		24/08/2018
26
27
28
#
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Emmanuel Bertin's avatar
Emmanuel Bertin committed
29
30
31
32
# First, disable the annoying config.cache
define([AC_CACHE_LOAD],)
define([AC_CACHE_SAVE],)

33
34
# This is your standard AstrOmatic source code...
AC_INIT(SExtractor, 2.25.1,[astromatic@astromatic.net],
35
36
	sextractor, [http://astromatic.net/software/sextractor])
AC_CONFIG_MACRO_DIR([m4])
Emmanuel Bertin's avatar
Emmanuel Bertin committed
37
AC_CONFIG_AUX_DIR(autoconf)
38
AC_CONFIG_SRCDIR(src/makeit.c)
39
AC_CONFIG_HEADERS(config.h)
Emmanuel Bertin's avatar
Emmanuel Bertin committed
40
41
AM_INIT_AUTOMAKE
date=`date +%Y-%m-%d`
42
date1=`date -R`
Emmanuel Bertin's avatar
Emmanuel Bertin committed
43
44
45
date2=`date +"%a %b %d %Y"`
date3=`date +"%B %Y"`
AC_DEFINE_UNQUOTED(DATE, "$date", [Archive creation date])
46
47
AC_SUBST(PACKAGER, "AstrOmatic")
AC_SUBST(DATE1, "$date1")
Emmanuel Bertin's avatar
Emmanuel Bertin committed
48
49
50
51
AC_SUBST(DATE2, "$date2")
AC_SUBST(DATE3, "$date3")

# Include macros
Emmanuel Bertin's avatar
Emmanuel Bertin committed
52
sinclude(acx_atlas.m4)
53
sinclude(acx_openblas.m4)
Emmanuel Bertin's avatar
Emmanuel Bertin committed
54
sinclude(acx_fftw.m4)
55
sinclude(acx_mkl.m4)
Emmanuel Bertin's avatar
Emmanuel Bertin committed
56
sinclude(acx_prog_cc_optim.m4)
Emmanuel Bertin's avatar
Emmanuel Bertin committed
57
58
sinclude(acx_pthread.m4)
sinclude(acx_urbi_resolve_dir.m4)
Emmanuel Bertin's avatar
Emmanuel Bertin committed
59

60
61
62
63
64
65
66
67
68
69
70
# Provide a special option for setting the package release number
AC_ARG_WITH(release,
	[AS_HELP_STRING([--with-release=<release number>],
	[set the package release number (default = 1)])],
	[],
	[with_release="no"])
if test "$with_release" = "no"; then
  with_release=1
fi
AC_SUBST(PACKAGE_RELEASE, "$with_release")

Emmanuel Bertin's avatar
Emmanuel Bertin committed
71
# Display pakage and version number
72
AC_MSG_RESULT([******** Configuring:  $PACKAGE_NAME $PACKAGE_VERSION - $PACKAGE_RELEASE ($date) ********])
Emmanuel Bertin's avatar
Emmanuel Bertin committed
73

74
# Provide special option for choosing automatically the compilation flags.
75
AC_MSG_CHECKING([if compilation flags are set automatically])
76
AC_ARG_ENABLE(auto-flags,
77
	[AS_HELP_STRING([--enable-auto-flags],
78
	[Let the configure script choose the compilation flags (default = no)])],
79
80
	AC_MSG_RESULT([yes]),
	AC_MSG_RESULT([no]))
Emmanuel Bertin's avatar
Emmanuel Bertin committed
81
82

# Provide special option for the Linux Intel C compiler
83
AC_MSG_CHECKING([whether the INTEL compiler is enabled])
Emmanuel Bertin's avatar
Emmanuel Bertin committed
84
AC_ARG_ENABLE(icc,
85
	[AS_HELP_STRING([--enable-icc],
86
	[Use the Intel compiler (default = no)])],
87
88
89
90
91
92
        CC="icc"
	AC_MSG_RESULT([yes]),
	AC_MSG_RESULT([no]))

# Provide special options for INTEL MKL
# We force the use of icc
93
AC_MSG_CHECKING([whether INTEL's MKL is enabled])
94
95
AC_ARG_ENABLE(mkl,
	[AS_HELP_STRING([--enable-mkl],
96
	[Use INTEL's MKL for solvers and FFTs (default = no)])],
97
98
        enable_icc="yes"
        CC="icc"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
99
100
101
102
	AC_MSG_RESULT([yes]),
	AC_MSG_RESULT([no]))

# Checks for programs.
Emmanuel Bertin's avatar
Emmanuel Bertin committed
103
AC_LANG(C)
104
105

AC_SEARCH_LIBS([strerror],[cposix])
106
if test "$enable_auto_flags" = "yes"; then
107
  CFLAGS=""
108
  LDFLAGS=""
109
110
  ACX_PROG_CC_OPTIM
fi
111
LT_INIT
Emmanuel Bertin's avatar
Emmanuel Bertin committed
112
113
114
115
116
117
118
AC_PROG_INSTALL

# Checks for libraries.
AC_CHECK_LIB(m, sin)

# Checks for header files.
AC_HEADER_STDC
Emmanuel Bertin's avatar
Emmanuel Bertin committed
119
120
AC_CHECK_HEADERS([fcntl.h limits.h malloc.h stdlib.h string.h sys/mman.h \
		sys/types.h unistd.h])
121
# Checks for INTEL math header files.
122
if test "$enable_icc" = "yes"; then
123
124
  AC_CHECK_HEADERS(mathimf.h)
fi
Emmanuel Bertin's avatar
Emmanuel Bertin committed
125
126
127
128
129

# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
130
131
AC_TYPE_LONG_LONG_INT
AC_TYPE_UNSIGNED_LONG_LONG_INT
Emmanuel Bertin's avatar
Emmanuel Bertin committed
132
133
134
135
136
137
138
139
140
AC_STRUCT_TM
AC_TYPE_UID_T

# Checks for library functions.
AC_FUNC_ERROR_AT_LINE
AC_FUNC_MMAP
AC_TYPE_SIGNAL
AC_FUNC_STAT
AC_FUNC_STRFTIME
141
142
AC_CHECK_FUNCS([atexit getenv gettimeofday isinf isnan logf memcpy memmove \
	memset mkdir munmap posix_memalign setlinebuf sincosf strstr sysconf])
Emmanuel Bertin's avatar
Emmanuel Bertin committed
143
144
145
146
147

# Check support for large files
AC_SYS_LARGEFILE
AC_FUNC_FSEEKO

Emmanuel Bertin's avatar
Emmanuel Bertin committed
148
# Provide special options for ATLAS
149
AC_ARG_WITH(atlas-libdir,
150
151
	[AS_HELP_STRING([--with-atlas-libdir=<ATLAS library path>],
	[Provide an alternative path to the ATLAS library])])
Emmanuel Bertin's avatar
Emmanuel Bertin committed
152
AC_ARG_WITH(atlas-incdir,
153
154
	[AS_HELP_STRING([--with-atlas-incdir=<ATLAS include dir>],
	[Provide an alternative path to the ATLAS include directory])])
Emmanuel Bertin's avatar
Emmanuel Bertin committed
155
156

# Provide special options for FFTW
157
AC_ARG_WITH(fftw-libdir,
158
159
	[AS_HELP_STRING([--with-fftw-libdir=<FFTW library path>],
	[Provide an alternative path to the FFTW library])])
Emmanuel Bertin's avatar
Emmanuel Bertin committed
160
AC_ARG_WITH(fftw-incdir,
161
162
	[AS_HELP_STRING([--with-fftw-incdir=<FFTW include dir>],
	[Provide an alternative path to the FFTW include directory])])
Emmanuel Bertin's avatar
Emmanuel Bertin committed
163

164
165
# Provide special options for the MKL library
AC_ARG_WITH(mkl-dir,
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
	[AS_HELP_STRING([--with-mkl-dir=<MKL path>],
	[Provide an alternative path to the MKL library])])

# Provide special options for OpenBLAS
AC_MSG_CHECKING([whether OpenBLAS is enabled])
AC_ARG_ENABLE(openblas,
	[AS_HELP_STRING([--enable-openblas],
	[Use the OpenBLAS library instead of ATLAS (default = no)])],
	AC_MSG_RESULT([yes]),
	AC_MSG_RESULT([no]))
AC_ARG_WITH(openblas-libdir,
	[AS_HELP_STRING([--with-openblas-libdir=<OpenBLAS library path>],
	[Provide an alternative path to the OpenBLAS library])])
AC_ARG_WITH(openblas-incdir,
	[AS_HELP_STRING([--with-openblas-incdir=<OpenBLAS header dir>],
	[Provide an alternative path to the OpenBLAS header directory])])
182

Emmanuel Bertin's avatar
Emmanuel Bertin committed
183
# Provide a special option for the default XSLT URL
184
with_xsl_url="file://"$(URBI_RESOLVE_DIR([$datadir]))"/$PACKAGE_TARNAME/$PACKAGE_TARNAME.xsl"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
185
AC_ARG_WITH(xsl_url,
186
	[AS_HELP_STRING([--with-xsl_url=<default URL for XSLT filter>],
187
	[Provide an alternative default URL of the XSLT filter])])
Emmanuel Bertin's avatar
Emmanuel Bertin committed
188

189
AC_DEFINE_UNQUOTED([XSL_URL], "$with_xsl_url",[Default URL of the XSLT filter])
Emmanuel Bertin's avatar
Emmanuel Bertin committed
190

191
# Provide special option to disable model-fitting (enabled by default)
192
AC_MSG_CHECKING([if model-fitting should be disabled (default=enabled)])
193
AC_ARG_ENABLE([model-fitting],
194
195
	[AS_HELP_STRING([--disable-model-fitting],
	[Disable model-fitting and library dependencies])],
196
	if test "$enable_model_fitting" = "no"; then
197
198
199
200
	  AC_MSG_RESULT([yes])
	else
	  AC_MSG_RESULT([no])
	fi,
201
	AC_MSG_RESULT([no]))
202

Emmanuel Bertin's avatar
Emmanuel Bertin committed
203
# Set flags for multithreading
204
n_pthreads=1024
Emmanuel Bertin's avatar
Emmanuel Bertin committed
205
AC_ARG_ENABLE(threads,
206
207
208
	[AS_HELP_STRING([--enable-threads@<:@=<max_number_of_threads>@:>@],
	[Enable multhreading (on with up to 1024 threads by default)])],
    if test "$enableval" = "no"; then
Emmanuel Bertin's avatar
Emmanuel Bertin committed
209
210
211
      use_pthreads="no"
    else
      use_pthreads="yes"
212
      if test "$enableval" != "yes"; then
Emmanuel Bertin's avatar
Emmanuel Bertin committed
213
214
215
216
217
        n_pthreads=$enableval
      fi
    fi,
    use_pthreads=yes
    )
218
219
# Deactivate multithreading for now
use_pthreads="no"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
220

221
222
223
224
# Provide special option for profiling
AC_MSG_CHECKING([for profiler mode])
AC_ARG_ENABLE(profiling,
	[AS_HELP_STRING([--enable-profiling],
225
	[Enable special mode for profiling (default = no)])]
Emmanuel Bertin's avatar
Emmanuel Bertin committed
226
227
228
	AC_MSG_RESULT([yes]),
	AC_MSG_RESULT([no]))

229
230
231
# Enable linking options for making the executable as portable as possible.
AC_MSG_CHECKING([best linking option])
AC_ARG_ENABLE(best-link,
232
	[AS_HELP_STRING([--enable-best-link],
233
	[Choose the right combination of static and dynamic linking to make \
234
the executable as portable as possible (default = no)])],
Emmanuel Bertin's avatar
Emmanuel Bertin committed
235
236
	AC_MSG_RESULT([yes]),
	AC_MSG_RESULT([no]))
Emmanuel Bertin's avatar
Emmanuel Bertin committed
237

Emmanuel Bertin's avatar
Emmanuel Bertin committed
238
239
################# Actions to complete in case of multhreading ################
AC_DEFINE_UNQUOTED(THREADS_NMAX, $n_pthreads,[Maximum number of POSIX threads])
240
if test "$use_pthreads" = "yes"; then
Emmanuel Bertin's avatar
Emmanuel Bertin committed
241
242
243
244
245
246
  AC_MSG_CHECKING([for multithreading])
  AC_MSG_RESULT([maximum of $n_pthreads thread(s)])
  AC_DEFINE(USE_THREADS, 1, [Triggers multhreading])
# CC, CFLAGS and LIBS are system and compiler-dependent
  ACX_PTHREAD
  CC="$PTHREAD_CC"
247
  [AM_CFLAGS="$AM_CFLAGS $PTHREAD_CFLAGS -D_REENTRANT"]
248
  LIBS="$LIBS $PTHREAD_LIBS"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
249
fi
250
251
AM_CONDITIONAL(USE_THREADS, test $use_pthreads = "yes")

252
253
254
############# Actions to complete if model-fitting is activated ##############
if test "$enable_model_fitting" != "no"; then
  AC_DEFINE(USE_MODEL, 1, [Triggers model-fitting])
255
############ handle the INTEL MKL library (FFTW + LAPACKe) ###########
256
257
  if test "$enable_mkl" = "yes"; then
    convlibs="${srcdir}/wcs/libwcs_c.a,${srcdir}/levmar/liblevmar.a"
258
    ACX_MKL($with_mkl_dir,,$enable_best_link,$convlibs)
259
260
261
262
263
264
265
266
267
    if test "$MKL_WARN" == ""; then
      AC_MSG_RESULT([yes])
    else
      AC_MSG_RESULT([no])
      AC_MSG_WARN([$MKL_WARN])
    fi
    AM_CFLAGS="$AM_CFLAGS $MKL_CFLAGS "
    AM_LDFLAGS="$AM_LDFLAGS $MKL_LDFLAGS "
    LIBS="$LIBS $MKL_LIBS"
268
  else
269
################ handle the FFTW library (Fourier transforms) ################
270
    ACX_FFTW($with_fftw_libdir, $with_fftw_incdir, $use_pthreads,yes,
271
      [
272
273
274
        [LIBS="$FFTW_LIBS $LIBS"]
        if test "$FFTW_WARN" != ""; then
          AC_MSG_WARN([$FFTW_WARN])
275
276
        fi
      ],
277
      AC_MSG_ERROR([$FFTW_ERROR Exiting.])
278
279
    )

280
281
282
283
284
285
286
287
288
289
290
291
292
293
    if test "x$enable_openblas" = "xyes"; then
######## Handle the OpenBLAS library (linear algebra: BLAS + LAPACKe) ########
      ACX_OPENBLAS($with_openblas_libdir, $with_openblas_incdir, $use_pthreads, no,
        [
          AM_CFLAGS="$AM_CFLAGS $OPENBLAS_CFLAGS "
          AM_LDFLAGS="$AM_LDFLAGS $OPENBLAS_LDFLAGS "
          LIBS="$OPENBLAS_LIBS $LIBS"
          if test "$OPENBLAS_WARN" != ""; then
            AC_MSG_WARN([$OPENBLAS_WARN])
          fi
        ],
        AC_MSG_ERROR([$OPENBLAS_ERROR Exiting.])
      )
    else
294
######### handle the ATLAS library (linear algebra: BLAS + cLAPACK) ##########
295
296
297
298
299
300
301
302
303
304
      ACX_ATLAS($with_atlas_libdir, $with_atlas_incdir, $use_pthreads,
        [
          [LIBS="$ATLAS_LIBS $LIBS"]
          if test "$ATLAS_WARN" != ""; then
            AC_MSG_WARN([$ATLAS_WARN])
	  fi
        ],
        AC_MSG_ERROR([$ATLAS_ERROR Exiting.])
      )
    fi
305
  fi
Emmanuel Bertin's avatar
Emmanuel Bertin committed
306
307
fi

Emmanuel Bertin's avatar
Emmanuel Bertin committed
308
309
AM_CONDITIONAL(USE_MODEL, [test "$enable_model_fitting" != "no"])

310
# Compile with profiling option
311
312
if test "$enable_profiling" = "yes"; then
  if test "$enable_icc" = "yes"; then
313
    AM_CFLAGS="$AM_CFLAGS -pq"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
314
  else
315
    AM_CFLAGS="$AM_CFLAGS -pg"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
316
  fi
317
  enable_best_link="no"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
318
319
fi

320
# "Best" linking option
321
322
if test "$enable_best_link" = "yes"; then
  if test "$enable_icc" = "yes"; then
323
    AM_LDFLAGS="-static-intel -qopenmp-link static -shared-libgcc \
324
	-static-libtool-libs -no-intel-extensions -avoid-version $AM_LDFLAGS"
325
326
327
  else
    AM_LDFLAGS="-shared-libgcc -static-libtool-libs -avoid-version $AM_LDFLAGS"
  fi
Emmanuel Bertin's avatar
Emmanuel Bertin committed
328
329
fi

330
331
332
AC_SUBST(AM_CFLAGS)
AC_SUBST(AM_CPPFLAGS)
AC_SUBST(AM_LDFLAGS)
Emmanuel Bertin's avatar
Emmanuel Bertin committed
333
334

# Display compiler and linker flags
Emmanuel Bertin's avatar
Emmanuel Bertin committed
335
AC_MSG_RESULT([***************************************************************])
336
337
AC_MSG_RESULT([Compile cmdline:  $CC $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS])
AC_MSG_RESULT([Link    cmdline:  $CC $AM_LDFLAGS $LDFLAGS $LIBS])
Emmanuel Bertin's avatar
Emmanuel Bertin committed
338
339
340
341
342
AC_MSG_RESULT([Default XSLT URL: $xsl_url])
AC_MSG_RESULT([***************************************************************])

AC_CONFIG_FILES([
Makefile
343
344
345
346
347
348
349
sextractor.spec
debian/Makefile
debian/changelog
doc/Makefile
doc/src/conf.py
man/Makefile
man/sex.1
Emmanuel Bertin's avatar
Emmanuel Bertin committed
350
351
352
353
354
src/Makefile
src/fits/Makefile
src/levmar/Makefile
src/wcs/Makefile
tests/Makefile
Emmanuel Bertin's avatar
Emmanuel Bertin committed
355
])
Emmanuel Bertin's avatar
Emmanuel Bertin committed
356
AC_OUTPUT