dnl CF_WITH_ENCODINGS_DIR version: 2 updated: 2013/02/16 20:11:32
dnl ---------------------
dnl Configure option to specify the location of encodings.dir, for programs
dnl that must read it directly.
AC_DEFUN([CF_WITH_ENCODINGS_DIR],
[
AC_MSG_CHECKING(for location of encodings.dir file)
AC_ARG_WITH(encodings-dir,
[  --with-encodings-dir=XXX file used for encodings directory (default: auto)],
[ENCODINGS_DIR_FILE=$withval],
[ENCODINGS_DIR_FILE=auto])

CF_VERBOSE()
case "x$ENCODINGS_DIR_FILE" in #(vi
xauto|xyes|xno)
	ENCODINGS_DIR_FILE=unknown
	for cf_path in \
		/usr/X11*/lib/X11/fonts \
		/usr/share/fonts/X11
		do
			test -d "$cf_path" || continue
			cf_encodings_dir=$cf_path/encodings/encodings.dir
			CF_VERBOSE(...testing $cf_encodings_dir)
			if test -f $cf_encodings_dir ; then
				ENCODINGS_DIR_FILE=$cf_encodings_dir
				break
			fi
		done
	;; #(vi
*)
	if test ! -f "$ENCODINGS_DIR_FILE" ; then
		AC_MSG_WARN(Encodings file not found: $ENCODINGS_DIR_FILE)
		ENCODINGS_DIR_FILE=/usr/share/fonts/X11
	fi
	;;
esac
AC_MSG_RESULT($ENCODINGS_DIR_FILE)
test $ENCODINGS_DIR_FILE = unknown && ENCODINGS_DIR_FILE=
AC_SUBST(ENCODINGS_DIR_FILE)
AC_DEFINE_UNQUOTED(ENCODINGS_DIR_FILE, "$ENCODINGS_DIR_FILE")
])dnl
