1 AC_DEFUN([AC_CHECK_EMACS],
2 [dnl Check for Emacsen.
4 dnl Apparently, if you run a shell window in Emacs, it sets the EMACS
5 dnl environment variable to 't'. Lets undo the damage.
6 test "$EMACS" = t && EMACS=
9 unset ac_cv_prog_EMACS; unset ac_cv_prog_XEMACS;
12 [ --with-emacs=EMACS compile with EMACS [EMACS=emacs, mule...]],
13 [if test "$withval" = yes -o -z "$withval"; then
14 AC_CHECK_PROGS(EMACS, emacs xemacs mule, emacs)
16 AC_CHECK_PROG(EMACS, $withval, $withval, emacs)
19 [ --with-xemacs=XEMACS compile with XEMACS [XEMACS=xemacs]],
20 [if test "$withval" = yes -o -z "$withval"; then
21 AC_CHECK_PROG(XEMACS, xemacs, xemacs, xemacs)
23 AC_CHECK_PROG(XEMACS, $withval, $withval, xemacs)
27 test -z "$EMACS" && AC_CHECK_PROGS(EMACS, emacs xemacs mule, emacs)])
31 AC_DEFUN([AC_EMACS_LISP], [
34 AC_MSG_CHECKING(for $1)
36 AC_CACHE_VAL(EMACS_cv_SYS_$1,[
38 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
39 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
40 if test -f ${OUTPUT}; then
41 retval=`cat ${OUTPUT}`
42 echo "=> ${retval}" >& AC_FD_CC 2>&1
44 EMACS_cv_SYS_$1=$retval
55 AC_DEFUN([AC_CHECK_EMACS_FLAVOR],
56 [AC_MSG_CHECKING([what flavor does $EMACS have])
59 unset EMACS_cv_SYS_flavor;
62 (cond ((featurep (quote xemacs)) \"XEmacs\")\
63 ((boundp (quote MULE)) \"MULE\")\
66 case $EMACS_cv_SYS_flavor in
74 AC_MSG_RESULT($EMACS_cv_SYS_flavor)])
76 AC_DEFUN([AC_PATH_LISPDIR], [
78 if test "$prefix" = NONE; then
79 AC_MSG_CHECKING([prefix for your Emacs])
80 AC_EMACS_LISP(prefix,(expand-file-name \"..\" invocation-directory),"noecho")
81 prefix=${EMACS_cv_SYS_prefix}
82 AC_MSG_RESULT($prefix)
85 [ --with-lispdir=DIR Where to install lisp files
86 (for XEmacs package, use --with-packagedir instead)],
88 AC_MSG_CHECKING([where lisp files should go])
89 if test -z "$lispdir"; then
92 if test "$theprefix" = NONE; then
93 theprefix=$ac_default_prefix
95 lispdir="\$(datadir)/${EMACS_FLAVOR}/site-lis"
96 for thedir in share lib; do
98 if test -d ${theprefix}/${thedir}/${EMACS_FLAVOR}/site-lisp; then
99 lispdir="\$(prefix)/${thedir}/${EMACS_FLAVOR}/site-lisp"
104 if test ${EMACS_FLAVOR} = xemacs; then
105 AC_MSG_RESULT([$lispdir
106 (it will be ignored when \"make install-package[[-ja]]\" is done)])
108 AC_MSG_RESULT([$lispdir])
114 dnl Perform sanity checking and try to locate the Shimbun package
116 AC_DEFUN([AC_CHECK_SHIMBUN], [
117 AC_MSG_CHECKING(for shimbun)
120 unset EMACS_cv_SYS_shimbun_dir;
122 AC_ARG_WITH(shimbun,[ --with-shimbun[[=ARG]] Use shimbun [[ARG=yes]]],
123 [if test "$withval" = yes -o -z "$withval"; then
126 HAVE_SHIMBUN=$withval
127 fi], HAVE_SHIMBUN=yes)
128 AC_SUBST(HAVE_SHIMBUN)
130 if test "${HAVE_SHIMBUN}" = yes; then
131 AC_EMACS_LISP(shimbun_dir,(file-name-directory (locate-library \"shimbun\")),"noecho")
132 SHIMBUN_DIR=$EMACS_cv_SYS_shimbun_dir
135 if test "${HAVE_SHIMBUN}" != yes; then
137 elif test -z "${SHIMBUN_DIR}"; then
139 AC_MSG_RESULT(not found)
141 AC_MSG_RESULT(${HAVE_SHIMBUN})
145 AC_DEFUN([AC_EXAMINE_PACKAGEDIR],
146 [dnl Examine PACKAGEDIR.
147 AC_EMACS_LISP(PACKAGEDIR,
149 (if (boundp (quote early-packages))\
150 (let ((dirs (delq nil (append (if early-package-load-path\
152 (if late-package-load-path\
154 (if last-package-load-path\
156 (while (and dirs (not package-dir))\
157 (if (file-directory-p (car dirs))\
158 (setq package-dir (car dirs)\
159 dirs (cdr dirs))))))\
160 (or package-dir \"\")),
163 AC_DEFUN([AC_PATH_PACKAGEDIR],
164 [dnl Check for PACKAGEDIR.
165 if test ${EMACS_FLAVOR} = xemacs; then
166 AC_MSG_CHECKING([where the XEmacs package is])
167 AC_ARG_WITH(packagedir,
168 [ --with-packagedir=DIR package DIR for XEmacs],
169 [if test "$withval" != yes -a -n "$withval"; then
172 AC_EXAMINE_PACKAGEDIR
174 AC_EXAMINE_PACKAGEDIR)
175 if test -z "$PACKAGEDIR"; then
176 AC_MSG_RESULT(not found)
178 AC_MSG_RESULT($PACKAGEDIR)
183 AC_SUBST(PACKAGEDIR)])
185 AC_DEFUN([AC_ADD_LOAD_PATH],
186 [dnl Check for additional load path.
188 [ --with-addpath=PATH search Emacs-Lisp libraries with PATH
189 use colons to separate directory names],
190 [if test "$withval" != yes -a -n "$withval"; then
191 AC_MSG_CHECKING([where to find the additional elisp libraries])
192 ADDITIONAL_LOAD_PATH=$withval
193 AC_MSG_RESULT($ADDITIONAL_LOAD_PATH)
195 ADDITIONAL_LOAD_PATH=)
196 AC_SUBST(ADDITIONAL_LOAD_PATH)])