WFDB Software Package 10.6.2

File: <base>/configure (22,726 bytes)
#! /bin/sh
# file: configure             G. Moody         24 May 2000
#                             Last revised:    28 November 2018
# Configuration script for the WFDB Software Package

# This script was not generated using 'autoconf'.  If you can implement
# autoconf input files for a 'configure' that does what this one does,
# please send them to wfdb@physionet.org for inclusion in a future
# version of this package.

# Note that any -m options (although parsed below) are currently ignored,
# except on x86_64 Linux, where they are prefixed to CFLAGS.  The help
# text below documents only -m32;  see the gcc manual for other -m options.

# Defaults (overridden by --interactive):
INTERACTIVE=no
LIBTYPE=dynamic
DIR=/usr/local
MANDIR=unknown
LIBDIR=unknown
HOST=
MFLAGS=
ARCHLIST=

NETLIB=unknown
WAVE=unknown
OWHOME=/usr/openwin

LC_ALL=C
export LC_ALL

# Read and process command-line arguments
for i in $*
do
  case $i in
    --dynamic)          LIBTYPE=dynamic ;;
    -i|--interactive)   INTERACTIVE=yes
    			LIBTYPE=
			DIR=
			MANDIR= ;;
    -m*)                if [ "x$MFLAGS" = x ]
                        then
		            MFLAGS=$i
		        else
		            MFLAGS="$MFLAGS $i"
		        fi ;;
    --enable-arch=*)    a=`echo $i | sed 's/[-a-zA-Z0-9]*=//' | tr , ' '`
                        ARCHLIST="$ARCHLIST $a" ;;
    --host=*)           HOST=`echo $i | sed 's/[-a-zA-Z0-9]*=//'` ;;
    --mandir=*)         MANDIR=`echo $i | sed 's/[-a-zA-Z0-9]*=//'` ;;
    --prefix=*)         DIR=`echo $i | sed 's/[-a-zA-Z0-9]*=//'` ;;
    --libdir=*)         LIBDIR=`echo $i | sed 's/[-a-zA-Z0-9]*=//'` ;;
    -q)			;; # ignored
    --shared)           LIBTYPE=dynamic ;;
    --static)           LIBTYPE=static
                        SYSLIBS=dynamic ;;
    --static_only)      LIBTYPE=static
		        SYSLIBS=static ;;
    --without-cygwin)   NOCYGWIN=yes ;;
    --without-netfiles) NETLIB=none ;;
    --with-libcurl)     NETLIB=libcurl ;;
    --without-xview)    WAVE=0 ;;
    --with-xview=*)     OWHOME=`echo $i | sed 's/[-a-zA-Z0-9]*=//'`
			WAVE=1 ;;
    *)                  cat <<EOF
usage: $0 [options]
Options:
    --dynamic           make a shared (dynamically linkable) WFDB library
                         if possible [default]
    --help              print this message
    --interactive       ask about library type and installation directories
    -m32                on 64-bit Linux, force compilation in 32-bit mode
    --mandir=MANDIR     install man pages in MANDIR
    --prefix=PREFIX     install files in PREFIX [default: $DIR]
    --shared            (same as --dynamic)
    --static            make a static WFDB library (do not make a shared
                         library even if possible)
    --static_only       link WFDB applications to static libraries only
                         (assumes --static;  compilation may fail if any
	                 necessary libraries are available as shared libraries
		         only)
    --without-cygwin    on Cygwin, compile binaries that do not link to the
                         Cygwin DLL. WAVE will not be built.
    --without-netfiles  disable NETFILES even if libcurl is available
    --with-libcurl      enable NETFILES via libcurl [default]
    --without-xview     disable WAVE even if XView is available
    --with-xview=PREFIX use XView libraries and headers installed in PREFIX
EOF
                        exit 1 ;;
  esac
done

# If cross-compiling, don't search for libraries automatically; only
# use curl and/or xview if specified on the command line.
if [ "x$HOST" != "x" ]
then
    if [ "x$NETLIB" = "xunknown" ]
    then
        NETLIB=none
    fi
    if [ "x$WAVE" = "xunknown" ]
    then
        WAVE=0
    fi
fi

echo "Checking the operating system type ..."
case x$HOST in
 x)        MACHINE=`uname -m | tr -d " "`
           KERNEL=`uname -s | tr -d " "`
           ;;
 x*-*-*)   MACHINE=`echo $HOST | cut -d- -f1`
           KERNEL=`echo $HOST | cut -d- -f3-`
           ;;
 x*-*)     MACHINE=`echo $HOST | cut -d- -f1`
           KERNEL=`echo $HOST | cut -d- -f2-`
           ;;
 x*)       MACHINE=unknown
           KERNEL=$HOST
           ;;
esac
ARCH=$MACHINE-$KERNEL
case `echo $KERNEL | tr A-Z a-z` in
  linux*)    case $MACHINE in
	        x86_64) OS=Linux-64 ;;
                *) OS=Linux ;;
             esac ;;
  freebsd*)  OS=FreeBSD ;;
  solaris*)  OS=Solaris ;;
  sunos*)    OS=Solaris ;;
  hp-ux*)    OS=HPUX ;;
  cygwin*)   if [ "x$NOCYGWIN" = "xyes" ]
             then
	         OS=mingw-compat
		 T=`echo $ARCH | sed s/CYGWIN/MINGW/`
		 ARCH=$T
             else
	         OS=cygwin
             fi ;;
  mingw*)    OS=mingw
             T=`echo $ARCH | sed s/CYGWIN/MINGW/`
             ARCH=$T ;;
  darwin*)   OS=Darwin ;;
  *)         OS=generic ;;
esac
echo "Configuring the WFDB software package for $OS."

SRCDIR="`pwd`"
LIB=lib
cd conf

echo "Checking the echo command ..."
echo -n >echo.out
if [ -s echo.out ]
then
ln -sf prompt-c prompt
else
ln -sf prompt-n prompt
fi
rm echo.out

PACKAGE=`basename "$SRCDIR"`
VERSION=
if [ -d ../.git ]
then
    ./prompt "Checking the package version number ..."
    VERSION=`cd ..; git --git-dir=.git describe --dirty 2>conf/gitver.t1`
    rm -f gitver.t1
    if [ "x$VERSION" = "x" ]
    then
       echo "unknown"
    else
       echo "$VERSION"
    fi
fi
if [ "x$VERSION" = "x" ]
then
    VERSION=`echo "$PACKAGE" | sed s/^wfdb-//`
fi
MAJOR=
MINOR=
RELEASE=
VNUM=`echo "$VERSION" | sed 's/[^0-9.].*//'`
case $VNUM in
 *.*.*) MAJOR=`echo $VNUM | cut -d . -f 1`
	MINOR=`echo $VNUM | cut -d . -f 2`
	RELEASE=`echo $VNUM | cut -d . -f 3` ;;
 *)     ./prompt "Major version number: "; read MAJOR
        ./prompt "Minor version number: "; read MINOR
        ./prompt "Release number: "; read RELEASE
        VERSION=$MAJOR.$MINOR.$RELEASE ;;
esac

if [ "x$MAJOR" = "x" ]; then MAJOR=0; fi
if [ "x$MINOR" = "x" ]; then MINOR=0; fi
if [ "x$RELEASE" = "x" ]; then RELEASE=0; fi

sed s/VMAJ/$MAJOR/ <version.def | sed s/VMIN/$MINOR/ | \
 sed s/VREL/$RELEASE/ | sed "s/VTAG/$VERSION/" >site.def
echo "# Definitions generated by 'configure'" >>site.def
echo >>site.def
echo "PACKAGE = $PACKAGE" >>site.def
echo "SRCDIR = \"$SRCDIR\"" >>site.def

if [ "x$SOURCE_DATE_EPOCH" = "x" ]
then
    date=date
else
    if date -d @0 >date.t1 2>date.t1
    then
        date="date -u -d @$SOURCE_DATE_EPOCH"
    else
        date="date -u -r $SOURCE_DATE_EPOCH"
    fi
    bd=`$date '+"%b %e %Y"'`
    echo "BUILD_DATE_FLAGS = -DWFDB_BUILD_DATE='$bd'" >>site.def
    rm -f date.t1
fi
echo LONGDATE = `$date "+%e %B %Y"` >>site.def
echo SHORTDATE = `$date "+%B %Y" | tr a-z A-Z` >>site.def
echo YEAR = `$date "+%Y"` >>site.def
echo "ARCH = $ARCH" >>site.def

if [ "x$HOST" = "x" ]
then
    echo "BUILD_CC = \$(CC)" >> site.def
else
    echo "BUILD_CC = cc" >> site.def
fi

echo "# _____________________________________________________________________________" >>site.def
echo >>site.def

rm -f site-slib.def
touch site-slib.def

case $OS in
  Linux)
	cat site.def linux-slib.def >site-slib.def
	cat linux.def >>site.def ;;
  Linux-64)
	if [ "x$MFLAGS" = "x-m32" ]
	then
	    OS=Linux
	    cat site.def linux-slib.def | \
		sed "s+MFLAGS =+MFLAGS = $MFLAGS+" >site-slib.def
	    cat linux.def | \
		sed "s+MFLAGS =+MFLAGS = $MFLAGS+" >>site.def
	else
	    LIB=lib64
            WAVE=0
	    cat site.def linux-slib.def >site-slib.def
	    cat linux.def >>site.def
	fi ;;
  FreeBSD)
	cat site.def freebsd-slib.def >site-slib.def
	cat freebsd.def >>site.def ;;
  Solaris)
	cat site.def solaris-slib.def >site-slib.def
	cat solaris.def >>site.def ;;
  HP-UX)
	cat site.def hpux-slib.def >site-slib.def
	cat hpux.def >>site.def ;;
  cygwin)
	LIB=bin
	cat site.def cygwin-slib.def >site-slib.def
	cat cygwin.def >>site.def ;;
  mingw)
	LIB=bin
	WAVE=0
	sed 's/NOCYGWIN//' site.def mingw-slib.def >site-slib.def
	sed 's/NOCYGWIN//' mingw.def >>site.def
        ( cd ../checkpkg; ./dosify ) ;;
  mingw-compat)
	LIB=bin
	OS=mingw
	WAVE=0
	sed 's/NOCYGWIN/-mno-cygwin/' site.def mingw-slib.def >site-slib.def
	sed 's/NOCYGWIN/-mno-cygwin/' mingw.def >>site.def ;;
  Darwin)
	echo "It is normal for Mac OS X to be recognized as Darwin."
	LMFLAGS=$MFLAGS
	WMFLAGS=$MFLAGS
	for a in $ARCHLIST
	do
	    LMFLAGS="$LMFLAGS -arch $a"
	    case $a in
	      i386|ppc) WMFLAGS="$WMFLAGS -arch $a" ;;
	    esac
	done
	if [ $WAVE = unknown ] && [ "x$WMFLAGS" = "x$MFLAGS" ]
	then
            WAVE=0
	fi
	cat site.def darwin-slib.def | \
	    sed "s+^MFLAGS =+MFLAGS = $LMFLAGS+" >site-slib.def
	cat darwin.def | \
	    sed "s+^MFLAGS =+MFLAGS = $LMFLAGS+;s+^WMFLAGS =+WMFLAGS = $WMFLAGS+" >>site.def ;;
  *)    OS=generic
	cat site.def generic-slib.def >site-slib.def
	cat generic.def >>site.def
	echo "Using the generic configuration, which may need to be customized"
	echo "for your operating system.  'configure' will offer suggestions"
	echo "for customization after it completes the generic configuration."
	;;
esac

if [ -s site-slib.def ]
then
  if [ x$LIBTYPE = x ]
  then
    echo
    echo "The WFDB library may be compiled as a static library or as a"
    echo "dynamically loaded (shared) library (the default).  Type S for a"
    ./prompt "static library, or D for a dynamically loaded library:"
    read LIBTYPE
  fi
else
    LIBTYPE=static
fi

case x$LIBTYPE in
  xS*|xs*) rm -f site-slib.def
           touch site-slib.def
           LIBTYPE=static ;;
        *) LIBTYPE=dynamic ;;
esac

if [ $LIBTYPE = static ]
then
    if [ x$SYSLIBS = x ]
    then
	echo
	echo "You may link the WFDB applications to dynamically loaded"
	echo "system libraries (such as the standard C library) to"
	echo "save disk space and for faster loading even while using"
	echo "the static WFDB library, or you may link them to static"
	echo "libraries only, which will make them easier to copy to"
	echo "other systems.  Note that choosing to link to static"
	echo "libraries only may cause compilation to fail if your"
	echo "system does not have a complete set of static libraries."
	echo "Type S to link to static libraries only, or D to link to"
	./prompt "dynamically loaded libraries where available:"
	read SYSLIBS
    fi
    case x$SYSLIBS in
        xS*|xs*) sed "s/LDFLAGS = -L/LDFLAGS = -static -L/" <site.def >site.tmp
		 mv site.tmp site.def
		 echo "Applications will be linked with static libraries only."
		 SYSLIBS=static
		 ;;
	      *) SYSLIBS=dynamic ;;
    esac
else
    SYSLIBS=dynamic

    dynamic_ldflags=`grep '^LDFLAGS =' site-slib.def | sed 's/LDFLAGS = *//'`
    if [ "x$dynamic_ldflags" != "x" ]; then
        sed "s|^LDFLAGS =.*|LDFLAGS = $dynamic_ldflags|" <site.def >site.tmp
        mv site.tmp site.def
    fi
fi

echo
./prompt "Looking for the C compiler ..."
if [ "x$HOST" != "x" ]
then
    CROSS_COMPILE=$HOST-
fi
WCC=`which ${CROSS_COMPILE}gcc 2>&1`
if [ "x$WCC" = "x" ]
then
    WCC="no gcc"
fi
if ( echo $WCC | egrep "no |not |unknown " >wcc.t1 )
then
    WCC=`which ${CROSS_COMPILE}cc 2>&1`
    if [ "x$WCC" = "x" ]
    then
        WCC="no cc"
    fi
    if ( echo $WCC | egrep "no |not |unknown " >wcc.t2 )
    then
        echo "not found"
	echo
        echo "The WFDB software cannot be compiled, because there does not"
        echo "appear to be a C compiler installed on this system.  Please"
        echo "install one, be sure that it is in your PATH, and that it is"
	echo "accessible as either '${CROSS_COMPILE}cc' or '${CROSS_COMPILE}gcc', then run ./configure again."
	cd ..
	exit 1
    else
	CC=${CROSS_COMPILE}cc
	wflags=
    fi
else
    CC=${CROSS_COMPILE}gcc
    wflags="-Wno-implicit -Wformat "
fi
echo "$CC"
sed "s|CC = gcc|CC = $CC|" <site.def >site.tmp
sed "s|^CFLAGS = |CFLAGS = $wflags|" <site.tmp >site.def
sed "s|CC = gcc|CC = $CC|" <site-slib.def >site.tmp
sed "s|^CFLAGS = |CFLAGS = $wflags|" <site.tmp >site-slib.def
rm -f wcc.t1 wcc.t2 site.tmp

./prompt "Looking for the command to strip debugging metadata ..."
WSTRIP=`which ${CROSS_COMPILE}strip 2>&1`
if [ "x$WSTRIP" = "x" ]
then
    WSTRIP="no strip"
fi
if ( echo $WSTRIP | egrep "no |not |unknown " >wstrip.t1 )
then
    STRIP=:
    echo "not found"
else
    STRIP=${CROSS_COMPILE}strip
    echo "$STRIP"
fi
rm -f wstrip.t1
if [ "x$STRIP" != "xstrip" ]
then
    sed "s|^STRIP = .*|STRIP = $STRIP|" <site.def >site.tmp
    mv site.tmp site.def
    sed "s|^STRIP = .*|STRIP = $STRIP|" <site-slib.def >site.tmp
    mv site.tmp site-slib.def
fi

if [ $LIBTYPE = static ] && [ "x${CROSS_COMPILE}" != "x" ]
then
    sed "s|^RANLIB = ranlib|RANLIB = ${CROSS_COMPILE}ranlib|" <site.def >site.tmp
    mv site.tmp site.def
fi

if [ x$DIR = x ]
then
    echo
    echo "Where do you wish to install the WFDB Software Package?"
    echo "It will be installed in subdirectories of WFDBROOT (by default,"
    echo "WFDBROOT is /usr, so that files are installed in /usr/bin,"
    echo "/usr/include, /usr/$LIB, etc.).  Other reasonable choices for"
    echo "WFDBROOT are /usr/local, /opt, or your home directory ($HOME)."
    echo "The value of WFDBROOT must be a full pathname (beginning with '/',"
    echo "but without a '/' at the end).  If the subdirectories (bin, include,"
    echo "lib, ...) of WFDBROOT don't exist, they will be created as necessary."
    echo
    DIR=
    while [ x$DIR = x ]
    do
        ./prompt "Choose a location, or press <Enter> to install in /usr:"
        read DIR
        case x$DIR in
            x/usr) ;;
                x) DIR=/usr ;;
              x*/) DIR=
                   echo "Please type the path again, omitting the '/' at the end." ;;
              x/*) ;;
               x*) DIR=
                   echo "Please enter an absolute pathname, beginning with '/'." ;;
        esac
    done
fi

case $DIR in
  /usr) ;;
    /*) sed "s+^WFDBROOT = /usr+WFDBROOT = $DIR+" <site.def >site.tmp
        mv site.tmp site.def
        sed "s+^WFDBROOT = /usr+WFDBROOT = $DIR+" <site-slib.def \
         >site.tmp
        mv site.tmp site-slib.def
esac

echo  "The WFDB software will be installed in '$DIR'."

if [ x$LIBDIR = xunknown ]
then
    case $OS in
      Linux*)
            nativelibdirs=`$CC -print-search-dirs | sed -n '/^libraries:/{s/^[^=]*=//; s/:/\n/g; p}' | sed ':LP; s+/[^/]*/\.\./+/+; tLP; s+/$++'`
            if [ "$MACHINE" = "x86_64" ] && echo "$nativelibdirs" | grep -q "^$DIR/lib64"; then
                if [ "x$MFLAGS" = "x-m32" ]; then
                    LIB=lib
                else
                    LIB=lib64
                fi
            else
                if [ "x$MFLAGS" = "x-m32" ]; then
                    LIB=lib32
                else
                    LIB=lib
                fi
            fi ;;
    esac
    LIBDIR="\$(WFDBROOT)/$LIB"
fi
sed "s+^LIBDIR = .*+LIBDIR = $LIBDIR+" <site.def >site.tmp
mv site.tmp site.def
sed "s+^LIBDIR = .*+LIBDIR = $LIBDIR+" <site-slib.def >site.tmp
mv site.tmp site-slib.def
xlibdir=`echo "$LIBDIR" | sed 's+$(WFDBROOT)+'"$DIR"+`

MANTMP=`grep "MANDIR =" site.def |sed 's+$(WFDBROOT)/++' |cut -d " " -f 3`
MANDEF=$DIR/$MANTMP
if [ x$MANDIR = xunknown ]
then
   MANDIR=$MANDEF
fi

if [ x$MANDIR = x ]
then
    echo
    echo "Where do you wish to install the manual pages?"
    echo "They will be installed in subdirectories of MANDIR (by default,"
    echo "MANDIR is '$MANDEF').  If you install them in a non-standard"
    echo "directory, you will need to add that directory to your MANPATH."
    echo "The value of MANDIR must be a full pathname (beginning with '/',"
    echo "but without a '/' at the end).  If the subdirectories (man1, man3,"
    echo "man5, ...) of MANDIR don't exist, they will be created as necessary."
    echo
    MANDIR=
    while [ x$MANDIR = x ]
    do
       ./prompt "Choose a location, or press <Enter> to install in $MANDEF:"
        read MANDIR
        case x$MANDIR in
            x/usr) ;;
                x) MANDIR=$MANDEF ;;
              x*/) MANDIR=
                   echo "Please type the path again, omitting the '/' at the end." ;;
              x/*) ;;
               x*) MANDIR=
                   echo "Please enter an absolute pathname, beginning with '/'." ;;
        esac
    done
fi

if [ "$MANDIR" != "$MANDEF" ]
then
    sed "s+^MANDIR = $MANDEF+MANDIR = $MANDIR+" <site.def >site.tmp
    mv site.tmp site.def
fi

echo  "The manual pages will be installed in '$MANDIR'."
echo

# Search for NETLIB if not specified on the command line
if [ x$NETLIB = xunknown ]
    then
    ./prompt "Looking for libcurl ..."
    WHICH=`which curl-config 2>&1`
    if [ "x$WHICH" = "x" ]
	then
	WHICH="no curl-config"
    fi
    if ( echo $WHICH | egrep "no |not |unknown " >which.t1 )
	then
	echo "not found"
	echo "The WFDB software will be compiled without NETFILES"
	echo "access, because libcurl does not appear to be"
	echo "installed on this system.  To add NETFILES access,"
	echo "install libcurl and run ./configure again."
	NETLIB=none
    else
	echo "found"
	echo "The WFDB software will be compiled with NETFILES access"
	echo "using libcurl."
	NETLIB=libcurl
    fi
    rm -f which.t1 which.t2
fi

case $NETLIB in
  libcurl) LC="\`curl-config --cflags\`"
	   LL="\`curl-config --libs\`"
	   NETFILES=1
	   NETFILES_LIBCURL=1
	   VIANF=" via libcurl"
	   WITHNF=with
	   ;;
  none)    LC=""
	   LL=""
	   NETFILES=0
	   NETFILES_LIBCURL=0
	   VIANF=""
	   WITHNF=without
	   ;;
esac
echo "NETFILES=$NETFILES" >../config.cache
echo "NETFILES_LIBCURL=$NETFILES_LIBCURL" >>../config.cache

sed "s/WFDB_NETFILES 1/WFDB_NETFILES $NETFILES/" < ../lib/wfdb.h0 | \
    sed "s/WFDBMAJOR/$MAJOR/" | \
    sed "s/WFDBMINOR/$MINOR/" | \
    sed "s/WFDBRELEASE/$RELEASE/" | \
    sed "s/WFDB_NETFILES_LIBCURL 1/WFDB_NETFILES_LIBCURL $NETFILES_LIBCURL/" \
      >../lib/wfdb.h
if [ $NETLIB != "none" ]
    then
    sed "s/LC =/LC = $LC/" <site.def | sed "s/LL =/LL = $LL/" >site.tmp
    mv site.tmp site.def
fi
sed "s/LC =/LC = $LC/" <site-slib.def | sed "s/LL =/LL = $LL/" >site.tmp
mv site.tmp site-slib.def

cd ..
echo
echo "Creating Makefile in lib ..."
if [ -s conf/site-slib.def ]
    then
    cat lib/Makefile.top conf/site-slib.def lib/Makefile.tpl >lib/Makefile
else
    cat lib/Makefile.top conf/site.def lib/Makefile.tpl >lib/Makefile
fi
for D in app checkpkg convert data doc doc/wag-src doc/wpg-src doc/wug-src \
         examples fortran psd wave waverc xml .
  do
  if [ -s $D/Makefile.top ]
      then
      echo "Creating Makefile in $D ..."
      cat $D/Makefile.top conf/site.def $D/Makefile.tpl >$D/Makefile
  fi
done

# Create output directories for documentation
for D in doc/wag doc/wpg doc/wug
do
    [ -d $D ] || mkdir $D
done

echo rm conf/site.def conf/site-slib.def

if [ "x$WAVE" = "xunknown" ]
    then
    echo
    conf/prompt "Looking for the XView libraries ..."
    TEXTEDIT=`which textedit 2>&1`
    if [ "x$TEXTEDIT" = "x" ]
    then
	TEXTEDIT="no textedit"
    fi
    if [ -d $OWHOME ]
    then
	WAVE=1;
    elif [ -d /usr/local/openwin ]
    then
	WAVE=1;
	OWHOME=/usr/local/openwin
    elif [ -d /opt/openwin ]
    then
	WAVE=1;
	OWHOME=/opt/openwin
    elif [ -d /usr/include/xview ]
    then
	WAVE=1;
	OWHOME=/usr
    elif ( echo $TEXTEDIT | egrep "no |not |unknown " >textedit.t1 )
    then
	WAVE=0;
    else
	WAVE=1;
	TEDIR=`dirname $TEXTEDIT`;
	OWHOME=`dirname $TEDIR`;
    fi
    rm -f textedit.t1
    if [ $WAVE = 0 ]
	then
	echo "not found"
	echo "WAVE will not be compiled, because the XView libraries do not"
	echo "appear to be installed on this system."
	echo "To compile WAVE, install XView, add the directory containing the"
	echo "XView textedit application to your PATH, and run ./configure again."
    else
	echo "found"
    fi
fi

if [ "x$WAVE" = "x1" ]
    then
    sed "s+/usr/openwin+$OWHOME+" <wave/Makefile >tmp.$$
    mv tmp.$$ wave/Makefile
    WAVECOMP="WAVE will be compiled and installed in '$DIR/bin'."
    echo "WAVE=1" >>config.cache
else
    cp -p wave/nomake wave/Makefile
    cp -p wave/nomake waverc/Makefile
    echo "WAVE=0" >>config.cache
    WAVECOMP="WAVE will not be compiled."
fi

# Clean up old *.o files in lib, to avoid possibly using binaries intended
# for a shared library in a static library or vice versa.
rm -f lib/*.o

if [ $DIR != "/usr" -a  $LIBTYPE = dynamic ]
    then
    cat <<EOF

IMPORTANT: You have chosen to build a dynamic (shared) WFDB library in
a directory, $DIR/$LIB, that is not normally searched for such
libraries.  In order to use the applications that will be compiled
with this library, it may be necessary to add this directory to your
LD_LIBRARY_PATH.  If your shell is csh or a variant, do this by
typing:
EOF
    if [ "x$LD_LIBRARY_PATH" = x ]
	then
	echo "  setenv LD_LIBRARY_PATH $DIR/$LIB"
	echo "Otherwise, do this by typing:"
	echo "  LD_LIBRARY_PATH=$DIR/$LIB"
	echo "  export LD_LIBRARY_PATH"
    else
	echo "  setenv LD_LIBRARY_PATH \${LD_LIBRARY_PATH}:$DIR/$LIB"
	echo "Otherwise, do this by typing:"
	echo "  LD_LIBRARY_PATH=\${LD_LIBRARY_PATH}:$DIR/$LIB"
	echo "  export LD_LIBRARY_PATH"
    fi
fi

if [ $OS = generic ]
    then
    cat <<EOF

No specific configuration information is available for your operating
system.  Please try compiling using the generic Makefiles that have
been generated by this configuration utility.  If there are problems,
it may be possible to solve them by customizing conf/generic.def (and
conf/generic-slib.def if you are attempting to compile a shared WFDB
library).  Run ./configure again after making any necessary changes to
these files.  Please send reports of success or failure, together with
the output of the command 'uname -a', and copies of any files you have
changed, to:
             wfdb@physionet.org
EOF

fi

if [ "x$MFLAGS" != x ]
    then
    CC="$CC $MFLAGS"
fi

cat <<EOF

Summary:

$PACKAGE-$OS is now ready to be compiled using '$CC'.
The WFDB library will be compiled as a $LIBTYPE library $WITHNF NETFILES
 access${VIANF}, and it will be installed in '$xlibdir'.
The WFDB library .h files will be installed in '$DIR/include/wfdb'.
The WFDB applications will be linked to $SYSLIBS system libraries, and
 they will be installed in '$DIR/bin'.
$WAVECOMP
Manual pages will be installed in subdirectories of '$MANDIR'.
Sample data files will be installed in '$DIR/database', which
 will be included in the default WFDB path.

If you need to compile a different WFDB library type, or install into different
directories, rerun this script with its "-i" (interactive) option:
      ./configure -i
Other options can be viewed by rerunning this script with its "-h" option:
      ./configure -h

WFDB software configuration is complete.
Now run 'make' to compile and test, followed by 'make install' to recompile
and install the software, man pages, and example data.  Finally, run
'make check' to verify that the installation is complete and successful.

EOF