From 905d3f6d3a604a93f9478170dffc4efa8121e0f0 Mon Sep 17 00:00:00 2001 From: eschnett Date: Tue, 12 Jun 2012 18:28:10 +0000 Subject: Rename configuration script git-svn-id: http://svn.cactuscode.org/projects/ExternalLibraries/LAPACK/trunk@28 c7ba4c71-c2f2-49b2-85d5-cb7b5f04bdfb --- LAPACK.sh | 185 ------------------------------------------------------ configuration.ccl | 2 +- configure.sh | 185 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 186 insertions(+), 186 deletions(-) delete mode 100644 LAPACK.sh create mode 100644 configure.sh diff --git a/LAPACK.sh b/LAPACK.sh deleted file mode 100644 index 388a83c..0000000 --- a/LAPACK.sh +++ /dev/null @@ -1,185 +0,0 @@ -#! /bin/bash - -################################################################################ -# Prepare -################################################################################ - -# Set up shell -if [ "$(echo ${VERBOSE} | tr '[:upper:]' '[:lower:]')" = 'yes' ]; then - set -x # Output commands -fi -set -e # Abort on errors - - - -################################################################################ -# Search -################################################################################ - -if [ -z "${LAPACK_DIR}" ]; then - echo "BEGIN MESSAGE" - echo "LAPACK selected, but LAPACK_DIR not set. Checking some places..." - echo "END MESSAGE" - - FILES="liblapack.a liblapack.so" - DIRS="/usr/lib /usr/local/lib /usr/lib64/atlas /usr/lib/atlas-base/atlas ${HOME}" - for file in $FILES; do - for dir in $DIRS; do - if test -r "$dir/$file"; then - LAPACK_DIR="$dir" - break - fi - done - done - - if [ -z "$LAPACK_DIR" ]; then - echo "BEGIN MESSAGE" - echo "LAPACK not found" - echo "END MESSAGE" - else - echo "BEGIN MESSAGE" - echo "Found LAPACK in ${LAPACK_DIR}" - echo "END MESSAGE" - fi -fi - - - -################################################################################ -# Build -################################################################################ - -if [ -z "${LAPACK_DIR}" \ - -o "$(echo "${LAPACK_DIR}" | tr '[a-z]' '[A-Z]')" = 'BUILD' ] -then - echo "BEGIN MESSAGE" - echo "Using bundled LAPACK..." - echo "END MESSAGE" - - # Set locations - THORN=LAPACK - NAME=lapack-3.4.0 - SRCDIR=$(dirname $0) - BUILD_DIR=${SCRATCH_BUILD}/build/${THORN} - if [ -z "${LAPACK_INSTALL_DIR}" ]; then - INSTALL_DIR=${SCRATCH_BUILD}/external/${THORN} - else - echo "BEGIN MESSAGE" - echo "Installing LAPACK into ${LAPACK_INSTALL_DIR}" - echo "END MESSAGE" - INSTALL_DIR=${LAPACK_INSTALL_DIR} - fi - DONE_FILE=${SCRATCH_BUILD}/done/${THORN} - LAPACK_DIR=${INSTALL_DIR} - - if [ "${F77}" = "none" ]; then - echo 'BEGIN ERROR' - echo "Building LAPACK requires a fortran compiler, but there is none configured: F77 = $F77. Aborting." - echo 'END ERROR' - exit 1 - fi - - if [ -e ${DONE_FILE} -a ${DONE_FILE} -nt ${SRCDIR}/dist/${NAME}.tar.gz \ - -a ${DONE_FILE} -nt ${SRCDIR}/LAPACK.sh ] - then - echo "BEGIN MESSAGE" - echo "LAPACK has already been built; doing nothing" - echo "END MESSAGE" - else - echo "BEGIN MESSAGE" - echo "Building LAPACK" - echo "END MESSAGE" - - # Build in a subshell - ( - exec >&2 # Redirect stdout to stderr - if [ "$(echo ${VERBOSE} | tr '[:upper:]' '[:lower:]')" = 'yes' ]; then - set -x # Output commands - fi - set -e # Abort on errors - cd ${SCRATCH_BUILD} - - # Set up environment - unset LIBS - if [ ${USE_RANLIB} != 'yes' ]; then - RANLIB=': ranlib' - fi - - echo "LAPACK: Preparing directory structure..." - mkdir build external done 2> /dev/null || true - rm -rf ${BUILD_DIR} ${INSTALL_DIR} - mkdir ${BUILD_DIR} ${INSTALL_DIR} - - echo "LAPACK: Unpacking archive..." - pushd ${BUILD_DIR} - ${TAR} xzf ${SRCDIR}/dist/${NAME}.tgz - - echo "LAPACK: Configuring..." - cd ${NAME}/SRC - - echo "LAPACK: Building..." - if echo ${F77} | grep -i xlf > /dev/null 2>&1; then - FIXEDF77FLAGS=-qfixed - fi - #${F77} ${F77FLAGS} ${FIXEDF77FLAGS} -c *.f ../INSTALL/dlamch.f ../INSTALL/ilaver.f ../INSTALL/lsame.f ../INSTALL/slamch.f - #${AR} ${ARFLAGS} liblapack.a *.o - #if [ ${USE_RANLIB} = 'yes' ]; then - # ${RANLIB} ${RANLIBFLAGS} liblapack.a - #fi - cat > make.cactus < ${DONE_FILE} - echo "LAPACK: Done." - - ) - - if (( $? )); then - echo 'BEGIN ERROR' - echo 'Error while building LAPACK. Aborting.' - echo 'END ERROR' - exit 1 - fi - fi - -fi - - - -################################################################################ -# Configure Cactus -################################################################################ - -# Set options -if [ "${LAPACK_DIR}" != '/usr/lib' -a "${LAPACK_DIR}" != '/usr/local/lib' ]; then - LAPACK_INC_DIRS= - LAPACK_LIB_DIRS="${LAPACK_DIR}" -fi -: ${LAPACK_LIBS='lapack'} - -# Pass options to Cactus -echo "BEGIN MAKE_DEFINITION" -echo "HAVE_LAPACK = 1" -echo "LAPACK_DIR = ${LAPACK_DIR}" -echo "LAPACK_INC_DIRS = ${LAPACK_INC_DIRS}" -echo "LAPACK_LIB_DIRS = ${LAPACK_LIB_DIRS}" -echo "LAPACK_LIBS = ${LAPACK_LIBS}" -echo "END MAKE_DEFINITION" - -echo 'INCLUDE_DIRECTORY $(LAPACK_INC_DIRS)' -echo 'LIBRARY_DIRECTORY $(LAPACK_LIB_DIRS)' -echo 'LIBRARY $(LAPACK_LIBS)' diff --git a/configuration.ccl b/configuration.ccl index 452a39b..5f613ee 100644 --- a/configuration.ccl +++ b/configuration.ccl @@ -2,7 +2,7 @@ PROVIDES LAPACK { - SCRIPT LAPACK.sh + SCRIPT configure.sh LANG bash OPTIONS LAPACK_DIR LAPACK_INSTALL_DIR LAPACK_LIBS } diff --git a/configure.sh b/configure.sh new file mode 100644 index 0000000..50ae090 --- /dev/null +++ b/configure.sh @@ -0,0 +1,185 @@ +#! /bin/bash + +################################################################################ +# Prepare +################################################################################ + +# Set up shell +if [ "$(echo ${VERBOSE} | tr '[:upper:]' '[:lower:]')" = 'yes' ]; then + set -x # Output commands +fi +set -e # Abort on errors + + + +################################################################################ +# Search +################################################################################ + +if [ -z "${LAPACK_DIR}" ]; then + echo "BEGIN MESSAGE" + echo "LAPACK selected, but LAPACK_DIR not set. Checking some places..." + echo "END MESSAGE" + + FILES="liblapack.a liblapack.so" + DIRS="/usr/lib /usr/local/lib /usr/lib64/atlas /usr/lib/atlas-base/atlas ${HOME}" + for file in $FILES; do + for dir in $DIRS; do + if test -r "$dir/$file"; then + LAPACK_DIR="$dir" + break + fi + done + done + + if [ -z "$LAPACK_DIR" ]; then + echo "BEGIN MESSAGE" + echo "LAPACK not found" + echo "END MESSAGE" + else + echo "BEGIN MESSAGE" + echo "Found LAPACK in ${LAPACK_DIR}" + echo "END MESSAGE" + fi +fi + + + +################################################################################ +# Build +################################################################################ + +if [ -z "${LAPACK_DIR}" \ + -o "$(echo "${LAPACK_DIR}" | tr '[a-z]' '[A-Z]')" = 'BUILD' ] +then + echo "BEGIN MESSAGE" + echo "Using bundled LAPACK..." + echo "END MESSAGE" + + # Set locations + THORN=LAPACK + NAME=lapack-3.4.0 + SRCDIR=$(dirname $0) + BUILD_DIR=${SCRATCH_BUILD}/build/${THORN} + if [ -z "${LAPACK_INSTALL_DIR}" ]; then + INSTALL_DIR=${SCRATCH_BUILD}/external/${THORN} + else + echo "BEGIN MESSAGE" + echo "Installing LAPACK into ${LAPACK_INSTALL_DIR}" + echo "END MESSAGE" + INSTALL_DIR=${LAPACK_INSTALL_DIR} + fi + DONE_FILE=${SCRATCH_BUILD}/done/${THORN} + LAPACK_DIR=${INSTALL_DIR} + + if [ "${F77}" = "none" ]; then + echo 'BEGIN ERROR' + echo "Building LAPACK requires a fortran compiler, but there is none configured: F77 = $F77. Aborting." + echo 'END ERROR' + exit 1 + fi + + if [ -e ${DONE_FILE} -a ${DONE_FILE} -nt ${SRCDIR}/dist/${NAME}.tar.gz \ + -a ${DONE_FILE} -nt ${SRCDIR}/configure.sh ] + then + echo "BEGIN MESSAGE" + echo "LAPACK has already been built; doing nothing" + echo "END MESSAGE" + else + echo "BEGIN MESSAGE" + echo "Building LAPACK" + echo "END MESSAGE" + + # Build in a subshell + ( + exec >&2 # Redirect stdout to stderr + if [ "$(echo ${VERBOSE} | tr '[:upper:]' '[:lower:]')" = 'yes' ]; then + set -x # Output commands + fi + set -e # Abort on errors + cd ${SCRATCH_BUILD} + + # Set up environment + unset LIBS + if [ ${USE_RANLIB} != 'yes' ]; then + RANLIB=': ranlib' + fi + + echo "LAPACK: Preparing directory structure..." + mkdir build external done 2> /dev/null || true + rm -rf ${BUILD_DIR} ${INSTALL_DIR} + mkdir ${BUILD_DIR} ${INSTALL_DIR} + + echo "LAPACK: Unpacking archive..." + pushd ${BUILD_DIR} + ${TAR} xzf ${SRCDIR}/dist/${NAME}.tgz + + echo "LAPACK: Configuring..." + cd ${NAME}/SRC + + echo "LAPACK: Building..." + if echo ${F77} | grep -i xlf > /dev/null 2>&1; then + FIXEDF77FLAGS=-qfixed + fi + #${F77} ${F77FLAGS} ${FIXEDF77FLAGS} -c *.f ../INSTALL/dlamch.f ../INSTALL/ilaver.f ../INSTALL/lsame.f ../INSTALL/slamch.f + #${AR} ${ARFLAGS} liblapack.a *.o + #if [ ${USE_RANLIB} = 'yes' ]; then + # ${RANLIB} ${RANLIBFLAGS} liblapack.a + #fi + cat > make.cactus < ${DONE_FILE} + echo "LAPACK: Done." + + ) + + if (( $? )); then + echo 'BEGIN ERROR' + echo 'Error while building LAPACK. Aborting.' + echo 'END ERROR' + exit 1 + fi + fi + +fi + + + +################################################################################ +# Configure Cactus +################################################################################ + +# Set options +if [ "${LAPACK_DIR}" != '/usr/lib' -a "${LAPACK_DIR}" != '/usr/local/lib' ]; then + LAPACK_INC_DIRS= + LAPACK_LIB_DIRS="${LAPACK_DIR}" +fi +: ${LAPACK_LIBS='lapack'} + +# Pass options to Cactus +echo "BEGIN MAKE_DEFINITION" +echo "HAVE_LAPACK = 1" +echo "LAPACK_DIR = ${LAPACK_DIR}" +echo "LAPACK_INC_DIRS = ${LAPACK_INC_DIRS}" +echo "LAPACK_LIB_DIRS = ${LAPACK_LIB_DIRS}" +echo "LAPACK_LIBS = ${LAPACK_LIBS}" +echo "END MAKE_DEFINITION" + +echo 'INCLUDE_DIRECTORY $(LAPACK_INC_DIRS)' +echo 'LIBRARY_DIRECTORY $(LAPACK_LIB_DIRS)' +echo 'LIBRARY $(LAPACK_LIBS)' -- cgit v1.2.3