configure.ac 10.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-2017 IAP/CNRS/UPMC
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:		19/06/2017
26
27
28
#
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

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

# This is your standard Bertin source code...
34
35
36
AC_INIT(SExtractor, 2.24.0,[astromatic@astromatic.net],
	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
53
sinclude(acx_atlas.m4)
sinclude(acx_fftw.m4)
54
sinclude(acx_mkl.m4)
Emmanuel Bertin's avatar
Emmanuel Bertin committed
55
sinclude(acx_prog_cc_optim.m4)
Emmanuel Bertin's avatar
Emmanuel Bertin committed
56
57
sinclude(acx_pthread.m4)
sinclude(acx_urbi_resolve_dir.m4)
Emmanuel Bertin's avatar
Emmanuel Bertin committed
58
59

# Display pakage and version number
60
AC_MSG_RESULT([******** Configuring:  $PACKAGE_NAME $VERSION ($date) ********])
Emmanuel Bertin's avatar
Emmanuel Bertin committed
61

62
# Provide special option for choosing automatically the compilation flags.
63
AC_MSG_CHECKING([if compilation flags are set automatically])
64
AC_ARG_ENABLE(auto-flags,
65
	[AS_HELP_STRING([--enable-auto-flags],
66
	[Let the configure script choose the compilation flags (default = no)])],
67
68
	AC_MSG_RESULT([yes]),
	AC_MSG_RESULT([no]))
Emmanuel Bertin's avatar
Emmanuel Bertin committed
69
70

# Provide special option for the Linux Intel C compiler
71
AC_MSG_CHECKING([whether the INTEL compiler is enabled])
Emmanuel Bertin's avatar
Emmanuel Bertin committed
72
AC_ARG_ENABLE(icc,
73
	[AS_HELP_STRING([--enable-icc],
74
	[Use the Intel compiler (default = no)])],
75
76
77
78
79
80
        CC="icc"
	AC_MSG_RESULT([yes]),
	AC_MSG_RESULT([no]))

# Provide special options for INTEL MKL
# We force the use of icc
81
AC_MSG_CHECKING([whether INTEL's MKL is enabled])
82
83
AC_ARG_ENABLE(mkl,
	[AS_HELP_STRING([--enable-mkl],
84
	[Use INTEL's MKL for solvers and FFTs (default = no)])],
85
86
        enable_icc="yes"
        CC="icc"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
87
88
89
90
	AC_MSG_RESULT([yes]),
	AC_MSG_RESULT([no]))

# Checks for programs.
Emmanuel Bertin's avatar
Emmanuel Bertin committed
91
AC_LANG(C)
92
93

AC_SEARCH_LIBS([strerror],[cposix])
94
if test x$enable_auto_flags = xyes; then
95
  CFLAGS=""
96
  LDFLAGS=""
97
98
  ACX_PROG_CC_OPTIM
fi
99
LT_INIT
Emmanuel Bertin's avatar
Emmanuel Bertin committed
100
101
102
103
104
105
106
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
107
108
AC_CHECK_HEADERS([fcntl.h limits.h malloc.h stdlib.h string.h sys/mman.h \
		sys/types.h unistd.h])
109
# Checks for INTEL math header files.
110
if test "$enable_icc" = "yes"; then
111
112
  AC_CHECK_HEADERS(mathimf.h)
fi
Emmanuel Bertin's avatar
Emmanuel Bertin committed
113
114
115
116
117

# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
118
119
AC_TYPE_LONG_LONG_INT
AC_TYPE_UNSIGNED_LONG_LONG_INT
Emmanuel Bertin's avatar
Emmanuel Bertin committed
120
121
122
123
124
125
126
127
128
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
129
130
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
131
132
133
134
135

# Check support for large files
AC_SYS_LARGEFILE
AC_FUNC_FSEEKO

Emmanuel Bertin's avatar
Emmanuel Bertin committed
136
# Provide special options for ATLAS
137
AC_ARG_WITH(atlas-libdir,
138
139
	[AS_HELP_STRING([--with-atlas-libdir=<ATLAS library path>],
	[Provide an alternative path to the ATLAS library])])
Emmanuel Bertin's avatar
Emmanuel Bertin committed
140
AC_ARG_WITH(atlas-incdir,
141
142
	[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
143
144

# Provide special options for FFTW
145
AC_ARG_WITH(fftw-libdir,
146
147
	[AS_HELP_STRING([--with-fftw-libdir=<FFTW library path>],
	[Provide an alternative path to the FFTW library])])
Emmanuel Bertin's avatar
Emmanuel Bertin committed
148
AC_ARG_WITH(fftw-incdir,
149
150
	[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
151

152
153
# Provide special options for the MKL library
AC_ARG_WITH(mkl-dir,
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
	[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])])
170

Emmanuel Bertin's avatar
Emmanuel Bertin committed
171
# Provide a special option for the default XSLT URL
172
with_xsl_url="file://"$(URBI_RESOLVE_DIR([$datadir]))"/$PACKAGE_TARNAME/$PACKAGE_TARNAME.xsl"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
173
AC_ARG_WITH(xsl_url,
174
	[AS_HELP_STRING([--with-xsl_url=<default URL for XSLT filter>],
175
	[Provide an alternative default URL of the XSLT filter])])
Emmanuel Bertin's avatar
Emmanuel Bertin committed
176

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

179
# Provide special option to disable model-fitting (enabled by default)
180
AC_MSG_CHECKING([if model-fitting should be disabled (default=enabled)])
181
AC_ARG_ENABLE([model-fitting],
182
183
	[AS_HELP_STRING([--disable-model-fitting],
	[Disable model-fitting and library dependencies])],
184
	if test "$enable_model_fitting" = "no"; then
185
186
187
188
	  AC_MSG_RESULT([yes])
	else
	  AC_MSG_RESULT([no])
	fi,
189
	AC_MSG_RESULT([no]))
190

Emmanuel Bertin's avatar
Emmanuel Bertin committed
191
# Set flags for multithreading
192
n_pthreads=1024
Emmanuel Bertin's avatar
Emmanuel Bertin committed
193
AC_ARG_ENABLE(threads,
194
195
196
	[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
197
198
199
      use_pthreads="no"
    else
      use_pthreads="yes"
200
      if test "$enableval" != "yes"; then
Emmanuel Bertin's avatar
Emmanuel Bertin committed
201
202
203
204
205
        n_pthreads=$enableval
      fi
    fi,
    use_pthreads=yes
    )
206
207
# Deactivate multithreading for now
use_pthreads="no"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
208

209
210
211
212
# Provide special option for profiling
AC_MSG_CHECKING([for profiler mode])
AC_ARG_ENABLE(profiling,
	[AS_HELP_STRING([--enable-profiling],
213
	[Enable special mode for profiling (default = no)])]
Emmanuel Bertin's avatar
Emmanuel Bertin committed
214
215
216
	AC_MSG_RESULT([yes]),
	AC_MSG_RESULT([no]))

217
218
219
# Enable linking options for making the executable as portable as possible.
AC_MSG_CHECKING([best linking option])
AC_ARG_ENABLE(best-link,
220
	[AS_HELP_STRING([--enable-best-link],
221
	[Choose the right combination of static and dynamic linking to make \
222
the executable as portable as possible (default = no)])],
Emmanuel Bertin's avatar
Emmanuel Bertin committed
223
224
	AC_MSG_RESULT([yes]),
	AC_MSG_RESULT([no]))
Emmanuel Bertin's avatar
Emmanuel Bertin committed
225

226

Emmanuel Bertin's avatar
Emmanuel Bertin committed
227
228
################# Actions to complete in case of multhreading ################
AC_DEFINE_UNQUOTED(THREADS_NMAX, $n_pthreads,[Maximum number of POSIX threads])
229
if test "$use_pthreads" = "yes"; then
Emmanuel Bertin's avatar
Emmanuel Bertin committed
230
231
232
233
234
235
  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"
236
  [AM_CFLAGS="$AM_CFLAGS $PTHREAD_CFLAGS -D_REENTRANT"]
237
  LIBS="$LIBS $PTHREAD_LIBS"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
238
fi
239
240
241
242
AM_CONDITIONAL(USE_THREADS, test $use_pthreads = "yes")

############ handle the INTEL MKL library (FFTW + LAPACKe) ###########
if test "$enable_mkl" = "yes"; then
243
  convlibs="${srcdir}/wcs/libwcs_c.a,${srcdir}/levmar/liblevmar.a"
244
245
246
  ACX_MKL($with_mkl_dir,yes,$enable_best_link,$convlibs)
  if test "$MKL_WARN" == ""; then
    AC_MSG_RESULT([yes])
247
  else
248
249
250
251
252
253
254
    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"
else
255
################ handle the FFTW library (Fourier transforms) ################
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
  ACX_FFTW($with_fftw_libdir, $with_fftw_incdir, $use_pthreads,yes,
    [
      [LIBS="$FFTW_LIBS $LIBS"]
      if test "$FFTW_WARN" != ""; then
        AC_MSG_WARN([$FFTW_WARN])
      fi
    ],
    AC_MSG_ERROR([$FFTW_ERROR Exiting.])
  )

  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
######### handle the ATLAS library (linear algebra: BLAS + cLAPACK) ##########
    ACX_ATLAS($with_atlas_libdir, $with_atlas_incdir, $use_pthreads,
      [
        [LIBS="$ATLAS_LIBS $LIBS"]
        if test "$ATLAS_WARN" != ""; then
286
	  AC_MSG_WARN([$ATLAS_WARN])
287
288
289
290
	fi
      ],
      AC_MSG_ERROR([$ATLAS_ERROR Exiting.])
    )
291
  fi
Emmanuel Bertin's avatar
Emmanuel Bertin committed
292
293
fi

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

296
# Compile with profiling option
297
298
if test "$enable_profiling" = "yes"; then
  if test "$enable_icc" = "yes"; then
299
    AM_CFLAGS="$AM_CFLAGS -pq"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
300
  else
301
    AM_CFLAGS="$AM_CFLAGS -pg"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
302
  fi
303
  enable_best_link="no"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
304
305
fi

306
# "Best" linking option
307
308
if test "$enable_best_link" = "yes"; then
  if test "$enable_icc" = "yes"; then
309
    AM_LDFLAGS="-static-intel -qopenmp-link static -shared-libgcc \
310
	-static-libtool-libs -no-intel-extensions -avoid-version $AM_LDFLAGS"
311
312
313
  else
    AM_LDFLAGS="-shared-libgcc -static-libtool-libs -avoid-version $AM_LDFLAGS"
  fi
Emmanuel Bertin's avatar
Emmanuel Bertin committed
314
315
fi

316
317
318
AC_SUBST(AM_CFLAGS)
AC_SUBST(AM_CPPFLAGS)
AC_SUBST(AM_LDFLAGS)
Emmanuel Bertin's avatar
Emmanuel Bertin committed
319
320

# Display compiler and linker flags
Emmanuel Bertin's avatar
Emmanuel Bertin committed
321
AC_MSG_RESULT([***************************************************************])
322
323
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
324
325
326
327
328
AC_MSG_RESULT([Default XSLT URL: $xsl_url])
AC_MSG_RESULT([***************************************************************])

AC_CONFIG_FILES([
Makefile
329
330
331
332
333
334
335
sextractor.spec
debian/Makefile
debian/changelog
doc/Makefile
doc/src/conf.py
man/Makefile
man/sex.1
Emmanuel Bertin's avatar
Emmanuel Bertin committed
336
337
338
339
340
src/Makefile
src/fits/Makefile
src/levmar/Makefile
src/wcs/Makefile
tests/Makefile
Emmanuel Bertin's avatar
Emmanuel Bertin committed
341
])
Emmanuel Bertin's avatar
Emmanuel Bertin committed
342
AC_OUTPUT