configure.ac 7.26 KB
Newer Older
Emmanuel Bertin's avatar
Emmanuel Bertin committed
1
# configure.in for SExtractor
2
# (C) E.Bertin 2002-2009
Emmanuel Bertin's avatar
Emmanuel Bertin committed
3
4
5
6
7
8
# Process this file with autoconf to produce a configure script.
# First, disable the annoying config.cache
define([AC_CACHE_LOAD],)
define([AC_CACHE_SAVE],)

# This is your standard Bertin source code...
9
AC_INIT(sextractor, 2.9.0, [bertin@iap.fr])
Emmanuel Bertin's avatar
Emmanuel Bertin committed
10
11
12
13
14
15
16
17
18
19
20
21
22
AC_CONFIG_SRCDIR(src/makeit.c)
AC_CONFIG_AUX_DIR(autoconf)
AM_CONFIG_HEADER(config.h)
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
23
24
sinclude(acx_atlas.m4)
sinclude(acx_fftw.m4)
Emmanuel Bertin's avatar
Emmanuel Bertin committed
25
sinclude(acx_prog_cc_optim.m4)
Emmanuel Bertin's avatar
Emmanuel Bertin committed
26
27
sinclude(acx_pthread.m4)
sinclude(acx_urbi_resolve_dir.m4)
Emmanuel Bertin's avatar
Emmanuel Bertin committed
28
29
30
31
32
33
34

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

# Initialize the list of compilers to consider
cclist="cc gcc"

35
36
# Provide special option for choosing automatically the compilation flags.
AC_MSG_CHECKING([if compilation flags are set automatically])
37
38
AC_ARG_ENABLE(auto-flags,
	[AC_HELP_STRING([--enable-auto-flags],
39
40
41
42
43
44
	[Let the configure script choose the compilation flags \
(off by default)])],
        use_autoflag="yes"
	AC_MSG_RESULT([yes]),
        use_autoflag="no"
	AC_MSG_RESULT([no]))
Emmanuel Bertin's avatar
Emmanuel Bertin committed
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59

# Provide special option for the Linux Intel C compiler
AC_MSG_CHECKING([for Linux Intel C compiler mode])
AC_ARG_ENABLE(icc,
	[AC_HELP_STRING([--enable-icc],
	[Enable special mode for compilation with the Intel compiler \
(off by default)])],
        use_icc="yes"
        cclist="icc $cclist"
	AC_MSG_RESULT([yes]),
        use_icc="no"
	AC_MSG_RESULT([no]))

# Checks for programs.
# GCC is chosen last because it is likely to yield less optimized code
Emmanuel Bertin's avatar
Emmanuel Bertin committed
60
AC_LANG(C)
Emmanuel Bertin's avatar
Emmanuel Bertin committed
61
AC_PROG_CC([$cclist])
Emmanuel Bertin's avatar
Emmanuel Bertin committed
62
# C Compiler: Check that it is ANSI C and POSIX-compliant
Emmanuel Bertin's avatar
Emmanuel Bertin committed
63
64
AM_PROG_CC_STDC
AC_ISC_POSIX
65
66
67
68
69
70
# Override automatic CFLAGS and LDFLAGS with those of user
if test "$use_autoflag" = "yes"; then
  CFLAGS=""
  LDFLAGS =""
  ACX_PROG_CC_OPTIM
fi
Emmanuel Bertin's avatar
Emmanuel Bertin committed
71
AC_PROG_LIBTOOL
Emmanuel Bertin's avatar
Emmanuel Bertin committed
72
73
74
75
76
77
78
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
79
80
AC_CHECK_HEADERS([fcntl.h limits.h malloc.h stdlib.h string.h sys/mman.h \
		sys/types.h unistd.h])
Emmanuel Bertin's avatar
Emmanuel Bertin committed
81
82
83
84
85
86
87
88
89
90

# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
AC_STRUCT_TM
AC_TYPE_UID_T

# Checks for library functions.
AC_FUNC_ERROR_AT_LINE
Emmanuel Bertin's avatar
Emmanuel Bertin committed
91
#AC_FUNC_MALLOC
Emmanuel Bertin's avatar
Emmanuel Bertin committed
92
93
94
95
AC_FUNC_MMAP
AC_TYPE_SIGNAL
AC_FUNC_STAT
AC_FUNC_STRFTIME
Emmanuel Bertin's avatar
Emmanuel Bertin committed
96
97
AC_CHECK_FUNCS([atexit getenv memcpy memmove memset mkdir munmap strstr \
		sincos logf])
Emmanuel Bertin's avatar
Emmanuel Bertin committed
98
99
100
101
102

# Check support for large files
AC_SYS_LARGEFILE
AC_FUNC_FSEEKO

Emmanuel Bertin's avatar
Emmanuel Bertin committed
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# Set the data directory to a true absolute path
datadir2=$(URBI_RESOLVE_DIR([$datadir]))

# Provide special options for ATLAS
AC_ARG_WITH(atlas,
        [AC_HELP_STRING([--with-atlas=<ATLAS library path>],
        [Provide an alternative path to the ATLAS library])],
    atlas_libdir=$withval,
    atlas_libdir=""
    )
AC_ARG_WITH(atlas-incdir,
        [AC_HELP_STRING([--with-atlas-incdir=<ATLAS include dir>],
        [Provide an alternative path to the ATLAS include directory])],
    atlas_incdir=$withval,
    atlas_incdir=""
    )

# Provide special options for FFTW
AC_ARG_WITH(fftw,
        [AC_HELP_STRING([--with-fftw=<FFTW library path>],
        [Provide an alternative path to the FFTW library])],
    fftw_libdir=$withval,
    fftw_libdir=""
    )
AC_ARG_WITH(fftw-incdir,
        [AC_HELP_STRING([--with-fftw-incdir=<FFTW include dir>],
        [Provide an alternative path to the FFTW include directory])],
    fftw_incdir=$withval,
    fftw_incdir=""
    )

# Provide a special option for the default XSLT URL
AC_ARG_WITH(xsl_url,
	[AC_HELP_STRING([--with-xsl_url=<default URL for XSLT filter>],
	[Provide an alternative default URL of the XSLT filter])],
	[xsl_url=$withval],
	[xsl_url="file://$datadir2/$PACKAGE_NAME/$PACKAGE_NAME.xsl"]
	)

AC_DEFINE_UNQUOTED([XSL_URL], "$xsl_url",[Default URL of the XSLT filter])

# Set flags for multithreading
n_pthreads=16
AC_ARG_ENABLE(threads,
        [AC_HELP_STRING([--enable-threads@<:@=<max_number_of_threads>@:>@],
148
	[Enable multhreading (on with up to 16 threads by default)])],
Emmanuel Bertin's avatar
Emmanuel Bertin committed
149
150
151
152
153
154
155
156
157
158
    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
    )
159
160
# Deactivate multithreading for now
use_pthreads="no"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
161
162
163
164
165
166
167
168
169
170
171
172

# Provide special option for gprof profiling
AC_MSG_CHECKING([for gprof profiler mode])
AC_ARG_ENABLE(gprof,
	[AC_HELP_STRING([--enable-gprof],
	[Enable special mode for compilation with the gprof profiler \
(off by default)])],
        use_gprof="yes"
	AC_MSG_RESULT([yes]),
        use_gprof="no"
	AC_MSG_RESULT([no]))

173
174
175
176
177
178
179
# Enable linking options for making the executable as portable as possible.
AC_MSG_CHECKING([best linking option])
AC_ARG_ENABLE(best-link,
	[AC_HELP_STRING([--enable-best-link],
	[Choose the right combination of static and dynamic linking to make \
the executable as portable as possible (off by default)])],
        use_best="yes"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
180
	AC_MSG_RESULT([yes]),
181
        use_best="no"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
182
	AC_MSG_RESULT([no]))
Emmanuel Bertin's avatar
Emmanuel Bertin committed
183

Emmanuel Bertin's avatar
Emmanuel Bertin committed
184
185
186
187
188
189
190
191
192
################# 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"
193
  [AM_CFLAGS="$AM_CFLAGS $PTHREAD_CFLAGS -D_REENTRANT"]
Emmanuel Bertin's avatar
Emmanuel Bertin committed
194
195
196
197
198
  LIBS="$PTHREAD_LIBS $LIBS"
fi
AM_CONDITIONAL(USE_THREADS, test $use_pthreads = "yes")

################ handle the FFTW library (Fourier transforms) ################
199
ACX_FFTW($fftw_libdir,$fftw_incdir,$use_pthreads,yes,
Emmanuel Bertin's avatar
Emmanuel Bertin committed
200
201
202
	[use_fftw=yes],[use_fftw=no])
if test "$use_fftw" = "yes"; then
  LIBS="$FFTW_LIBS $LIBS"
203
204
205
  if test "$FFTW_WARN" != ""; then
    AC_MSG_WARN([$FFTW_WARN])
  fi
Emmanuel Bertin's avatar
Emmanuel Bertin committed
206
207
208
209
210
211
212
213
214
else
  AC_MSG_ERROR([$FFTW_ERROR Exiting.])
fi

################## handle the ATLAS library(linear algebra) ##################
ACX_ATLAS($atlas_libdir,$atlas_incdir,$use_pthreads,
	[use_atlas=yes],[use_atlas=no])
if test "$use_atlas" = "yes"; then
  LIBS="$ATLAS_LIB $LIBS"
215
216
217
  if test "$ATLAS_WARN" != ""; then
    AC_MSG_WARN([$ATLAS_WARN])
  fi
Emmanuel Bertin's avatar
Emmanuel Bertin committed
218
219
else
  AC_MSG_ERROR([$ATLAS_ERROR Exiting.])
Emmanuel Bertin's avatar
Emmanuel Bertin committed
220
221
222
223
224
fi

# Link with gprof option
if test "$use_gprof" = "yes"; then
  if test "$use_icc" = "yes"; then
225
    AM_CFLAGS="$AM_CFLAGS -pq"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
226
  else
227
    AM_CFLAGS="$AM_CFLAGS -pg"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
228
  fi
229
  use_best="no"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
230
231
fi

232
233
# "Best" linking option
if test "$use_best" = "yes"; then
Emmanuel Bertin's avatar
Emmanuel Bertin committed
234
  AM_LDFLAGS="-shared-libgcc -static-libtool-libs $AM_LDFLAGS"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
235
236
fi

237
238
239
AC_SUBST(AM_CFLAGS)
AC_SUBST(AM_CPPFLAGS)
AC_SUBST(AM_LDFLAGS)
Emmanuel Bertin's avatar
Emmanuel Bertin committed
240
241

# Display compiler and linker flags
Emmanuel Bertin's avatar
Emmanuel Bertin committed
242
AC_MSG_RESULT([***************************************************************])
243
244
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
245
246
247
248
249
250
251
252
253
254
255
256
257
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
258
AC_OUTPUT