API compat
[fanfix.git] / configure.sh
CommitLineData
ec1f3444
NR
1#!/bin/sh
2
3# default:
4PREFIX=/usr/local
5PROGS="java javac jar"
6
80500544
NR
7UI=be/nikiroo/utils/ui/test/TestUI
8JUI="-C bin/ be/nikiroo/utils/ui"
9ANDOIRD=
10JANDROID=
11
ec1f3444
NR
12valid=true
13while [ "$*" != "" ]; do
80500544
NR
14 key=`echo "$1" | cut -f1 -d=`
15 val=`echo "$1" | cut -f2 -d=`
ec1f3444 16 case "$key" in
80500544
NR
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
ec1f3444
NR
26 PREFIX="$val"
27 ;;
80500544
NR
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 ;;
ec1f3444
NR
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
80383c14
NR
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
fbcc2a2a 74echo "MAIN = be/nikiroo/utils/test_code/Test" > Makefile
80500544 75echo "MORE = $UI $ANDROID" >> Makefile
fbcc2a2a 76echo "TEST = be/nikiroo/utils/test_code/Test" >> Makefile
80383c14 77echo "TEST_PARAMS = $cols $ok $ko" >> Makefile
ec1f3444
NR
78echo "NAME = nikiroo-utils" >> Makefile
79echo "PREFIX = $PREFIX" >> Makefile
80500544 80echo "JAR_FLAGS += -C bin/ be $JUI $JANDROID -C bin/ VERSION" >> Makefile
b771aed5 81echo "SJAR_FLAGS += -C src/ org -C src/ be" >> Makefile
ec1f3444
NR
82
83cat Makefile.base >> Makefile
84