configure.ac 12 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-2020 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:		23/09/2020
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
# This is your standard AstrOmatic source code...
34
AC_INIT(SExtractor, 2.27.0, [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)
56
sinclude(acx_cfitsio.m4)
Emmanuel Bertin's avatar
Emmanuel Bertin committed
57
sinclude(acx_prog_cc_optim.m4)
Emmanuel Bertin's avatar
Emmanuel Bertin committed
58
59
sinclude(acx_pthread.m4)
sinclude(acx_urbi_resolve_dir.m4)
Emmanuel Bertin's avatar
Emmanuel Bertin committed
60

61
62
63
64
65
66
67
68
69
70
71
# 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
72
# Display pakage and version number
73
AC_MSG_RESULT([******** Configuring:  $PACKAGE_NAME $PACKAGE_VERSION - $PACKAGE_RELEASE ($date) ********])
Emmanuel Bertin's avatar
Emmanuel Bertin committed
74

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

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

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

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

AC_SEARCH_LIBS([strerror],[cposix])
107
if test "$enable_auto_flags" = "yes"; then
108
  CFLAGS=""
109
  LDFLAGS=""
110
111
  ACX_PROG_CC_OPTIM
fi
112
LT_INIT
Emmanuel Bertin's avatar
Emmanuel Bertin committed
113
114
115
116
117
118
119
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
120
121
AC_CHECK_HEADERS([fcntl.h limits.h malloc.h stdlib.h string.h sys/mman.h \
		sys/types.h unistd.h])
122
# Checks for INTEL math header files.
123
if test "$enable_icc" = "yes"; then
124
125
  AC_CHECK_HEADERS(mathimf.h)
fi
Emmanuel Bertin's avatar
Emmanuel Bertin committed
126
127
128
129
130

# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
131
132
AC_TYPE_LONG_LONG_INT
AC_TYPE_UNSIGNED_LONG_LONG_INT
Emmanuel Bertin's avatar
Emmanuel Bertin committed
133
134
135
136
137
138
139
140
141
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
142
143
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
144
145
146
147
148

# Check support for large files
AC_SYS_LARGEFILE
AC_FUNC_FSEEKO

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

# Provide special options for FFTW
158
AC_ARG_WITH(fftw-libdir,
159
160
	[AS_HELP_STRING([--with-fftw-libdir=<FFTW library path>],
	[Provide an alternative path to the FFTW library])])
Emmanuel Bertin's avatar
Emmanuel Bertin committed
161
AC_ARG_WITH(fftw-incdir,
162
163
	[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
164

165
166
# Provide special options for the MKL library
AC_ARG_WITH(mkl-dir,
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
	[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])])
183

184
# Provide special option for CFITSIO
185
AC_MSG_CHECKING([whether CFITSIO support should be disabled (default=enabled)])
186
AC_ARG_ENABLE(cfitsio,
187
188
189
190
191
192
193
	[AS_HELP_STRING([--disable-cfitsio],
	[Disable support for compressed FITS files through the CFITSIO library (default=enabled)])],
	if test "$enable_cfitsio" = "no"; then
	  AC_MSG_RESULT([yes])
	else
	  AC_MSG_RESULT([no])
	fi,
194
195
196
197
198
	AC_MSG_RESULT([no]))
AC_ARG_WITH(cfitsio-libdir,
	[AS_HELP_STRING([--with-cfitsio-libdir=<CFITSIO library path>],
	[Provide an alternative path to the CFITSIO library])])
AC_ARG_WITH(cfitsio-incdir,
199
200
	[AS_HELP_STRING([--with-cfitsio-incdir=<CFITSIO include dir>],
	[Provide an alternative path to the CFITSIO include directory])])
201

Emmanuel Bertin's avatar
Emmanuel Bertin committed
202
# Provide a special option for the default XSLT URL
203
with_xsl_url="file://"$(URBI_RESOLVE_DIR([$datadir]))"/$PACKAGE_TARNAME/$PACKAGE_TARNAME.xsl"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
204
AC_ARG_WITH(xsl_url,
205
	[AS_HELP_STRING([--with-xsl_url=<default URL for XSLT filter>],
206
	[Provide an alternative default URL of the XSLT filter])])
Emmanuel Bertin's avatar
Emmanuel Bertin committed
207

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

210
# Provide special option to disable model-fitting (enabled by default)
211
AC_MSG_CHECKING([if model-fitting should be disabled (default=enabled)])
212
AC_ARG_ENABLE([model-fitting],
213
214
	[AS_HELP_STRING([--disable-model-fitting],
	[Disable model-fitting and library dependencies])],
215
	if test "$enable_model_fitting" = "no"; then
216
217
218
219
	  AC_MSG_RESULT([yes])
	else
	  AC_MSG_RESULT([no])
	fi,
220
	AC_MSG_RESULT([no]))
221

Emmanuel Bertin's avatar
Emmanuel Bertin committed
222
# Set flags for multithreading
223
n_pthreads=1024
Emmanuel Bertin's avatar
Emmanuel Bertin committed
224
AC_ARG_ENABLE(threads,
225
226
227
	[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
228
229
230
      use_pthreads="no"
    else
      use_pthreads="yes"
231
      if test "$enableval" != "yes"; then
Emmanuel Bertin's avatar
Emmanuel Bertin committed
232
233
234
235
236
        n_pthreads=$enableval
      fi
    fi,
    use_pthreads=yes
    )
237
238
# Deactivate multithreading for now
use_pthreads="no"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
239

240
241
242
243
# Provide special option for profiling
AC_MSG_CHECKING([for profiler mode])
AC_ARG_ENABLE(profiling,
	[AS_HELP_STRING([--enable-profiling],
244
	[Enable special mode for profiling (default = no)])]
Emmanuel Bertin's avatar
Emmanuel Bertin committed
245
246
247
	AC_MSG_RESULT([yes]),
	AC_MSG_RESULT([no]))

248
249
250
# Enable linking options for making the executable as portable as possible.
AC_MSG_CHECKING([best linking option])
AC_ARG_ENABLE(best-link,
251
	[AS_HELP_STRING([--enable-best-link],
252
	[Choose the right combination of static and dynamic linking to make \
253
the executable as portable as possible (default = no)])],
Emmanuel Bertin's avatar
Emmanuel Bertin committed
254
255
	AC_MSG_RESULT([yes]),
	AC_MSG_RESULT([no]))
Emmanuel Bertin's avatar
Emmanuel Bertin committed
256

Emmanuel Bertin's avatar
Emmanuel Bertin committed
257
258
################# Actions to complete in case of multhreading ################
AC_DEFINE_UNQUOTED(THREADS_NMAX, $n_pthreads,[Maximum number of POSIX threads])
259
if test "$use_pthreads" = "yes"; then
Emmanuel Bertin's avatar
Emmanuel Bertin committed
260
261
262
263
264
265
  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"
266
  [AM_CFLAGS="$AM_CFLAGS $PTHREAD_CFLAGS -D_REENTRANT"]
267
  LIBS="$LIBS $PTHREAD_LIBS"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
268
fi
269
270
AM_CONDITIONAL(USE_THREADS, test $use_pthreads = "yes")

271
272
273
############# Actions to complete if model-fitting is activated ##############
if test "$enable_model_fitting" != "no"; then
  AC_DEFINE(USE_MODEL, 1, [Triggers model-fitting])
274
############ handle the INTEL MKL library (FFTW + LAPACKe) ###########
275
276
  if test "$enable_mkl" = "yes"; then
    convlibs="${srcdir}/wcs/libwcs_c.a,${srcdir}/levmar/liblevmar.a"
277
    ACX_MKL($with_mkl_dir,,$enable_best_link,$convlibs)
278
279
280
281
282
283
284
285
286
    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"
287
  else
288
################ handle the FFTW library (Fourier transforms) ################
289
    ACX_FFTW($with_fftw_libdir, $with_fftw_incdir, $use_pthreads,yes,
290
      [
291
292
293
        [LIBS="$FFTW_LIBS $LIBS"]
        if test "$FFTW_WARN" != ""; then
          AC_MSG_WARN([$FFTW_WARN])
294
295
        fi
      ],
296
      AC_MSG_ERROR([$FFTW_ERROR Exiting.])
297
298
    )

299
300
301
302
303
304
305
306
307
308
309
310
311
312
    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
313
######### handle the ATLAS library (linear algebra: BLAS + cLAPACK) ##########
314
315
316
317
318
319
320
321
322
323
      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
324
  fi
Emmanuel Bertin's avatar
Emmanuel Bertin committed
325
326
fi

327
328
329
330
331
332
333
334
335
########################## handle the CFITSIO library ########################
if test "$enable_cfitsio" != "no"; then
  ACX_CFITSIO($with_cfitsio_libdir, $with_cfitsio_incdir,
	[LIBS="$CFITSIO_LIBS $LIBS"]
	if test "$CFITSIO_WARN" != ""; then
	  AC_MSG_WARN([$CFITSIO_WARN])
	fi,
	AC_MSG_ERROR([$CFITSIO_ERROR Exiting.]))
fi
336

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

339
# Compile with profiling option
340
341
if test "$enable_profiling" = "yes"; then
  if test "$enable_icc" = "yes"; then
342
    AM_CFLAGS="$AM_CFLAGS -pq"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
343
  else
344
    AM_CFLAGS="$AM_CFLAGS -pg"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
345
  fi
346
  enable_best_link="no"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
347
348
fi

349
# "Best" linking option
350
351
if test "$enable_best_link" = "yes"; then
  if test "$enable_icc" = "yes"; then
352
    AM_LDFLAGS="-static-intel -qopenmp-link static -shared-libgcc \
353
	-static-libtool-libs -no-intel-extensions -avoid-version $AM_LDFLAGS"
354
355
356
  else
    AM_LDFLAGS="-shared-libgcc -static-libtool-libs -avoid-version $AM_LDFLAGS"
  fi
Emmanuel Bertin's avatar
Emmanuel Bertin committed
357
358
fi

359
360
361
AC_SUBST(AM_CFLAGS)
AC_SUBST(AM_CPPFLAGS)
AC_SUBST(AM_LDFLAGS)
Emmanuel Bertin's avatar
Emmanuel Bertin committed
362
363

# Display compiler and linker flags
Emmanuel Bertin's avatar
Emmanuel Bertin committed
364
AC_MSG_RESULT([***************************************************************])
365
366
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
367
368
369
370
371
AC_MSG_RESULT([Default XSLT URL: $xsl_url])
AC_MSG_RESULT([***************************************************************])

AC_CONFIG_FILES([
Makefile
372
373
374
375
376
377
378
sextractor.spec
debian/Makefile
debian/changelog
doc/Makefile
doc/src/conf.py
man/Makefile
man/sex.1
Emmanuel Bertin's avatar
Emmanuel Bertin committed
379
380
381
382
383
src/Makefile
src/fits/Makefile
src/levmar/Makefile
src/wcs/Makefile
tests/Makefile
Emmanuel Bertin's avatar
Emmanuel Bertin committed
384
])
Emmanuel Bertin's avatar
Emmanuel Bertin committed
385
AC_OUTPUT