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 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341
|
#!/bin/sh
#*******************************************************************************
# *
# Viewmol *
# *
# G E T M A C H I N E *
# *
# Copyright (c) Joerg-R. Hill, December 2000 *
# *
#*******************************************************************************
#
# $Id: getmachine,v 1.5 2000/12/10 15:07:25 jrh Exp $
# $Log: getmachine,v $
# Revision 1.5 2000/12/10 15:07:25 jrh
# Release 2.3
#
# Revision 1.4 1999/05/24 01:25:38 jrh
# Release 2.2.1
#
# Revision 1.3 1999/02/07 22:02:47 jrh
# Release 2.2
#
# Revision 1.2 1998/01/26 00:47:46 jrh
# Release 2.1
#
# Revision 1.1 1996/12/10 18:46:19 jrh
# Initial revision
#
# This shell script adapts the Makefile in dependence
# of the machine and the operating system you use.
# It is called from 'make viewmol' before the compiler
# is invoked.
#
makedir()
{
if [ ! -d "$dir" ]
then
mkdir "$dir"
fi
cd $dir
}
givehint()
{
if [ $hint -eq 1 ]
then
echo 'If you want to use environment variables in any of the following'
echo 'paths, do it like this: $(HOME)'
hint=0
fi
}
use_mesa=no
if [ "$1" = "mesa" ]
then
use_mesa=yes
shift
fi
target=$1
os=`uname -s`
#if [ "$os" = "Linux" -o "$os" = "FreeBSD" ]
if [ "$os" = "FreeBSD" ]
then
use_mesa=yes
fi
if [ ! -f .config.$os ]
then
hint=1
if [ -f /usr/lib/libtiff.a ]
then
libtiff="-L/usr/lib"
else
givehint
echo -n "Please enter the name of the directory where libtiff.a can be found: "
read libtiff
if [ "$libtiff" != "" ]
then
libtiff="-L${libtiff}"
fi
fi
echo "LIBTIFF = ${libtiff}" > .config.$os
if [ -f /usr/include/tiff.h ]
then
tiffinclude="/usr/include"
else
givehint
echo -n "Please enter the name of the directory where the include file for libtiff can be found: "
read tiffinclude
fi
echo "TIFFINCLUDE = $tiffinclude" >> .config.$os
if [ "$use_mesa" = "yes" ]
then
if [ -f /usr/lib/libMesaGL.a -a -f /usr/lib/libMesaGLU.a ]
then
mesalib="-L/usr/lib"
else
givehint
echo -n "Please enter the name of the directory where the Mesa libraries can be found: "
read mesalib
if [ "$mesalib" != "" ]
then
mesalib="-L${mesalib}"
fi
fi
echo "MESALIB = $mesalib" >> .config.$os
if [ -f /usr/include/GL/gl.h ]
then
mesainclude="/usr/include"
else
givehint
echo -n "Pleae enter the name of the directory where the include files for Mesa can be found: "
read mesainclude
fi
echo "MESAINCLUDE = $mesainclude" >> .config.$os
fi
list=`find /usr -name Python.h -print 2> /dev/null`
version=`(for i in $list
do
dir=\`dirname $i\`
echo \`basename $dir\`
done) | sort | tail -1`
if [ "$version" != "" ]
then
pythoninclude=`dirname \`(for i in $list
do
echo $i | grep $version
done)\``
pythonversion=$version
else
givehint
echo -n "Please enter the name of the directory where the include files for Python can be found: "
read pythoninclude
pythonversion=`basename $pythoninclude`
fi
echo "PYTHONVERSION = $pythonversion" >> .config.$os
echo "PYTHONINCLUDE = $pythoninclude" >> .config.$os
if [ "$version" != "" ]
then
pythonlib=`dirname \`find /usr -name "lib${version}.a" -print 2> /dev/null | grep "$version/"\``
else
givehint
echo -n "Please enter the name of the directory where the Python library can be found: "
read pythonlib
fi
echo "LIBPYTHON = -L$pythonlib" >> .config.$os
fi
case $os in
#
# This is an IBM RS/6000.
#
AIX) if [ `uname -m | cut -c9-10` = "70" ]
then
dir="${os}_POWER2"
else
dir="${os}_POWER"
fi
makedir
cat ../.config.$os > makefile
echo 'OPT=-O2' >> makefile
echo 'CFLAGS=-DAIX' >> makefile
echo 'LDFLAGS=' >> makefile
echo 'SCANDIR=' >> makefile
if [ "$use_mesa" = "yes" ]
then
echo 'INCLUDE=$(MESAINCLUDE) -I$(TIFFINCLUDE) -I$(PYTHONINCLUDE)' >> makefile
echo 'LIBRARY=$(MESALIB) $(LIBTIFF) $(LIBPYTHON)' >> makefile
echo 'LIBS=-l${PYTHONVERSION} -ltiff -lMesaGLU -lMesaGL -lXm -lXmu -lXi -lXext -lXt -lX11 -lm' >> makefile
else
echo 'INCLUDE=/usr/lpp/OpenGL/include -I$(TIFFINCLUDE) -I$(PYTHONINCLUDE)' >> makefile
echo 'LIBRARY=-L/usr/lpp/OpenGL/lib $(LIBTIFF) $(LIBPYTHON)' >> makefile
echo 'LIBS=-l${PYTHONVERSION} -ltiff -lGLU -lGL -lXm -lXmu -lXi -lXext -lXt -lX11 -lm' >> makefile
fi
;;
#
# This is a Silicon Graphics.
#
IRIX*) dir="${os}_`hinv | awk '/CPU:/ {print $3}' | cut -d/ -f2`"
makedir
cat ../.config.$os > makefile
echo 'OPT=-O2' >> makefile
if [ "$dir" = "IRIX_R4400" -o "$dir" = "IRIX_R4600" -o "$dir" = "IRIX_R5000" ]
then
echo 'CFLAGS=-DIRIX -n32' >> makefile
echo 'LDFLAGS=-n32 -Wl,-woff,85,-woff,134' >> makefile
elif [ "$dir" = "IRIX64_R8000" -o "$dir" = "IRIX64_R10000" -o "$dir" = "IRIX64_R12000" ]
then
#
# uses -n32 since libtiff is not available in a 64 bit version on SGIs
#
echo 'CFLAGS=-DIRIX -n32' >> makefile
echo 'LDFLAGS=-n32 -Wl,-woff,85,-woff,134' >> makefile
else
echo 'CFLAGS=-DIRIX' >> makefile
echo 'LDFLAGS=-Wl,-woff,85,-woff,134' >> makefile
fi
echo 'SCANDIR=' >> makefile
if [ "$use_mesa" = "yes" ]
then
echo 'INCLUDE=$(MESAINCLUDE) -I$(TIFFINCLUDE) -I$(PYTHONINCLUDE)' >> makefile
echo 'LIBRARY=$(MESALIB) $(LIBTIFF) $(LIBPYTHON)' >> makefile
echo 'LIBS=-l${PYTHONVERSION} -ltiff -lMesaGLU -lMesaGL -lXm -lXmu -lXi -lXext -lXt -lX11 -lpthread -lm' >> makefile
else
echo 'INCLUDE=$(TIFFINCLUDE) -I$(PYTHONINCLUDE)' >> makefile
echo 'LIBRARY=$(LIBTIFF) $(LIBPYTHON)' >> makefile
echo 'LIBS=-l${PYTHONVERSION} -ltiff -lGLU -lGL -lXm -lXmu -lXi -lXt -lX11 -lpthread -lm -lCsup' >> makefile
fi
;;
#
# This is Linux.
#
Linux) dir="$os"
makedir
cat ../.config.$os > makefile
gcc -v 2>&1 | grep egcs > /dev/null
egcs=$?
if [ $egcs -eq 0 ]
then
# processor=`cat /proc/cpuinfo | grep cpu | grep -v cpuid | awk '{printf("%s\n", $3);}'`
processor=`uname --machine`
if [ "$processor" = "i686" ]
then
echo 'OPT=-O6 -mpentiumpro -fomit-frame-pointer -ffast-math -malign-double' >> makefile
else [ "$processor" = "i586" ]
echo 'OPT=-O6 -mpentium -fomit-frame-pointer -ffast-math -malign-double' >> makefile
fi
else
echo 'OPT=-O6 -fomit-frame-pointer -ffast-math' >> makefile
fi
echo 'CFLAGS=-Wall -I/usr/X11R6/include -DLINUX' >> makefile
echo 'LDFLAGS=' >> makefile
echo 'SCANDIR=' >> makefile
if [ "$use_mesa" = "yes" ]
then
echo 'INCLUDE=$(MESAINCLUDE) -I$(TIFFINCLUDE) -I$(PYTHONINCLUDE)' >> makefile
echo 'LIBRARY=$(MESALIB) $(LIBPYTHON)' >> makefile
echo 'LIBS=-L/usr/X11R6/lib -l${PYTHONVERSION} -ltiff -lMesaGLU -lMesaGL -lXm -lXmu -lXp -lXi -lXext -lXt -lX11 -lpthread -ldb -lutil -ldl -lm' >> makefile
else
echo 'INCLUDE=$(TIFFINCLUDE) -I$(PYTHONINCLUDE)' >> makefile
echo 'LIBRARY=$(LIBPYTHON)' >> makefile
echo 'LIBS=-L/usr/local/lib -l${PYTHONVERSION} -ltiff -lGLU -lGL -L/usr/X11R6/lib -lXm -lXmu -lXp -lXi -lXext -lXt -lX11 -lpthread -ldb -lutil -ldl -lm' >> makefile
fi
;;
#
# This is FreeBSD
#
FreeBSD) dir="$os"
makedir
cat ../.config.$os > makefile
echo 'OPT=-O6 -m486 -fomit-frame-pointer' >> makefile
echo 'CFLAGS=-Wall -DLINUX' >> makefile
echo 'LDFLAGS=' >> makefile
echo 'SCANDIR=' >> makefile
if [ "$use_mesa" = "yes" ]
then
echo 'INCLUDE=$(MESAINCLUDE) -I$(TIFFINCLUDE) -I$(PYTHONINCLUDE)' >> makefile
echo 'LIBRARY=$(MESALIB) $(LIBTIFF) $(LIBPYTHON)' >> makefile
echo 'LIBS=-L/usr/X11R6/lib -l${PYTHONVERSION} -ltiff -lMesaGLU -lMesaGL -lXm -lXmu -lXi -lXext -lXt -lX11 -lm' >> makefile
else
echo 'INCLUDE=$(TIFFINCLUDE) -I$(PYTHONINCLUDE)' >> makefile
echo 'LIBRARY=$(LIBTIFF) $(LIBPYTHON)' >> makefile
echo 'LIBS=-l${PYTHONVERSION} -ltiff -lGLU -lGL -lXm -lXmu -lXi -lXext -lXt -lX11 -lm' >> makefile
fi
;;
#
# This is OSF1
#
OSF1) dir="$os"
makedir
cat ../.config.$os > makefile
echo 'OPT=-O2 -Olimit 615' >> makefile
echo 'CFLAGS=-ieee_with_no_inexact' >> makefile
echo 'LDFLAGS=' >> makefile
echo 'SCANDIR=' >> makefile
if [ "$use_mesa" = "yes" ]
then
echo 'INCLUDE=$(MESAINCLUDE) -I$(TIFFINCLUDE) -I$(PYTHONINCLUDE)' >> makefile
echo 'LIBRARY=$(MESALIB) $(LIBTIFF) $(LIBPYTHON)' >> makefile
echo 'LIBS=-l${PYTHONVERSION} -ltiff -lMesaGLU -lMesaGL -lXm -lXmu -lXi -lXext -lXt -lX11 -lm' >> makefile
else
echo 'INCLUDE=$(TIFFINCLUDE) -I$(PYTHONINCLUDE)' >> makefile
echo 'LIBRARY=$(LIBTIFF) $(LIBPYTHON)' >> makefile
echo 'LIBS=-l${PYTHONVERSION} -lXm -lXmu -lXi -lXt -lGLU -lGL -lX11 -ltiff -lm' >> makefile
fi
;;
#
# This is HP-UX
#
HP-UX) dir="$os"
makedir
cat ../.config.$os > makefile
echo 'OPT=-O2' >> makefile
echo 'CFLAGS=-Aa -D_HPUX_SOURCE' >> makefile
echo 'LDFLAGS=' >> makefile
echo 'SCANDIR=' >> makefile
if [ "$use_mesa" = "yes" ]
then
echo 'INCLUDE=$(MESAINCLUDE) -I$(TIFFINCLUDE) -I/usr/include/Motif1.2 -I/usr/include/X11R5 -I$(PYTHONINCLUDE)' >> makefile
echo 'LIBRARY=$(MESALIB) $(LIBTIFF) -L/usr/lib/Motif1.2 -L/usr/lib/X11R5 $(LIBPYTHON)' >> makefile
echo 'LIBS=-l${PYTHONVERSION} -ltiff -lMesaGLU -lMesaGL -lXm -lXi -lXext -lXt -lX11 -lm' >> makefile
else
echo 'INCLUDE=$(TIFFINCLUDE) -I/usr/include/Motif1.2 -I/usr/include/X11R5 -I$(PYTHONINCLUDE)' >> makefile
echo 'LIBRARY=$(LIBTIFF) -L/usr/lib/Motif1.2 -L/usr/lib/X11R5 $(LIBPYTHON)' >> makefile
echo 'LIBS=-l${PYTHONVERSION} -lXm -lXmu -lXi -lXt -lGLU -lGL -lX11 -ltiff -lm' >> makefile
fi
;;
#
# This is SunOS
#
SunOS) dir="$os"
makedir
cat ../.config.$os > makefile
echo 'OPT=-xO4 -native' >> makefile
echo 'CFLAGS= -DSunOS -xlibmil' >> makefile
echo 'LDFLAGS=-L/usr/dt/lib ' >> makefile
echo 'SCANDIR=scandir.o' >> makefile
if [ "$use_mesa" = "yes" ]
then
echo 'INCLUDE=$(MESAINCLUDE) -I$(TIFFINCLUDE) -I$(PYTHONINCLUDE)' >> makefile
echo 'LIBRARY=$(MESALIB) $(LIBTIFF) $(LIBPYTHON)' >> makefile
echo 'LIBS=-l${PYTHONVERSION} -lMesaGLU -lMesaGL -lXm -lXmu -lXi -lXt -lX11 -lm -Bstatic -ltiff -Bdynamic' >> makefile
else
echo 'INCLUDE=$(TIFFINCLUDE) -I$(PYTHONINCLUDE)' >> makefile
echo 'LIBRARY=$(LIBTIFF) $(LIBPYTHON)' >> makefile
echo 'LIBS=-l${PYTHONVERSION} -lXm -lXmu -lXi -lXt -lGLU -lGL -lX11 -lm -Bstatic -ltiff -Bdynamic ' >> makefile
fi
;;
#
# This is a (not yet) known operating system.
#
*) echo "Sorry, I don't know the operating system '$os'."
echo "Edit 'getmachine' to include the required options."
exit 1
;;
esac
cat ../Makefile >> makefile
make ${target}_
rm -f makefile
|