Release coccinelle-0.2.0rc1
[bpt/coccinelle.git] / scripts / coccicheck / configure
CommitLineData
951c7801
C
1#!/bin/bash
2
3MODE=$1
4PROJECT=$2
5
6if [ "$MODE" == "" -o "$PROJECT" == "" ]; then
7 echo -e "\n\tUsage: $0 mode path\n"
8 echo -e "\tmode\torg or diff according to your needs"
9 echo -e "\tpath\tyour project path\n"
10 exit 1
11fi
12
7f004419
C
13SPATCHVER=`spatch -version 2>&1 | sed "s|spatch version \([^ ]*\) .*|\1|"`
14WITHPYTHON=`spatch -version 2>&1 | sed "s|spatch version \([^ ]*\) with Python support|yes|"`
15WITHPYTHON=`echo $WITHPYTHON | sed "s|spatch version \([^ ]*\) without Python support||"`
16
17echo "Using spatch version $SPATCHVER"
18#TODO: Add version check
19
20if [ "$WITHPYTHON" ] ; then
21 echo "Your version has been build with Python support"
22else
23 echo "Your version has no Python support"
24 if [ "org" == "$MODE" ] ; then
25 echo "org mode requires Python support."
26 exit 1
27 fi
28fi
29echo
30
951c7801
C
31echo "Using PREFIX="${PREFIX:=`pwd`}
32echo "Using PROJECT="${PROJECT:=$PREFIX/project}
33echo "Using COCCI="${COCCI:=$PREFIX/cocci}
34echo "Using RESULTS="${RESULTS:=$PREFIX/results}
7f004419
C
35
36if [ "`which glimpse`" ]; then
37 FLAGS=${SPFLAGS:="-timeout 60 -use_glimpse"}
38else
39 FLAGS=${SPFLAGS:="-timeout 60"}
40fi
41SPFLAGS="$FLAGS -D $MODE"
42echo "Using SPFLAGS="$SPFLAGS
951c7801
C
43
44echo -e "\nFor efficiency, run \`<coccinelle dir>/scripts/glimpseindex_cocci.sh\`"
7f004419
C
45echo -e "in $PROJECT"
46echo -e "NB: glimpse is available at http://webglimpse.net/ but it is not under the GPL.\n"
951c7801
C
47
48sed -i "s|^PREFIX?=.*$|PREFIX?=${PREFIX}|" Makefile
49sed -i "s|^PROJECT?=.*$|PROJECT?=${PROJECT}|" Makefile
50sed -i "s|^COCCI?=.*$|COCCI?=${COCCI}|" Makefile
51sed -i "s|^RESULTS?=.*$|RESULTS?=${RESULTS}|" Makefile
52sed -i "s|^SPFLAGS?=.*$|SPFLAGS?=\"${SPFLAGS}\"|" Makefile
53