Fixed.
[riece] / acinclude.m4
1 AC_DEFUN(AC_DEFINE_GNUS_PRODUCT_NAME,
2  [echo $ac_n "defining gnus product name... $ac_c"
3   AC_CACHE_VAL(EMACS_cv_GNUS_PRODUCT_NAME,[EMACS_cv_GNUS_PRODUCT_NAME=$1])
4   GNUS_PRODUCT_NAME=${EMACS_cv_GNUS_PRODUCT_NAME}
5   AC_MSG_RESULT(${GNUS_PRODUCT_NAME})
6   AC_SUBST(GNUS_PRODUCT_NAME)])
7
8 AC_DEFUN(AC_CHECK_EMACS,
9  [dnl Check for Emacsen.
10
11   dnl Apparently, if you run a shell window in Emacs, it sets the EMACS
12   dnl environment variable to 't'.  Lets undo the damage.
13   test "$EMACS" = t && EMACS=
14
15   dnl Ignore cache.
16   unset ac_cv_prog_EMACS; unset ac_cv_prog_XEMACS;
17
18   AC_ARG_WITH(emacs,
19    [  --with-emacs=EMACS      compile with EMACS [EMACS=emacs, mule...]],
20    [if test "$withval" = yes -o -z "$withval"; then
21       AC_CHECK_PROGS(EMACS, emacs xemacs mule, emacs)
22     else
23       AC_CHECK_PROG(EMACS, $withval, $withval, emacs)
24     fi])
25   AC_ARG_WITH(xemacs,
26    [  --with-xemacs=XEMACS    compile with XEMACS [XEMACS=xemacs]],
27    [if test "$withval" = yes -o -z "$withval"; then
28       AC_CHECK_PROG(XEMACS, xemacs, xemacs, xemacs)
29     else
30       AC_CHECK_PROG(XEMACS, $withval, $withval, xemacs)
31     fi
32     EMACS=$XEMACS],
33    [XEMACS=xemacs
34     test -z "$EMACS" && AC_CHECK_PROGS(EMACS, emacs xemacs mule, emacs)])
35   AC_SUBST(EMACS)
36   AC_SUBST(XEMACS)])
37
38 AC_DEFUN(AC_EMACS_LISP, [
39 elisp="$2"
40 if test -z "$3"; then
41         AC_MSG_CHECKING(for $1)
42 fi
43 AC_CACHE_VAL(EMACS_cv_SYS_$1,[
44         OUTPUT=./conftest-$$
45         echo ${EMACS}' -batch -eval '\''(let ((x '${elisp}')) (write-region (if (stringp x) (princ x) (prin1-to-string x)) nil "'${OUTPUT}'" nil 5))'\' >& AC_FD_CC 2>&1
46         eval ${EMACS}' -batch -eval '\''(let ((x '${elisp}')) (write-region (if (stringp x) (princ x) (prin1-to-string x)) nil "'${OUTPUT}'" nil 5))'\' >& AC_FD_CC 2>&1
47         retval=`cat ${OUTPUT}`
48         echo "=> ${retval}" >& AC_FD_CC 2>&1
49         rm -f ${OUTPUT}
50         EMACS_cv_SYS_$1=$retval
51 ])
52 $1=${EMACS_cv_SYS_$1}
53 if test -z "$3"; then
54         AC_MSG_RESULT($$1)
55 fi
56 ])
57
58 AC_DEFUN(AC_CHECK_EMACS_FLAVOR,
59  [AC_MSG_CHECKING([what a flavor does $EMACS have])
60
61   dnl Ignore cache.
62   unset EMACS_cv_SYS_flavor;
63
64   AC_EMACS_LISP(flavor,
65     (cond ((featurep (quote xemacs)) \"XEmacs\")\
66           ((boundp (quote MULE)) \"MULE\")\
67           (t \"FSF Emacs\")),
68     "noecho")
69   case $EMACS_cv_SYS_flavor in
70   XEmacs)
71     EMACS_FLAVOR=xemacs;;
72   MULE)
73     EMACS_FLAVOR=mule;;
74   *)
75     EMACS_FLAVOR=emacs;;
76   esac
77   AC_MSG_RESULT($EMACS_cv_SYS_flavor)])
78
79 AC_DEFUN(AC_PATH_LISPDIR, [
80   AC_CHECK_EMACS_FLAVOR
81   if test "$prefix" = NONE; then
82         AC_MSG_CHECKING([prefix for your Emacs])
83         AC_EMACS_LISP(prefix,(expand-file-name \"..\" invocation-directory),"noecho")
84         prefix=${EMACS_cv_SYS_prefix}
85         AC_MSG_RESULT($prefix)
86   fi
87   AC_ARG_WITH(lispdir,
88     [  --with-lispdir=DIR      Where to install lisp files
89                           (for XEmacs package, use --with-packagedir instead)],
90     lispdir=${withval})
91   AC_MSG_CHECKING([where lisp files should go])
92   if test -z "$lispdir"; then