configure.ac 12.4 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-2022 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:		16/09/2022
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
35
AC_INIT([SExtractor],[2.27.0],[astromatic@astromatic.iap.fr],
        [sextractor],[http://astromatic.net/software/sextractor])
36
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
84
85
86
87
88
89
90
91
92
# Provide special option for the Linux Intel C "classic" compiler
AC_MSG_CHECKING([whether the classic INTEL compiler is enabled])
AC_ARG_ENABLE(icc,
	[AS_HELP_STRING([--enable-icc],
	[Use the Intel compiler (default = no)])],
        CC="icc"
        enable_iccx="yes"
	AC_MSG_RESULT([yes]),
	AC_MSG_RESULT([no]))

Emmanuel Bertin's avatar
Emmanuel Bertin committed
93
# Provide special option for the Linux Intel OneAPI C compiler
94
AC_MSG_CHECKING([whether the INTEL compiler is enabled])
Emmanuel Bertin's avatar
Emmanuel Bertin committed
95
96
AC_ARG_ENABLE(icx,
	[AS_HELP_STRING([--enable-icx],
97
	[Use the Intel compiler (default = no)])],
Emmanuel Bertin's avatar
Emmanuel Bertin committed
98
        CC="icx"
99
        enable_iccx="yes"
100
101
102
103
	AC_MSG_RESULT([yes]),
	AC_MSG_RESULT([no]))

# Provide special options for INTEL MKL
104
105
106
# We use icc if available, if not Intel OneAPI's icx
# (we don't use AC_PROG_CC as it does not play nice
# in a conditional block)
107
AC_MSG_CHECKING([whether INTEL's MKL is enabled])
108
109
AC_ARG_ENABLE(mkl,
	[AS_HELP_STRING([--enable-mkl],
110
	[Use INTEL's MKL for solvers and FFTs (default = no)])],
111
112
113
114
	    AC_MSG_RESULT([yes])
        CC=""
        [AC_CHECK_PROGS(CC, [icc icx cc])]
        enable_iccx="yes",
Emmanuel Bertin's avatar
Emmanuel Bertin committed
115
116
117
	AC_MSG_RESULT([no]))

# Checks for programs.
Emmanuel Bertin's avatar
Emmanuel Bertin committed
118
AC_LANG(C)
119
120

AC_SEARCH_LIBS([strerror],[cposix])
121
if test "$enable_auto_flags" = "yes"; then
122
  CFLAGS=""
123
  LDFLAGS=""
124
125
  ACX_PROG_CC_OPTIM
fi
126
LT_INIT
Emmanuel Bertin's avatar
Emmanuel Bertin committed
127
128
129
130
131
132
AC_PROG_INSTALL

# Checks for libraries.
AC_CHECK_LIB(m, sin)

# Checks for header files.
Emmanuel Bertin's avatar
Emmanuel Bertin committed
133
134
AC_CHECK_HEADERS([fcntl.h limits.h malloc.h stdlib.h string.h sys/mman.h \
		sys/types.h unistd.h])
135
# Checks for INTEL math header files.
136
if test "$enable_iccx" = "yes"; then
137
138
  AC_CHECK_HEADERS(mathimf.h)
fi
Emmanuel Bertin's avatar
Emmanuel Bertin committed
139
140
141
142
143

# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
144
145
AC_TYPE_LONG_LONG_INT
AC_TYPE_UNSIGNED_LONG_LONG_INT
Emmanuel Bertin's avatar
Emmanuel Bertin committed
146
147
148
149
150
151
152
153
AC_STRUCT_TM
AC_TYPE_UID_T

# Checks for library functions.
AC_FUNC_ERROR_AT_LINE
AC_FUNC_MMAP
AC_FUNC_STAT
AC_FUNC_STRFTIME
154
155
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
156
157
158
159
160

# Check support for large files
AC_SYS_LARGEFILE
AC_FUNC_FSEEKO

Emmanuel Bertin's avatar
Emmanuel Bertin committed
161
# Provide special options for ATLAS
162
AC_ARG_WITH(atlas-libdir,
163
164
	[AS_HELP_STRING([--with-atlas-libdir=<ATLAS library path>],
	[Provide an alternative path to the ATLAS library])])
Emmanuel Bertin's avatar
Emmanuel Bertin committed
165
AC_ARG_WITH(atlas-incdir,
166
167
	[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
168
169

# Provide special options for FFTW
170
AC_ARG_WITH(fftw-libdir,
171
172
	[AS_HELP_STRING([--with-fftw-libdir=<FFTW library path>],
	[Provide an alternative path to the FFTW library])])
Emmanuel Bertin's avatar
Emmanuel Bertin committed
173
AC_ARG_WITH(fftw-incdir,
174
175
	[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
176

177
178
# Provide special options for the MKL library
AC_ARG_WITH(mkl-dir,
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
	[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])])
195

196
# Provide special option for CFITSIO
197
AC_MSG_CHECKING([whether CFITSIO support should be disabled (default=enabled)])
198
AC_ARG_ENABLE(cfitsio,
199
200
201
202
203
204
205
	[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,
206
207
208
209
210
	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,
211
212
	[AS_HELP_STRING([--with-cfitsio-incdir=<CFITSIO include dir>],
	[Provide an alternative path to the CFITSIO include directory])])
213

Emmanuel Bertin's avatar
Emmanuel Bertin committed
214
# Provide a special option for the default XSLT URL
215
with_xsl_url="file://"$(URBI_RESOLVE_DIR([$datadir]))"/$PACKAGE_TARNAME/$PACKAGE_TARNAME.xsl"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
216
AC_ARG_WITH(xsl_url,
217
	[AS_HELP_STRING([--with-xsl_url=<default URL for XSLT filter>],
218
	[Provide an alternative default URL of the XSLT filter])])
Emmanuel Bertin's avatar
Emmanuel Bertin committed
219

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

222
# Provide special option to disable model-fitting (enabled by default)
223
AC_MSG_CHECKING([if model-fitting should be disabled (default=enabled)])
224
AC_ARG_ENABLE([model-fitting],
225
226
	[AS_HELP_STRING([--disable-model-fitting],
	[Disable model-fitting and library dependencies])],
227
	if test "$enable_model_fitting" = "no"; then
228
229
230
231
	  AC_MSG_RESULT([yes])
	else
	  AC_MSG_RESULT([no])
	fi,
232
	AC_MSG_RESULT([no]))
233

Emmanuel Bertin's avatar
Emmanuel Bertin committed
234
# Set flags for multithreading
235
n_pthreads=1024
Emmanuel Bertin's avatar
Emmanuel Bertin committed
236
AC_ARG_ENABLE(threads,
237
238
239
	[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
240
241
242
      use_pthreads="no"
    else
      use_pthreads="yes"
243
      if test "$enableval" != "yes"; then
Emmanuel Bertin's avatar
Emmanuel Bertin committed
244
245
246
247
248
        n_pthreads=$enableval
      fi
    fi,
    use_pthreads=yes
    )
249
250
# Deactivate multithreading for now
use_pthreads="no"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
251

252
253
254
255
# Provide special option for profiling
AC_MSG_CHECKING([for profiler mode])
AC_ARG_ENABLE(profiling,
	[AS_HELP_STRING([--enable-profiling],
256
	[Enable special mode for profiling (default = no)])],
Emmanuel Bertin's avatar
Emmanuel Bertin committed
257
258
259
	AC_MSG_RESULT([yes]),
	AC_MSG_RESULT([no]))

260
261
262
# Enable linking options for making the executable as portable as possible.
AC_MSG_CHECKING([best linking option])
AC_ARG_ENABLE(best-link,
263
	[AS_HELP_STRING([--enable-best-link],
264
	[Choose the right combination of static and dynamic linking to make \
265
the executable as portable as possible (default = no)])],
Emmanuel Bertin's avatar
Emmanuel Bertin committed
266
267
	AC_MSG_RESULT([yes]),
	AC_MSG_RESULT([no]))
Emmanuel Bertin's avatar
Emmanuel Bertin committed
268

Emmanuel Bertin's avatar
Emmanuel Bertin committed
269
270
################# Actions to complete in case of multhreading ################
AC_DEFINE_UNQUOTED(THREADS_NMAX, $n_pthreads,[Maximum number of POSIX threads])
271
if test "$use_pthreads" = "yes"; then
Emmanuel Bertin's avatar
Emmanuel Bertin committed
272
273
274
275
276
277
  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"
278
  [AM_CFLAGS="$AM_CFLAGS $PTHREAD_CFLAGS -D_REENTRANT"]
279
  LIBS="$LIBS $PTHREAD_LIBS"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
280
fi
281
282
AM_CONDITIONAL(USE_THREADS, test $use_pthreads = "yes")

283
284
285
############# Actions to complete if model-fitting is activated ##############
if test "$enable_model_fitting" != "no"; then
  AC_DEFINE(USE_MODEL, 1, [Triggers model-fitting])
286
############ handle the INTEL MKL library (FFTW + LAPACKe) ###########
287
288
  if test "$enable_mkl" = "yes"; then
    convlibs="${srcdir}/wcs/libwcs_c.a,${srcdir}/levmar/liblevmar.a"
289
    ACX_MKL($with_mkl_dir,,$enable_best_link,$convlibs)
290
    if test "$MKL_WARN" != ""; then
291
292
293
294
295
      AC_MSG_WARN([$MKL_WARN])
    fi
    AM_CFLAGS="$AM_CFLAGS $MKL_CFLAGS "
    AM_LDFLAGS="$AM_LDFLAGS $MKL_LDFLAGS "
    LIBS="$LIBS $MKL_LIBS"
296
  else
297
################ handle the FFTW library (Fourier transforms) ################
298
    ACX_FFTW($with_fftw_libdir, $with_fftw_incdir, $use_pthreads,yes,
299
      [
300
301
302
        [LIBS="$FFTW_LIBS $LIBS"]
        if test "$FFTW_WARN" != ""; then
          AC_MSG_WARN([$FFTW_WARN])
303
304
        fi
      ],
305
      AC_MSG_ERROR([$FFTW_ERROR Exiting.])
306
307
    )

308
309
310
311
312
313
314
315
316
317
318
319
320
321
    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
322
######### handle the ATLAS library (linear algebra: BLAS + cLAPACK) ##########
323
324
325
326
327
328
329
330
331
332
      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
333
  fi
Emmanuel Bertin's avatar
Emmanuel Bertin committed
334
335
fi

336
337
338
339
340
341
342
343
344
########################## 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
345

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

348
# Compile with profiling option
349
if test "$enable_profiling" = "yes"; then
350
  if test "$enable_iccx" = "yes"; then
351
    AM_CFLAGS="$AM_CFLAGS -pq"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
352
  else
353
    AM_CFLAGS="$AM_CFLAGS -pg"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
354
  fi
355
  enable_best_link="no"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
356
357
fi

358
# "Best" linking option
359
if test "$enable_best_link" = "yes"; then
360
  if test "$enable_iccx" = "yes"; then
Emmanuel Bertin's avatar
Emmanuel Bertin committed
361
362
    AM_LDFLAGS="-static-intel -qopenmp-link=static -shared-libgcc \
	-static-libtool-libs -avoid-version $AM_LDFLAGS"
363
364
365
  else
    AM_LDFLAGS="-shared-libgcc -static-libtool-libs -avoid-version $AM_LDFLAGS"
  fi
Emmanuel Bertin's avatar
Emmanuel Bertin committed
366
367
fi

368
369
370
AC_SUBST(AM_CFLAGS)
AC_SUBST(AM_CPPFLAGS)
AC_SUBST(AM_LDFLAGS)
Emmanuel Bertin's avatar
Emmanuel Bertin committed
371
372

# Display compiler and linker flags
Emmanuel Bertin's avatar
Emmanuel Bertin committed
373
AC_MSG_RESULT([***************************************************************])
374
375
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
376
377
378
379
380
AC_MSG_RESULT([Default XSLT URL: $xsl_url])
AC_MSG_RESULT([***************************************************************])

AC_CONFIG_FILES([
Makefile
381
382
383
384
385
386
387
sextractor.spec
debian/Makefile
debian/changelog
doc/Makefile
doc/src/conf.py
man/Makefile
man/sex.1
Emmanuel Bertin's avatar
Emmanuel Bertin committed
388
389
390
391
392
src/Makefile
src/fits/Makefile
src/levmar/Makefile
src/wcs/Makefile
tests/Makefile
Emmanuel Bertin's avatar
Emmanuel Bertin committed
393
])
Emmanuel Bertin's avatar
Emmanuel Bertin committed
394
AC_OUTPUT