1 AC_DEFUN(AC_DEFINE_GNUS_PRODUCT_NAME,
2 [echo $ECHO_N "defining gnus product name... $ECHO_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 (if (featurep (quote xemacs))\
69 if test $EMACS_cv_SYS_flavor = XEmacs; then
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 if test "$EMACS_FLAVOR" = "xemacs"; then
96 datadir="\$(prefix)/lib"
97 lispdir="\$(datadir)/${EMACS_FLAVOR}/site-packages/lisp/${GNUS_PRODUCT_NAME}"
99 lispdir="\$(datadir)/${EMACS_FLAVOR}/site-lisp/${GNUS_PRODUCT_NAME}"
101 for thedir in share lib; do
103 if test -d ${theprefix}/${thedir}/${EMACS_FLAVOR}/site-lisp; then
104 if test "$EMACS_FLAVOR" = "xemacs"; then
105 lispdir="\$(prefix)/${thedir}/${EMACS_FLAVOR}/site-packages/lisp/${GNUS_PRODUCT_NAME}"
107 lispdir="\$(prefix)/${thedir}/${EMACS_FLAVOR}/site-lisp/${GNUS_PRODUCT_NAME}"
113 if test ${EMACS_FLAVOR} = xemacs; then
114 AC_MSG_RESULT([$lispdir
115 (it will be ignored when \"make install-package[[-ja]]\" is done)])
117 AC_MSG_RESULT([$lispdir])
122 AC_DEFUN(AC_PATH_ETCDIR, [
123 AC_ARG_WITH(etcdir,[ --with-etcdir=DIR Where to install etc files], etcdir=${withval})
124 AC_MSG_CHECKING([where etc files should go])
125 if test -z "$etcdir"; then
126 dnl Set default value.
127 if test "$EMACS_FLAVOR" = "xemacs"; then
128 etcdir="\$(lispdir)/../../etc"
130 etcdir="\$(lispdir)/../etc"
133 AC_MSG_RESULT($etcdir)
138 dnl This is a bit on the "evil hack" side of things. It is so we can
139 dnl have a different default infodir for XEmacs. A user can still specify
140 dnl someplace else with '--infodir=DIR'.
142 AC_DEFUN(AC_PATH_INFO_DIR, [
143 AC_MSG_CHECKING([where the TeXinfo docs should go])
144 dnl Set default value. This must be an absolute path.
145 if test "$infodir" = "\${prefix}/info"; then
146 if test "$EMACS_FLAVOR" = "xemacs"; then
147 info_dir="\$(prefix)/${thedir}/${EMACS_FLAVOR}/site-packages/info"
149 info_dir="\$(prefix)/info"
154 AC_MSG_RESULT([$info_dir
155 (it will be ignored when \"make install-package[[-ja]]\" is done)])
160 dnl This will set the XEmacs command line options to be slightly different
161 dnl from the Emacs ones. If building with XEmacs the options will be
162 dnl "-batch -no-autoloads..." to give a much cleaner build environment.
164 AC_DEFUN(AC_SET_BUILD_FLAGS, [
165 AC_MSG_CHECKING([which options to pass on to (X)Emacs])
166 if test "x$FLAGS" = "x"; then
167 if test "$EMACS_FLAVOR" = "xemacs"; then
168 FLAGS="-batch -no-autoloads -l \$(srcdir)/dgnushack.el"
170 FLAGS="-batch -q -no-site-file -l \$(srcdir)/dgnushack.el"
175 AC_MSG_RESULT($FLAGS)
180 dnl Check whether a function exists in a library
181 dnl All '_' characters in the first argument are converted to '-'
183 AC_DEFUN(AC_EMACS_CHECK_LIB, [
184 if test -z "$3"; then
185 AC_MSG_CHECKING(for $2 in $1)
187 library=`echo $1 | tr _ -`
188 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")
189 if test "${EMACS_cv_SYS_$1}" = nil; then
192 if test "${EMACS_cv_SYS_$1}" = t; then
195 HAVE_$1=${EMACS_cv_SYS_$1}
197 if test -z "$3"; then
198 AC_MSG_RESULT($HAVE_$1)
203 dnl Perform sanity checking and try to locate the W3 package
205 AC_DEFUN(AC_CHECK_W3, [
206 AC_MSG_CHECKING(for acceptable W3 version)
209 unset EMACS_cv_ACCEPTABLE_W3;
210 unset EMACS_cv_SYS_w3_dir;
211 unset EMACS_cv_SYS_w3_forms;
213 AC_CACHE_VAL(EMACS_cv_ACCEPTABLE_W3,[
214 AC_EMACS_CHECK_LIB(w3_forms, w3-form-encode-xwfu,"noecho")
215 if test "${HAVE_w3_forms}" = yes; then
216 EMACS_cv_ACCEPTABLE_W3=yes
218 EMACS_cv_ACCEPTABLE_W3=
221 if test "${EMACS_cv_ACCEPTABLE_W3}" = yes; then
222 AC_EMACS_LISP(w3_dir,(file-name-directory (locate-library \"w3-forms\")),"noecho")
223 EMACS_cv_ACCEPTABLE_W3=$EMACS_cv_SYS_w3_dir
226 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` ])
227 W3=${EMACS_cv_ACCEPTABLE_W3}
229 if test -z "${EMACS_cv_ACCEPTABLE_W3}"; then
230 AC_MSG_RESULT(not found)
237 dnl Perform sanity checking and try to locate the W3 package
239 AC_DEFUN(AC_CHECK_URL, [
240 AC_MSG_CHECKING(for acceptable URL version)
243 unset EMACS_cv_ACCEPTABLE_URL;
244 unset EMACS_cv_SYS_url_dir;
245 unset EMACS_cv_SYS_url;
247 AC_CACHE_VAL(EMACS_cv_ACCEPTABLE_URL,[
248 AC_EMACS_CHECK_LIB(url, url-retrieve, "noecho")
249 if test "${HAVE_url}" = yes; then
250 EMACS_cv_ACCEPTABLE_URL=yes
252 EMACS_cv_ACCEPTABLE_URL=
255 if test "${EMACS_cv_ACCEPTABLE_URL}" = yes; then
256 AC_EMACS_LISP(url_dir,(file-name-directory (locate-library \"url\")),"noecho")
257 EMACS_cv_ACCEPTABLE_URL=$EMACS_cv_SYS_url_dir
260 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` ])
261 URL=${EMACS_cv_ACCEPTABLE_URL}
263 if test -z "${EMACS_cv_ACCEPTABLE_URL}"; then
264 AC_MSG_RESULT(not found)
266 AC_MSG_RESULT(${URL})
271 dnl Perform checking available fonts: Adobe Bembo, Adobe Futura and
272 dnl Bitstream Courier.
275 AC_DEFUN(GNUS_CHECK_FONTS, [
276 test "$LATEX" = t && LATEX=
277 test "$LATEX" || AC_PATH_PROGS(LATEX, latex, no)
278 AC_MSG_CHECKING(for available fonts)
279 AC_ARG_WITH(fonts,[ --with-fonts Assume all fonts required are available],[USE_FONTS="$withval"])
286 if test -z "${USE_FONTS}"; then
287 if test "${LATEX}" = no; then
291 echo '\nonstopmode\documentclass{article}\usepackage{bembo}\begin{document}\end{document}' > ${OUTPUT}
292 if ${LATEX} ${OUTPUT} </dev/null >& AC_FD_CC 2>&1 ; then
293 if test -z "${USE_FONTS}"; then
294 USE_FONTS="Adobe Bembo"
296 USE_FONTS="${USE_FONTS}, Adobe Bembo"
299 WITHOUT_FONTS_bembo='%'
301 echo '\nonstopmode\documentclass{article}\begin{document}{\fontfamily{pfu}\fontsize{10pt}{10}\selectfont test}\end{document}' > ${OUTPUT}
302 if retval=`${LATEX} ${OUTPUT} </dev/null 2>& AC_FD_CC`; then
303 if echo "$retval" | grep 'Some font shapes were not available' >& AC_FD_CC 2>&1 ; then
306 if test -z "${USE_FONTS}"; then
307 USE_FONTS="Adobe Futura"
309 USE_FONTS="${USE_FONTS}, Adobe Futura"
312 WITHOUT_FONTS_pfu='%'
315 echo '\nonstopmode\documentclass{article}\begin{document}{\fontfamily{bcr}\fontsize{10pt}{10}\selectfont test}\end{document}' > ${OUTPUT}
316 if retval=`${LATEX} ${OUTPUT} </dev/null 2>& AC_FD_CC`; then
317 if echo "$retval" | grep 'Some font shapes were not available' >& AC_FD_CC 2>&1 ; then
320 if test -z "${USE_FONTS}"; then
321 USE_FONTS="Bitstream Courier"
323 USE_FONTS="${USE_FONTS}, Bitstream Courier"
326 WITHOUT_FONTS_bcr='%'
329 rm -f ${OUTPUT} ${OUTPUT}.aux ${OUTPUT}.log ${OUTPUT}.dvi
331 elif test "${USE_FONTS}" = yes ; then
333 WITHOUT_FONTS_bembo='%'
335 WITHOUT_FONTS_pfu='%'
337 WITHOUT_FONTS_bcr='%'
339 AC_SUBST(WITH_FONTS_bembo)
340 AC_SUBST(WITHOUT_FONTS_bembo)
341 AC_SUBST(WITH_FONTS_pfu)
342 AC_SUBST(WITHOUT_FONTS_pfu)
343 AC_SUBST(WITH_FONTS_bcr)
344 AC_SUBST(WITHOUT_FONTS_bcr)
345 if test -z "${USE_FONTS}" ; then
348 USE_FONTS=`echo "${USE_FONTS}" | sed 's/,\([[^,]]*\)$/ and\1/'`
349 AC_MSG_RESULT(${USE_FONTS})
350 if test "${USE_FONTS}" = yes ; then
351 USE_FONTS='Set in Adobe Bembo, Adobe Futura and Bitstream Courier.'
352 elif test "${USE_FONTS}" = no ; then
355 USE_FONTS="Set in ${USE_FONTS}."
360 AC_DEFUN(AC_EXAMINE_PACKAGEDIR,
361 [dnl Examine PACKAGEDIR.
362 AC_EMACS_LISP(PACKAGEDIR,
364 (if (and (boundp (quote configure-package-path))\
365 (listp configure-package-path))\
366 (delete \"\" configure-package-path))\
367 (if (boundp (quote early-packages))\
369 (if early-package-load-path early-packages)\
370 (if late-package-load-path late-packages)\
371 (if last-package-load-path last-packages)))))\
373 (while (and dirs (not package-dir))\
374 (if (file-directory-p (car dirs))\
375 (setq package-dir (car 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)])