<<< Date Index >>>     <<< Thread Index >>>

[PATCH] Support --docdir, complain if that conflicts with --with-docdir



# HG changeset patch
# User Matthias Andree <matthias.andree@xxxxxx>
# Date 1248733349 -7200
# Branch HEAD
# Node ID 9949607b3f3d35121459cb34416ba3c1e54599bb
# Parent  86e066a206ac9d0eb2df5ce67eed22fda4287846
Support --docdir, complain if that conflicts with --with-docdir.

Fixes #3282.

Note that this relies on the autoconf 2.60+ default for
docdir; if that ever changes in a newer autoconf release, the script
must be updated to avoid false positives.

Note that --with-docdir should be phased out and replaced by --docdir,
after 1.6.

diff -r 86e066a206ac -r 9949607b3f3d configure.ac
--- a/configure.ac      Fri Jul 24 14:30:45 2009 +0200
+++ b/configure.ac      Tue Jul 28 00:22:29 2009 +0200
@@ -537,12 +537,30 @@
 AC_SUBST([datarootdir])
 
 AC_MSG_CHECKING(where to put the documentation)
+mutt_with_docdir_set=no
 AC_ARG_WITH(docdir, AC_HELP_STRING([--with-docdir=PATH], [Specify where to put 
the documentation]),
-        [mutt_cv_docdir=$withval],
-        [mutt_cv_docdir='${datarootdir}/doc/mutt'])
+        [mutt_cv_docdir="$withval"
+         mutt_with_docdir_set=yes],
+        [mutt_cv_docdir="${docdir:-'${datarootdir}/doc/mutt'}"])
 AC_MSG_RESULT($mutt_cv_docdir)
 
-docdir=$mutt_cv_docdir
+dnl FIXME: this is somewhat dangerous - if the autoconf docdir default ever
+dnl changes, it needs to be added here as an additional
+dnl -a "$docddir" != "newdefault"   branch to the test command below,
+dnl else there will be false complaints if users use --with-docdir.
+if test -n "$docdir" \
+        -a "$docdir" != '${datarootdir}/doc/${PACKAGE}' \
+        -a $mutt_with_docdir_set != no \
+       -a "$mutt_cv_docdir" != "$docdir"
+then
+dnl we suggest to use --docdir, as that is the future; and on older
+dnl autoconf-generated configures, docdir shouldn't be set. We may
+dnl inherit it from the environment though and fail. So suggest the
+dnl safe solution instead of the legacy option.
+        AC_MSG_ERROR([--with-docdir=$mutt_cv_docdir conflicts with 
--docdir=$docdir.  Remove --with-docdir=... and retry.])
+fi
+
+docdir="$mutt_cv_docdir"
 AC_SUBST(docdir)
 
 if test x$mutt_cv_setgid = xyes; then