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)])
8 AC_DEFUN(AC_CHECK_EMACS,
9 [dnl Check for Emacsen.
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 x$EMACS = xt && EMACS=
16 unset ac_cv_prog_EMACS; unset ac_cv_prog_XEMACS;
19 [ --with-emacs=EMACS compile with EMACS [EMACS=emacs, mule...]],
20 [if test x$withval = xyes -o x$withval = x; then
21 AC_CHECK_PROGS(EMACS, emacs xemacs mule, emacs)
23 AC_CHECK_PROG(EMACS, $withval, $withval, emacs)
26 [ --with-xemacs=XEMACS compile with XEMACS [XEMACS=xemacs]],
27 [if test x$withval = xyes -o x$withval = x; then
28 AC_CHECK_PROG(XEMACS, xemacs, xemacs, xemacs)
30 AC_CHECK_PROG(XEMACS, $withval, $withval, xemacs)
35 AC_CHECK_PROGS(EMACS, emacs xemacs mule, emacs)])
39 AC_DEFUN(AC_EMACS_LISP, [
42 AC_MSG_CHECKING(for $1)
44 AC_CACHE_VAL(EMACS_cv_SYS_$1,[
46 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
47 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
48 retval=`cat ${OUTPUT}`
49 echo "=> ${retval}" >& AC_FD_CC 2>&1
51 EMACS_cv_SYS_$1=$retval
59 AC_DEFUN(AC_CHECK_EMACS_FLAVOR,
60 [AC_MSG_CHECKING([what a flavor does $EMACS have])
63 unset EMACS_cv_SYS_flavor;
66 (cond ((featurep (quote xemacs)) \"XEmacs\")\
67 ((boundp (quote MULE)) \"MULE\")\
70 case $EMACS_cv_SYS_flavor in
78 AC_MSG_RESULT($EMACS_cv_SYS_flavor)])
80 AC_DEFUN(AC_PATH_LISPDIR, [
82 if test "$prefix" = "NONE"; then
83 AC_MSG_CHECKING([prefix for your Emacs])
84 AC_EMACS_LISP(prefix,(expand-file-name \"..\" invocation-directory),"noecho")
85 prefix=${EMACS_cv_SYS_prefix}
86 AC_MSG_RESULT($prefix)
89 [ --with-lispdir=DIR Where to install lisp files
90 (for XEmacs package, use --with-packagedir instead)],
92 AC_MSG_CHECKING([where lisp files should go])
93 if test -z "$lispdir"; then
96 if test "x$theprefix" = "xNONE"; then
97 theprefix=$ac_default_prefix
99 lispdir="\$(datadir)/${EMACS_FLAVOR}/site-lisp/${GNUS_PRODUCT_NAME}"
100 for thedir in share lib; do
102 if test -d ${theprefix}/${thedir}/${EMACS_FLAVOR}/site-lisp; then
103 lispdir="\$(prefix)/${thedir}/${EMACS_FLAVOR}/site-lisp/${GNUS_PRODUCT_NAME}"
108 if test ${EMACS_FLAVOR} = xemacs; then
109 AC_MSG_RESULT([$lispdir
110 (it will be ignored when \"make install-package[[-ja]]\" is done)])
112 AC_MSG_RESULT([$lispdir])
118 dnl Check whether a function exists in a library
119 dnl All '_' characters in the first argument are converted to '-'
121 AC_DEFUN(AC_EMACS_CHECK_LIB, [
122 if test -z "$3"; then
123 AC_MSG_CHECKING(for $2 in $1)
125 library=`echo $1 | tr _ -`
126 AC_EMACS_LISP($1,(progn (fmakunbound (quote $2)) (condition-case nil (progn (require (quote $library)) (fboundp (quote $2))) (error (prog1 nil (message \"$library not found\"))))),"noecho")
127 if test "${EMACS_cv_SYS_$1}" = "nil"; then
130 if test "${EMACS_cv_SYS_$1}" = "t"; then
133 HAVE_$1=${EMACS_cv_SYS_$1}
135 if test -z "$3"; then
136 AC_MSG_RESULT($HAVE_$1)
141 dnl Perform sanity checking and try to locate the W3 package
143 AC_DEFUN(AC_CHECK_W3, [
144 AC_MSG_CHECKING(for acceptable W3 version)
147 unset EMACS_cv_ACCEPTABLE_W3;
148 unset EMACS_cv_SYS_w3_dir;
149 unset EMACS_cv_SYS_w3_forms;
151 AC_CACHE_VAL(EMACS_cv_ACCEPTABLE_W3,[
152 AC_EMACS_CHECK_LIB(w3_forms, w3-form-encode-xwfu,"noecho")
153 if test "${HAVE_w3_forms}" = "yes"; then
154 EMACS_cv_ACCEPTABLE_W3=yes
156 EMACS_cv_ACCEPTABLE_W3=
159 if test "x${EMACS_cv_ACCEPTABLE_W3}" = "xyes"; then
160 AC_EMACS_LISP(w3_dir,(file-name-directory (locate-library \"w3-forms\")),"noecho")
161 EMACS_cv_ACCEPTABLE_W3=$EMACS_cv_SYS_w3_dir
164 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` ])
165 W3=${EMACS_cv_ACCEPTABLE_W3}
167 if test "x${EMACS_cv_ACCEPTABLE_W3}" = "x"; then
168 AC_MSG_RESULT(not found)
174 AC_DEFUN(AC_EXAMINE_PACKAGEDIR,
175 [dnl Examine PACKAGEDIR.
176 AC_EMACS_LISP(PACKAGEDIR,
178 (if (boundp (quote early-packages))\
179 (let ((dirs (delq nil (append (if early-package-load-path\
181 (if late-package-load-path\
183 (if last-package-load-path\
185 (while (and dirs (not package-dir))\
186 (if (file-directory-p (car dirs))\
187 (setq package-dir (car dirs)\
188 dirs (cdr dirs))))))\
189 (or package-dir \"\")),
192 AC_DEFUN(AC_PATH_PACKAGEDIR,
193 [dnl Check for PACKAGEDIR.
194 if test ${EMACS_FLAVOR} = xemacs; then
195 AC_MSG_CHECKING([where the XEmacs package is])
196 AC_ARG_WITH(packagedir,
197 [ --with-packagedir=DIR package DIR for XEmacs],
198 [if test x$withval != xyes -a x$withval != x; then
201 AC_EXAMINE_PACKAGEDIR
203 AC_EXAMINE_PACKAGEDIR)
204 if test x$PACKAGEDIR = x; then
205 AC_MSG_RESULT(not found)
207 AC_MSG_RESULT($PACKAGEDIR)
212 AC_SUBST(PACKAGEDIR)])
214 AC_DEFUN(AC_ADD_LOAD_PATH,
215 [dnl Check for additional load path.
217 [ --with-addpath=PATH search Emacs-Lisp libraries with PATH
218 use colons to separate directory names],
219 [if test x$withval != xyes -a x$withval != x; then
220 AC_MSG_CHECKING([where to find the additional elisp libraries])
221 ADDITIONAL_LOAD_PATH=$withval
222 AC_MSG_RESULT($ADDITIONAL_LOAD_PATH)
224 ADDITIONAL_LOAD_PATH=)
225 AC_SUBST(ADDITIONAL_LOAD_PATH)])