From 2144e66296264f92b30d833b7e4ef4e4926acc2c Mon Sep 17 00:00:00 2001 From: Claus-Justus Heine <Claus-Justus.Heine@IANS.Uni-Stuttgart.DE> Date: Sun, 16 Aug 2009 14:58:08 +0000 Subject: [PATCH] Fix the usage/non-usage of an external blas library. --- configure.ac | 121 +++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 89 insertions(+), 32 deletions(-) diff --git a/configure.ac b/configure.ac index 9edd0ec..8914bbc 100644 --- a/configure.ac +++ b/configure.ac @@ -127,8 +127,8 @@ AC_SUBST(DEMOSOURCES) # AC_CONFIG_COMMANDS([alberta_util/src/alberta_util_inlines.h], [if test -f alberta_util/src/alberta_util_inlines.h && \ - cmp alberta_util/src/alberta_util_inlines.h alberta_util/src/alberta_util_inlines.h.in -then + cmp alberta_util/src/alberta_util_inlines.h \ + alberta_util/src/alberta_util_inlines.h.in > /dev/null 2>&1; then AC_MSG_NOTICE([alberta_util/src/alberta_util_inlines.h is unchanged]) else AC_MSG_NOTICE([Creating alberta_util/src/alberta_util_inlines.h]) @@ -139,8 +139,8 @@ fi]) AC_CONFIG_COMMANDS([alberta_util/src/alberta_util.h], [if test -f alberta_util/src/alberta_util.h && \ - cmp alberta_util/src/alberta_util.h alberta_util/src/alberta_util.h.in -then + cmp alberta_util/src/alberta_util.h \ + alberta_util/src/alberta_util.h.in > /dev/null 2>&1; then AC_MSG_NOTICE([alberta_util/src/alberta_util.h is unchanged]) else AC_MSG_NOTICE([Creating alberta_util/src/alberta_util.h]) @@ -173,13 +173,6 @@ AC_ARG_ENABLE([dim-of-world], ;; esac]) -ALBERTA_ENABLE_FLAG([fortran-blas], - [Use Fortran BLAS routines for some basic linear algebra stuff and use some - other Fortran modules (e.g. gpskca for matrix-profile reduction).], - [disabled], - [USE_F77_BLAS], - [DEFINE SUBST COND]) - ALBERTA_ENABLE_FLAG([vector-basis-functions], [Disable support for vector-valued basis functions. If you leave this enabled ALBERTA supports DIM_OF_WORLD-valued basis functions and scalar basis @@ -257,12 +250,33 @@ AC_PATH_PROG([CPP], [cpp], [], [/usr/bin:/lib:$PATH]) AC_DEFINE_UNQUOTED([CPP],["$CPP"],["Command which runs the C preprecessor"]) # -# Support for FORTRAN code in ALBERTA +# Support for FORTRAN code in ALBERTA. Fortran is optional, but it is +# easier to run the test for the compiler anyway. # +AC_PROG_F77 +if test -z "${F77}"; then + AC_MSG_RESULT([The Fortran compiler cannot be found. DON'T PANIC: +this simply means that you cannot use the GPSKCA band-width/profile +reduction library, but otherwise has no measurable impact.]) +fi + +if test -n "${F77}"; then + AC_F77_LIBRARY_LDFLAGS + if test -z "${FLIBS}"; then +# cannot be, some run-time stuff is needed, so this means F77 cannot +# compile anything. This is a mis-feature in autoconf: we actually +# only want to determine whether or not the bloody Fortran f*ck is +# able to compile anyting. + AC_MSG_RESULT([Unable to determine how to link against the Fortran +run-time libraries. For this reason, we assume that "${F77}" either +is no Fortran compiler or that its installation is broken. DON'T PANIC: +this simply means that you cannot use the GPSKCA band-width/profile +reduction library, but otherwise has no measurable impact.]) + F77="" + fi +fi -if test "$USE_F77_BLAS" -eq 1; then - AC_PROG_F77 - AC_F77_LIBRARY_LDFLAGS +if test -n "${F77}"; then AC_F77_WRAPPERS AC_F77_FUNC([dnrm2],[DNRM2_F77_FUNC]) AC_F77_FUNC([daxpy],[DAXPY_F77_FUNC]) @@ -274,7 +288,6 @@ if test "$USE_F77_BLAS" -eq 1; then AC_F77_FUNC([dswap],[DSWAP_F77_FUNC]) AC_F77_FUNC([dxpay],[DXPAY_F77_FUNC]) AC_F77_FUNC([drandn],[DRANDN_F77_FUNC]) - AC_F77_FUNC([gpskca],[GPSKCA_F77_FUNC]) AC_SUBST([DNRM2_F77_FUNC]) AC_SUBST([DAXPY_F77_FUNC]) AC_SUBST([DEXPY_F77_FUNC]) @@ -285,6 +298,10 @@ if test "$USE_F77_BLAS" -eq 1; then AC_SUBST([DSWAP_F77_FUNC]) AC_SUBST([DXPAY_F77_FUNC]) AC_SUBST([DRANDN_F77_FUNC]) + AC_F77_FUNC([gpskca],[GPSKCA_F77_FUNC]) +else + with_gpskca=no + with_blas=no fi # @@ -498,6 +515,7 @@ AC_CHECK_HEADERS([math.h stdlib.h unistd.h string.h rpc/types.h rpc/xdr.h],, [AC_MSG_ERROR([Sorry, these are needed..])]) AC_CHECK_HEADERS([malloc.h]) + # # try to pull in some special features (but make sure to supply # replacements if they are not available) @@ -523,6 +541,13 @@ AC_CHECK_FUNCS([pow sqrt strdup strchr strstr rand srand \ xdr_int32_t xdr_int64_t xdr_int],, [AC_MSG_ERROR([Sorry, these are needed..])]) +# +# functions to aid malloc debugging. Of course, we do not require +# them, but they may be helpful. These functions are available in the +# current glibc, so they are qutie GNUish (or Doug Lea-ish) +# +AC_CHECK_FUNCS([mallinfo malloc_usable_size malloc_trim malloc_stats]) + # # ffsl is not necessarily needed, but helpful. # @@ -571,6 +596,7 @@ AM_CONDITIONAL(NEED_GETOPT, [test "x${NEED_GETOPT}" = "x1"]) # Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_TYPE_SIZE_T +AC_TYPE_SSIZE_T AC_TYPE_SIGNAL AC_CHECK_SIZEOF([long long]) @@ -594,23 +620,26 @@ AC_CHECK_MEMBERS([struct sigaction.sa_sigaction],,,[#include <signal.h>]) # check for BLAS library. The BLAS may come under different names. We default # to -lblas, but other possibilities are sunperf, atlas, cxml (Alpha AXP) # etc etc etc etc etc etc etc etc etc etc ........................... +# The BLAS library is optional. # # Let the user decide what it wants (handled by ALBERTA_CHECK_PACKAGE() +# Note that gpskca does not depend on BLAS at all. # -if test "$USE_F77_BLAS" -eq 1; then - ALBERTA_CHECK_PACKAGE([blas],[blas], - [${DAXPY_F77_FUNC}],[],[${FLIBS}],[],[],[],[required]) - ALBERTA_CHECK_PACKAGE([gpskca],[gpskca], - [${GPSKCA_F77_FUNC}],[],[${FLIBS}],[],[],[],[optional]) +ALBERTA_CHECK_PACKAGE([blas],[blas], + [${DAXPY_F77_FUNC}],[],[${FLIBS}],[],[],[],[optional disabled]) +if test -n "${BLAS_LIBS}"; then + USE_LIBBLAS="1" else - AM_CONDITIONAL([HAVE_BLAS], [false]) - AC_DEFINE([HAVE_BLAS], 0, [Define to 1 if BLAS is available]) - AC_SUBST([BLAS_ALL_LIBS], []) - AM_CONDITIONAL([HAVE_GPSKCA], [false]) - AC_DEFINE([HAVE_GPSKCA], 0, [Define to 1 if GPSKCA is available]) - AC_SUBST([GPSKCA_ALL_LIBS], []) + USE_LIBBLAS="0" fi +AC_SUBST([USE_LIBBLAS]) +ALBERTA_CHECK_PACKAGE([gpskca],[gpskca], + [${GPSKCA_F77_FUNC}],[],[${FLIBS}],[],[],[],[optional enabled]) +# +# Only support linking with fortran stuff if needed. +# +AM_CONDITIONAL(NEED_F77_LINK, [test -n "${BLAS_LIBS}" -o -n "${GPSKCA_LIBS}"]) ALBERTA_ENABLE_FLAG([graphics], [disable support for visualization, including all add-ons which need graphics.], @@ -670,17 +699,26 @@ ALBERTA_CHECK_PACKAGE([silo],[silo],[DBPutUcdmesh], AM_CONDITIONAL(GEOMVIEW, true) # -# Malloc debugging +# Malloc debugging and options # +ALBERTA_ENABLE_FLAG([plain-malloc], + [Use the system's malloc without any modifications. If disabled (the default), + ALBERTA will pipe all allocations through small trampoline functions and + record some meta-data (the size of the allocations) and makes sure that + malloc(0) returns NULL and stuff like that.], + 0, + [ALBERTA_ALLOC_MALLOC], + [DEFINE SUBST COND]) + ALBERTA_ENABLE_FLAG([allocrecord], - [use some hand-made malloc debugger, which logs allocations in a round-robin + [Use some hand-made malloc debugger, which logs allocations in a round-robin data-base. The optized liberaries will still use the default allocators.], 0, [ALBERTA_ALLOC_RECORD], [DEFINE SUBST COND]) ALBERTA_ENABLE_FLAG([efence], - [use the malloc debugger "Electric Fence" for all allocations for the DEBUG + [Use the malloc debugger "Electric Fence" for all allocations for the DEBUG libraries, the optimized libraries will still use the default allocators.], 0, ALBERTA_EFENCE) @@ -688,16 +726,35 @@ test "$ALBERTA_EFENCE" = "1" && EFENCE_DISABLE=no test "${BUILD_ALBERTA_DEBUG}" = "0" && EFENCE_DISABLE=yes ALBERTA_CHECK_PACKAGE([efence],[efence],[_eff_malloc],[],[],[efence.h],[],[], [optional disabled]) -if test "$ALBERTA_EFENCE" = 1 -a -z "$EFENCE_LIB"; then +if test "$ALBERTA_EFENCE" = 1 -a -z "$EFENCE_LIBS"; then AC_MSG_RESULT( ["EFence" memory debugger not found or disabled, we will not try to use it.]) ALBERTA_EFENCE=0 fi -if test "$ALBERTA_EFENCE" = 0 -a -n "$EFENCE_LIB"; then +if test "$ALBERTA_EFENCE" = 0 -a -n "$EFENCE_LIBS"; then AC_MSG_RESULT([using "Electric Fence" memory debugger for debugging libraries.]) ALBERTA_EFENCE=1 fi +ALBERTA_ENABLE_FLAG([duma], + [Use the malloc debugger "DUMA" for all allocations for the DEBUG + libraries, the optimized libraries will still use the default allocators.], + 0, + ALBERTA_DUMA) +test "$ALBERTA_DUMA" = "1" && DUMA_DISABLE=no +test "${BUILD_ALBERTA_DEBUG}" = "0" && DUMA_DISABLE=yes +ALBERTA_CHECK_PACKAGE([duma],[duma],[_duma_malloc],[],[],[duma.h],[],[], + [optional disabled]) +if test "$ALBERTA_DUMA" = 1 -a -z "$DUMA_LIBS"; then + AC_MSG_RESULT( +["DUMA" memory debugger not found or disabled, we will not try to use it.]) + ALBERTA_DUMA=0 +fi +if test "$ALBERTA_DUMA" = 0 -a -n "$DUMA_LIBS"; then + AC_MSG_RESULT([using "DUMA" memory debugger for debugging libraries.]) + ALBERTA_DUMA=1 +fi + # # OpenMP # -- GitLab