19 ##########################################################################
22 echo "*** configure.sh: $*" 1>&2
26 ##########################################################################
32 echo "usage: configure.sh [<option> ...]"
34 echo "where <option> is one of the following"
37 echo "-g | --debug include debugging code and symbols"
38 echo "-l | --log include logging code (default with '-g')"
39 echo "-c | --check include checking code (default with '-g')"
40 echo "-p | --profile compile with '-pg' for profiling"
41 echo "--coverage compile with coverage options"
42 echo "--no-check no checking code (overwrite default for '-g')"
43 echo "--chksol always check solution (default for '-c')"
44 echo "--no-chksol do not check solution"
45 echo "--softfloats use software floats"
46 echo "--double use hardware floats (of 'double' type)"
47 echo "--no-log no logging code (overwrite default for '-g')"
48 echo "-O[0-4] set optimization level unless '-g' specified"
49 echo "-flto enable link time optimization"
50 echo "--picosat add checking code depending on PicoSAT"
51 echo "--druplig add checking code depending on Druplig"
52 echo "-f...|-m... add other compiler options"
53 echo "--aiger=<dir> specify AIGER directory (default '../aiger')"
54 echo "--no-aiger no targets requiring AIGER library"
55 echo "--yalsat=<dir> specify YalSAT directory (default '../yalsat')"
56 echo "--no-yalsat do not include YalSAT code"
59 -g|--debug) debug=yes;;
61 -c|--check) check=yes;;
62 --chksol) chksol=yes;;
63 --no-chksol|--nchksol) chksol=no;;
64 --no-check) check=no;;
66 -p|--profile) profile=yes;;
67 --softfloats) double=no;;
68 --double) double=yes;;
69 --coverage) coverage=yes;;
70 --picosat) picosat=yes;;
71 --druplig) druplig=yes;;
73 -O0|-O1|-O2|-O3|-O4) olevel=$1;;
74 -lto|-flto|--lto|--flto) lto=yes;;
76 --aiger=*) aiger=`echo "$1"|sed -e 's,^--aiger=,,' `;;
77 --no-aiger) aiger=no;;
78 --yalsat=*) yalsat=`echo "$1"|sed -e 's,^--yalsat=,,' `;;
79 --no-yalsat) yalsat=no;;
80 -f*|-m*) if [ $other = none ]; then other=$1; else other="$other $1"; fi;;
81 *) echo "*** configure.sh: invalid command line option '$1'"; exit 1;;
86 ##########################################################################
88 if [ x"$aiger" = xundefined ]
96 if [ x"$aiger" = xundefined ]
99 elif [ ! x"$aiger" = xno ]
103 die "'$aiger' not a directory (use '--aiger' or '--no-aiger')"
104 elif [ ! -f "$aiger/aiger.h" ]
106 die "can not find '$aiger/aiger.h'"
107 elif [ ! -f "$aiger/aiger.o" ]
109 die "can not find '$aiger/aiger.o'"
113 ##########################################################################
115 if [ x"$yalsat" = xundefined ]
124 if [ x"$yalsat" = xundefined ]
127 elif [ ! x"$yalsat" = xno ]
129 if [ ! -d "$yalsat" ]
131 die "'$yalsat' not a directory (use '--yalsat' or '--no-yalsat')"
132 elif [ ! -f "$yalsat/yals.h" ]
134 die "can not find '$yalssat/yals.h'"
135 elif [ ! -f "$yalsat/libyals.a" ]
137 die "can not find '$yalsat/libyals.a'"
141 ##########################################################################
143 [ $log = undefined ] && log=$debug
144 [ $check = undefined ] && check=$debug
146 for CNF in profile.cnf.gz \
147 /data/cnf/sc2009/applications/simon-s03-fifo8-300.cnf \
148 /data/cnf/cmu/longmult12.dimacs \
152 [ -f $CNF ] && break;
155 ##########################################################################
157 [ x"$CC" = x ] && CC=gcc
163 [ $olevel = none ] || CFLAGS="$CFLAGS $olevel"
165 [ $olevel = none ] && olevel=-O3
166 CFLAGS="$CFLAGS $olevel"
167 [ $lto = yes ] && CFLAGS="$CFLAGS -flto -fwhole-program"
170 [ $double = no ] && CFLAGS="$CFLAGS -DNDBLSCR"
173 if [ $picosat = yes ]
175 if [ ! -d ../picosat ]
177 echo "*** configure.sh: can not find '../picosat'"
179 elif [ ! -f ../picosat/picosat.h ]
181 echo "*** configure.sh: can not find '../picosat/picosat.h'"
183 elif [ ! -f ../picosat/libpicosat.a ]
185 echo "*** configure.sh: can not find '../picosat/libpicosat.a'"
188 HDEPS="../picosat/picosat.h"
189 LDEPS="../picosat/libpicosat.a"
190 LIBS="$LIBS -L../picosat -lpicosat"
191 CFLAGS="$CFLAGS -I../picosat"
198 if [ $druplig = yes ]
200 if [ ! -d ../druplig ]
202 echo "*** configure.sh: can not find '../druplig'"
204 elif [ ! -f ../druplig/druplig.h ]
206 echo "*** configure.sh: can not find '../druplig/druplig.h'"
208 elif [ ! -f ../druplig/libdruplig.a ]
210 echo "*** configure.sh: can not find '../druplig/libdruplig.a'"
213 HDEPS="../druplig/druplig.h"
214 LDEPS="../druplig/libdruplig.a"
215 LIBS="$LIBS -L../druplig -ldruplig"
216 CFLAGS="$CFLAGS -I../druplig"
232 if [ ! "$yalsat" = no ]
234 [ x"$HDEPS" = x ] || HDEPS="${HDEPS} "
235 HDEPS="${HDEPS}$yalsat/yals.h"
236 [ x"$LDEPS" = x ] || LDEPS="${LDEPS} "
237 LDEPS="${LDEPS}$yalsat/libyals.a"
238 [ x"$LIBS" = x ] || LIBS="${LIBS} "
239 LIBS="${LIBS} -L$yalsat -lyals"
240 [ x"$CFLAGS" = x ] || CFLAGS="${CFLAGS} "
241 CFLAGS="${CFLAGS} -I$yalsat"
244 [ $chksol = undefined ] && chksol=$check
245 [ $static = yes ] && CFLAGS="$CFLAGS -static"
246 [ $profile = yes ] && CFLAGS="$CFLAGS -pg"
247 [ $coverage = yes ] && CFLAGS="$CFLAGS -ftest-coverage -fprofile-arcs"
248 [ $other = none ] || CFLAGS="$CFLAGS $other"
249 [ $log = no ] && CFLAGS="$CFLAGS -DNLGLOG"
250 [ $check = no ] && CFLAGS="$CFLAGS -DNDEBUG"
251 [ $chksol = no ] && CFLAGS="$CFLAGS -DNCHKSOL"
252 [ $picosat = no ] && CFLAGS="$CFLAGS -DNLGLPICOSAT"
253 [ $druplig = no ] && CFLAGS="$CFLAGS -DNLGLDRUPLIG"
254 [ $yalsat = no ] && CFLAGS="$CFLAGS -DNLGLYALSAT"
258 ##########################################################################
263 -e "s,@CFLAGS@,$CFLAGS," \
264 -e "s,@HDEPS@,$HDEPS," \
265 -e "s,@LDEPS@,$LDEPS," \
266 -e "s,@AIGERTARGETS@,$AIGERTARGETS," \
267 -e "s,@AIGER@,$AIGER," \
269 -e "s,@LIBS@,$LIBS," \
270 makefile.in > makefile