1# Process this file with autoconf to produce a configure script. 2AC_INIT(harminv, 1.3.1, stevenj@alum.mit.edu) 3AM_INIT_AUTOMAKE(1.6) 4AC_CONFIG_SRCDIR(harminv.c) 5AM_CONFIG_HEADER(config.h) 6AM_MAINTAINER_MODE 7 8# Shared-library version number; indicates api compatibility, and is 9# *not* the same as the "public" version number. CURRENT:REVISION:AGE 10SHARED_VERSION_INFO="2:4:0" 11AC_SUBST(SHARED_VERSION_INFO) 12AM_ENABLE_SHARED(no) dnl shared libs cause too many headaches to be default 13 14############################################################################## 15 16AC_ARG_ENABLE(debug, [AC_HELP_STRING([--enable-debug,compile for debugging])], 17 enable_debug=$enableval, enable_debug=no) 18if test "$enable_debug" = "yes"; then 19 CFLAGS="-g" 20 CXXFLAGS="-g" 21 FFLAGS="-g" 22 AC_DEFINE(DEBUG,1,[define to enable debugging code]) 23fi 24 25############################################################################## 26 27# Checks for programs. 28AC_PROG_CC 29AC_PROG_MAKE_SET 30AC_PROG_INSTALL 31 32# Fortran libraries are (probably) required for BLAS and LAPACK: 33AC_F77_LIBRARY_LDFLAGS 34AC_F77_DUMMY_MAIN 35AC_F77_WRAPPERS 36 37# Add lots of compiler warnings to check for if we are using gcc: 38# (The variable $GCC is set to "yes" by AC_PROG_CC if we are using gcc.) 39if test "$GCC" = "yes" && test "$USE_MAINTAINER_MODE" = yes; then 40 CFLAGS="$CFLAGS -Wall -W -Wbad-function-cast -Wcast-qual -Wpointer-arith -Wcast-align -pedantic" 41fi 42 43# Checks for header files. 44AC_CHECK_HEADERS(unistd.h getopt.h) 45 46########################################################################### 47 48AC_ARG_WITH(cxx, [ --with-cxx=<dir> force use of C++ and complex<double>], with_cxx=$withval, with_cxx=no) 49 50if test "x$with_cxx" = "xno"; then 51 52have_c_complex=yes 53AC_CHECK_HEADERS(complex.h) 54AC_CACHE_CHECK([for C complex keyword], acx_cv_c_complex, 55 [acx_cv_c_complex=unsupported 56 for acx_kw in complex _Complex __complex__; do 57 AC_TRY_COMPILE([#include <complex.h>], [float $acx_kw foo;], 58 [acx_cv_c_complex=$acx_kw; break]) 59 done 60 ]) 61 62if test "$acx_cv_c_complex" = "unsupported"; then 63 AC_MSG_WARN([C doesn't support complex numbers; switching to C++.]) 64 have_c_complex=no 65else 66 if test "$acx_cv_c_complex" != "complex"; then 67 AC_DEFINE_UNQUOTED(complex, $acx_cv_c_complex, [Define to equivalent of C99 complex keyword. Do not define if complex is supported directly.]) 68 fi 69 70 AC_CACHE_CHECK([for C complex I constant], acx_cv_c_complex_I, 71 [acx_cv_c_complex_I=unsupported 72 for acx_kw in I "(1.0i)"; do 73 AC_TRY_COMPILE([#include <complex.h>], 74 [float $acx_cv_c_complex foo = $acx_kw;], 75 [acx_cv_c_complex_I=$acx_kw; break]) 76 done 77 ]) 78 79 if test "$acx_cv_c_complex_I" = "unsupported"; then 80 AC_MSG_ERROR([C doesn't support complex numbers.]) 81 have_c_complex=no 82 else 83 if test "$acx_cv_c_complex_I" != "I"; then 84 AC_DEFINE_UNQUOTED(I, $acx_cv_c_complex_I, [Define to equivalent of C99 complex I constant. Do not define if I is supported directly.]) 85 fi 86 fi 87 88 AC_CACHE_CHECK([for CX_LIMITED_RANGE_ON macro], acx_cv_c_cx_limited_range_on, 89 [acx_cv_c_cx_limited_range_on=no 90 AC_TRY_COMPILE([#include <complex.h>], 91 [CX_LIMITED_RANGE_ON;], [acx_cv_c_cx_limited_range_on=yes])]) 92 if test "$acx_cv_c_cx_limited_range_on" = "no"; then 93 AC_DEFINE(CX_LIMITED_RANGE_ON, 0, [Define to no-op if C99 macro is not available.]) 94 fi 95 96fi # C has complex keyword 97 98fi # $with_cxx = no 99 100if test "$have_c_complex" = "yes"; then 101 AC_CHECK_FUNCS(carg) 102fi 103 104########################################################################### 105 106AC_PROG_CXX 107if test "$with_cxx" = "yes" -o "$have_c_complex" = "no"; then 108 CC="$CXX" 109 CFLAGS="$CXXFLAGS" 110fi 111 112########################################################################### 113 114AC_CHECK_TYPES([long double]) 115 116########################################################################### 117 118AC_PROG_LIBTOOL 119########################################################################### 120 121AC_CHECK_LIB(m, sqrt) 122 123########################################################################### 124 125# Checks for BLAS/LAPACK libraries: 126 127ACX_BLAS([], [AC_MSG_ERROR([BLAS library not found])]) 128ACX_LAPACK([], [AC_MSG_ERROR([LAPACK library not found])]) 129 130LIBS="$LAPACK_LIBS $BLAS_LIBS $LIBS $FLIBS" 131 132########################################################################### 133 134AC_CONFIG_FILES([Makefile harminv.pc]) 135AC_OUTPUT 136