File: configure

package info (click to toggle)
picosat 936-4
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 464 kB
  • sloc: ansic: 13,779; sh: 160; makefile: 139
file content (151 lines) | stat: -rwxr-xr-x 2,966 bytes parent folder | download | duplicates (4)
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
#!/bin/sh

satcompetition=no

log=no
debug=no
optimize=no
stats=undefined
trace=undefined
static=yes
shared=no
thirtytwobit=no
static=no

while [ $# -gt 0 ]
do
  case $1 in
    -l|--log) debug=yes; log=yes;;
    -g|--debug) debug=yes; optimize=no;;
    -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;;
    -O) debug=no; optimize=yes;;
    *) cat <<EOF
usage: ./configure [<option> ...]

where <option> is one of the following:

  -g|--debug           includ debugging code and symbols
  -l|--log             add low level logging code
  -s|--stats           include and enable more expensive stats counters
  -t|--trace           compile with trace generation support (more memory)
  --no-stats           disable expensive stats
  --no-trace           enable trace generation (less memory)
  -32|--32|-m32        compile for 32 bit machine even on 64 bit host
  -static|--static     only produce static library
  -shared|--shared     produce shared library as well
  -O                   optimize a lot and disable trace generation
EOF
exit 1
;;
  esac
shift
done

echo "version ... `cat VERSION`"

if [ $satcompetition = yes ]
then
  debug=no
  optimize=yes
  stats=no
  trace=no
  thirtytwobit=yes
  static=yes
  shared=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 "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"
	if [ $optimize = yes ]
	then
	  CFLAGS="$CFLAGS -O3 -fomit-frame-pointer -finline-limit=1000000"
	else
	  CFLAGS="$CFLAGS -O2"
	fi
      fi
      ;;
    *)
      if [ $debug = yes ]
      then
        CFLAGS="$CFLAGS -g"
      else
        CFLAGS="$CFLAGS -O"
      fi
      ;;
  esac
fi

TARGETS="picosat picomus libpicosat.a"
if [ $shared = yes ]
then
  TARGETS="$TARGETS libpicosat.so"
  CFLAGS="$CFLAGS -fPIC"
fi
echo "targets ... $TARGETS"

echo "cc ... $CC"

echo "cflags ... $CFLAGS"

echo -n "makefile ..."
rm -f makefile
sed \
  -e "s,@CC@,$CC," \
  -e "s,@CFLAGS@,$CFLAGS," \
  -e "s,@TARGETS@,$TARGETS," \
makefile.in > makefile
echo " done"