2 # This file is part of the FElt finite element analysis package.
3 # Copyright (C) 1993-1995 Jason I. Gobat and Darren C. Atkinson
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 # find a program in your path
25 if [ -x $dir/$2 -a ! -d $dir/$2 ]; then
34 # find a file in a list
38 if [ -f $file -o -d $file ]; then
46 # parse a command line option
49 eval $1="`echo \"$2\" | sed -e 's/^[^=]*=//'`"
53 # print help information and exit
56 echo "usage: configure [options]"
57 echo " --contrib build contributed elements [no]"
58 echo " --prefix=dir destination directory prefix [$DEST]"
59 echo " --cc=prog C compiler [$CC]"
60 echo " --cpp=prog C preprocessor [$CPP]"
61 echo " --ccopts=options C compiler options [$CCOPTS]"
62 echo " --syslibs=libs system dependent libraries [$SYSLIBS]"
63 echo " --x-defaults=dir X11 defaults directory [$X11DEF]"
64 echo " --x-includes=dir X11 include directory [$X11INC]"
65 echo " --x-libraries=dir X11 library directory [$X11LIB]"
70 # try to find the defaults
79 findfile DEST
"/usr/felt \
84 findfile READDIR
"/lib/libreadline.a \
85 /usr/lib/libreadline.a \
86 /usr/local/lib/libreadline.a \
87 /usr/gnu/lib/libreadline.a \
88 /opt/gnu/lib/libreadline.a"
90 findfile CPP
"/lib/cpp \
97 findfile X11DEF
"/usr/X11R6/lib/X11/app-defaults \
98 /usr/X11R5/lib/X11/app-defaults \
99 /usr/X11R4/lib/X11/app-defaults \
100 /usr/X386/lib/X11/app-defaults \
101 /usr/X11/lib/X11/app-defaults \
102 /usr/X11R6/lib/app-defaults \
103 /usr/X11R5/lib/app-defaults \
104 /usr/X11R4/lib/app-defaults \
105 /usr/X386/lib/app-defaults \
106 /usr/X11/lib/app-defaults \
107 /usr/lib/X11R6/app-defaults \
108 /usr/lib/X11R5/app-defaults \
109 /usr/lib/X11R4/app-defaults \
110 /usr/lib/X386/app-defaults \
111 /usr/lib/X11/app-defaults \
112 /usr/openwin/lib/app-defaults"
114 findfile X11INC
"/usr/X11R6/include \
123 /usr/openwin/include"
125 findfile X11LIB
"/usr/X11R6/lib \
137 # provide worst-case defaults
149 RANLIB
=`basename $RANLIB`
150 READDIR
=`dirname $READDIR`
153 if [ $CC = gcc
]; then CCOPTS
=-O3; else CCOPTS
=-O; fi
156 # defaults for known architectures that fail the above
159 HP-UX
*) RANLIB
=true
;;
160 SunOS?
5.
*) CCOPTS
="$CCOPTS -D_XOPEN_SOURCE";;
161 Irix
*) if [ $CC = cc
]; then CCOPTS
="$CCOPTS -Wf,-XNl16384"; fi;;
165 # parse command line arguments
171 --cc=*) parse CC
$arg;;
172 --cpp=*) parse CPP
$arg;;
173 --prefix=*) parse DEST
$arg;;
174 --ccopts=*) parse CCOPTS
$arg;;
175 --syslibs=*) parse SYSLIBS
$arg;;
176 --x-defaults=*) parse X11DEF
$arg;;
177 --x-includes=*) parse X11INC
$arg;;
178 --x-libraries=*) parse X11LIB
$arg;;
179 --readline=*) parse READDIR
$arg;;
181 CFLAGS
=*) parse CCOPTS
$arg;;
183 --contrib) CONTRIBFLAGS
=-DCONTRIB; CONTRIBDIR
=contrib
;;
184 --contrib=y
) CONTRIBFLAGS
=-DCONTRIB; CONTRIBDIR
=contrib
;;
185 --contrib=yes) CONTRIBFLAGS
=-DCONTRIB; CONTRIBDIR
=contrib
;;
190 # determine the readline library options
192 if [ -f $READDIR/libreadline.a
]; then
194 READLIBS
="-L$READDIR -lreadline -ltermcap"
204 echo " C compiler =" $CC
205 echo " C compiler options =" $CCOPTS
206 echo " C preprocessor =" $CPP
207 echo " ranlib program =" $RANLIB
208 echo " destination prefix =" $DEST
209 echo " readline library directory =" $READDIR
210 echo " X11 application defaults =" $X11DEF
211 echo " X11 include directory =" $X11INC
212 echo " X11 library directory =" $X11LIB
215 # create Makefile.conf
217 cat > .
/etc
/Makefile.conf
<< EOF
221 CONTRIBDIR = $CONTRIBDIR
222 CONTRIBFLAGS = $CONTRIBFLAGS
225 DESTLIB = $DEST/lib/felt
227 INSTALL = sh \$(TOPDIR)/etc/install.sh -c
229 LIBELT = \$(TOPDIR)/lib/Elements/libelt.a
230 LIBFELT = \$(TOPDIR)/lib/Felt/libfelt.a
231 LIBGEN = \$(TOPDIR)/lib/Generate/libgen.a
232 LIBGEOMPACK = \$(TOPDIR)/lib/Geompack/libgeompack.a
233 LIBMTX = \$(TOPDIR)/lib/Matrix/libmtx.a
234 LIBWIDGETS = \$(TOPDIR)/lib/Widgets/libwidgets.a
235 MKDIR = sh \$(TOPDIR)/etc/mkdirhier.sh