📄 configure
字号:
#!/bin/sh## -------------------------------------------------------------------------# Configure script for IT++ External libraries: FFTW, BLAS, CBLAS, LAPACK # and ATLAS. Some ideas taken from a previous script written by Pal Frenger.## Author: Adam Piatyszek <ediap@users.sourceforge.net>## $Date: 2006/02/28 13:57:08 $# $Revision: 1.15 $## -------------------------------------------------------------------------# IT++ External - set of external libraries (FFTW, LAPACK, CBLAS and ATLAS)# used by the IT++ library## Copyright (C) 1995-2005 (see AUTHORS file for a list of contributors)## This program is free software; you can redistribute it and/or modify# it under the terms of the GNU General Public License as published by# the Free Software Foundation; either version 2 of the License, or# (at your option) any later version.## This program is distributed in the hope that it will be useful,# but WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# GNU General Public License for more details.## You should have received a copy of the GNU General Public License# along with this program; if not, write to the Free Software# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA# -------------------------------------------------------------------------# ---------------------------------------------------------------------------# Default values# ---------------------------------------------------------------------------package_name="itpp-external"package_version="2.1.1"prefix="/usr/local"libdir="$prefix/lib"builddir=`pwd`tempdir=`dirname $0`case $tempdir in /*) srcdir=`dirname $0` ;; *) srcdir="$builddir/`dirname $0`" ;;esacextsrcdir="$srcdir/extsrc"fftw=yesblas=yeslapack=yescblas=yesatlas=noshared=yes# ---------------------------------------------------------------------------# File names of source packages# ---------------------------------------------------------------------------fftw_file="fftw-3.1.tar.gz"blas_file="blas.tgz"blas_patch="blas-makefile"cblas_file="cblas.tgz"cblas_patch="cblas-shared.patch"lapack_file="lapack.tgz"lapack_patch1="lapack-20020531-20021004.patch"lapack_patch2="lapack-shared.patch"atlas_file="atlas3.6.0.tar.gz"# ---------------------------------------------------------------------------# Packages' base directories# ---------------------------------------------------------------------------fftw_dir="fftw-3.1"blas_dir="BLAS"cblas_dir="CBLAS"lapack_dir="LAPACK"atlas_dir="ATLAS"# ---------------------------------------------------------------------------# Usage text# ---------------------------------------------------------------------------show_usage() { cat << EOTUsage: ./configure [options]Options: --prefix=PREFIX install files in PREFIX (1) --libdir=LIBDIR install library files into LIBDIR (2) --enable-fftw enable FFTW library (+) --disable-fftw disable FFTW library --enable-blas enable BLAS library (ATLAS disabled) (+) --disable-blas disable BLAS library --enable-lapack enable LAPACK library (+) --disable-lapack disable LAPACK library --enable-cblas enable CBLAS library (ATLAS disabled) (+) --disable-cblas disable CBLAS library --enable-atlas enable ATLAS library (BLAS/CBLAS disabled) --disable-atlas disable ATLAS library --enable-shared build shared libraries if possible (+) --disable-shared do not build shared libraries --help display this help end exit(1) Absolute path has to be used. PREFIX=/usr/local by default.(2) LIBDIR=PREFIX/lib by default(+) option set by defaultNote: ATLAS configuration procedure is interactive and asks a set of questions.EOT}# ---------------------------------------------------------------------------# Command line arguments parser# ---------------------------------------------------------------------------configure_args="$@"while test $# -gt 0; do case $1 in --prefix=*) prefix="${1#--prefix=}"; libdir="$prefix/lib" ;; --libdir=*) libdir="${1#--libdir=}" ;; --enable-fftw) fftw=yes ;; --disable-fftw) fftw=no ;; --enable-blas) blas=yes; atlas=no ;; --disable-blas) blas=no ;; --enable-lapack) lapack=yes ;; --disable-lapack) lapack=no ;; --enable-cblas) cblas=yes; atlas=no ;; --disable-cblas) cblas=no ;; --enable-atlas) atlas=yes; blas=no; cblas=no; shared=no ;; --disable-atlas) atlas=no ;; --enable-shared) shared=yes ;; --disable-shared) shared=no ;; *) show_usage; exit 1 ;; esac shiftdoneif test "x$fftw" = "xno" -a "x$blas" = "xno" -a "x$lapack" = "xno" \ -a "x$cblas" = "xno" -a "x$atlas" = "xno"; then echo "*** Error: No external libraries selected. ***"; exit 1;fiif test "x$atlas" = "xyes" -a "x$shared" = "xyes"; then echo "*** Error: Shared ATLAS library is not supported. ***"; exit 1;fi# ---------------------------------------------------------------------------# Check for libtool# ---------------------------------------------------------------------------libtool --version > /dev/null 2>&1 || { echo "Error: libtool program is required by $package_name-$package_version"; exit 1;}# ---------------------------------------------------------------------------# Save environment flags# ---------------------------------------------------------------------------MY_CC="gcc"MY_FC="g77"MY_CFLAGS="-O3 -pipe -funroll-all-loops"MY_FFLAGS="-O3 -pipe -funroll-all-loops"MY_LTFLAGS=""test "x$CC" != "x" && MY_CC="$CC"test "x$FC" != "x" && MY_FC="$FC"test "x$CFLAGS" != "x" && MY_CFLAGS="$CFLAGS"test "x$FFLAGS" != "x" && MY_FFLAGS="$FFLAGS"test "x$shared" = "xno" && MY_LTFLAGS="-static"# ---------------------------------------------------------------------------# Unpack neded packages# ---------------------------------------------------------------------------cd $builddirif test "x$fftw" = "xyes"; then echo "Unpacking FFTW... " gzip -cd < $extsrcdir/$fftw_file | tar xf - echo " done."fiif test "x$blas" = "xyes"; then echo "Unpacking BLAS... " $srcdir/mkinstalldirs $blas_dir > /dev/null 2>&1 cd $blas_dir gzip -cd < $extsrcdir/$blas_file | tar xf - 2>/dev/null cd $builddir echo " done." echo "Patching BLAS... " cat $extsrcdir/$blas_patch > $blas_dir/Makefile echo " done."fiif test "x$cblas" = "xyes"; then echo "Unpacking CBLAS... " gzip -cd < $extsrcdir/$cblas_file | tar xf - echo " done." echo "Patching CBLAS... " cat $extsrcdir/$cblas_patch | patch -p0 -s echo " done."fiif test "x$lapack" = "xyes"; then echo "Unpacking LAPACK... " gzip -cd < $extsrcdir/$lapack_file | tar xf - 2> /dev/null echo " done." echo "Patching LAPACK... " cat $extsrcdir/$lapack_patch1 | patch -p0 -s cat $extsrcdir/$lapack_patch2 | patch -p0 -s echo " done."fiif test "x$atlas" = "xyes"; then echo "Unpacking ATLAS... " gzip -cd < $extsrcdir/$atlas_file | tar xf - echo " done."fi# ---------------------------------------------------------------------------# Preconfigure packages# ---------------------------------------------------------------------------if test "x$fftw" = "xyes"; then cd $builddir/$fftw_dir echo "Configuring FFTW..." ./configure --prefix=$prefix --libdir=$libdir --enable-shared=$shared echo "FFTW configuration done."fiif test "x$cblas" = "xyes"; then cd $builddir/$cblas_dir echo "Configuring CBLAS..." cblas_arch="LINUX" cat Makefile.$cblas_arch > Makefile.in echo "CBLAS configuration done."fiif test "x$lapack" = "xyes"; then cd $builddir/$lapack_dir echo "Configuring LAPACK..." lapack_arch="LINUX" cat INSTALL/make.inc.$lapack_arch > make.inc echo "LAPACK configuration done."fiif test "x$atlas" = "xyes"; then cd $builddir/$atlas_dir echo "Configuring ATLAS interactively..." make atlas_arch=`echo Make.*_* | sed 's/Make\.//'` echo "ATLAS configuration done."fi# ---------------------------------------------------------------------------# Create Makefile.config# ---------------------------------------------------------------------------cd $builddirecho "Creating Makefile.config... "cat << EOF > Makefile# This file has been automatically generated by the following command:# $ ./configure $configure_args#---------------------------------------------------------------------------# Name and version:#---------------------------------------------------------------------------package_name := $package_namepackage_version := $package_version#---------------------------------------------------------------------------# Directory settings:#---------------------------------------------------------------------------srcdir := $srcdirbuilddir := $builddirprefix := $prefixlibdir := $libdir#---------------------------------------------------------------------------# Flags:#---------------------------------------------------------------------------CC := $MY_CCFC := $MY_FCCFLAGS := $MY_CFLAGSFFLAGS := $MY_FFLAGSLTFLAGS := $MY_LTFLAGS#---------------------------------------------------------------------------# Selections made with the configure script:#---------------------------------------------------------------------------fftw_flag := $fftwblas_flag := $blaslapack_flag := $lapackcblas_flag := $cblasatlas_flag := $atlas#---------------------------------------------------------------------------# Packages' specific settings:#---------------------------------------------------------------------------fftw_srcdir := \$(builddir)/$fftw_dirblas_srcdir := \$(builddir)/$blas_dircblas_srcdir := \$(builddir)/$cblas_dirlapack_srcdir := \$(builddir)/$lapack_diratlas_srcdir := \$(builddir)/$atlas_diratlas_arch := $atlas_archatlas_libdir := \$(atlas_srcdir)/lib/\$(atlas_arch)EOFcat $srcdir/Makefile.in >> Makefileecho " done."echo "------------------------------------------------------------------------------$package_name-$package_version configuration:------------------------------------------------------------------------------Directories: - prefix ....... : ${prefix} - libdir ....... : ${libdir}External libraries: - FFTW ......... : ${fftw} - BLAS ......... : ${blas} - LAPACK ....... : ${lapack} - CBLAS ........ : ${cblas} - ATLAS ........ : ${atlas}Other options: - shared ....... : ${shared}Compiler flags: - CC ........... : ${MY_CC} - FC ........... : ${MY_FC} - CFLAGS ....... : ${MY_CFLAGS} - FFLAGS ....... : ${MY_FFLAGS} ------------------------------------------------------------------------------Now type 'make && make install' to build and install the selected libraries------------------------------------------------------------------------------"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -