configure.ac 9.57 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-2013 Emmanuel Bertin -- 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:		06/06/2013
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
AC_INIT(sextractor, 2.18.12, [bertin@iap.fr])
Emmanuel Bertin's avatar
Emmanuel Bertin committed
35
36
AC_CONFIG_SRCDIR(src/makeit.c)
AC_CONFIG_AUX_DIR(autoconf)
37
AC_CONFIG_HEADERS(config.h)
Emmanuel Bertin's avatar
Emmanuel Bertin committed
38
39
40
41
42
43
44
45
46
47
AM_INIT_AUTOMAKE
date=`date +%Y-%m-%d`
date2=`date +"%a %b %d %Y"`
date3=`date +"%B %Y"`
AC_DEFINE_UNQUOTED(DATE, "$date", [Archive creation date])
AC_SUBST(PACKAGER, "Emmanuel Bertin")
AC_SUBST(DATE2, "$date2")
AC_SUBST(DATE3, "$date3")

# Include macros
Emmanuel Bertin's avatar
Emmanuel Bertin committed
48
49
sinclude(acx_atlas.m4)
sinclude(acx_fftw.m4)
50
sinclude(acx_mkl.m4)
Emmanuel Bertin's avatar
Emmanuel Bertin committed
51
sinclude(acx_prog_cc_optim.m4)
Emmanuel Bertin's avatar
Emmanuel Bertin committed
52
53
sinclude(acx_pthread.m4)
sinclude(acx_urbi_resolve_dir.m4)
Emmanuel Bertin's avatar
Emmanuel Bertin committed
54
55
56
57

# Display pakage and version number
AC_MSG_RESULT([*********** Configuring:  $PACKAGE $VERSION ($date) **********])

58
# Provide special option for choosing automatically the compilation flags.
59
AC_MSG_CHECKING([if compilation flags should be set automatically])
60
AC_ARG_ENABLE(auto-flags,
61
	[AS_HELP_STRING([--enable-auto-flags],
62
63
64
65
	[Let the configure script choose the compilation flags \
(off by default)])],
	AC_MSG_RESULT([yes]),
	AC_MSG_RESULT([no]))
Emmanuel Bertin's avatar
Emmanuel Bertin committed
66
67

# Provide special option for the Linux Intel C compiler
68
AC_MSG_CHECKING([whether we should use the INTEL compiler])
Emmanuel Bertin's avatar
Emmanuel Bertin committed
69
AC_ARG_ENABLE(icc,
70
	[AS_HELP_STRING([--enable-icc],
Emmanuel Bertin's avatar
Emmanuel Bertin committed
71
72
	[Enable special mode for compilation with the Intel compiler \
(off by default)])],
73
74
75
76
77
78
79
80
81
82
83
84
        CC="icc"
	AC_MSG_RESULT([yes]),
	AC_MSG_RESULT([no]))

# Provide special options for INTEL MKL
# We force the use of icc
AC_MSG_CHECKING([whether we should use INTEL's MKL])
AC_ARG_ENABLE(mkl,
	[AS_HELP_STRING([--enable-mkl],
	[Use INTEL's MKL for solvers and FFTs (off by default)])],
        enable_icc="yes"
        CC="icc"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
85
86
87
88
	AC_MSG_RESULT([yes]),
	AC_MSG_RESULT([no]))

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

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

# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
116
117
AC_TYPE_LONG_LONG_INT
AC_TYPE_UNSIGNED_LONG_LONG_INT
Emmanuel Bertin's avatar
Emmanuel Bertin committed
118
119
120
121
122
123
124
125
126
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
127
128
129
130
AC_CHECK_FUNCS([atexit logf getenv gettimeofday memcpy memmove memset mkdir \
		munmap posix_memalign setlinebuf sincosf strstr sysconf])
AC_CHECK_FUNC([isnan], AC_DEFINE_UNQUOTED([HAVE_ISNAN2], 1,
		[Second isnan check]))
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
138
AC_ARG_WITH(atlas-libdir,
        [AS_HELP_STRING([--with-atlas-libdir=<ATLAS library path>],
139
        [Provide an alternative path to the ATLAS library])])
Emmanuel Bertin's avatar
Emmanuel Bertin committed
140
AC_ARG_WITH(atlas-incdir,
141
        [AS_HELP_STRING([--with-atlas-incdir=<ATLAS include dir>],
142
        [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
        [AS_HELP_STRING([--with-fftw-libdir=<FFTW library path>],
147
        [Provide an alternative path to the FFTW library])])
Emmanuel Bertin's avatar
Emmanuel Bertin committed
148
AC_ARG_WITH(fftw-incdir,
149
        [AS_HELP_STRING([--with-fftw-incdir=<FFTW include dir>],
150
        [Provide an alternative path to the FFTW include directory])])
Emmanuel Bertin's avatar
Emmanuel Bertin committed
151

152
153
154
155
156
# Provide special options for the MKL library
AC_ARG_WITH(mkl-dir,
        [AS_HELP_STRING([--with-mkl-dir=<MKL path>],
        [Provide an alternative path to the MKL library])])

Emmanuel Bertin's avatar
Emmanuel Bertin committed
157
# Provide a special option for the default XSLT URL
158
with_xsl_url="file://"$(URBI_RESOLVE_DIR([$datadir]))"/$PACKAGE_NAME/$PACKAGE_NAME.xsl"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
159
AC_ARG_WITH(xsl_url,
160
	[AS_HELP_STRING([--with-xsl_url=<default URL for XSLT filter>],
161
	[Provide an alternative default URL of the XSLT filter])])
Emmanuel Bertin's avatar
Emmanuel Bertin committed
162

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

165
# Provide special option to disable model-fitting (enabled by default)
166
enable_model_fitting="yes"
167
168
AC_MSG_CHECKING([if model-fitting should be disabled])
AC_ARG_ENABLE([model-fitting],
169
	[AS_HELP_STRING([--disable-model-fitting],
170
171
172
173
174
175
	[Disable model-fitting and library dependencies (enabled by default)])],
	if test "$enable_model_fitting" = "no"; then
	  AC_MSG_RESULT([yes])
	else
	  AC_MSG_RESULT([no])
	fi)
176

Emmanuel Bertin's avatar
Emmanuel Bertin committed
177
178
179
# Set flags for multithreading
n_pthreads=16
AC_ARG_ENABLE(threads,
180
        [AS_HELP_STRING([--enable-threads@<:@=<max_number_of_threads>@:>@],
181
	[Enable multhreading (on with up to 16 threads by default)])],
Emmanuel Bertin's avatar
Emmanuel Bertin committed
182
183
184
185
186
187
188
189
190
191
    if test "$enableval" = "no"; then
      use_pthreads="no"
    else
      use_pthreads="yes"
      if test "$enableval" != "yes"; then
        n_pthreads=$enableval
      fi
    fi,
    use_pthreads=yes
    )
192
193
# Deactivate multithreading for now
use_pthreads="no"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
194

195
196
197
198
199
# Provide special option for profiling
AC_MSG_CHECKING([for profiler mode])
AC_ARG_ENABLE(profiling,
	[AS_HELP_STRING([--enable-profiling],
	[Enable special mode for profiling (off by default)])],
Emmanuel Bertin's avatar
Emmanuel Bertin committed
200
201
202
	AC_MSG_RESULT([yes]),
	AC_MSG_RESULT([no]))

203
204
205
# Enable linking options for making the executable as portable as possible.
AC_MSG_CHECKING([best linking option])
AC_ARG_ENABLE(best-link,
206
	[AS_HELP_STRING([--enable-best-link],
207
208
	[Choose the right combination of static and dynamic linking to make \
the executable as portable as possible (off by default)])],
Emmanuel Bertin's avatar
Emmanuel Bertin committed
209
210
	AC_MSG_RESULT([yes]),
	AC_MSG_RESULT([no]))
Emmanuel Bertin's avatar
Emmanuel Bertin committed
211

212
213
############# Actions to complete if model-fitting is activated ##############
AC_MSG_CHECKING([for model-fitting configure option])
214
if test "$enable_model_fitting" = "yes"; then
215
216
217
218
219
  AC_MSG_RESULT([enabled])
  AC_DEFINE(USE_MODEL, 1, [Triggers model-fitting and linking with ATLAS/FFTW])
else
  AC_MSG_RESULT([disabled])
fi
220
AM_CONDITIONAL(USE_MODEL, [test $enable_model_fitting = "yes"])
221

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

236
237
238
if test "$enable_model_fitting" = "yes"; then
############ handle the INTEL MKL library (FFTW + LAPACK) ###########
  if test "$enable_mkl" = "yes"; then
239
    convlibs="${srcdir}/wcs/libwcs_c.a,${srcdir}/levmar/liblevmar.a"
240
    ACX_MKL($with_mkl_dir,,$enable_best_link,$convlibs)
241
242
    if test "$MKL_WARN" != ""; then
      AC_MSG_WARN([$MKL_WARN])
243
    fi
244
    AM_CFLAGS="$AM_CFLAGS $MKL_CFLAGS "
245
246
    AM_LDFLAGS="$AM_LDFLAGS $MKL_LDFLAGS"
    LIBS="$LIBS $MKL_LIBS"
247
  else
248
249
250
251
252
253
254
################ handle the FFTW library (Fourier transforms) ################
    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.]))
Emmanuel Bertin's avatar
Emmanuel Bertin committed
255
################## handle the ATLAS library(linear algebra) ##################
256
257
258
259
260
261
    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.]))
262
  fi
Emmanuel Bertin's avatar
Emmanuel Bertin committed
263
264
fi

265
266
# Compile with profiling option
if test "$enable_profiling" = "yes"; then
267
  if test "$enable_icc" = "yes"; then
268
    AM_CFLAGS="$AM_CFLAGS -pq"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
269
  else
270
    AM_CFLAGS="$AM_CFLAGS -pg"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
271
  fi
272
  enable_best_link="no"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
273
274
fi

275
# "Best" linking option
276
if test "$enable_best_link" = "yes"; then
277
278
  if test "$enable_icc" = "yes"; then
    AM_LDFLAGS="-static-intel -openmp-link static -shared-libgcc \
279
	-static-libtool-libs -no-intel-extensions -avoid-version $AM_LDFLAGS"
280
281
282
  else
    AM_LDFLAGS="-shared-libgcc -static-libtool-libs -avoid-version $AM_LDFLAGS"
  fi
Emmanuel Bertin's avatar
Emmanuel Bertin committed
283
284
fi

285
286
287
AC_SUBST(AM_CFLAGS)
AC_SUBST(AM_CPPFLAGS)
AC_SUBST(AM_LDFLAGS)
Emmanuel Bertin's avatar
Emmanuel Bertin committed
288
289

# Display compiler and linker flags
Emmanuel Bertin's avatar
Emmanuel Bertin committed
290
AC_MSG_RESULT([***************************************************************])
291
292
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
293
294
295
296
297
298
299
300
301
302
303
304
305
AC_MSG_RESULT([Default XSLT URL: $xsl_url])
AC_MSG_RESULT([***************************************************************])

AC_CONFIG_FILES([
Makefile
src/Makefile
src/fits/Makefile
src/levmar/Makefile
src/wcs/Makefile
man/Makefile
tests/Makefile
sextractor.spec
man/sex.1])
Emmanuel Bertin's avatar
Emmanuel Bertin committed
306
AC_OUTPUT