1 dnl Process this file with autoconf to produce a configure script.
4 AC_CONFIG_SRCDIR(gsl_math.h)
6 AM_INIT_AUTOMAKE([gnu no-dependencies])
7 AC_CONFIG_HEADERS([config.h])
10 dnl Library versioning (current:revision:age)
11 dnl See the libtool manual for an explanation of the numbers
13 dnl gsl-1.0 libgsl 0:0:0 libgslcblas 0:0:0
14 dnl gsl-1.1 libgsl 1:0:1 libgslcblas 0:0:0
15 dnl gsl-1.1.1 libgsl 2:0:2 libgslcblas 0:0:0
16 dnl gsl-1.2 libgsl 3:0:3 libgslcblas 0:0:0
17 dnl gsl-1.3 libgsl 4:0:4 libgslcblas 0:0:0
18 dnl gsl-1.4 libgsl 5:0:5 libgslcblas 0:0:0
19 dnl gsl-1.5 libgsl 6:0:6 libgslcblas 0:0:0
20 dnl gsl-1.6 libgsl 7:0:7 libgslcblas 0:0:0
21 dnl gsl-1.7 libgsl 8:0:8 libgslcblas 0:0:0
22 dnl gsl-1.8 libgsl 9:0:9 libgslcblas 0:0:0
23 dnl gsl-1.9 libgsl 10:0:10 libgslcblas 0:0:0
24 dnl gsl-1.10 libgsl 10:0:10 (*) libgslcblas 0:0:0
25 dnl gsl-1.11 libgsl 12:0:12 libgslcblas 0:0:0
27 dnl (*) There was an error on this release. Firstly, the versioning
28 dnl numbers were not updated. Secondly, 2 functions were removed, but
29 dnl the age not reset--this should have been 11:0:0. However these
30 dnl functions were not documented and are regarded as internal, so we
31 dnl will assume 11:0:11.
33 dnl How to update library version number
34 dnl ====================================
36 dnl C: increment if the interface has additions, changes, removals.
38 dnl R: increment any time the source changes; set to 0 if you
39 dnl incremented CURRENT
41 dnl A: increment if any interfaces have been added; set to 0 if any
42 dnl interfaces have been removed. removal has precedence over adding,
43 dnl so set to 0 if both happened.
54 GSL_LT_VERSION="${GSL_CURRENT}:${GSL_REVISION}:${GSL_AGE}"
55 AC_SUBST(GSL_LT_VERSION)
57 GSL_LT_CBLAS_VERSION="${CBLAS_CURRENT}:${CBLAS_REVISION}:${CBLAS_AGE}"
58 AC_SUBST(GSL_LT_CBLAS_VERSION)
64 AC_DEFINE(RELEASED,[],[Defined if this is an official release])
68 dnl things required by automake
72 dnl Check for which system.
75 dnl Checks for programs.
83 dnl Check compiler features
90 GSL_CFLAGS="-I$includedir"
91 GSL_LIBS="-L$libdir -lgsl"
96 dnl Check for "extern inline", using a modified version of the test
97 dnl for AC_C_INLINE from acspecific.mt
99 AC_CACHE_CHECK([for extern inline], ac_cv_c_extern_inline,
100 [ac_cv_c_extern_inline=no
101 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[extern $ac_cv_c_inline double foo(double x);
102 extern $ac_cv_c_inline double foo(double x) { return x + 1.0 ; } ;
103 double foo (double x) { return x + 1.0 ; };]], [[ foo(1.0) ]])],[ac_cv_c_extern_inline="yes"],[])
106 if test "$ac_cv_c_extern_inline" != no ; then
107 AC_DEFINE(HAVE_INLINE,[],[Define if you have inline])
110 dnl Checks for header files.
111 AC_CHECK_HEADERS(ieeefp.h)
113 dnl Checks for typedefs, structures, and compiler characteristics.
121 AM_CONDITIONAL(MINGW32_HOST, test "$MINGW" = "true")
123 dnl Checks for library functions.
128 dnl strcasecmp, strerror, xmalloc, xrealloc, probably others should be added.
129 dnl removed strerror from this list, it's hardcoded in the err/ directory
130 dnl Any functions which appear in this list of functions should be provided
131 dnl in the utils/ directory
132 dnl xmalloc is not used, removed (bjg)
133 AC_REPLACE_FUNCS(memcpy memmove strdup strtol strtoul)
135 AC_CACHE_CHECK(for EXIT_SUCCESS and EXIT_FAILURE,
136 ac_cv_decl_exit_success_and_failure,
144 ac_cv_decl_exit_success_and_failure=yes,
145 ac_cv_decl_exit_success_and_failure=no)
148 if test "$ac_cv_decl_exit_success_and_failure" = yes ; then
149 AC_DEFINE(HAVE_EXIT_SUCCESS_AND_FAILURE,1,[Defined if you have ansi EXIT_SUCCESS and EXIT_FAILURE in stdlib.h])
152 dnl Use alternate libm if specified by user
154 if test "x$LIBS" = "x" ; then
158 dnl Remember to put a definition in acconfig.h for each of these
159 AC_CHECK_DECLS(feenableexcept,,,[#define _GNU_SOURCE 1
161 AC_CHECK_DECLS(fesettrapenable,,,[#define _GNU_SOURCE 1
163 AC_CHECK_DECLS(hypot,,,[#include <math.h>])
164 AC_CHECK_DECLS(expm1,,,[#include <math.h>])
165 AC_CHECK_DECLS(acosh,,,[#include <math.h>])
166 AC_CHECK_DECLS(asinh,,,[#include <math.h>])
167 AC_CHECK_DECLS(atanh,,,[#include <math.h>])
168 AC_CHECK_DECLS(ldexp,,,[#include <math.h>])
169 AC_CHECK_DECLS(frexp,,,[#include <math.h>])
170 AC_CHECK_DECLS(isinf,,,[#include <math.h>])
171 AC_CHECK_DECLS(isfinite,,,[#include <math.h>])
172 AC_CHECK_DECLS(finite,,,[#include <math.h>
176 AC_CHECK_DECLS(isnan,,,[#include <math.h>])
178 dnl OpenBSD has a broken implementation of log1p.
181 AC_MSG_RESULT([avoiding OpenBSD system log1p - using gsl version])
184 AC_CHECK_DECLS(log1p,,,[#include <math.h>])
188 AC_CACHE_CHECK([for long double stdio], ac_cv_func_printf_longdouble,
189 [AC_RUN_IFELSE([AC_LANG_SOURCE([[
194 const char * s = "5678.25"; long double x = 1.234 ;
195 fprintf(stderr,"%Lg\n",x) ;
196 sscanf(s, "%Lg", &x);
197 if (x == 5678.25) {exit (0);} else {exit(1); };
198 }]])],[ac_cv_func_printf_longdouble="yes"],[ac_cv_func_printf_longdouble="no"],[ac_cv_func_printf_longdouble="no"])])
200 if test "$ac_cv_func_printf_longdouble" != no; then
201 AC_DEFINE(HAVE_PRINTF_LONGDOUBLE,1,[Define this if printf can handle %Lf for long double])
204 AC_CACHE_CHECK([for extended floating point registers],ac_cv_c_extended_fp,
207 ac_cv_c_extended_fp=no
210 ac_cv_c_extended_fp=no
213 ac_cv_c_extended_fp=no
216 ac_cv_c_extended_fp=no
219 ac_cv_c_extended_fp=yes
222 ac_cv_c_extended_fp=yes
225 ac_cv_c_extended_fp=yes
228 ac_cv_c_extended_fp=unknown
233 if test $ac_cv_c_extended_fp != "no" ; then
234 AC_DEFINE(HAVE_EXTENDED_PRECISION_REGISTERS,1,[Defined on architectures with excess floating-point precision])
237 AC_CACHE_CHECK([for IEEE arithmetic interface type], ac_cv_c_ieee_interface,
240 ac_cv_c_ieee_interface=gnusparc
243 ac_cv_c_ieee_interface=gnum68k
246 ac_cv_c_ieee_interface=gnuppc
248 *86-*-gnu | *86_64-*-gnu | *86-*-linux* | *86_64-*-linux*)
249 ac_cv_c_ieee_interface=gnux86
252 ac_cv_c_ieee_interface=sunos4
255 ac_cv_c_ieee_interface=solaris
258 ac_cv_c_ieee_interface=hpux11
261 ac_cv_c_ieee_interface=hpux
264 ac_cv_c_ieee_interface=tru64
267 ac_cv_c_ieee_interface=aix
270 ac_cv_c_ieee_interface=irix
273 ac_cv_c_ieee_interface=darwin
276 ac_cv_c_ieee_interface=darwin86
279 ac_cv_c_ieee_interface=netbsd
282 ac_cv_c_ieee_interface=openbsd
285 ac_cv_c_ieee_interface=freebsd
288 ac_cv_c_ieee_interface=os2emx
291 ac_cv_c_ieee_interface=unknown
296 if test "$ac_cv_c_ieee_interface" = "gnux86" ; then
297 AC_CACHE_CHECK([for FPU_SETCW], ac_cv_c_fpu_setcw,
298 [ac_cv_c_fpu_setcw=no
299 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <fpu_control.h>
301 #include <i386/fpu_control.h>
302 #define _FPU_SETCW(cw) __setfpucw(cw)
304 ]], [[ unsigned short mode = 0 ; _FPU_SETCW(mode); ]])],[ac_cv_c_fpu_setcw="yes"],[ac_cv_c_ieee_interface=unknown])
308 if test "$ac_cv_c_ieee_interface" = "gnux86" ; then
309 AC_CACHE_CHECK([for SSE extensions], ac_cv_c_fpu_sse,
311 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
313 #define _FPU_SETMXCSR(cw_sse) asm volatile ("ldmxcsr %0" : : "m" (*&cw_sse))
314 ]], [[ unsigned int mode = 0x1f80 ; _FPU_SETMXCSR(mode); exit(0); ]])],[ac_cv_c_fpu_sse="yes"])
316 if test $ac_cv_c_fpu_sse = yes; then
317 AC_DEFINE([HAVE_FPU_X86_SSE], 1,
318 [Define if x86 processor has sse extensions.])
322 ac_tr_ieee_interface=HAVE_`echo $ac_cv_c_ieee_interface | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`_IEEE_INTERFACE
323 AC_DEFINE_UNQUOTED($ac_tr_ieee_interface,1,[IEEE Interface Type])
325 AC_SUBST(HAVE_GNUSPARC_IEEE_INTERFACE)
326 AC_SUBST(HAVE_GNUM68K_IEEE_INTERFACE)
327 AC_SUBST(HAVE_GNUPPC_IEEE_INTERFACE)
328 AC_SUBST(HAVE_GNUX86_IEEE_INTERFACE)
329 AC_SUBST(HAVE_SUNOS4_IEEE_INTERFACE)
330 AC_SUBST(HAVE_SOLARIS_IEEE_INTERFACE)
331 AC_SUBST(HAVE_HPUX11_IEEE_INTERFACE)
332 AC_SUBST(HAVE_HPUX_IEEE_INTERFACE)
333 AC_SUBST(HAVE_TRU64_IEEE_INTERFACE)
334 AC_SUBST(HAVE_IRIX_IEEE_INTERFACE)
335 AC_SUBST(HAVE_AIX_IEEE_INTERFACE)
336 AC_SUBST(HAVE_FREEBSD_IEEE_INTERFACE)
337 AC_SUBST(HAVE_OS2EMX_IEEE_INTERFACE)
338 AC_SUBST(HAVE_NETBSD_IEEE_INTERFACE)
339 AC_SUBST(HAVE_OPENBSD_IEEE_INTERFACE)
340 AC_SUBST(HAVE_DARWIN_IEEE_INTERFACE)
341 AC_SUBST(HAVE_DARWIN86_IEEE_INTERFACE)
343 dnl Check for IEEE control flags
345 save_cflags="$CFLAGS"
346 AC_CACHE_CHECK([for IEEE compiler flags], ac_cv_c_ieee_flags,
350 if test X"$GCC" = Xyes ; then
351 ieee_flags='-mieee -mfp-rounding-mode=d'
353 # This assumes Compaq's C compiler.
354 ieee_flags='-ieee -fprm d'
358 if test X"$ieee_flags" != X ; then
359 CFLAGS="$ieee_flags $CFLAGS"
360 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[int foo;]])],[ac_cv_c_ieee_flags="$ieee_flags"],[ac_cv_c_ieee_flags="none"])
362 ac_cv_c_ieee_flags="none"
365 if test "$ac_cv_c_ieee_flags" != "none" ; then
366 CFLAGS="$ac_cv_c_ieee_flags $save_cflags"
368 CFLAGS="$save_cflags"
371 dnl Check IEEE comparisons, whether "x != x" is true for NaNs
373 AC_CACHE_CHECK([for IEEE comparisons], ac_cv_c_ieee_comparisons,
374 [AC_RUN_IFELSE([AC_LANG_SOURCE([[
378 int status; double inf, nan;
381 status = (nan == nan);
383 }]])],[ac_cv_c_ieee_comparisons="yes"],[ac_cv_c_ieee_comparisons="no"],[ac_cv_c_ieee_comparisons="yes"])
386 if test "$ac_cv_c_ieee_comparisons" != no ; then
387 AC_DEFINE(HAVE_IEEE_COMPARISONS,1,[Define this if IEEE comparisons work correctly (e.g. NaN != NaN)])
390 dnl Check for IEEE denormalized arithmetic
392 AC_CACHE_CHECK([for IEEE denormalized values], ac_cv_c_ieee_denormals,
393 [AC_RUN_IFELSE([AC_LANG_SOURCE([[
398 volatile double z = 1e-308;
399 for (i = 0; i < 5; i++) { z = z / 10.0 ; };
400 for (i = 0; i < 5; i++) { z = z * 10.0 ; };
403 }]])],[ac_cv_c_ieee_denormals="yes"],[ac_cv_c_ieee_denormals="no"],[ac_cv_c_ieee_denormals="yes"])
406 if test "$ac_cv_c_ieee_denormals" != no ; then
407 AC_DEFINE(HAVE_IEEE_DENORMALS,1,[Define this if IEEE denormalized numbers are available])
410 AH_TEMPLATE([HIDE_INLINE_STATIC],[Define if you need to hide the static definitions of inline functions])
412 AH_BOTTOM([/* Use 0 and 1 for EXIT_SUCCESS and EXIT_FAILURE if we don't have them */
413 #if !HAVE_EXIT_SUCCESS_AND_FAILURE
414 #define EXIT_SUCCESS 0
415 #define EXIT_FAILURE 1
418 AH_BOTTOM([/* Define one of these if you have a known IEEE arithmetic interface */
419 #undef HAVE_GNUSPARC_IEEE_INTERFACE
420 #undef HAVE_GNUM68K_IEEE_INTERFACE
421 #undef HAVE_GNUPPC_IEEE_INTERFACE
422 #undef HAVE_GNUX86_IEEE_INTERFACE
423 #undef HAVE_SUNOS4_IEEE_INTERFACE
424 #undef HAVE_SOLARIS_IEEE_INTERFACE
425 #undef HAVE_HPUX11_IEEE_INTERFACE
426 #undef HAVE_HPUX_IEEE_INTERFACE
427 #undef HAVE_TRU64_IEEE_INTERFACE
428 #undef HAVE_IRIX_IEEE_INTERFACE
429 #undef HAVE_AIX_IEEE_INTERFACE
430 #undef HAVE_FREEBSD_IEEE_INTERFACE
431 #undef HAVE_OS2EMX_IEEE_INTERFACE
432 #undef HAVE_NETBSD_IEEE_INTERFACE
433 #undef HAVE_OPENBSD_IEEE_INTERFACE
434 #undef HAVE_DARWIN_IEEE_INTERFACE
435 #undef HAVE_DARWIN86_IEEE_INTERFACE])
437 AH_BOTTOM([/* Define a rounding function which moves extended precision values
438 out of registers and rounds them to double-precision. This should
439 be used *sparingly*, in places where it is necessary to keep
440 double-precision rounding for critical expressions while running in
441 extended precision. For example, the following code should ensure
442 exact equality, even when extended precision registers are in use,
444 double q = GSL_COERCE_DBL(3.0/7.0) ;
445 if (q == GSL_COERCE_DBL(3.0/7.0)) { ... } ;
447 It carries a penalty even when the program is running in double
448 precision mode unless you compile a separate version of the
449 library with HAVE_EXTENDED_PRECISION_REGISTERS turned off. */
451 #if HAVE_EXTENDED_PRECISION_REGISTERS
452 #define GSL_COERCE_DBL(x) (gsl_coerce_double(x))
454 #define GSL_COERCE_DBL(x) (x)
457 AH_BOTTOM([/* Substitute gsl functions for missing system functions */
460 #define hypot gsl_hypot
464 #define log1p gsl_log1p
468 #define expm1 gsl_expm1
472 #define acosh gsl_acosh
476 #define asinh gsl_asinh
480 #define atanh gsl_atanh
484 #define ldexp gsl_ldexp
488 #define frexp gsl_frexp
492 #define isinf gsl_isinf
495 #if !HAVE_DECL_FINITE
496 #define finite gsl_finite
500 #define isnan gsl_isnan
503 AH_BOTTOM([#ifdef __GNUC__
504 #define DISCARD_POINTER(p) do { ; } while(p ? 0 : 0);
506 #define DISCARD_POINTER(p) /* ignoring discarded pointer */
509 AH_BOTTOM([#if defined(GSL_RANGE_CHECK_OFF) || !defined(GSL_RANGE_CHECK)
510 #define GSL_RANGE_CHECK 0 /* turn off range checking by default internally */
513 AH_VERBATIM([GSL_DISABLE_DEPRECATED],
514 [/* Disable deprecated functions and enums while building */
515 #define GSL_DISABLE_DEPRECATED 1])
518 AC_CONFIG_FILES([gsl-config gsl.pc gsl_version.h gsl.spec gsl/Makefile test/Makefile err/Makefile sys/Makefile utils/Makefile const/Makefile min/Makefile multimin/Makefile ieee-utils/Makefile fft/Makefile specfunc/Makefile dht/Makefile fit/Makefile multifit/Makefile bspline/Makefile statistics/Makefile sum/Makefile roots/Makefile multiroots/Makefile ntuple/Makefile poly/Makefile qrng/Makefile rng/Makefile randist/Makefile siman/Makefile integration/Makefile interpolation/Makefile doc/Makefile block/Makefile vector/Makefile matrix/Makefile histogram/Makefile monte/Makefile ode-initval/Makefile cblas/Makefile blas/Makefile linalg/Makefile eigen/Makefile permutation/Makefile combination/Makefile sort/Makefile complex/Makefile diff/Makefile deriv/Makefile cheb/Makefile cdf/Makefile wavelet/Makefile Makefile])