1 AC_DEFUN(AC_DEFINE_GNUS_PRODUCT_NAME,
2 [dnl Defining gnus product name.
4 AC_SUBST(GNUS_PRODUCT_NAME)])
6 AC_DEFUN(AC_CHECK_EMACS,
7 [dnl Check for Emacsen.
9 dnl Apparently, if you run a shell window in Emacs, it sets the EMACS
10 dnl environment variable to 't'. Lets undo the damage.
11 test x$EMACS = xt && EMACS=
14 [ --with-emacs=EMACS compile with EMACS [EMACS=emacs, mule...]],
15 [if test x$withval = xyes -o x$withval = x; then
16 AC_CHECK_PROGS(EMACS, emacs xemacs mule, emacs)
18 AC_CHECK_PROG(EMACS, $withval, $withval, emacs)
21 [ --with-xemacs=XEMACS compile with XEMACS [XEMACS=xemacs]],
22 [if test x$withval = xyes -o x$withval = x; then
23 AC_CHECK_PROG(XEMACS, xemacs, xemacs, xemacs)
25 AC_CHECK_PROG(XEMACS, $withval, $withval, xemacs)
30 AC_CHECK_PROGS(EMACS, emacs xemacs mule, emacs)])
34 AC_DEFUN(AC_EMACS_LISP, [
37 AC_MSG_CHECKING(for $1)
39 AC_CACHE_VAL(EMACS_cv_SYS_$1,[
41 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
42 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
43 retval=`cat ${OUTPUT}`
44 echo "=> ${retval}" >& AC_FD_CC 2>&1
46 EMACS_cv_SYS_$1=$retval
54 AC_DEFUN(AC_CHECK_EMACS_FLAVOR,
55 [AC_MSG_CHECKING([what a flavor does $EMACS have])
57 (cond ((featurep (quote xemacs)) \"XEmacs\")\
58 ((boundp (quote MULE)) \"MULE\")\
61 case $EMACS_cv_SYS_flavor in
69 AC_MSG_RESULT($EMACS_cv_SYS_flavor)])
71 AC_DEFUN(AC_PATH_LISPDIR, [
73 if test "$prefix" = "NONE"; then
74 AC_MSG_CHECKING([prefix for your Emacs])
75 AC_EMACS_LISP(prefix,(expand-file-name \"..\" invocation-directory),"noecho")
76 prefix=${EMACS_cv_SYS_prefix}
77 AC_MSG_RESULT($prefix)
80 [ --with-lispdir=DIR Where to install lisp files
81 (for XEmacs package, use --with-packagedir instead)],
83 AC_MSG_CHECKING([where lisp files should go])
84 if test -z "$lispdir"; then
87 if test "x$theprefix" = "xNONE"; then
88 theprefix=$ac_default_prefix
90 lispdir="\$(datadir)/${EMACS_FLAVOR}/site-lisp/${GNUS_PRODUCT_NAME}"
91 for thedir in share lib; do
93 if test -d ${theprefix}/${thedir}/${EMACS_FLAVOR}/site-lisp; then
94 lispdir="\$(prefix)/${thedir}/${EMACS_FLAVOR}/site-lisp/${GNUS_PRODUCT_NAME}"
99 if test ${EMACS_FLAVOR} = xemacs; then
100 AC_MSG_RESULT([$lispdir
101 (it will be ignored when \"make install-package[[-ja]]\" is done)])
103 AC_MSG_RESULT([$lispdir])
109 dnl Check whether a function exists in a library
110 dnl All '_' characters in the first argument are converted to '-'
112 AC_DEFUN(AC_EMACS_CHECK_LIB, [
113 if test -z "$3"; then
114 AC_MSG_CHECKING(for $2 in $1)
116 library=`echo $1 | tr _ -`
117 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")
118 if test "${EMACS_cv_SYS_$1}" = "nil"; then
121 if test "${EMACS_cv_SYS_$1}" = "t"; then
124 HAVE_$1=${EMACS_cv_SYS_$1}
126 if test -z "$3"; then
127 AC_MSG_RESULT($HAVE_$1)
132 dnl Perform sanity checking and try to locate the W3 package
134 AC_DEFUN(AC_CHECK_W3, [
135 AC_MSG_CHECKING(for acceptable W3 version)
136 AC_CACHE_VAL(EMACS_cv_ACCEPTABLE_W3,[
137 AC_EMACS_CHECK_LIB(w3_forms, w3-form-encode-xwfu,"noecho")
138 if test "${HAVE_w3_forms}" = "yes"; then
139 EMACS_cv_ACCEPTABLE_W3=yes
141 EMACS_cv_ACCEPTABLE_W3=
144 if test "x${EMACS_cv_ACCEPTABLE_W3}" = "xyes"; then
145 AC_EMACS_LISP(w3_dir,(file-name-directory (locate-library \"w3-forms\")),"noecho")
146 EMACS_cv_ACCEPTABLE_W3=$EMACS_cv_SYS_w3_dir
149 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` ])
150 W3=${EMACS_cv_ACCEPTABLE_W3}
152 if test "x${EMACS_cv_ACCEPTABLE_W3}" = "x"; then
153 AC_MSG_RESULT("not found")
155 AC_MSG_RESULT("${W3}")
159 AC_DEFUN(AC_EXAMINE_PACKAGEDIR,
160 [dnl Examine PACKAGEDIR.
161 AC_EMACS_LISP(PACKAGEDIR,
163 (if (boundp (quote early-packages))\
164 (let ((dirs (delq nil (append (if early-package-load-path\
166 (if late-package-load-path\
168 (if last-package-load-path\
170 (while (and dirs (not package-dir))\
171 (if (file-directory-p (car dirs))\
172 (setq package-dir (car dirs)\
173 dirs (cdr dirs))))))\
174 (or package-dir \"\")),
177 AC_DEFUN(AC_PATH_PACKAGEDIR,
178 [dnl Check for PACKAGEDIR.
179 if test ${EMACS_FLAVOR} = xemacs; then
180 AC_MSG_CHECKING([where the XEmacs package is])
181 AC_ARG_WITH(packagedir,
182 [ --with-packagedir=DIR package DIR for XEmacs],
183 [if test x$withval != xyes -a x$withval != x; then
186 AC_EXAMINE_PACKAGEDIR
188 AC_EXAMINE_PACKAGEDIR)
189 if test x$PACKAGEDIR = x; then
190 AC_MSG_RESULT("not found")
192 AC_MSG_RESULT($PACKAGEDIR)
197 AC_SUBST(PACKAGEDIR)])
199 AC_DEFUN(AC_ADD_LOAD_PATH,
200 [dnl Check for additional load path.
202 [ --with-addpath=PATH search Emacs-Lisp libraries with PATH
203 use colons to separate directory names],
204 [if test x$withval != xyes -a x$withval != x; then
205 AC_MSG_CHECKING([where to find the additional elisp libraries])
206 ADDITIONAL_LOAD_PATH=$withval
207 AC_MSG_RESULT($ADDITIONAL_LOAD_PATH)
209 ADDITIONAL_LOAD_PATH=)
210 AC_SUBST(ADDITIONAL_LOAD_PATH)])