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