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
|
#!/bin/sh
satcompetition=no
log=no
debug=no
stats=undefined
trace=undefined
static=yes
shared=no
thirtytwobit=no
static=no
while [ $# -gt 0 ]
do
case $1 in
-g|--debug) debug=yes;;
-O|--optimize) debug=no;;
-l|--log) log=yes;;
-s|--stats) stats=yes;;
-t|--trace) trace=yes;;
--no-stats) stats=no;;
--no-trace) trace=no;;
-32|--32|-m32) thirtytwobit=yes;;
-static|--static) static=yes;;
-shared|--shared) shared=yes;;
*) cat <<EOF
usage: ./configure [<option> ...]
where <option> is one of the following:
-g|--debug include debugging code and symbols
-O|--optimize optimized compilation (default)
-l|--log add low level logging code (default with '-g')
-s|--stats more expensive statististcs (default with '-g')
-t|--trace trace generation (more memory, default with '-g')
--no-stats disable expensive stats
--no-trace enable trace generation
-32|--32|-m32 compile for 32 bit machine even on 64 bit host
-static|--static produce static binary
-shared|--shared produce shared library
EOF
exit 1
;;
esac
shift
done
echo "version ... `cat VERSION`"
if [ $satcompetition = yes ]
then
debug=no
stats=no
trace=no
thirtytwobit=yes
static=yes
shared=no
fi
echo "debug ... $debug"
echo "log ... $log"
[ $stats = undefined ] && stats=$debug
echo "stats ... $stats"
[ $trace = undefined ] && trace=$debug
echo "trace ... $trace"
echo "static ... $static"
echo "shared ... $shared"
[ "X$CC" = X ] && CC=gcc
if [ X"$CFLAGS" = X ]
then
case X"$CC" in
*wine*|*mingw*) CFLAGS="-DNGETRUSAGE -DNALLSIGNALS";;
*);;
esac
[ $log = yes ] && CFLAGS="$CFLAGS -DLOGGING"
[ $stats = yes ] && CFLAGS="$CFLAGS -DSTATS"
[ $trace = yes ] && CFLAGS="$CFLAGS -DTRACE"
[ $static = yes ] && CFLAGS="$CFLAGS -static"
case X"$CC" in
X*gcc*)
CFLAGS="$CFLAGS -Wall -Wextra"
[ $thirtytwobit = yes ] && CFLAGS="$CFLAGS -m32"
if [ $debug = yes ]
then
CFLAGS="$CFLAGS -g3 -ggdb"
else
CFLAGS="$CFLAGS -DNDEBUG -O3"
fi
;;
*)
if [ $debug = yes ]
then
CFLAGS="$CFLAGS -g"
else
CFLAGS="$CFLAGS -O"
fi
;;
esac
fi
TARGETS="picosat picomcs picomus picogcnf libpicosat.a"
if [ $shared = yes ]
then
TARGETS="$TARGETS libpicosat.so"
CFLAGS="$CFLAGS -fPIC"
fi
echo "targets ... $TARGETS"
echo "cc ... $CC"
echo "cflags ... $CFLAGS"
printf "makefile ..."
rm -f makefile
sed \
-e "s,@CC@,$CC," \
-e "s,@CFLAGS@,$CFLAGS," \
-e "s,@TARGETS@,$TARGETS," \
makefile.in > makefile
echo " done"
|