configure 1 KB
Newer Older
sulincix's avatar
sulincix committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#!/bin/bash
is_exists(){
	echo -ne "Checking $1 "
	p=$(which "$1")
	if [ "$p" == "" ] ; then
		echo "(not found)"
		exit 1
	else
		echo "(yes)"
	fi
}
helpmsg(){
	echo "Usage ./configure  [options]"
	echo "  --prefix      : Use custom prefix location (default /usr)"
	echo "  --clear       : Remove alt fles"
	echo "  --help        : Show this message"
}
#defaults
19
export prefix="/usr/local"
sulincix's avatar
sulincix committed
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
export nsl=true
cp Makefile.in Makefile.ac

for arg in $*
do
	if echo $arg | grep "^--clear" &>/dev/null ; then
		[ -f Makefile.ac ] && rm -f Makefile.ac
		[ -f Makefile ] && rm -f Makefile
		[ -d build ] && rm -rf build
		exit 0
	elif echo $arg | grep "^--help" &>/dev/null ; then
		helpmsg
		exit 0
	elif echo $arg | grep "^--prefix=" &>/dev/null; then
		export prefix=$(echo "$arg" | sed "s/^.*=//g")
	fi
done
#Checking program
for item in msgfmt install python3 chown chmod
do
	is_exists $item
aaaaa's avatar
aaaaa committed
41
done
sulincix's avatar
sulincix committed
42 43 44 45
sed -i "s|@prefix@|$prefix|g" Makefile.ac
echo -e "    Prefix: $prefix"
echo -e "    Locale-Support: $nsl"
mv Makefile.ac Makefile