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
|
#!/bin/sh
satcompetition=undefined
log=no
debug=no
optimize=no
stats=undefined
trace=undefined
while [ $# -gt 0 ]
do
case $1 in
--log) debug=yes; log=yes;;
-g) debug=yes; optimize=no;;
--stats) stats=yes;;
--no-stats) stats=no;;
--trace) trace=yes;;
--no-trace) trace=no;;
-O) debug=no; optimize=yes;;
*) cat <<EOF
*** usage: ./configure [-g][-O][--log][--[no-]stats][--[no-]trace]
EOF
exit 1
;;
esac
shift
done
if [ $satcompetition = yes ]
then
debug=no
optimize=yes
stats=no
trace=no
fi
echo "debug ... $debug"
echo "optimize ... $optimize"
echo "log ... $log"
if [ $stats = undefined ]
then
if [ $optimize = yes ]
then
stats=no
else
stats=yes
fi
fi
echo "stats ... $stats"
if [ $trace = undefined ]
then
if [ $optimize = yes ]
then
trace=no
else
trace=yes
fi
fi
echo "trace ... $trace"
echo -n "cc ..."
[ "X$CC" = X ] && CC=gcc
echo " $CC"
echo -n "cflags ..."
if [ X"$CFLAGS" = X ]
then
CFLAGS=""
[ $log = yes ] && CFLAGS="$CFLAGS -DLOGGING"
[ $stats = yes ] && CFLAGS="$CFLAGS -DSTATS"
[ $trace = yes ] && CFLAGS="$CFLAGS -DTRACE"
case X"$CC" in
Xgcc*)
CFLAGS="$CFLAGS -W -Wall"
if [ $satcompetition = yes ]
then
CFLAGS="$CFLAGS -static"
fi
if [ $debug = yes ]
then
CFLAGS="$CFLAGS -g3 -ggdb"
else
CFLAGS="$CFLAGS -DNDEBUG"
if [ $optimize = yes ]
then
CFLAGS="$CFLAGS -O3"
else
CFLAGS="$CFLAGS -O2"
fi
fi
;;
*)
if [ $debug = yes ]
then
CFLAGS="$CFLAGS -g"
else
CFLAGS="$CFLAGS -O"
fi
;;
esac
fi
echo " $CFLAGS"
echo -n "makefile ..."
rm -f makefile
sed -e "s,@CC@,$CC," -e "s,@CFLAGS@,$CFLAGS," makefile.in > makefile
echo " done"
|