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 "$EMACS" = t && 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 "$withval" = yes -o -z "$withval"; 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 "$withval" = yes -o -z "$withval"; then
28 AC_CHECK_PROG(XEMACS, xemacs, xemacs, xemacs)
30 AC_CHECK_PROG(XEMACS, $withval, $withval, xemacs)
34 test -z "$EMACS" && AC_CHECK_PROGS(EMACS, emacs xemacs mule, emacs)])
38 AC_DEFUN(AC_EMACS_LISP, [
41 AC_MSG_CHECKING(for $1)
43 AC_CACHE_VAL(EMACS_cv_SYS_$1,[
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
50 EMACS_cv_SYS_$1=$retval
58 AC_DEFUN(AC_CHECK_EMACS_FLAVOR,
59 [AC_MSG_CHECKING([what a flavor does $EMACS have])
62 unset EMACS_cv_SYS_flavor;
65 (cond ((featurep (quote xemacs)) \"XEmacs\")\
66 ((boundp (quote MULE)) \"MULE\")\
69 case $EMACS_cv_SYS_flavor in
77 AC_MSG_RESULT($EMACS_cv_SYS_flavor)])
79 AC_DEFUN(AC_PATH_LISPDIR, [
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)
88 [ --with-lispdir=DIR Where to install lisp files
89 (for XEmacs package, use --with-packagedir instead)],
91 AC_MSG_CHECKING([where lisp files should go])
92 if test -z "$lispdir"; then
95 if test "$theprefix" = NONE; then
96 theprefix=$ac_default_prefix
98 if test "$EMACS_FLAVOR" = "xemacs"; then
99 datadir="\$(prefix)/lib"
100 lispdir="\$(datadir)/${EMACS_FLAVOR}/site-packages/lisp/${GNUS_PRODUCT_NAME}"
102 lispdir="\$(datadir)/${EMACS_FLAVOR}/site-lisp/${GNUS_PRODUCT_NAME}"
104 for thedir in share lib; do
106 if test -d ${theprefix}/${thedir}/${EMACS_FLAVOR}/site-lisp; then
107 if test "$EMACS_FLAVOR" = "xemacs"; then
108 lispdir="\$(prefix)/${thedir}/${EMACS_FLAVOR}/site-packages/lisp/${GNUS_PRODUCT_NAME}"
110 lispdir="\$(prefix)/${thedir}/${EMACS_FLAVOR}/site-lisp/${GNUS_PRODUCT_NAME}"
116 if test ${EMACS_FLAVOR} = xemacs; then
117 AC_MSG_RESULT([$lispdir
118 (it will be ignored when \"make install-package[[-ja]]\" is done)])
120 AC_MSG_RESULT([$lispdir])
125 AC_DEFUN(AC_PATH_ETCDIR, [
126 AC_ARG_WITH(etcdir,[ --with-etcdir=DIR Where to install etc files], etcdir=${withval})
127 AC_MSG_CHECKING([where etc files should go])
128 if test -z "$etcdir"; then
129 dnl Set default value.
130 if test "$EMACS_FLAVOR" = "xemacs"; then
131 etcdir="\$(lispdir)/../../etc"
133 etcdir="\$(lispdir)/../etc"
136 AC_MSG_RESULT($etcdir)
141 dnl This is a bit on the "evil hack" side of things. It is so we can
142 dnl have a different default infodir for XEmacs. A user can still specify
143 dnl someplace else with '--infodir=DIR'.
145 AC_DEFUN(AC_PATH_INFO_DIR, [
146 AC_MSG_CHECKING([where the TeXinfo docs should go])
147 dnl Set default value. This must be an absolute path.
148 if test "$infodir" = "\${prefix}/info"; then
149 if test "$EMACS_FLAVOR" = "xemacs"; then
150 info_dir="\$(prefix)/${thedir}/${EMACS_FLAVOR}/site-packages/info"
152 info_dir="\$(prefix)/info"
157 AC_MSG_RESULT($info_dir)
162 dnl This will set the XEmacs command line options to be slightly different
163 dnl from the Emacs ones. If building with XEmacs the options will be
164 dnl "-batch -no-autoloads..." to give a much cleaner build environment.
166 AC_DEFUN(AC_SET_BUILD_FLAGS, [
167 AC_MSG_CHECKING([which options to pass on to (X)Emacs])
168 if test "x$FLAGS" = "x"; then
169 if test "$EMACS_FLAVOR" = "xemacs"; then
170 FLAGS="-batch -no-autoloads -l \$(srcdir)/dgnushack.el"
172 FLAGS="-batch -q -no-site-file -l \$(srcdir)/dgnushack.el"
177 AC_MSG_RESULT($FLAGS)
182 dnl Check whether a function exists in a library
183 dnl All '_' characters in the first argument are converted to '-'
185 AC_DEFUN(AC_EMACS_CHECK_LIB, [
186 if test -z "$3"; then
187 AC_MSG_CHECKING(for $2 in $1)
189 library=`echo $1 | tr _ -`
190 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")
191 if test "${EMACS_cv_SYS_$1}" = nil; then
194 if test "${EMACS_cv_SYS_$1}" = t; then
197 HAVE_$1=${EMACS_cv_SYS_$1}
199 if test -z "$3"; then
200 AC_MSG_RESULT($HAVE_$1)
205 dnl Perform sanity checking and try to locate the W3 package
207 AC_DEFUN(AC_CHECK_W3, [
208 AC_MSG_CHECKING(for acceptable W3 version)
211 unset EMACS_cv_ACCEPTABLE_W3;
212 unset EMACS_cv_SYS_w3_dir;
213 unset EMACS_cv_SYS_w3_forms;
215 AC_CACHE_VAL(EMACS_cv_ACCEPTABLE_W3,[
216 AC_EMACS_CHECK_LIB(w3_forms, w3-form-encode-xwfu,"noecho")
217 if test "${HAVE_w3_forms}" = yes; then
218 EMACS_cv_ACCEPTABLE_W3=yes
220 EMACS_cv_ACCEPTABLE_W3=
223 if test "${EMACS_cv_ACCEPTABLE_W3}" = yes; then
224 AC_EMACS_LISP(w3_dir,(file-name-directory (locate-library \"w3-forms\")),"noecho")
225 EMACS_cv_ACCEPTABLE_W3=$EMACS_cv_SYS_w3_dir
228 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` ])
229 W3=${EMACS_cv_ACCEPTABLE_W3}
231 if test -z "${EMACS_cv_ACCEPTABLE_W3}"; then
232 AC_MSG_RESULT(not found)
239 dnl Perform sanity checking and try to locate the W3 package
241 AC_DEFUN(AC_CHECK_URL, [
242 AC_MSG_CHECKING(for acceptable URL version)
245 unset EMACS_cv_ACCEPTABLE_URL;
246 unset EMACS_cv_SYS_url_dir;
247 unset EMACS_cv_SYS_url;
249 AC_CACHE_VAL(EMACS_cv_ACCEPTABLE_URL,[
250 AC_EMACS_CHECK_LIB(url, url-retrieve, "noecho")
251 if test "${HAVE_url}" = yes; then
252 EMACS_cv_ACCEPTABLE_URL=yes
254 EMACS_cv_ACCEPTABLE_URL=
257 if test "${EMACS_cv_ACCEPTABLE_URL}" = yes; then
258 AC_EMACS_LISP(url_dir,(file-name-directory (locate-library \"url\")),"noecho")
259 EMACS_cv_ACCEPTABLE_URL=$EMACS_cv_SYS_url_dir
262 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` ])
263 URL=${EMACS_cv_ACCEPTABLE_URL}
265 if test -z "${EMACS_cv_ACCEPTABLE_URL}"; then
266 AC_MSG_RESULT(not found)
268 AC_MSG_RESULT("${URL}")
273 dnl Perform checking available fonts: Adobe Bembo, Adobe Futura and
274 dnl Bitstream Courier.
277 AC_DEFUN(GNUS_CHECK_FONTS, [
278 test "$LATEX" = t && LATEX=
279 test "$LATEX" || AC_PATH_PROGS(LATEX, latex, no)
280 AC_MSG_CHECKING(for available fonts)
281 AC_ARG_WITH(fonts,[ --with-fonts Assume all fonts required are available],[USE_FONTS="$withval"])
288 if test -z "${USE_FONTS}"; then
289 if test "${LATEX}" = no; then
293 echo '\nonstopmode\documentclass{article}\usepackage{bembo}\begin{document}\end{document}' > ${OUTPUT}
294 if ${LATEX} ${OUTPUT} </dev/null >& AC_FD_CC 2>&1 ; then
295 if test -z "${USE_FONTS}"; then
296 USE_FONTS="Adobe Bembo"
298 USE_FONTS="${USE_FONTS}, Adobe Bembo"
301 WITHOUT_FONTS_bembo='%'
303 echo '\nonstopmode\documentclass{article}\begin{document}{\fontfamily{pfu}\fontsize{10pt}{10}\selectfont test}\end{document}' > ${OUTPUT}
304 if retval=`${LATEX} ${OUTPUT} </dev/null 2>& AC_FD_CC`; then
305 if echo "$retval" | grep 'Some font shapes were not available' >& AC_FD_CC 2>&1 ; then
308 if test -z "${USE_FONTS}"; then
309 USE_FONTS="Adobe Futura"
311 USE_FONTS="${USE_FONTS}, Adobe Futura"
314 WITHOUT_FONTS_pfu='%'
317 echo '\nonstopmode\documentclass{article}\begin{document}{\fontfamily{bcr}\fontsize{10pt}{10}\selectfont test}\end{document}' > ${OUTPUT}
318 if retval=`${LATEX} ${OUTPUT} </dev/null 2>& AC_FD_CC`; then
319 if echo "$retval" | grep 'Some font shapes were not available' >& AC_FD_CC 2>&1 ; then
322 if test -z "${USE_FONTS}"; then
323 USE_FONTS="Bitstream Courier"
325 USE_FONTS="${USE_FONTS}, Bitstream Courier"
328 WITHOUT_FONTS_bcr='%'
331 rm -f ${OUTPUT} ${OUTPUT}.aux ${OUTPUT}.log ${OUTPUT}.dvi
333 elif test "${USE_FONTS}" = yes ; then
335 WITHOUT_FONTS_bembo='%'
337 WITHOUT_FONTS_pfu='%'
339 WITHOUT_FONTS_bcr='%'
341 AC_SUBST(WITH_FONTS_bembo)
342 AC_SUBST(WITHOUT_FONTS_bembo)
343 AC_SUBST(WITH_FONTS_pfu)
344 AC_SUBST(WITHOUT_FONTS_pfu)
345 AC_SUBST(WITH_FONTS_bcr)
346 AC_SUBST(WITHOUT_FONTS_bcr)
347 if test -z "${USE_FONTS}" ; then
350 USE_FONTS=`echo "${USE_FONTS}" | sed 's/,\([[^,]]*\)$/ and\1/'`
351 AC_MSG_RESULT("${USE_FONTS}")
352 if test "${USE_FONTS}" = yes ; then
353 USE_FONTS='Set in Adobe Bembo, Adobe Futura and Bitstream Courier.'
354 elif test "${USE_FONTS}" = no ; then
357 USE_FONTS="Set in ${USE_FONTS}."
362 AC_DEFUN(AC_EXAMINE_PACKAGEDIR,
363 [dnl Examine PACKAGEDIR.
364 AC_EMACS_LISP(PACKAGEDIR,
366 (if (boundp (quote early-packages))\
367 (let ((dirs (delq nil (append (if early-package-load-path\
369 (if late-package-load-path\
371 (if last-package-load-path\
373 (while (and dirs (not package-dir))\
374 (if (file-directory-p (car dirs))\
375 (setq package-dir (car dirs)\
376 dirs (cdr dirs))))))\
377 (or package-dir \"\")),
380 AC_DEFUN(AC_PATH_PACKAGEDIR,
381 [dnl Check for PACKAGEDIR.
382 if test ${EMACS_FLAVOR} = xemacs; then
383 AC_MSG_CHECKING([where the XEmacs package is])
384 AC_ARG_WITH(packagedir,
385 [ --with-packagedir=DIR package DIR for XEmacs],
386 [if test "$withval" != yes -a -n "$withval"; then
389 AC_EXAMINE_PACKAGEDIR
391 AC_EXAMINE_PACKAGEDIR)
392 if test -z "$PACKAGEDIR"; then
393 AC_MSG_RESULT(not found)
395 AC_MSG_RESULT($PACKAGEDIR)
400 AC_SUBST(PACKAGEDIR)])
402 AC_DEFUN(AC_ADD_LOAD_PATH,
403 [dnl Check for additional load path.
405 [ --with-addpath=PATH search Emacs-Lisp libraries with PATH
406 use colons to separate directory names],
407 [if test "$withval" != yes -a -n "$withval"; then
408 AC_MSG_CHECKING([where to find the additional elisp libraries])
409 ADDITIONAL_LOAD_PATH=$withval
410 AC_MSG_RESULT($ADDITIONAL_LOAD_PATH)
412 ADDITIONAL_LOAD_PATH=)
413 AC_SUBST(ADDITIONAL_LOAD_PATH)])