public software.sextractor

[/] [trunk/] [configure.ac] - Blame information for rev 227

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 bertin
# configure.in for SExtractor
2 221 bertin
# (C) E.Bertin 2002-2010
3 2 bertin
# Process this file with autoconf to produce a configure script.
4
# First, disable the annoying config.cache
5
define([AC_CACHE_LOAD],)
6
define([AC_CACHE_SAVE],)
7
 
8
# This is your standard Bertin source code...
9 227 bertin
AC_INIT(sextractor, 2.12.0, [bertin@iap.fr])
10 2 bertin
AC_CONFIG_SRCDIR(src/makeit.c)
11
AC_CONFIG_AUX_DIR(autoconf)
12
AM_CONFIG_HEADER(config.h)
13
AM_INIT_AUTOMAKE
14
date=`date +%Y-%m-%d`
15
date2=`date +"%a %b %d %Y"`
16
date3=`date +"%B %Y"`
17
AC_DEFINE_UNQUOTED(DATE, "$date", [Archive creation date])
18
AC_SUBST(PACKAGER, "Emmanuel Bertin")
19
AC_SUBST(DATE2, "$date2")
20
AC_SUBST(DATE3, "$date3")
21
 
22
# Include macros
23 173 bertin
sinclude(acx_atlas.m4)
24
sinclude(acx_fftw.m4)
25 2 bertin
sinclude(acx_prog_cc_optim.m4)
26 173 bertin
sinclude(acx_pthread.m4)
27
sinclude(acx_urbi_resolve_dir.m4)
28 2 bertin
 
29
# Display pakage and version number
30
AC_MSG_RESULT([*********** Configuring:  $PACKAGE $VERSION ($date) **********])
31
 
32
# Initialize the list of compilers to consider
33
cclist="cc gcc"
34
 
35 201 bertin
# Provide special option for choosing automatically the compilation flags.
36
AC_MSG_CHECKING([if compilation flags are set automatically])
37 202 bertin
AC_ARG_ENABLE(auto-flags,
38
        [AC_HELP_STRING([--enable-auto-flags],
39 201 bertin
        [Let the configure script choose the compilation flags \
40
(off by default)])],
41
        AC_MSG_RESULT([yes]),
42
        AC_MSG_RESULT([no]))
43 2 bertin
 
44
# Provide special option for the Linux Intel C compiler
45
AC_MSG_CHECKING([for Linux Intel C compiler mode])
46
AC_ARG_ENABLE(icc,
47
        [AC_HELP_STRING([--enable-icc],
48
        [Enable special mode for compilation with the Intel compiler \
49
(off by default)])],
50
        cclist="icc $cclist"
51
        AC_MSG_RESULT([yes]),
52
        AC_MSG_RESULT([no]))
53
 
54
# Checks for programs.
55
# GCC is chosen last because it is likely to yield less optimized code
56 173 bertin
AC_LANG(C)
57 2 bertin
AC_PROG_CC([$cclist])
58 173 bertin
# C Compiler: Check that it is ANSI C and POSIX-compliant
59 2 bertin
AM_PROG_CC_STDC
60
AC_ISC_POSIX
61 201 bertin
# Override automatic CFLAGS and LDFLAGS with those of user
62 206 bertin
if test "$enable_auto_flags" = "yes"; then
63 201 bertin
  CFLAGS=""
64 217 bertin
  LDFLAGS=""
65 201 bertin
  ACX_PROG_CC_OPTIM
66
fi
67 173 bertin
AC_PROG_LIBTOOL
68 2 bertin
AC_PROG_INSTALL
69
 
70
# Checks for libraries.
71
AC_CHECK_LIB(m, sin)
72
 
73
# Checks for header files.
74
AC_HEADER_STDC
75 173 bertin
AC_CHECK_HEADERS([fcntl.h limits.h malloc.h stdlib.h string.h sys/mman.h \
76
                sys/types.h unistd.h])
77 216 bertin
if test "$enable_icc" = "yes" -a "$CC" = "icc"; then
78 205 bertin
  AC_CHECK_HEADERS(mathimf.h)
79
fi
80 2 bertin
 
81
# Checks for typedefs, structures, and compiler characteristics.
82
AC_C_CONST
83
AC_TYPE_OFF_T
84
AC_TYPE_SIZE_T
85 215 bertin
AC_TYPE_LONG_LONG_INT
86
AC_TYPE_UNSIGNED_LONG_LONG_INT
87 2 bertin
AC_STRUCT_TM
88
AC_TYPE_UID_T
89
 
90
# Checks for library functions.
91
AC_FUNC_ERROR_AT_LINE
92 173 bertin
#AC_FUNC_MALLOC
93 2 bertin
AC_FUNC_MMAP
94
AC_TYPE_SIGNAL
95
AC_FUNC_STAT
96
AC_FUNC_STRFTIME
97 173 bertin
AC_CHECK_FUNCS([atexit getenv memcpy memmove memset mkdir munmap strstr \
98 211 bertin
                sincosf logf gettimeofday posix_memalign])
99 2 bertin
 
100
# Check support for large files
101
AC_SYS_LARGEFILE
102
AC_FUNC_FSEEKO
103
 
104 173 bertin
# Set the data directory to a true absolute path
105
datadir2=$(URBI_RESOLVE_DIR([$datadir]))
106 8 bertin
 
107 173 bertin
# Provide special options for ATLAS
108
AC_ARG_WITH(atlas,
109
        [AC_HELP_STRING([--with-atlas=],
110
        [Provide an alternative path to the ATLAS library])],
111
    atlas_libdir=$withval,
112
    atlas_libdir=""
113
    )
114
AC_ARG_WITH(atlas-incdir,
115
        [AC_HELP_STRING([--with-atlas-incdir=],
116
        [Provide an alternative path to the ATLAS include directory])],
117
    atlas_incdir=$withval,
118
    atlas_incdir=""
119
    )
120
 
121
# Provide special options for FFTW
122
AC_ARG_WITH(fftw,
123
        [AC_HELP_STRING([--with-fftw=],
124
        [Provide an alternative path to the FFTW library])],
125
    fftw_libdir=$withval,
126
    fftw_libdir=""
127
    )
128
AC_ARG_WITH(fftw-incdir,
129
        [AC_HELP_STRING([--with-fftw-incdir=],
130
        [Provide an alternative path to the FFTW include directory])],
131
    fftw_incdir=$withval,
132
    fftw_incdir=""
133
    )
134
 
135
# Provide a special option for the default XSLT URL
136
AC_ARG_WITH(xsl_url,
137
        [AC_HELP_STRING([--with-xsl_url=],
138
        [Provide an alternative default URL of the XSLT filter])],
139
        [xsl_url=$withval],
140
        [xsl_url="file://$datadir2/$PACKAGE_NAME/$PACKAGE_NAME.xsl"]
141
        )
142
 
143
AC_DEFINE_UNQUOTED([XSL_URL], "$xsl_url",[Default URL of the XSLT filter])
144
 
145 227 bertin
# Provide special option to disable model-fitting (enabled by default)
146
AC_MSG_CHECKING([if model-fitting should be disabled])
147
AC_ARG_ENABLE([model-fitting],
148
        [AC_HELP_STRING([--disable-model-fitting],
149
        [Disable model-fitting and ATLAS/FFTW dependency \
150
(enabled by default)])],
151
        [use_model="$enableval"],
152
        [use_model="yes"])
153
if test "$use_model" = "no"; then
154
  AC_MSG_RESULT([yes])
155
else
156
  AC_MSG_RESULT([no])
157
fi
158
 
159 173 bertin
# Set flags for multithreading
160
n_pthreads=16
161
AC_ARG_ENABLE(threads,
162
        [AC_HELP_STRING([--enable-threads@<:@=@:>@],
163 181 bertin
        [Enable multhreading (on with up to 16 threads by default)])],
164 173 bertin
    if test "$enableval" = "no"; then
165
      use_pthreads="no"
166
    else
167
      use_pthreads="yes"
168
      if test "$enableval" != "yes"; then
169
        n_pthreads=$enableval
170
      fi
171
    fi,
172
    use_pthreads=yes
173
    )
174 194 bertin
# Deactivate multithreading for now
175
use_pthreads="no"
176 173 bertin
 
177
# Provide special option for gprof profiling
178
AC_MSG_CHECKING([for gprof profiler mode])
179
AC_ARG_ENABLE(gprof,
180
        [AC_HELP_STRING([--enable-gprof],
181
        [Enable special mode for compilation with the gprof profiler \
182
(off by default)])],
183
        AC_MSG_RESULT([yes]),
184
        AC_MSG_RESULT([no]))
185
 
186 202 bertin
# Enable linking options for making the executable as portable as possible.
187
AC_MSG_CHECKING([best linking option])
188
AC_ARG_ENABLE(best-link,
189
        [AC_HELP_STRING([--enable-best-link],
190
        [Choose the right combination of static and dynamic linking to make \
191
the executable as portable as possible (off by default)])],
192 173 bertin
        AC_MSG_RESULT([yes]),
193
        AC_MSG_RESULT([no]))
194
 
195 227 bertin
############# Actions to complete if model-fitting is activated ##############
196
AC_MSG_CHECKING([for model-fitting configure option])
197
if test "$use_model" = "yes"; then
198
  AC_MSG_RESULT([enabled])
199
  AC_DEFINE(USE_MODEL, 1, [Triggers model-fitting and linking with ATLAS/FFTW])
200
else
201
  AC_MSG_RESULT([disabled])
202
fi
203
AM_CONDITIONAL(USE_MODEL, [test $use_model = "yes"])
204
 
205 173 bertin
################# Actions to complete in case of multhreading ################
206
AC_DEFINE_UNQUOTED(THREADS_NMAX, $n_pthreads,[Maximum number of POSIX threads])
207
if test "$use_pthreads" = "yes"; then
208
  AC_MSG_CHECKING([for multithreading])
209
  AC_MSG_RESULT([maximum of $n_pthreads thread(s)])
210
  AC_DEFINE(USE_THREADS, 1, [Triggers multhreading])
211
# CC, CFLAGS and LIBS are system and compiler-dependent
212
  ACX_PTHREAD
213
  CC="$PTHREAD_CC"
214 201 bertin
  [AM_CFLAGS="$AM_CFLAGS $PTHREAD_CFLAGS -D_REENTRANT"]
215 173 bertin
  LIBS="$PTHREAD_LIBS $LIBS"
216 2 bertin
fi
217 227 bertin
AM_CONDITIONAL(USE_THREADS, [test $use_pthreads = "yes"])
218 2 bertin
 
219 173 bertin
################ handle the FFTW library (Fourier transforms) ################
220 227 bertin
if test "$use_model" = "yes"; then
221
  ACX_FFTW($fftw_libdir,$fftw_incdir,$use_pthreads,yes,
222 173 bertin
        [use_fftw=yes],[use_fftw=no])
223 227 bertin
  if test "$use_fftw" = "yes"; then
224
    LIBS="$FFTW_LIBS $LIBS"
225
    if test "$FFTW_WARN" != ""; then
226
      AC_MSG_WARN([$FFTW_WARN])
227
    fi
228
  else
229
    AC_MSG_ERROR([$FFTW_ERROR Exiting.])
230 197 bertin
  fi
231 173 bertin
fi
232
 
233
################## handle the ATLAS library(linear algebra) ##################
234 227 bertin
if test "$use_model" = "yes"; then
235
  ACX_ATLAS($atlas_libdir,$atlas_incdir,$use_pthreads,
236 173 bertin
        [use_atlas=yes],[use_atlas=no])
237 227 bertin
  if test "$use_atlas" = "yes"; then
238
    LIBS="$ATLAS_LIB $LIBS"
239
    if test "$ATLAS_WARN" != ""; then
240
      AC_MSG_WARN([$ATLAS_WARN])
241
    fi
242
  else
243
    AC_MSG_ERROR([$ATLAS_ERROR Exiting.])
244 197 bertin
  fi
245 173 bertin
fi
246
 
247 2 bertin
# Link with gprof option
248 206 bertin
if test "$enable_gprof" = "yes"; then
249
  if test "$enable_icc" = "yes"; then
250 201 bertin
    AM_CFLAGS="$AM_CFLAGS -pq"
251 2 bertin
  else
252 201 bertin
    AM_CFLAGS="$AM_CFLAGS -pg"
253 2 bertin
  fi
254 206 bertin
  enable_best_link="no"
255 2 bertin
fi
256
 
257 202 bertin
# "Best" linking option
258 206 bertin
if test "$enable_best_link" = "yes"; then
259 204 bertin
  AM_LDFLAGS="-shared-libgcc -static-libtool-libs $AM_LDFLAGS"
260 2 bertin
fi
261
 
262 201 bertin
AC_SUBST(AM_CFLAGS)
263
AC_SUBST(AM_CPPFLAGS)
264
AC_SUBST(AM_LDFLAGS)
265 2 bertin
 
266
# Display compiler and linker flags
267 173 bertin
AC_MSG_RESULT([***************************************************************])
268 201 bertin
AC_MSG_RESULT([Compile cmdline:  $CC $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS])
269
AC_MSG_RESULT([Link    cmdline:  $CC $AM_LDFLAGS $LDFLAGS $LIBS])
270 173 bertin
AC_MSG_RESULT([Default XSLT URL: $xsl_url])
271
AC_MSG_RESULT([***************************************************************])
272 2 bertin
 
273 173 bertin
AC_CONFIG_FILES([
274
Makefile
275
src/Makefile
276
src/fits/Makefile
277
src/levmar/Makefile
278
src/wcs/Makefile
279
man/Makefile
280
tests/Makefile
281
sextractor.spec
282
man/sex.1])
283 2 bertin
AC_OUTPUT