1-MMS依赖的库文件:
sudo aptitude install ksh lesstif2-dev gfortran
2-然后:
SETUP文件:
#################################################################
#!/bin/sh
#
# Note - If your system does not have ksh, this script will
# will also work with sh.
#
# MMS installation script
# Steve Markstrom - USGS 9/16/94
# Loosely based on the "setup" script from GRASS.
#
PRINTF=make/printf;export PRINTF
AGREE=make/agree;export AGREE
FINDCMD=make/findcmd
LINEUP=make/lineup
ACCESS=make/access
CC=gcc
FC=gfortran
RM="rm -f"
MV="mv -f"
CP=cp
RANLIB=ranlib
MAKE=make
LN="ln -s"
CD=cd
AR="ar ruv"
ansi=False
HASX=True
HASmotif=True
HASGRASS=True
#
# MMS master directory
#
MMSDIR=`pwd`; export MMSDIR
echo
echo
echo "This is the MMS system level installation script."
echo "Installing to MMS master directory $MMSDIR."
echo
#
# Set flags for make
#
FORTRAN_FLAGS=-u ; check_f77_flags=yes
COMPILE_FLAGS=-O ; check_cc_flags=yes
LDFLAGS=-s ; check_ld_flags=yes
if test "$ansi" = "False"
then
XCFLAGS= ; check_x_c_flags=yes
else
XCFLAGS= ; check_x_c_flags=yes
fi
XLDFLAGS= ; check_x_ld_flags=yes
XINCPATH=/usr/include ; check_x_inc_path=yes
XMINCPATH=/usr/include/Xm ; check_xm_inc_path=yes
XLIBPATH=/usr/lib ; check_x_lib_path=yes
XTLIBPATH=/usr/lib ; check_xt_lib_path=yes
XMLIBPATH=/usr/lib ; check_xm_lib_path=yes
XEXTRALIBS= ; check_x_xtra_libs=yes
MATHLIB=-lm ; check_mathlib=yes
FORTRANLIBS= ; check_f77_libs=yes
GRASSLIBPATH=/usr/lib ; check_grass_path_path=yes
GRASSLIB=-lgis
FINDGRASSLIB=libgis.a
XMLIB=-lXm
FINDXMLIB=libXm
XTLIB=-lXt
FINDXTLIB=libXt
XLIB=-lX11
FINDXLIB=libX11
OS=`uname -s`
REL=`uname -r`
MAJOR_REL=${REL%%.*}
echo You are running $OS release $REL
if test $OS = "SunOS"
then
if test $MAJOR_REL = "4"
then
ARC=SUN4
COMPILE_FLAGS="$COMPILE_FLAGS -D_MAIN_UNDEFINED -D$ARC"
check_cc_flags=yes
check_mathlib=no
check_ld_flags=no
check_x_ld_flags=no
check_x_xtra_libs=no
FORTRANLIBS="/usr/lang/SC2.0.1/values-Xt.o -L/usr/lang/SC2.0.1 -lM77 -lF77 -lansi"
check_f77lib=yes
else
CC=cc
ARC=SOLARIS
COMPILE_FLAGS="$COMPILE_FLAGS -D$ARC -DSYSV -DUSE_DIRENT"
check_cc_flags=yes
RANLIB="ls"
check_mathlib=no
LDFLAGS="-lsocket"
check_ld_flags=yes
check_x_ld_flags=no
check_x_xtra_libs=no
FORTRANLIBS="-L/opt/SUNWspro/SC3.0.1/lib -lM77 -lF77 -lsunmath -lsocket -lnsl -L/usr/local/ccs/lib -lgen -lm"
check_f77lib=yes
XINCPATH=/usr/openwin/share/include ; check_x_inc_path=yes
XMINCPATH=/usr/dt/include ; check_xm_inc_path=yes
XLIBPATH=/usr/openwin/lib ; check_x_lib_path=yes
XTLIBPATH=/usr/openwin/lib ; check_xt_lib_path=yes
XMLIBPATH=/usr/dt/lib ; check_xm_lib_path=yes
XEXTRALIBS="-lsocket -lnsl" ; check_x_xtra_libs=yes
echo
echo
echo "Please check your path for the placement of '/usr/ucb'."
echo
echo "This directory must come after the other important"
echo "solaris directories for proper installation of MMS."
echo
echo
fi
elif test $OS = "dgux"
then
ARC=DG
COMPILE_FLAGS="$COMPILE_FLAGS -D$ARC -DSYSV"
check_cc_flags=yes
RANLIB="ar -tls"
check_mathlib=no
check_ld_flags=no
check_x_ld_flags=no
XEXTRALIBS="-L/usr/lib -lPW -ldgc"
check_x_xtra_libs=yes
FORTRANLIBS="-L/usr/opt/ghf/lib -lFPNATIVE -lf -lI66 -lind -lvms"
check_f77lib=yes
FORTRAN_FLAGS="-u -X159 -X57"
check_f77_flags=yes
elif test $OS = "HP-UX"
then
ARC=HP
CC=c89
COMPILE_FLAGS="$COMPILE_FLAGS -D$ARC -D_HPUX_SOURCE -DSYSV"
check_cc_flags=yes
check_mathlib=no
check_ld_flags=no
check_x_ld_flags=no
check_x_xtra_libs=no
FORTRANLIBS="-lf"
check_f77lib=yes
FORTRAN_FLAGS="+E3 +ppu -K -w"
check_f77_flags=yes
elif test $OS = "IRIX"
then
ARC=SGI
CC=cc
COMPILE_FLAGS="-mips2 -Olimit 3000 -D$ARC -DSYSV"
check_cc_flags=yes
check_mathlib=no
LDFLAGS="-mips2"
check_ld_flags=yes
check_x_ld_flags=no
check_x_xtra_libs=no
# FORTRANLIBS="-lF77 -lU77 -lI77 -lisam -lm"
FORTRANLIBS="-lftn -lm"
check_f77lib=yes
FORTRAN_FLAGS="-u"
check_f77_flags=yes
RANLIB="/usr/bin/true"
AR="ar rv"
elif test $OS = "AIX"
then
ARC=AIX
COMPILE_FLAGS="$COMPILE_FLAGS -D$ARC"
FC=xlf
check_mathlib=no
check_ld_flags=no
check_x_ld_flags=no
check_x_xtra_libs=no
FORTRANLIBS="-lxlf90 -lxlf"
check_f77lib=yes
FORTRAN_FLAGS="-u -qextname"
check_f77_flags=yes
elif test $OS = "Linux"
then
ARC=LINUX
COMPILE_FLAGS="$COMPILE_FLAGS -D$ARC"
check_mathlib=no
check_ld_flags=no
check_x_ld_flags=no
XEXTRALIBS="-lXp -lXext" ; check_x_xtra_libs=yes
FORTRANLIBS="-lgfortran -lgcc"
check_f77lib=yes
FORTRAN_FLAGS="-Wall -fno-second-underscore"
check_f77_flags=yes
XLIBPATH=/usr/lib ; check_x_lib_path=yes
XTLIBPATH=/usr/lib ; check_xt_lib_path=yes
XMLIBPATH=/usr/lib ; check_xm_lib_path=yes
elif test $OS = "OSF1"
then
ARC=OSF1
CC=cc
COMPILE_FLAGS="$COMPILE_FLAGS -D$ARC -DSYSV -DUSE_DIRENT"
check_cc_flags=yes
check_mathlib=no
check_ld_flags=no
check_x_ld_flags=no
check_x_xtra_libs=no
FORTRANLIBS="-lfor -lots"
check_f77lib=yes
FORTRAN_FLAGS="-u -i8"
check_f77_flags=yes
else
echo
echo Your operating system is $OS.
echo MMS has not been tested on this platform.
echo Please send email to markstro@usgs.gov.
echo
echo
exit 1
fi
echo ARC flag has been set to $ARC
#
# Figure out the C compiler
#
echo
sh $PRINTF %s C compiler to use [$CC]:
read x
if test "$x" != ""
then
CC=$x
fi
if $CC -o /tmp/$$ make/main.c
then
sh $PRINTF "%s/n" C compiler looks good.
rm -f /tmp/$$
else
sh $PRINTF "%s/n" There were errors. Go find your C compiler and come back...
exit 1
fi
(cd make
rm -f access access.o
$CC access.c -o access >/dev/null 2>/dev/null
rm -f access.o
)
#
# Figure out the FORTRAN compiler
#
echo
sh $PRINTF %s FORTRAN compiler to use [$FC]:
read x
if test "$x" != ""
then
FC=$x
fi
if $FC -o /tmp/$$ make/main.f
then
sh $PRINTF "%s/n" FORTRAN compiler looks good.
rm -f /tmp/$$
else
sh $PRINTF "%s/n" There were errors. Go find your FORTRAN compiler and come back...
exit 1
fi
(cd make
rm -f access access.o
$CC access.c -o access >/dev/null 2>/dev/null
rm -f access.o
)
#
# Set the MMS subdirectories.
#
MSRCDIR=$MMSDIR/src/mms
MINCDIR=$MMSDIR/src/include
MLIBDIR=$MMSDIR/lib
MOBJDIR=$MMSDIR/obj
OBJDIR=$MMSDIR/obj
MBINDIR=$MMSDIR/bin
######
sh $PRINTF "/n%s/n/n" Checking your compiler for ANSI compliance.
if $CC -o /tmp/$$ make/ansi.c 1>/dev/null 2>&1
then
sh $PRINTF "%s/n" Your compiler seems to be an Ansi-C compiler
sh $PRINTF "%s/n" Compile flags must be defined to make it
sh $PRINTF "%s/n/n/n" "behave like a K&R C compiler."
ansi=True
else
sh $PRINTF "%s/n/n" You are OK.
ansi=False
fi
rm -f /tmp/$$
#
# Find X includes and libs
#
if test "$HASX" != "False"
then
if test -d $XINCPATH
then
sh $PRINTF "%s/n/n" Found X11 include path -- $XINCPATH
sh $PRINTF %s X include path to use [$XINCPATH]:
read x
if test "$x" != ""
then
XINCPATH=$x
fi
elif test -d /usr/local/include/X11
then
XINCPATH=/usr/local/include/X11
sh $PRINTF "%s/n/n" Found X11 include path -- $XINCPATH
else
sh $PRINTF "%s/n" "I can't find your X11 include path."
if sh $AGREE Is X installed on your system
then
while true
do
sh $PRINTF "/n"
sh $PRINTF %s "Path for X11 include files [RETURN for none] -->"
read x
if test "$x" != ""
then
if $ACCESS r $x/Xlib.h
then
XINCPATH=$x
sh $PRINTF "%s/n/n" Found It.
break
else
sh $PRINTF "%s/n/n" Invalid path. Try again.
fi
else
XINCPATH=
break
fi
done
else
HASX=False
fi
fi
fi
XINCPATH=`echo $XINCPATH | sed 's///X11$//'`
if test "$XINCPATH" = "/usr/include"
then
XINCPATH=""
fi
echo XINCPATH=$XINCPATH
if test "$HASMotif" != "False"
then
if test -d $XMINCPATH
then
sh $PRINTF "%s/n/n" Found Motif Include path -- $XMINCPATH
sh $PRINTF %s Motif Include path to use [$XMINCPATH]:
read x
if test "$x" != ""
then
XMINCPATH=$x
fi
elif test -d $XINCPATH/Xm
then
XMINCPATH=$XINCPATH/Xm
sh $PRINTF "%s/n/n" Found Motif Include path -- $XMINCPATH
break
else
sh $PRINTF "%s/n" "I can't find your Motif include path."
while true
do
sh $PRINTF "/n"
sh $PRINTF %s "Path for Motif include files [RETURN for none] -->"
read x
if test "$x" != ""
then
if $ACCESS r $x/Xm.h
then
XMINCPATH=$x
sh $PRINTF "%s/n/n" Found it.
break
else
sh $PRINTF "%s/n/n" Invalid path. Try again.
fi
else
XMINCPATH=
HASMotif=False
break
fi
done
fi
fi
XMINCPATH=`echo $XMINCPATH | sed 's///Xm$//'`
if test "$XMINCPATH" = "/usr/include"
then
XMINCPATH=""
fi
if test "$HASX" != "False"
then
if $ACCESS r $XLIBPATH/"$FINDXLIB.a" || $ACCESS r $XLIBPATH/"$FINDXLIB.so"
then
sh $PRINTF "%s/n/n" Found The X11 library -- $XLIBPATH
sh $PRINTF %s X11 library path to use [$XLIBPATH]:
read x
if test "$x" != ""
then
XLIBPATH=$x
fi
else
sh $PRINTF "%s/n" "I can't seem to find your X Library."
while true
do
sh $PRINTF %s "Path to your X Library [RETURN for none] -->"
read x
if test "$x" != ""
then
if $ACCESS r $x/"$FINDXLIB.a" || $ACCESS r $x/"$FINDXLIB.so"
then
XLIBPATH=$x
XTLIBPATH=$x
sh $PRINTF "%s/n/n" Found it.
break
else
sh $PRINTF "%s/n" This is an invalid path. Try again.
fi
else
XLIBPATH=
break;
fi
done
fi
fi
if test "$HASMotif" != "False"
then
if $ACCESS r $XTLIBPATH/"$FINDXTLIB.a" || $ACCESS r $XTLIBPATH/"$FINDXTLIB.so"
then
sh $PRINTF "%s/n/n" Found The Intrinsics library -- $XTLIBPATH
sh $PRINTF %s Intrinsics library path to use [$XTLIBPATH]:
read x
if test "$x" != ""
then
XTLIBPATH=$x
fi
else
sh $PRINTF "%s/n/n" "I can't seem to find your X Intrinsics Library."
while true
do
sh $PRINTF %s "Path to your X Intrinsics Library [RETURN for none] -->"
read x
if test "$x" != ""
then
if $ACCESS r $x/"$FINDXTLIB.a" || $ACCESS r $x/"$FINDXTLIB.so"
then
XTLIBPATH=$x
sh $PRINTF "%s/n/n" Found it.
break
else
sh $PRINTF "%s/n/n" This is an invalid path. Try again.
fi
else
XTLIBPATH=
break
fi
done
fi
fi
if test "$HASMotif" != "False"
then
if $ACCESS r $XMLIBPATH/"$FINDXMLIB.a" || $ACCESS r $XMLIBPATH/"$FINDXMLIB.so"
then
sh $PRINTF "%s/n/n" Found The Motif library -- $XMLIBPATH
sh $PRINTF %s Motif library path to use [$XMLIBPATH]:
read x
if test "$x" != ""
then
XMLIBPATH=$x
fi
else
sh $PRINTF "%s/n/n" "I can't seem to find your X Motif Library."
while true
do
sh $PRINTF %s "Path to your X Motif Library [RETURN for none] -->"
read x
if test "$x" != ""
then
if $ACCESS r $x/"$FINDXMLIB.a" || $ACCESS r $x/"$FINDXMLIB.so"
then
XMLIBPATH=$x
sh $PRINTF "%s/n/n" Found it.
break
else
sh $PRINTF "%s/n/n" This is an invalid path. Try again.
fi
else
XMLIBPATH=
HASMotif=False
break
fi
done
fi
fi
########## GRASS ###############################################
cat << 'EOF'
Some MMS utilities require the GIS package GRASS. If you do not
have GRASS installed on your machine, you can still use MMS, but
some of the GIS functions will be disabled. If you install GRASS
at a later time, just rerun this "setup" script and specify the
GRASS locations -- then remake.
EOF
if test "$HASGRASS" != "False"
then
if $ACCESS r $XGRASSLIBPATH/$FINDGRASSLIB
then
sh $PRINTF "%s/n/n" Found The GRASS library in $XGRASSLIBPATH
sh $PRINTF %s GRASS library path to use [$XGRASSLIBPATH]:
read x
if test "$x" != ""
then
GRASSLIBPATH=$x
fi
else
sh $PRINTF "%s/n/n" "I can't seem to find your GRASS Library."
while true
do
sh $PRINTF %s "Path to your GRASS Library [RETURN for none] -->"
read x
if test "$x" != ""
then
if $ACCESS r $x/$FINDGRASSLIB
then
GRASSLIBPATH=$x
sh $PRINTF "%s/n/n" Found it.
break
else
sh $PRINTF "%s/n/n" This is an invalid path. Try again.
fi
else
GRASSLIBIBPATH=
HASGRASS=False
break
fi
done
fi
fi
########## COMPILE_FLAGS #########################################
cat << 'EOF'
Specify the flags to be passed to the C-compiler.
Enter - if no flags are to be specified.
EOF
if test "$CC" = "gcc"
then
COMPILE_FLAGS="$COMPILE_FLAGS"
fi
while true
do
sh $PRINTF %s "COMPILE_FLAGS [$COMPILE_FLAGS] : "
read x
if test "$x" != ""
then
COMPILE_FLAGS="$x"
check_cc_flags=yes
fi
if test "$COMPILE_FLAGS" = -
then
COMPILE_FLAGS=
check_cc_flags=no
break
fi
ok=yes
x=
for flag in $COMPILE_FLAGS
do
case "$flag" in
-*) ;;
*) flag=-$flag;ok=no;;
esac
if test "$x" = ""
then
x="$flag"
else
x="$x $flag"
fi
done
COMPILE_FLAGS="$x"
if test $ok = no
then
check_cc_flags=yes
echo ""
echo "Please only specify -options"
echo ""
continue
fi
if test "$check_cc_flags" = yes
then
echo ""
echo "I will check the compile flags now"
echo "Please watch for error messages"
rm -f /tmp/$$.c /tmp/$$.o
cp make/main.c /tmp/$$.c
(cd /tmp; $CC $COMPILE_FLAGS -c $$.c)
rm -f /tmp/$$.c /tmp/$$.o
echo ""
echo Check complete
if sh $AGREE Any problems
then
continue
fi
fi
break
done
echo COMPILE_FLAGS = "$COMPILE_FLAGS"
check_cc_flags=no
########## FORTRAN_FLAGS #########################################
cat << 'EOF'
Specify the flags to be passed to the FORTRAN compiler.
****IMPORTANT****
If you are using g77 (Gnu fortran), you MUST specify
the "-fno-second-underscore" flag. Be aware that "f77"
may be linked or aliased to "g77".
If you are not using g77, remove the "-fno-second-underscore"
flag from the flag list.
Enter - if no flags are to be specified.
EOF
FORTRAN_FLAGS="$FORTRAN_FLAGS"
while true
do
sh $PRINTF %s "FORTRAN_FLAGS [$FORTRAN_FLAGS] : "
read x
if test "$x" != ""
then
FORTRAN_FLAGS="$x"
check_f77_flags=yes
fi
if test "$FORTRAN_FLAGS" = -
then
FORTRAN_FLAGS=
check_f77_flags=no
break
fi
ok=yes
x=
for flag in $FORTRAN_FLAGS
do
case "$flag" in
-*) ;;
+*) ;;
*) flag=-$flag;ok=no;;
esac
if test "$x" = ""
then
x="$flag"
else
x="$x $flag"
fi
done
FORTRAN_FLAGS="$x"
if test $ok = no
then
check_f77_flags=yes
echo ""
echo "Please only specify -options"
echo ""
continue
fi
if test "$check_f77_flags" = yes
then
echo ""
echo "I will check the FORTRAN flags now"
echo "Please watch for error messages"
$RM /tmp/$$.f /tmp/$$.o
$CP make/main.f /tmp/$$.f
(cd /tmp; $FC $FORTRAN_FLAGS $$.f)
$RM /tmp/$$.f /tmp/$$.o
echo ""
echo Check complete
if sh $AGREE Any problems
then
continue
fi
fi
break
done
echo COMPILE_FLAGS = "$FORTRAN_FLAGS"
check_f77_flags=no
########## LDFLAGS ###############################################
cat << 'EOF'
Specify the flags to be passed to the loader (ld).
Enter - if no flags are to be specified.
EOF
while true
do
sh $PRINTF %s "LDFLAGS [$LDFLAGS] : "
read x
if test "$x" != ""
then
LDFLAGS="$x"
check_ld_flags=yes
fi
if test "$LDFLAGS" = -
then
LDFLAGS=
check_ld_flags=no
break
fi
ok=yes
x=
for flag in $LDFLAGS
do
case "$flag" in
-*) ;;
*) flag=-$flag;ok=no;;
esac
if test "$x" = ""
then
x="$flag"
else
x="$x $flag"
fi
done
LDFLAGS="$x"
if test $ok = no
then
echo ""
echo "Please only specify -options"
echo ""
check_ld_flags=yes
continue
fi
if test "$check_ld_flags" = yes
then
echo ""
echo "I will check the loader flags now"
echo "Please watch for error messages"
rm -f /tmp/$$.c /tmp/$$.o /tmp/$$
cp make/main.c /tmp/$$.c
(cd /tmp; $CC $COMPILE_FLAGS -c $$.c; $CC $LDFLAGS $$.o -o $$)
rm -f /tmp/$$.c /tmp/$$.o /tmp/$$
echo ""
echo Check complete
if sh $AGREE Any problems
then
continue
fi
fi
break
done
echo LDFLAGS = "$LDFLAGS"
check_ld_flags=no
if test "$HASX" != "False"
then
########## XCFLAGS ###############################################
cat << 'EOF'
Specify the flags to be passed to the compiler that are
required specifically for X Window-based programs. Some systems
require extra compiler flags to increase the symbol table size,
etc. when compiling for X Windows. See the installation guide for
help if you are unsure.
Enter - if no flags are to be specified.
EOF
while true
do
sh $PRINTF %s "XCFLAGS [$XCFLAGS] : "
read x
if test "$x" != ""
then
XCFLAGS="$x"
check_x_c_flags=yes
fi
if test "$XCFLAGS" = -
then
XCFLAGS=
check_x_c_flags=no
break
fi
if test "$check_x_c_flags" = yes
then
echo ""
echo "I will check the loader flags now"
echo "Please watch for error messages"
rm -f /tmp/$$.c /tmp/$$.o /tmp/$$
cp make/main.c /tmp/$$.c
(cd /tmp; $CC $COMPILE_FLAGS $XCFLAGS -c $$.c; $CC $$.o -o $$)
rm -f /tmp/$$.c /tmp/$$.o /tmp/$$
echo ""
echo Check complete
if sh $AGREE Any problems
then
continue
fi
fi
break
done
echo XCFLAGS = "$XCFLAGS"
check_x_c_flags=no
########## XLDFLAGS ###############################################
cat << 'EOF'
Specify the flags to be passed to the loader (ld) that are
required specifically for X Window-based programs. Some systems
require extra loader flags when compiling for X Windows.
See the installation guide for help if you are unsure.
Enter - if no flags are to be specified.
EOF
while true
do
sh $PRINTF %s "XLDFLAGS [$XLDFLAGS] : "
read x
if test "$x" != ""
then
XLDFLAGS="$x"
check_x_ld_flags=yes
fi
if test "$XLDFLAGS" = -
then
XLDFLAGS=
check_x_ld_flags=no
break
fi
if test "$check_x_ld_flags" = yes
then
echo ""
echo "I will check the loader flags now"
echo "Please watch for error messages"
rm -f /tmp/$$.c /tmp/$$.o /tmp/$$
cp make/main.c /tmp/$$.c
(cd /tmp; $CC $COMPILE_FLAGS -c $$.c; $CC $XLDFLAGS $$.o -o $$)
rm -f /tmp/$$.c /tmp/$$.o /tmp/$$
echo ""
echo Check complete
if sh $AGREE Any problems
then
continue
fi
fi
break
done
echo XLDFLAGS = "$XLDFLAGS"
check_x_ld_flags=no
########## XEXTRALIBS ###############################################
cat << 'EOF'
Some system require additional libraries when compiling X Window programs.
Specify the additional libraries needed when compiling X Window programs.
Consult your installation guide if you are unsure of the need for these
libraries.
Enter - if there are no extra libraries needed.
EOF
if test "$XINCPATH" != ""
then
XINCPATH=-I$XINCPATH
fi
if test "$XMINCPATH" != ""
then
XMINCPATH=-I$XMINCPATH
fi
while true
do
sh $PRINTF %s "XEXTRALIBS [$XEXTRALIBS] : "
read x
if test "$x" != ""
then
XEXTRALIBS="$x"
check_x_xtra_libs=yes
fi
if test "$XEXTRALIBS" = -
then
XEXTRALIBS=
check_x_xtra_flags=no
break
fi
ok=yes
x=
for flag in $XEXTRALIBS
do
case "$flag" in
-) ;;
-*) ;;
*) flag=-$flag;ok=no;;
esac
if test "$x" = ""
then
x="$flag"
else
x="$x $flag"
fi
case "$flag" in
-) flag=;ok=yes;;
-l*) ok=yes;;
-*) flag="`echo $flag|sed s/-/-l/`";;
*) flag=-l$flag;;
esac
done
XEXTRALIBS="$x"
if test $ok = no
then
echo ""
echo "Please prefix the libraries with -l"
echo ""
check_x_xtra_libs=yes
continue
fi
if test "$XEXTRALIBS" = ""
then
break
fi
if test "$check_x_xtra_libs" = yes
then
echo ""
echo "Checking $XEXTRALIBS. Please watch for any errors"
rm -f /tmp/$$ X.o
$CC make/X.c -o /tmp/$$ $XINCPATH -L$XLIBPATH -lX11 $XEXTRALIBS
rm -f /tmp/$$ X.o
echo ""
echo "Check complete"
if sh $AGREE Any problems
then
continue
fi
fi
break
done
echo XEXTRALIBS = "$XEXTRALIBS"
check_x_xtra_libs=no
fi
########## MATHLIB ###############################################
cat << 'EOF'
Specify the math library.
Enter - if there is no math library, otherwise enter -lm.
EOF
while true
do
sh $PRINTF %s "MATHLIB [$MATHLIB] : "
read x
if test "$x" != ""
then
MATHLIB="$x"
check_mathlib=yes
fi
ok=no
case "$MATHLIB" in
-) MATHLIB=;ok=yes;;
-l*) ok=yes;;
-l)
MATHLIB=
if sh $FINDLIB m
then
MATHLIB=-lm
fi
;;
-*) MATHLIB="`echo $MATHLIB|sed s/-/-l/`";;
*) MATHLIB=-l$MATHLIB;;
esac
if test $ok = no
then
echo ""
echo "Please prefix the library with -l"
echo ""
check_mathlib=yes
continue
fi
if test "$MATHLIB" = ""
then
break
fi
if test "$check_mathlib" = yes
then
echo ""
echo "Checking $MATHLIB. Please watch for any errors"
rm -f /tmp/$$ math.o
$CC utils/math.c $MATHLIB -o /tmp/$$
rm -f /tmp/$$ math.o
echo ""
echo "Check complete"
if sh $AGREE Any problems
then
continue
fi
fi
break
done
echo MATHLIB = "$MATHLIB"
check_mathlib=no
########## FORTRANLIBS ###############################################
cat << 'EOF'
Some system require additional libraries when compiling FORTRAN code.
Specify the additional libraries needed when compiling FORTRAN.
Consult your FORTRAN manual for necessary libraries.
Enter - if there are no extra libraries needed.
EOF
while true
do
sh $PRINTF %s "FORTRANLIBS [$FORTRANLIBS] : "
read x
if test "$x" != ""
then
FORTRANLIBS="$x"
check_f77_libs=yes
fi
if test "$FORTRANLIBS" = -
then
FORTRANLIBS=
check_f77_flags=no
break
fi
if test "$FORTRANLIBS" = ""
then
break
fi
if test "$check_f77_libs" = yes
then
echo ""
echo "Checking $FORTRANLIBS. Please watch for any errors"
rm -f /tmp/$$ main.o
$CC make/main.c -o /tmp/$$ $FORTRANLIBS -lm
rm -f /tmp/$$ main.o
echo ""
echo "Check complete"
if sh $AGREE Any problems
then
continue
fi
fi
break
done
echo FORTRANLIBS = "$FORTRANLIBS"
check_f77_libs=no
#
# Write the header file ####################################################
#
HEADER=makelist
cat << 'EOF'
Now that you have defined everything, please name the file
to store this information in.
EOF
while true
do
sh $PRINTF %s "Makelist file [$HEADER] : "
read x
if test "$x" != ""
then
HEADER="$x"
fi
case "$HEADER" in
/|/*|*/|*/*)
echo ""
echo "Must not contain a /"
echo ""
continue
esac
HEAD=$MMSDIR/make/$HEADER
if test -f $HEAD
then
echo ""
echo "$HEADER - file exists"
if sh $AGREE Ok to overwrite
then
break
fi
else
break
fi
done
echo HEADER = $HEADER
rm -f $HEAD
echo "Creating makelist file"
(
echo CC = $CC
echo FC = $FC
echo ARC = $ARC
echo RM = $RM
echo MV = $MV
echo CP = $CP
echo RANLIB = $RANLIB
echo MAKE = $MAKE
echo LN = $LN
echo CD = $CD
echo AR = $AR
ansi=False
echo ""
echo COMPILE_FLAGS = $COMPILE_FLAGS
echo LDFLAGS = $LDFLAGS
echo PRINTFLAGS = -DUSE_LPR_PRINT_CMD
echo ""
echo XCFLAGS = $XCFLAGS
echo XLDFLAGS = $XLDFLAGS
echo XINCPATH = $XINCPATH
echo XMINCPATH = $XMINCPATH
if test "$XLIBPATH" != ""
then
echo XLIBPATH = -L$XLIBPATH
else
echo XLIBPATH =
fi
if test "$XTLIBPATH" != ""
then
echo XTLIBPATH = -L$XTLIBPATH
else
echo XTLIBPATH =
fi
if test "$XMLIBPATH" != ""
then
echo XMLIBPATH = -L$XMLIBPATH
else
echo XMLIBPATH =
fi
echo XLIB = $XLIB
echo XTLIB = $XTLIB
echo XMLIB = $XMLIB
echo XEXTRALIBS = $XEXTRALIBS
echo MATHLIB = $MATHLIB
if test "$HASGRASS" != "False"
then
echo GISFLAG = "-D_GIS"
echo GISLIB = -L$GRASSLIBPATH $GRASSLIB
else
echo GISFLAG = "-D_NO_GIS"
echo GISLIB =
fi
echo ""
echo ""
echo "######################################################################"
echo "# local macros for model building"
echo "######################################################################"
echo ""
echo MMSDIR = $MMSDIR
echo MSRCDIR = $MSRCDIR
echo MINCDIR = $MINCDIR
echo MLIBDIR = $MLIBDIR
echo MOBJDIR = $MOBJDIR
echo OBJDIR = $OBJDIR
echo MBINDIR = $MBINDIR
#
# Include directories
#
if test "$XINCPATH" != "$XMINCPATH"
then
INCLUDES="$XINCPATH $XMINCPATH -I$MINCDIR"
else
INCLUDES="$XINCPATH -I$MINCDIR"
fi
echo "CFLAGS = $COMPILE_FLAGS $XCFLAGS $INCLUDES"
echo "FFLAGS = $FORTRAN_FLAGS"
echo "FLIBS = $FORTRANLIBS $MATHLIB"
if test "$XMLIBPATH" != "$XLIBPATH"
then
if test "$XTLIBPATH" != "$XLIBPATH"
then
echo "GLIBS = -L$XMLIBPATH $XMLIB -L$XTLIBPATH $XTLIB -L$XLIBPATH $XLIB $XEXTRALIBS"
else
echo "GLIBS = -L$XMLIBPATH $XMLIB -L$XTLIBPATH $XTLIB $XLIB $XEXTRALIBS"
fi
else
echo "GLIBS = -L$XMLIBPATH $XMLIB $XTLIB $XLIB $XEXTRALIBS"
fi
) | sh $LINEUP > $HEAD
echo "Makelist file $HEAD created"
echo
cd make; ${LN} makelist ${ARC}makelist
cd $MMSDIR
### Install the scripts ############################################
echo "Updating the scripts. . . "
echo
cd $MMSDIR/src/scripts; make;
cd $MMSDIR
echo
### Ask about compiling the libraries ##############################
echo
if test -r $MMSDIR/lib/libxmms.a
then
echo "The MMS libraries seem to exist."
sh $PRINTF %s "Remake them anyway [no] -->"
read x
echo
if (test "$x" = "") || (test "$x" = "n") || (test "$x" = "no")
then
echo "Not making MMS libraries now."
echo "You can always make them later by running make in $MMSDIR"
else
cd $MMSDIR/src/util; make;
cd $MMSDIR/src/mms; make;
cd $MMSDIR/src/Xbae/src; make;
cd $MMSDIR/src/plot_widgets/plot_widgets; make;
cd $MMSDIR/src/plot_widgets/util; make;
cd $MMSDIR
fi
else
echo "The MMS libraries do not seem to exist."
sh $PRINTF %s "Shall I make them for you [yes] -->"
read x
echo
if (test "$x" = "") || (test "$x" = "y") || (test "$x" = "yes")
then
cd $MMSDIR/src/util; make;
cd $MMSDIR/src/mms; make;
cd $MMSDIR/src/Xbae/src; make;
cd $MMSDIR/src/plot_widgets/plot_widgets; make;
cd $MMSDIR/src/plot_widgets/util; make;
cd $MMSDIR
else
echo "Not making MMS libraries now."
echo "You can always make them later by running make in $MMSDIR"
fi
fi
### Ask about compiling the executables ############################
echo
echo
echo
if test -r $MMSDIR/bin/xmbuild
then
echo "The MMS executables seem to exist."
sh $PRINTF %s "Remake them anyway [no] -->"
read x
echo
if (test "$x" = "") || (test "$x" = "n") || (test "$x" = "no")
then
if (test "$HASGRASS" = "False")
then
echo "Not making MMS executables now."
echo "You can always make them later by running make in $MMSDIR"
else
echo "Not making MMS executables now."
echo "You can always make them later by running 'make gis' in $MMSDIR"
fi
else
cd $MMSDIR/src/Xgraph; make;
cd $MMSDIR/src/xmbuild; make;
cd $MMSDIR/src/displayer; make;
cd $MMSDIR/src/pdraw; make;
cd $MMSDIR/src/xmgr/src; make;
cd $MMSDIR/src/xbm2icon; make;
cd $MMSDIR/src/scripts; make;
if (test "$HASGRASS" != "False")
then
cd $MMSDIR/src/gis; make;
fi
cd $MMSDIR
fi
else
echo "The MMS executables do not seem to exist."
sh $PRINTF %s "Shall I make them for you [yes] -->"
read x
echo
if (test "$x" = "") || (test "$x" = "y") || (test "$x" = "yes")
then
cd $MMSDIR/src/Xgraph; make;
cd $MMSDIR/src/xmbuild; make;
cd $MMSDIR/src/displayer; make;
cd $MMSDIR/src/pdraw; make;
cd $MMSDIR/src/xmgr/src; make;
cd $MMSDIR/src/xbm2icon; make;
cd $MMSDIR/src/scripts; make;
if (test "$HASGRASS" != "False")
then
cd $MMSDIR/src/gis; make;
fi
cd $MMSDIR
else
if (test "$HASGRASS" = "False")
then
echo "Not making MMS executables now."
echo "You can always make them later by running make in $MMSDIR"
else
echo "Not making MMS executables now."
echo "You can always make them later by running 'make gis' in $MMSDIR"
fi
fi
fi
### Done ########################################################
echo
echo
echo MMS Setup completed
echo
exit 0
#################################################################
3-还要修改mms/src/Xbae/src/Input.c文件:
在其头引用中加入:
#include <stdio.h>
#include <stdlib.h>
4- 再修改mms/src/pdraw/plotps.c文件,在函数正式开始前,加入:
double find_angle();
5--改正完后,就可以直接进行make了:
./setup
make all
然后安装就没有问题了。