#!/bin/sh

prefix="/usr/local"
exec_prefix="${prefix}"
exec_prefix_set=no
includedir="${prefix}/include"
la_file="${exec_prefix}/lib/libchardet.la"

usage="\
Usage: chardet-config [--prefix] [--exec-prefix] [--version] [--libs] [--defs] [--cflags]"

if test $# -eq 0; then
	echo "${usage}" 1>&2
	exit 1
fi

. $la_file

while test $# -gt 0; do
	case "$1" in
		-*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
		*) optarg= ;;
	esac

	case $1 in
		--prefix=*)
			prefix="$optarg"
			if test "$exec_prefix_set" = no ; then
				exec_prefix="$optarg"
			fi
			;;
		--prefix)
			echo -n "$prefix"
			;;
		--exec-prefix=*)
			exec_prefix="$optarg"
			exec_prefix_set=yes
			;;
		--exec-prefix)
			echo -n "$exec_prefix"
			;;
		--version)
			echo "1.0.6"
			exit 0
			;;
		--cflags)
			echo -n " -O2 -pipe -fvisibility=hidden"
			;;
		--defs)
			includes="-I${includedir}"
			echo -n " -DHAVE_CONFIG_H $includes/chardet"
			;;
		--libs)
			echo -n " -L${libdir} -lchardet ${dependency_libs}"
			;;
		*)
			echo "${usage}" 1>&2
			exit 1
			;;
	esac
	shift
done

exit 0
