#! /bin/sh # file: configure G. Moody 24 May 2000 # Last revised: 8 August 2005 # 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 me (george@mit.edu) 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. NETLIB=unknown for i in $* do case $i in --dynamic) LIBTYPE=dynamic ;; -m*) if [ "x$MFLAGS" = x ] then MFLAGS=$i else MFLAGS="$MFLAGS $i" fi ;; --mandir=*) MANDIR=`echo $i | sed 's/[-a-zA-Z0-9]*=//'` ;; --prefix=*) DIR=`echo $i | sed 's/[-a-zA-Z0-9]*=//'` ;; --shared) LIBTYPE=dynamic ;; --static) LIBTYPE=static ;; --static_only) LIBTYPE=static SYSLIBS=static ;; --without-cygwin) NOCYGWIN=yes ;; --without-netfiles) NETLIB=none ;; --with-libcurl) NETLIB=libcurl ;; --with-libwww) NETLIB=libwww ;; *) cat <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"` cp version.def site.def echo "# Definitions generated by 'configure'" >>site.def echo >>site.def echo "PACKAGE = $PACKAGE" >>site.def echo "SRCDIR = \"$SRCDIR\"" >>site.def echo LONGDATE = `date '+%e %B %Y'` >>site.def echo SHORTDATE = `date '+%B %Y' | tr a-z A-Z` >>site.def echo "# _____________________________________________________________________________" >>site.def echo >>site.def rm -f site-slib.def touch site-slib.def case `uname` in Linux*) OS=Linux case `arch` in x86_64) if [ "x$MFLAGS" = x ] then LIB=lib64 cat site.def linux-slib.def | sed s+/lib\$+/lib64+g >site-slib.def cat linux.def | sed s+/lib\$+/lib64+g >>site.def else cat site.def linux-slib.def | \ sed "s+MFLAGS =+MFLAGS = $MFLAGS+" >site-slib.def cat linux.def | \ sed "s+MFLAGS =+MFLAGS = $MFLAGS+" >>site.def fi ;; *) cat site.def linux-slib.def >site-slib.def cat linux.def >>site.def ;; esac ;; FreeBSD*) OS=FreeBSD cat site.def freebsd-slib.def >site-slib.def cat freebsd.def >>site.def ;; SunOS*) OS=Solaris cat site.def solaris-slib.def >site-slib.def cat solaris.def >>site.def echo "It is normal, and harmless, for Solaris to be recognized as" echo "SunOS." ;; HP-UX*) OS=HPUX cat site.def hpux-slib.def >site-slib.def cat hpux.def >>site.def ;; CYGWIN*) if [ "x$NOCYGWIN" = "xyes" ] then OS=mingw sed 's/NOCYGWIN/-mno-cygwin/' site.def mingw-slib.def >site-slib.def sed 's/NOCYGWIN/-mno-cygwin/' mingw.def >>site.def else OS=cygwin cat site.def cygwin-slib.def >site-slib.def cat cygwin.def >>site.def fi ;; MINGW*) OS=mingw sed 's/NOCYGWIN//' site.def mingw-slib.def >site-slib.def sed 's/NOCYGWIN//' mingw.def >>site.def ;; Darwin*) OS=Darwin LIBTYPE=dynamic cat site.def darwin-slib.def >site-slib.def cat darwin.def >>site.def echo "It is normal for Mac OS X to be recognized as Darwin." echo "Building static libraries is not supported on Darwin." ;; *) 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 for" echo "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.tmp mv site.tmp site.def echo "Applications will be linked with static libraries only." SYSLIBS=static ;; *) SYSLIBS=dynamic ;; esac else SYSLIBS=dynamic fi echo ./prompt "Looking for the C compiler ..." WCC=`which gcc 2>&1` if [ "x$WCC" = "x" ] then WCC="no gcc" fi if ( echo $WCC | egrep "no |not " >wcc.t1 ) then WCC=`which cc 2>&1` if [ "x$WCC" = "x" ] then WCC="no cc" fi if ( echo $WCC | egrep "no |not " >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 'cc' or 'gcc', then run ./configure again." cd .. exit else sed "s/CC = gcc/CC = cc/" site.tmp mv site.tmp site.def sed "s/CC = gcc/CC = cc/" site.tmp mv site.tmp site-slib.def CC=cc fi else CC=gcc fi echo "$CC" rm -f wcc.t1 wcc.t2 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 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.tmp mv site.tmp site.def sed "s+^WFDBROOT = /usr+WFDBROOT = $DIR+" site.tmp mv site.tmp site-slib.def esac echo "The WFDB software will be installed in '$DIR'." MANTMP=`grep "MANDIR =" site.def |sed 's+$(WFDBROOT)/++' |cut -d " " -f 3` MANDEF=$DIR/$MANTMP 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 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.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 " >which.t1 ) then echo "not found" ./prompt "Looking for libwww ..." WHICH=`which libwww-config 2>&1` if [ "x$WHICH" = "x" ] then WHICH="no libwww-config" fi if ( echo $WHICH | egrep "no |not " >which.t2 ) then echo "not found" echo "The WFDB software will be compiled without NETFILES" echo "access, because neither libcurl nor libwww appears to" echo "be installed on this system. To add NETFILES access," echo "install libcurl or libwww and run ./configure again." NETLIB=none else echo "found" echo "The WFDB software will be compiled with NETFILES access" echo "using libwww." NETLIB=libwww fi 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 ;; libwww) LC="\`libwww-config --cflags\`" LL="\`libwww-config --libs\`" NETFILES=1 NETFILES_LIBCURL=0 VIANF=" via libwww" 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/WFDB_NETFILES_LIBCURL 1/WFDB_NETFILES_LIBCURL $NETFILES_LIBCURL/" \ >../lib/wfdb.h if [ $LIBTYPE = "static" -a $NETLIB != "none" ] then LL = "$LL $LL $LL" sed "s/LC =/LC = $LC/" site.tmp mv site.tmp site.def fi sed "s/LC =/LC = $LC/" 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 . 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 echo rm conf/site.def conf/site-slib.def if [ "$OS" = "mingw" ] then cp -p wave/nomake wave/Makefile cp -p wave/nomake waverc/Makefile echo "WAVE=0" >>config.cache WAVECOMP="WAVE will not be compiled." else echo conf/prompt "Looking for the XView libraries ..." TEXTEDIT=`which textedit 2>&1` if [ "x$TEXTEDIT" = "x" ] then TEXTEDIT="no textedit" fi if [ -d /usr/openwin ] then WAVE=1; elif [ -d /usr/local/openwin ] then WAVE=1; sed "s+/usr/openwin+/usr/local/openwin+" tmp.$$ mv tmp.$$ wave/Makefile elif [ -d /opt/openwin ] then WAVE=1; sed "s+/usr/openwin+/opt/openwin+" tmp.$$ mv tmp.$$ wave/Makefile elif ( echo $TEXTEDIT | egrep "no |not " >textedit.t1 ) then WAVE=0; else WAVE=1; TEDIR=`dirname $TEXTEDIT`; OWHOME=`dirname $TEDIR`; sed "s+/usr/openwin+$OWHOME+" tmp.$$ mv tmp.$$ wave/Makefile 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." cp -p wave/nomake wave/Makefile cp -p wave/nomake waverc/Makefile echo "WAVE=0" >>config.cache WAVECOMP="WAVE will not be compiled." else echo "found" WAVECOMP="WAVE will be compiled and installed in '$DIR/bin'." echo "WAVE=1" >>config.cache fi 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 <