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])
117 AC_DEFUN(AC_PATH_ETCDIR, [
118 AC_ARG_WITH(etcdir,[ --with-etcdir=DIR Where to install etc files], etcdir=${withval})
119 AC_MSG_CHECKING([where etc files should go])
120 if test -z "$etcdir"; then
121 dnl Set default value
122 etcdir="\$(lispdir)/../etc"
124 AC_MSG_RESULT($etcdir)
129 dnl Check whether a function exists in a library
130 dnl All '_' characters in the first argument are converted to '-'
132 AC_DEFUN(AC_EMACS_CHECK_LIB, [
133 if test -z "$3"; then
134 AC_MSG_CHECKING(for $2 in $1)
136 library=`echo $1 | tr _ -`
137 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")
138 if test "${EMACS_cv_SYS_$1}" = "nil"; then
141 if test "${EMACS_cv_SYS_$1}" = "t"; then
144 HAVE_$1=${EMACS_cv_SYS_$1}
146 if test -z "$3"; then
147 AC_MSG_RESULT($HAVE_$1)
152 dnl Perform sanity checking and try to locate the W3 package
154 AC_DEFUN(AC_CHECK_W3, [
155 AC_MSG_CHECKING(for acceptable W3 version)
158 unset EMACS_cv_ACCEPTABLE_W3;
159 unset EMACS_cv_SYS_w3_dir;
160 unset EMACS_cv_SYS_w3_forms;
162 AC_CACHE_VAL(EMACS_cv_ACCEPTABLE_W3,[
163 AC_EMACS_CHECK_LIB(w3_forms, w3-form-encode-xwfu,"noecho")
164 if test "${HAVE_w3_forms}" = "yes"; then
165 EMACS_cv_ACCEPTABLE_W3=yes
167 EMACS_cv_ACCEPTABLE_W3=
170 if test "x${EMACS_cv_ACCEPTABLE_W3}" = "xyes"; then
171 AC_EMACS_LISP(w3_dir,(file-name-directory (locate-library \"w3-forms\")),"noecho")
172 EMACS_cv_ACCEPTABLE_W3=$EMACS_cv_SYS_w3_dir
175 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` ])
176 W3=${EMACS_cv_ACCEPTABLE_W3}
178 if test "x${EMACS_cv_ACCEPTABLE_W3}" = "x"; then
179 AC_MSG_RESULT(not found)
186 dnl Perform sanity checking and try to locate the W3 package
188 AC_DEFUN(AC_CHECK_URL, [
189 AC_MSG_CHECKING(for acceptable URL version)
192 unset EMACS_cv_ACCEPTABLE_URL;
193 unset EMACS_cv_SYS_url_dir;
194 unset EMACS_cv_SYS_url;
196 AC_CACHE_VAL(EMACS_cv_ACCEPTABLE_URL,[
197 AC_EMACS_CHECK_LIB(url, url-retrieve, "noecho")
198 if test "${HAVE_url}" = "yes"; then
199 EMACS_cv_ACCEPTABLE_URL=yes
201 EMACS_cv_ACCEPTABLE_URL=
204 if test "x${EMACS_cv_ACCEPTABLE_URL}" = "xyes"; then
205 AC_EMACS_LISP(url_dir,(file-name-directory (locate-library \"url\")),"noecho")
206 EMACS_cv_ACCEPTABLE_URL=$EMACS_cv_SYS_url_dir
209 AC_ARG_WITH(url,[ --with-url=DIR Specify where to find the url package], [ EMACS_cv_ACCEPTABLE_URL=`( cd $withval && pwd || echo "$withval" ) 2> /dev/null` ])
210 URL=${EMACS_cv_ACCEPTABLE_URL}
212 if test "x${EMACS_cv_ACCEPTABLE_URL}" = "x"; then
213 AC_MSG_RESULT(not found)
215 AC_MSG_RESULT("${URL}")
219 AC_DEFUN(AC_EXAMINE_PACKAGEDIR,
220 [dnl Examine PACKAGEDIR.
221 AC_EMACS_LISP(PACKAGEDIR,
223 (if (boundp (quote early-packages))\
224 (let ((dirs (delq nil (append (if early-package-load-path\
226 (if late-package-load-path\
228 (if last-package-load-path\
230 (while (and dirs (not package-dir))\
231 (if (file-directory-p (car dirs))\
232 (setq package-dir (car dirs)\
233 dirs (cdr dirs))))))\
234 (or package-dir \"\")),
237 AC_DEFUN(AC_PATH_PACKAGEDIR,
238 [dnl Check for PACKAGEDIR.
239 if test ${EMACS_FLAVOR} = xemacs; then
240 AC_MSG_CHECKING([where the XEmacs package is])
241 AC_ARG_WITH(packagedir,
242 [ --with-packagedir=DIR package DIR for XEmacs],
243 [if test x$withval != xyes -a x$withval != x; then
246 AC_EXAMINE_PACKAGEDIR
248 AC_EXAMINE_PACKAGEDIR)
249 if test x$PACKAGEDIR = x; then
250 AC_MSG_RESULT(not found)
252 AC_MSG_RESULT($PACKAGEDIR)
257 AC_SUBST(PACKAGEDIR)])
259 AC_DEFUN(AC_ADD_LOAD_PATH,
260 [dnl Check for additional load path.
262 [ --with-addpath=PATH search Emacs-Lisp libraries with PATH
263 use colons to separate directory names],
264 [if test x$withval != xyes -a x$withval != x; then
265 AC_MSG_CHECKING([where to find the additional elisp libraries])
266 ADDITIONAL_LOAD_PATH=$withval
267 AC_MSG_RESULT($ADDITIONAL_LOAD_PATH)
269 ADDITIONAL_LOAD_PATH=)
270 AC_SUBST(ADDITIONAL_LOAD_PATH)])