+dnl --- *@-mdw_DIR_TEXMF-@* ---
+dnl
+dnl Author: Mark Wooding
+dnl
+dnl Synopsis: mdw_DIR_TEXMF
+dnl
+dnl Arguments: ---
+dnl
+dnl Use: Sets the substitution `texmfdir' as a sensible TeX install
+dnl tree.
+
+AC_DEFUN([mdw_DIR_TEXMF], [
+AC_ARG_WITH([texmfdir],
+[ --with-texmfdir=DIR set the TeX install directory to DIR],
+[texmfdir=$withval],
+[AC_MSG_CHECKING([where to put installed TeX files])
+mdw_DEFINE_PATHS([
+texmfdir='${datadir}/texmf'
+for d in \
+ '${datadir}/texmf' '${prefix}/lib/texmf' \
+ '${prefix}/texmf' '${libdir}/lib/texmf'; do
+ if test -d "mdw_PATH([$d])"; then
+ texmfdir=$d
+ break
+ fi
+done
+AC_MSG_RESULT([$texmfdir])])])
+AC_SUBST(texmfdir)])
+