fix limit in replace for BufferedInputStream
[nikiroo-utils.git] / configure.sh
1 #!/bin/sh
2
3 # default:
4 PREFIX=/usr/local
5 PROGS="java javac jar make sed"
6
7 IMG=be/nikiroo/utils/ui/ImageUtilsAwt
8
9 valid=true
10 while [ "$*" != "" ]; do
11 key=`echo "$1" | cut -f1 -d=`
12 val=`echo "$1" | cut -f2 -d=`
13 case "$key" in
14 --)
15 ;;
16 --help) # This help message
17 echo The following arguments can be used:
18 cat "$0" | grep '^\s*--' | grep '#' | while read ln; do
19 cmd=`echo "$ln" | cut -f1 -d')'`
20 msg=`echo "$ln" | cut -f2 -d'#'`
21 echo " $cmd$msg"
22 done
23 ;;
24 --prefix) #=PATH Change the prefix to the given path
25 PREFIX="$val"
26 ;;
27 *)
28 echo "Unsupported parameter: '$1'" >&2
29 echo >&2
30 sh "$0" --help >&2
31 valid=false
32 ;;
33 esac
34 shift
35 done
36
37 [ $valid = false ] && exit 1
38
39 MESS="A required program cannot be found:"
40 for prog in $PROGS; do
41 out="`whereis -b "$prog" 2>/dev/null`"
42 if [ "$out" = "$prog:" ]; then
43 echo "$MESS $prog" >&2
44 valid=false
45 fi
46 done
47
48 [ $valid = false ] && exit 2
49
50 if [ "`whereis tput`" = "tput:" ]; then
51 ok='"[ ok ]"';
52 ko='"[ !! ]"';
53 cols=80;
54 else
55 #ok='"`tput bold`[`tput setf 2` OK `tput init``tput bold`]`tput init`"';
56 #ko='"`tput bold`[`tput setf 4` !! `tput init``tput bold`]`tput init`"';
57 ok='"`tput bold`[`tput setaf 2` OK `tput init``tput bold`]`tput init`"';
58 ko='"`tput bold`[`tput setaf 1` !! `tput init``tput bold`]`tput init`"';
59 cols='"`tput cols`"';
60 fi;
61
62 echo "MAIN = be/nikiroo/fanfix/Main" > Makefile
63 echo "MORE = $IMG" >> Makefile
64 echo "TEST = be/nikiroo/fanfix/test/Test" >> Makefile
65 echo "TEST_PARAMS = $cols $ok $ko" >> Makefile
66 echo "NAME = fanfix" >> Makefile
67 echo "PREFIX = $PREFIX" >> Makefile
68 echo "JAR_FLAGS += -C bin/ org -C bin/ be -C ./ LICENSE -C ./ VERSION -C libs/ licenses" >> Makefile
69 echo "SJAR_FLAGS += -C src/ org -C src/ be" >> Makefile
70
71 cat Makefile.base >> Makefile
72