1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245
|
#!/bin/sh
# This file is part of the FElt finite element analysis package.
# Copyright (C) 1993-1995 Jason I. Gobat and Darren C. Atkinson
#
# 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., 675 Mass Ave, Cambridge, MA 02139, USA.
# find a program in your path
which() {
IFS=:
for dir in $PATH; do
if [ -x $dir/$2 -a ! -d $dir/$2 ]; then
eval "$1=$dir/$2"
break
fi
done
IFS=" "
}
# find a file in a list
findfile() {
for file in $2; do
if [ -f $file -o -d $file ]; then
eval $1=$file
break
fi
done
}
# parse a command line option
parse() {
eval $1="`echo \"$2\" | sed -e 's/^[^=]*=//'`"
}
# print help information and exit
help() {
echo "usage: configure [options]"
echo " --contrib build contributed elements [no]"
echo " --prefix=dir destination directory prefix [$DEST]"
echo " --cc=prog C compiler [$CC]"
echo " --cpp=prog C preprocessor [$CPP]"
echo " --ccopts=options C compiler options [$CCOPTS]"
echo " --syslibs=libs system dependent libraries [$SYSLIBS]"
echo " --x-defaults=dir X11 defaults directory [$X11DEF]"
echo " --x-includes=dir X11 include directory [$X11INC]"
echo " --x-libraries=dir X11 library directory [$X11LIB]"
exit 0
}
# try to find the defaults
echo Configuring ...
which CC gcc
which RANLIB ranlib
which CAT cat
which TRUE true
findfile DEST "/usr/felt \
/usr/local \
/usr/contrib \
/usr"
findfile READDIR "/lib/libreadline.a \
/usr/lib/libreadline.a \
/usr/local/lib/libreadline.a \
/usr/gnu/lib/libreadline.a \
/opt/gnu/lib/libreadline.a"
findfile CPP "/lib/cpp \
/usr/lib/cpp \
/usr/ccs/lib/cpp \
/usr/lang/cpp \
/usr/bin/cpp \
/bin/cpp"
findfile X11DEF "/usr/X11R6/lib/X11/app-defaults \
/usr/X11R5/lib/X11/app-defaults \
/usr/X11R4/lib/X11/app-defaults \
/usr/X386/lib/X11/app-defaults \
/usr/X11/lib/X11/app-defaults \
/usr/X11R6/lib/app-defaults \
/usr/X11R5/lib/app-defaults \
/usr/X11R4/lib/app-defaults \
/usr/X386/lib/app-defaults \
/usr/X11/lib/app-defaults \
/usr/lib/X11R6/app-defaults \
/usr/lib/X11R5/app-defaults \
/usr/lib/X11R4/app-defaults \
/usr/lib/X386/app-defaults \
/usr/lib/X11/app-defaults \
/usr/openwin/lib/app-defaults"
findfile X11INC "/usr/X11R6/include \
/usr/X11R5/include \
/usr/X11R4/include \
/usr/X386/include \
/usr/X11/include \
/usr/include/X11R6 \
/usr/include/X11R5 \
/usr/include/X11R4 \
/usr/include/X11 \
/usr/openwin/include"
findfile X11LIB "/usr/X11R6/lib \
/usr/X11R5/lib \
/usr/X11R4/lib \
/usr/X386/lib \
/usr/X11/lib \
/usr/lib/X11R6 \
/usr/lib/X11R5 \
/usr/lib/X11R4 \
/usr/lib/X11 \
/usr/openwin/lib"
# provide worst-case defaults
: ${CC:=cc}
: ${RANLIB:=$TRUE}
: ${READDIR:=/lib}
: ${DEST}:=.}
: ${CPP:=$CAT}
: ${X11DEF:=.}
: ${X11INC:=.}
: ${X11LIB:=.}
CC=`basename $CC`
RANLIB=`basename $RANLIB`
READDIR=`dirname $READDIR`
CONTRIBDIR=none
CCOPTS="${CFLAGS:-g}"
# defaults for known architectures that fail the above
case `uname -rs` in
HP-UX*) RANLIB=true;;
SunOS?5.*) CCOPTS="$CCOPTS -D_XOPEN_SOURCE";;
Irix*) if [ $CC = cc ]; then CCOPTS="$CCOPTS -Wf,-XNl16384"; fi;;
esac
# parse command line arguments
for arg in $*; do
case $arg in
-h | --help) help;;
--cc=*) parse CC $arg;;
--cpp=*) parse CPP $arg;;
--prefix=*) parse DEST $arg;;
--ccopts=*) parse CCOPTS $arg;;
--syslibs=*) parse SYSLIBS $arg;;
--x-defaults=*) parse X11DEF $arg;;
--x-includes=*) parse X11INC $arg;;
--x-libraries=*) parse X11LIB $arg;;
--readline=*) parse READDIR $arg;;
CFLAGS=*) parse CCOPTS $arg;;
--contrib) CONTRIBFLAGS=-DCONTRIB; CONTRIBDIR=contrib;;
--contrib=y) CONTRIBFLAGS=-DCONTRIB; CONTRIBDIR=contrib;;
--contrib=yes) CONTRIBFLAGS=-DCONTRIB; CONTRIBDIR=contrib;;
esac
done
# determine the readline library options
if [ -f $READDIR/libreadline.a ]; then
READLINE=-DREADLINE
READLIBS="-L$READDIR -lreadline -ltermcap"
else
READDIR=none
READLINE=
READLIBS=
fi
# print defaults
echo " C compiler =" $CC
echo " C compiler options =" $CCOPTS
echo " C preprocessor =" $CPP
echo " ranlib program =" $RANLIB
echo " destination prefix =" $DEST
echo " readline library directory =" $READDIR
echo " X11 application defaults =" $X11DEF
echo " X11 include directory =" $X11INC
echo " X11 library directory =" $X11LIB
# create Makefile.conf
cat > ./etc/Makefile.conf << EOF
AR = ar
CC = $CC
CCOPTS = $CCOPTS
CONTRIBDIR = $CONTRIBDIR
CONTRIBFLAGS = $CONTRIBFLAGS
CPP = $CPP
DESTBIN = $DEST/bin
DESTLIB = $DEST/lib/felt
DESTMAN = $DEST/man
INSTALL = sh \$(TOPDIR)/etc/install.sh -c
LDOPTS =
LIBELT = \$(TOPDIR)/lib/Elements/libelt.a
LIBFELT = \$(TOPDIR)/lib/Felt/libfelt.a
LIBGEN = \$(TOPDIR)/lib/Generate/libgen.a
LIBGEOMPACK = \$(TOPDIR)/lib/Geompack/libgeompack.a
LIBMTX = \$(TOPDIR)/lib/Matrix/libmtx.a
LIBWIDGETS = \$(TOPDIR)/lib/Widgets/libwidgets.a
MKDIR = sh \$(TOPDIR)/etc/mkdirhier.sh
RANLIB = $RANLIB
READLINE = $READLINE
READLIBS = $READLIBS
RM = rm -f
SYSLIBS =
X11DEF = $X11DEF
X11INC = $X11INC
X11LIB = $X11LIB
EOF
exit 0
|