Synch with Gnus.
[elisp/gnus.git-] / aclocal.m4
index 5766fc4..aee05d3 100644 (file)
@@ -1,12 +1,23 @@
 AC_DEFUN(AC_DEFINE_GNUS_PRODUCT_NAME,
- [dnl Defining gnus product name.
-  GNUS_PRODUCT_NAME=$1])
+ [echo $ac_n "defining gnus product name... $ac_c"
+  AC_CACHE_VAL(EMACS_cv_GNUS_PRODUCT_NAME,[EMACS_cv_GNUS_PRODUCT_NAME=$1])
+  GNUS_PRODUCT_NAME=${EMACS_cv_GNUS_PRODUCT_NAME}
+  AC_MSG_RESULT(${GNUS_PRODUCT_NAME})
+  AC_SUBST(GNUS_PRODUCT_NAME)])
 
 AC_DEFUN(AC_CHECK_EMACS,
  [dnl Check for Emacsen.
+
+  dnl Apparently, if you run a shell window in Emacs, it sets the EMACS
+  dnl environment variable to 't'.  Lets undo the damage.
+  test x$EMACS = xt && EMACS=
+
+  dnl Ignore cache.
+  unset ac_cv_prog_EMACS; unset ac_cv_prog_XEMACS;
+
   AC_ARG_WITH(emacs,
    [  --with-emacs=EMACS      compile with EMACS [EMACS=emacs, mule...]],
-   [if test x$withval = xyes -o x$withval = xt -o x$withval = x; then
+   [if test x$withval = xyes -o x$withval = x; then
       AC_CHECK_PROGS(EMACS, emacs xemacs mule, emacs)
     else
       AC_CHECK_PROG(EMACS, $withval, $withval, emacs)
@@ -20,7 +31,7 @@ AC_DEFUN(AC_CHECK_EMACS,
     fi
     EMACS=$XEMACS],
    [XEMACS=xemacs
-    test x$EMACS = xt -o x$EMACS = x &&\
+    test x$EMACS = x &&\
       AC_CHECK_PROGS(EMACS, emacs xemacs mule, emacs)])
   AC_SUBST(EMACS)
   AC_SUBST(XEMACS)])
@@ -47,6 +58,10 @@ fi
 
 AC_DEFUN(AC_CHECK_EMACS_FLAVOR,
  [AC_MSG_CHECKING([what a flavor does $EMACS have])
+
+  dnl Ignore cache.
+  unset EMACS_cv_SYS_flavor;
+
   AC_EMACS_LISP(flavor,
     (cond ((featurep (quote xemacs)) \"XEmacs\")\
           ((boundp (quote MULE)) \"MULE\")\
@@ -90,8 +105,12 @@ AC_DEFUN(AC_PATH_LISPDIR, [
        fi
     done
   fi
-  AC_MSG_RESULT([$lispdir
+  if test ${EMACS_FLAVOR} = xemacs; then
+    AC_MSG_RESULT([$lispdir
          (it will be ignored when \"make install-package[[-ja]]\" is done)])
+  else
+    AC_MSG_RESULT([$lispdir])
+  fi
   AC_SUBST(lispdir)
 ])
 
@@ -123,15 +142,21 @@ dnl Perform sanity checking and try to locate the W3 package
 dnl
 AC_DEFUN(AC_CHECK_W3, [
 AC_MSG_CHECKING(for acceptable W3 version)
+
+dnl Ignore cache.
+unset EMACS_cv_ACCEPTABLE_W3;
+unset EMACS_cv_SYS_w3_dir;
+unset EMACS_cv_SYS_w3_forms;
+
 AC_CACHE_VAL(EMACS_cv_ACCEPTABLE_W3,[
 AC_EMACS_CHECK_LIB(w3_forms, w3-form-encode-xwfu,"noecho")
 if test "${HAVE_w3_forms}" = "yes"; then
        EMACS_cv_ACCEPTABLE_W3=yes
 else
-       EMACS_cv_ACCEPTABLE_W3=no
+       EMACS_cv_ACCEPTABLE_W3=
 fi
 
-if test "${EMACS_cv_ACCEPTABLE_W3}" = "yes"; then
+if test "x${EMACS_cv_ACCEPTABLE_W3}" = "xyes"; then
        AC_EMACS_LISP(w3_dir,(file-name-directory (locate-library \"w3-forms\")),"noecho")
        EMACS_cv_ACCEPTABLE_W3=$EMACS_cv_SYS_w3_dir
 fi
@@ -139,19 +164,51 @@ fi
    AC_ARG_WITH(w3,[  --with-w3=DIR           Specify where to find the w3 package], [ EMACS_cv_ACCEPTABLE_W3=`( cd $withval && pwd || echo "$withval" ) 2> /dev/null` ])
    W3=${EMACS_cv_ACCEPTABLE_W3}
    AC_SUBST(W3)
-   AC_MSG_RESULT("${W3}")
+   if test "x${EMACS_cv_ACCEPTABLE_W3}" = "x"; then
+       AC_MSG_RESULT(not found)
+   else
+       AC_MSG_RESULT(${W3})
+   fi
 ])
 
+AC_DEFUN(AC_EXAMINE_PACKAGEDIR,
+ [dnl Examine PACKAGEDIR.
+  AC_EMACS_LISP(PACKAGEDIR,
+    (let (package-dir)\
+      (if (boundp (quote early-packages))\
+         (let ((dirs (delq nil (append (if early-package-load-path\
+                                           early-packages)\
+                                       (if late-package-load-path\
+                                           late-packages)\
+                                       (if last-package-load-path\
+                                           last-packages)))))\
+           (while (and dirs (not package-dir))\
+             (if (file-directory-p (car dirs))\
+                 (setq package-dir (car dirs)\
+                       dirs (cdr dirs))))))\
+      (or package-dir \"\")),
+    "noecho")])
+
 AC_DEFUN(AC_PATH_PACKAGEDIR,
  [dnl Check for PACKAGEDIR.
-  AC_ARG_WITH(packagedir,
-   [  --with-packagedir=DIR   package DIR for XEmacs],
-   [if test x$withval != xyes -a x$withval != x; then
-      AC_MSG_CHECKING([where the package should go])
-      PACKAGEDIR=$withval
+  if test ${EMACS_FLAVOR} = xemacs; then
+    AC_MSG_CHECKING([where the XEmacs package is])
+    AC_ARG_WITH(packagedir,
+      [  --with-packagedir=DIR   package DIR for XEmacs],
+      [if test x$withval != xyes -a x$withval != x; then
+       PACKAGEDIR=$withval
+      else
+       AC_EXAMINE_PACKAGEDIR
+      fi],
+      AC_EXAMINE_PACKAGEDIR)
+    if test x$PACKAGEDIR = x; then
+      AC_MSG_RESULT(not found)
+    else
       AC_MSG_RESULT($PACKAGEDIR)
-    fi],
-    PACKAGEDIR=)
+    fi
+  else
+    PACKAGEDIR=
+  fi
   AC_SUBST(PACKAGEDIR)])
 
 AC_DEFUN(AC_ADD_LOAD_PATH,