Blame configure

e09104
#!/bin/sh
e09104
e09104
# a simple configure-make wrapper for use in conjunction with the 'lazy' build script.
e09104
# 'lazy' is deviant, occasionally useful, and permissively licensed; get_lazy() below,
e09104
# then look for configure.template in the root directory.
e09104
e09104
init_vars()
e09104
{
e09104
	lz_config_dir=`readlink -f $(dirname $0)`
e09104
	lz_pwd=`pwd`
e09104
e09104
	if [ x"$lz_config" = x ]; then
e09104
		. $lz_config_dir/config.lzy || exit 2
e09104
	else
e09104
		. "$lz_config" || exit 2
e09104
	fi
e09104
}
e09104
e09104
e09104
error_msg()
e09104
{
e09104
	echo $@ >&2
e09104
}
e09104
e09104
e09104
require_out_of_tree()
e09104
{
e09104
	if [ x"$lz_config_dir" = x"$lz_pwd" ]; then
e09104
		error_msg "$lz_package: out-of-tree builds are required."
e09104
		error_msg "please invoke configure again from a clean build directory."
e09104
		exit 2
e09104
	fi
e09104
e09104
	return 0
e09104
}
e09104
e09104
e09104
get_lazy()
e09104
{
e09104
	which lazy && lazy=`which lazy` && return 0
e09104
e09104
	if ! [ -d slazy ]; then
e09104
		git clone git://midipix.org/lazy slazy || exit 2
e09104
	fi
e09104
e09104
	lazy=$lz_pwd/slazy/lazy
e09104
}
e09104
e09104
e09104
lazy_approach()
e09104
{
e09104
	if [ x"$lz_prefix" = x ]; then
e09104
		error_msg "prefix is required."
e09104
		exit 2
e09104
	fi
e09104
e09104
	if [ x"$lz_arch" = x ];     then lz_arch=$lz_default_arch; fi
e09104
	if [ x"$lz_target" = x ];   then lz_target=$lz_default_target; fi
e09104
	if [ x"$lz_compiler" = x ]; then lz_compiler=$lz_default_compiler; fi
e09104
	if [ x"$lz_compiler" = x ]; then lz_compiler=gcc; fi
e09104
e09104
	$lazy -x config	$lz_debug	\
e09104
		-t $lz_target		\
e09104
		-a $lz_arch		\
e09104
		-c $lz_compiler		\
e09104
		-n $lz_package		\
e09104
		-p $lz_config_dir	\
e09104
		-f $lz_prefix		\
e09104
		|| exit 2
e09104
e09104
}
e09104
e09104
e09104
lazy_copy()
e09104
{
e09104
	cp "$lz_config_dir/Makefile.in" "$lz_pwd/Makefile"
e09104
}
e09104
e09104
e09104
for arg ; do
e09104
	case "$arg" in
e09104
		--help)	usage
e09104
			;;
e09104
e09104
		--prefix=*)
e09104
			lz_prefix=${arg#*=}
e09104
			;;
e09104
		--host=*)
e09104
			lz_target=${arg#*=}
e09104
			;;
e09104
		--target=*)
e09104
			lz_target=${arg#*=}
e09104
			;;
e09104
		--compiler=*)
e09104
			lz_compiler=${arg#*=}
e09104
			;;
e09104
		--config=*)
e09104
			lz_config=${arg#*=}
e09104
			;;
e09104
		--debug)
e09104
			lz_debug='-d'
e09104
			;;
e09104
		*)
e09104
			error_msg ${arg#}: "unsupported config argument."
e09104
			exit 2
e09104
			;;
e09104
	esac
e09104
done
e09104
e09104
e09104
init_vars
e09104
require_out_of_tree
e09104
get_lazy
e09104
lazy_approach
e09104
lazy_copy