1dnl -*-autoconf-*- 2dnl Process this file with autoconf to produce a configure script. 3 4dnl Start autoconf processing. 5AC_INIT 6 7dnl Checking host/target/build systems, for make, install etc. 8AC_CANONICAL_TARGET 9dnl Perform program name transformation 10AC_ARG_PROGRAM 11 12 13# 14# versions 15# 16LAPACKPP_VERSION_MAJOR=2 17LAPACKPP_VERSION_MINOR=5 18LAPACKPP_VERSION_PATCHLEVEL=4 19rpm_release="1" 20LAPACKPP_VERSION_STRING="$LAPACKPP_VERSION_MAJOR.$LAPACKPP_VERSION_MINOR.$LAPACKPP_VERSION_PATCHLEVEL" 21 22dnl Automake doc recommends to do this only here. 23AM_INIT_AUTOMAKE(lapackpp,"$LAPACKPP_VERSION_STRING") 24 25# SO version of all liblapackpp.so 26# 27LAPACKPP_SO_CURRENT=16 28LAPACKPP_SO_REVISION=0 29LAPACKPP_SO_AGE=2 30 31# Substitute these vars 32AC_SUBST(LAPACKPP_VERSION_MAJOR) 33AC_SUBST(LAPACKPP_VERSION_MINOR) 34AC_SUBST(LAPACKPP_VERSION_PATCHLEVEL) 35AC_SUBST(LAPACKPP_VERSION_STRING) 36AC_SUBST(rpm_release) 37AC_SUBST(LAPACKPP_SO_CURRENT) 38AC_SUBST(LAPACKPP_SO_REVISION) 39AC_SUBST(LAPACKPP_SO_AGE) 40 41AC_DEFINE_UNQUOTED(LAPACKPP_VERSION_MAJOR,$LAPACKPP_VERSION_MAJOR, 42 [major version]) 43AC_DEFINE_UNQUOTED(LAPACKPP_VERSION_MINOR,$LAPACKPP_VERSION_MINOR, 44 [minor version]) 45AC_DEFINE_UNQUOTED(LAPACKPP_VERSION_PATCHLEVEL,$LAPACKPP_VERSION_PATCHLEVEL, 46 [patchlevel]) 47AC_DEFINE_UNQUOTED(LAPACKPP_VERSION_STRING,"$LAPACKPP_VERSION_STRING", 48 [version string]) 49 50dnl set the program name for make 51AC_PROG_MAKE_SET 52 53dnl make /usr/local the default for the installation 54AC_PREFIX_DEFAULT(/usr/local) 55if test "x$prefix" = "xNONE"; then 56 prefix=$ac_default_prefix 57 ac_configure_args="$ac_configure_args --prefix $prefix" 58fi 59AC_SUBST(prefix) 60 61dnl without this order in this file, automake will be confused! 62AC_CONFIG_HEADER(config.h) 63AM_SANITY_CHECK 64 65### ------------------------------------------------------------- 66 67dnl checks for programs. 68AC_PROG_CXX 69AC_PROG_CPP 70AC_PROG_INSTALL 71AC_ENABLE_FAST_INSTALL 72AC_PATH_PROG([SED], [sed]) 73 74dnl Turn off libtool static library generation 75AC_DISABLE_STATIC 76AC_LIBTOOL_WIN32_DLL 77AC_LIBTOOL_RC 78AC_PROG_LIBTOOL 79 80dnl Check for structs, compiler characteristics 81AC_C_CONST 82 83dnl Check for headers 84AC_HEADER_STDC 85AC_CHECK_HEADERS([stdlib.h unistd.h]) 86 87dnl Check for C++ headers 88AC_LANG_PUSH(C++) 89AC_CHECK_HEADERS([bits/cpp_type_traits.h], [HAVE_BITS_CPP_TYPE_TRAITS_H=1 90 ], [HAVE_BITS_CPP_TYPE_TRAITS_H=0]) 91AC_LANG_POP(C++) 92AC_CXX_NAMESPACES 93AC_SUBST(HAVE_BITS_CPP_TYPE_TRAITS_H) 94 95### ------------------------------------------------------------- 96### Specific packages 97### ------------------------------------------------------------- 98 99case "$target" in 100 *-mingw32*) 101 ACX_WINDOWS_PATHS 102 ;; 103esac 104 105 106dnl Check for fortran compiler and its flags 107AC_PROG_F77 108AC_PROG_FC 109AC_FC_LIBRARY_LDFLAGS 110AC_FC_DUMMY_MAIN 111 112dnl Check for Lapack 113ACX_LAPACK([ 114 dnl action-if-found: 115 AC_DEFINE(HAVE_LAPACKPP,1,[Define if you have LAPACK++ library.]) 116 # This defines LAPACK_LIBS, BLAS_LIBS, and FLIBS 117], [ 118 dnl action-if-not-found: 119 AC_MSG_ERROR([Blas/Lapack was not found. 120*** This means Lapack++ and matrix support cannot be compiled. 121*** This makes this library unusable. Please get blas and lapack 122*** installed. If you do have these installed, use the options 123*** --with-blas=<libname> or --with-lapack=<libname> and/or set 124*** the env variable LDFLAGS to include the appropriate linker 125*** flags.]) 126]) 127 128dnl Workaround for bogus FLIBS: 129FLIBS=`echo ${FLIBS} | ${SED} 's/-lgfortranbegin//' ` 130 131### ------------------------------------------------------------- 132### Check the return value behaviour of zdotc() 133### ------------------------------------------------------------- 134save_LIBS=$LIBS 135LIBS="$LIBS $BLAS_LIBS $FLIBS" 136 137# Try the return value on stack (will segfault if wrong zdotc prototype) 138AC_MSG_CHECKING(whether zdotc() returns result on stack) 139AC_RUN_IFELSE( 140[AC_LANG_PROGRAM([[ 141 #include <math.h> 142 #define F77NAME(x) x##_ 143 typedef struct { double r, i; } doublecomplex; 144 doublecomplex F77NAME(zdotc)( 145 const int *n, 146 const doublecomplex *cx, 147 const int *incx, const doublecomplex *cy, 148 const int *incy); 149 ]], 150 [[ 151 doublecomplex cx[1], cy[1], tmp; 152 int n = 1, incx = 1, incy = 1; 153 cx[0].r = 2; cx[0].i = 0; 154 cy[0].r = 3; cy[0].i = 0; 155 tmp = F77NAME(zdotc)(&n, cx, &incx, cy, &incy); 156 /* printf("Result: (%f,%f)\n", tmp.r, tmp.i); */ 157 return (fabs(tmp.r - 6.0) < 0.1) ? 0 : 1; 158 ]])], 159[res_with_stack=yes], 160[res_with_stack=no], 161[res_with_stack=unknown]) 162AC_MSG_RESULT($res_with_stack) 163 164# And now the return value as first argument (will segfault if wrong 165# zdotc prototype) 166if test x$res_with_stack = "xno" ; then 167AC_MSG_CHECKING(whether zdotc() returns result as first argument) 168AC_RUN_IFELSE( 169[AC_LANG_PROGRAM([[ 170 #include <math.h> 171 #define F77NAME(x) x##_ 172 typedef struct { double r, i; } doublecomplex; 173 void F77NAME(zdotc)(doublecomplex *c, 174 const int *n, 175 const doublecomplex *cx, 176 const int *incx, const doublecomplex *cy, 177 const int *incy); 178 ]], 179 [[ 180 doublecomplex cx[1], cy[1], tmp; 181 int n = 1, incx = 1, incy = 1; 182 cx[0].r = 2; cx[0].i = 0; 183 cy[0].r = 3; cy[0].i = 0; 184 F77NAME(zdotc)(&tmp, &n, cx, &incx, cy, &incy); 185 /* printf("Result: (%f,%f)", tmp.r, tmp.i); */ 186 return (fabs(tmp.r - 6.0) < 0.1) ? 0 : 1; 187 ]])], 188[res_no_stack=yes], 189[res_no_stack=no], 190[res_no_stack=unknown]) 191AC_MSG_RESULT($res_no_stack) 192else 193 res_no_stack=no 194fi 195 196if test x$res_with_stack = "xyes" -a x$res_no_stack = "xno"; then 197 HAVE_ZDOTC_WITH_RV=1 198else 199 if test x$res_with_stack = "xno" -a x$res_no_stack = "xyes"; then 200 HAVE_ZDOTC_WITH_RV=0 201 else 202 case "$target" in 203 *-mingw32*) 204 HAVE_ZDOTC_WITH_RV=1 205 ;; 206 *) 207 if test x$res_with_stack = "xyes" -a x$res_no_stack = "xyes"; then 208 AC_MSG_ERROR(Both checks ran successful - we cannot determine the actual return value.) 209 HAVE_ZDOTC_WITH_RV=0 210 else 211 AC_MSG_WARN(Return value behaviour of ZDOTC is unknown. Guessing as first argument.) 212 HAVE_ZDOTC_WITH_RV=1 213 fi 214 ;; 215 esac 216 fi 217fi 218AC_SUBST(HAVE_ZDOTC_WITH_RV) 219 220LIBS=$save_LIBS 221 222### ------------------------------------------------------------- 223### system specifics 224### ------------------------------------------------------------- 225AC_MSG_CHECKING([for system type]) 226LAPACK_OS_WIN32=0 227LAPACKPP_INCLUDES="-I${pkgincludedir} -DLA_COMPLEX_SUPPORT" 228LAPACKPP_INTERNAL_LIBFILE="\${top_builddir}/src/liblapackpp.la" 229LAPACKPP_LIBS="-llapackpp" 230LAPACKPP_LDFLAGS="-L${libdir}" 231case "$target" in 232 *-mingw32*) 233 LAPACKPP_LDFLAGS="-L${WIN_PATH_WINDOWS_MINGW} -L${bindir}" 234 ARCH="WIN32" 235 LAPACK_OS_WIN32=1 236 AC_DEFINE(OS_WIN32, 1, [Define to 1 if using windows]) 237 AC_DEFINE_UNQUOTED(BUILDING_LAPACK_DLL, 1, [Define to 1 if DLL is built]) 238 ;; 239 *-linux*) 240 ARCH="Linux" 241 ;; 242 *) 243 ARCH="OS_${target_os}" 244 # Workaround for bogus system names 245 ARCH=` echo ${ARCH} | ${SED} 's/[^a-z0-9_]//g' ` 246 ;; 247esac 248AC_MSG_RESULT($ARCH) 249 250AC_SUBST(LAPACK_OS_WIN32) 251AM_CONDITIONAL(IS_WINDOWS, [test "$ARCH" = "WIN32"]) 252 253# These are the INCLUDES and LDFLAGS as an application should use them. 254AC_SUBST(LAPACKPP_INCLUDES) 255AC_SUBST(LAPACKPP_LIBS) 256AC_SUBST(LAPACKPP_LDFLAGS) 257AC_SUBST(LAPACKPP_INTERNAL_LIBFILE) 258 259# These are the variables for the internal tests. 260# For whatever reason, the variable top_srcdir needs to be quoted here. 261more_defs="-DLA_COMPLEX_SUPPORT -D${ARCH}" 262all_libraries="-L\${top_builddir}/src ${LAPACKPP_LIBS}" 263all_includes="-I\${top_srcdir}/include ${more_defs}" 264 265AC_SUBST(all_includes) 266AC_SUBST(all_libraries) 267 268### ------------------------------------------------------------- 269### Configuration flags 270### ------------------------------------------------------------- 271 272dnl Debugging code with empty default 273ACX_COMPILE_WARN([ ]) 274 275dnl Whether the MSVC-compiled DLL should be included 276dnl in the self-installing exe 277AC_ARG_WITH([msvc-dll], 278 AS_HELP_STRING([--with-msvc-dll], 279 [if the self-installing exe should include the msvc DLL]) ) 280if test "x$with_msvc_dll" = "xyes"; then 281 ISCC_WITH_DLL="" 282 ISCC_WITHOUT_DLL=";" 283else 284 ISCC_WITH_DLL=";" 285 ISCC_WITHOUT_DLL="" 286fi 287AC_SUBST(ISCC_WITH_DLL) 288AC_SUBST(ISCC_WITHOUT_DLL) 289 290 291### ------------------------------------------------------------- 292 293dnl All Makefiles that are to be generated. 294AC_CONFIG_FILES([ 295 Makefile 296 lapackpp.iss 297 mainpage.doxygen 298 lapackpp.spec 299 lapackpp.pc 300 src/ressource.rc 301 blaspp/Makefile 302 blaspp/src/Makefile 303 blaspp/testing/Makefile 304 contrib/Makefile 305 include/Makefile 306 include/laversion.h 307 macros/Makefile 308 matrix/Makefile 309 matrix/src/Makefile 310 matrix/testing/Makefile 311 src/Makefile 312 testing/Makefile 313]) 314AC_OUTPUT 315 316