-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathconfigure
executable file
·92 lines (70 loc) · 1.66 KB
/
configure
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
#!/bin/sh
debug=no
flip=unknown
usage () {
cat <<EOF
usage: configure [-h|--help][-g|--debug][--no-flip]
-h | --help print this command line option summary
-g | --debug build with assertion checking and symbols
--no-flip disable flipping with '-DNFLIP' at compile-time
(to support old legacy versions of 'CaDiCaL')
EOF
exit 0
}
die () {
echo "configure: error: $*" 1>&2
exit 1
}
msg () {
echo "[configure] $*"
}
checkdir () {
[ -d "$1" ] || die "could not find '$1'"
}
checkfile () {
[ -f "$1" ] || die "could not find '$1'"
}
[ x"$CADICAL" = x ] && CADICAL="../cadical"
checkdir "$CADICAL"
cadicalversion="`cat $CADICAL/VERSION`"
checkdir "$CADICAL/src"
checkdir "$CADICAL/build"
checkfile "$CADICAL/src/cadical.hpp"
checkfile "$CADICAL/build/libcadical.a"
while [ $# -gt 0 ]
do
case $1 in
-h|--help) usage;;
-g|--debug) debug=yes;;
--no-flip) flip=no;;
*) die "invalid option '$1' (try '-h')";;
esac
shift
done
msg "Using CADICAL='$CADICAL' version '$cadicalversion'"
if [ x"`grep 'bool flip' $CADICAL/src/cadical.hpp`" = x ]
then
[ $flip = no ] || \
die "no 'CaDiCaL' support for 'bool flip (int lit)' (update version or use '--no-flip')"
flip=no
else
msg "your 'CaDiCaL' version supports 'bool flip (int lit)'"
flip=yes
fi
if [ x"$CXX" = x ]
then
COMPILE="g++ -Wall -std=c++11"
else
COMPILE="$CXX -W"
fi
if [ $debug = yes ]
then
COMPILE="$COMPILE -g -ggdb3"
else
COMPILE="$COMPILE -O3 -DNDEBUG"
fi
[ $flip = no ] && COMPILE="$COMPILE -DNFLIP"
msg "Compiling with '$COMPILE'"
rm -f makefile
sed -e "s/@COMPILE@/$COMPILE/" makefile.in > makefile
msg "Generated 'makefile' (run 'make' to compile)"