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 lispdir="\$(datadir)/${EMACS_FLAVOR}/site-packages/lisp/${GNUS_PRODUCT_NAME}"
101 lispdir="\$(datadir)/${EMACS_FLAVOR}/site-lisp/${GNUS_PRODUCT_NAME}"
103 for thedir in share lib; do
105 if test -d ${theprefix}/${thedir}/${EMACS_FLAVOR}/site-lisp; then
106 if test "$EMACS_FLAVOR" = "xemacs"; then
107 lispdir="\$(prefix)/${thedir}/${EMACS_FLAVOR}/site-packages/lisp/${GNUS_PRODUCT_NAME}"
109 lispdir="\$(prefix)/${thedir}/${EMACS_FLAVOR}/site-lisp/${GNUS_PRODUCT_NAME}"
115 if test ${EMACS_FLAVOR} = xemacs; then
116 AC_MSG_RESULT([$lispdir
117 (it will be ignored when \"make install-package[[-ja]]\" is done)])
119 AC_MSG_RESULT([$lispdir])
124 AC_DEFUN(AC_PATH_ETCDIR, [
125 AC_ARG_WITH(etcdir,[ --with-etcdir=DIR Where to install etc files], etcdir=${withval})
126 AC_MSG_CHECKING([where etc files should go])
127 if test -z "$etcdir"; then
128 dnl Set default value
129 if test "$EMACS_FLAVOR" = "xemacs"; then
130 etcdir="\$(lispdir)/../etc/gnus"
132 etcdir="\$(lispdir)/../etc"
135 AC_MSG_RESULT($etcdir)
140 dnl Check whether a function exists in a library
141 dnl All '_' characters in the first argument are converted to '-'
143 AC_DEFUN(AC_EMACS_CHECK_LIB, [
144 if test -z "$3"; then
145 AC_MSG_CHECKING(for $2 in $1)
147 library=`echo $1 | tr _ -`
148 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")
149 if test "${EMACS_cv_SYS_$1}" = nil; then
152 if test "${EMACS_cv_SYS_$1}" = t; then
155 HAVE_$1=${EMACS_cv_SYS_$1}
157 if test -z "$3"; then
158 AC_MSG_RESULT($HAVE_$1)
163 dnl Perform sanity checking and try to locate the W3 package
165 AC_DEFUN(AC_CHECK_W3, [
166 AC_MSG_CHECKING(for acceptable W3 version)
169 unset EMACS_cv_ACCEPTABLE_W3;
170 unset EMACS_cv_SYS_w3_dir;
171 unset EMACS_cv_SYS_w3_forms;
173 AC_CACHE_VAL(EMACS_cv_ACCEPTABLE_W3,[
174 AC_EMACS_CHECK_LIB(w3_forms, w3-form-encode-xwfu,"noecho")
175 if test "${HAVE_w3_forms}" = yes; then
176 EMACS_cv_ACCEPTABLE_W3=yes
178 EMACS_cv_ACCEPTABLE_W3=
181 if test "${EMACS_cv_ACCEPTABLE_W3}" = yes; then
182 AC_EMACS_LISP(w3_dir,(file-name-directory (locate-library \"w3-forms\")),"noecho")
183 EMACS_cv_ACCEPTABLE_W3=$EMACS_cv_SYS_w3_dir
186 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` ])
187 W3=${EMACS_cv_ACCEPTABLE_W3}
189 if test -z "${EMACS_cv_ACCEPTABLE_W3}"; then
190 AC_MSG_RESULT(not found)
197 dnl Perform sanity checking and try to locate the W3 package
199 AC_DEFUN(AC_CHECK_URL, [
200 AC_MSG_CHECKING(for acceptable URL version)
203 unset EMACS_cv_ACCEPTABLE_URL;
204 unset EMACS_cv_SYS_url_dir;
205 unset EMACS_cv_SYS_url;
207 AC_CACHE_VAL(EMACS_cv_ACCEPTABLE_URL,[
208 AC_EMACS_CHECK_LIB(url, url-retrieve, "noecho")
209 if test "${HAVE_url}" = yes; then
210 EMACS_cv_ACCEPTABLE_URL=yes
212 EMACS_cv_ACCEPTABLE_URL=
215 if test "${EMACS_cv_ACCEPTABLE_URL}" = yes; then
216 AC_EMACS_LISP(url_dir,(file-name-directory (locate-library \"url\")),"noecho")
217 EMACS_cv_ACCEPTABLE_URL=$EMACS_cv_SYS_url_dir
220 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` ])
221 URL=${EMACS_cv_ACCEPTABLE_URL}
223 if test -z "${EMACS_cv_ACCEPTABLE_URL}"; then
224 AC_MSG_RESULT(not found)
226 AC_MSG_RESULT("${URL}")
231 dnl Perform checking available fonts: Adobe Bembo, Adobe Futura and
232 dnl Bitstream Courier.
235 AC_DEFUN(GNUS_CHECK_FONTS, [
236 test "$LATEX" = t && LATEX=
237 test "$LATEX" || AC_PATH_PROGS(LATEX, latex, no)
238 AC_MSG_CHECKING(for available fonts)
239 AC_ARG_WITH(fonts,[ --with-fonts Assume all fonts required are available],[USE_FONTS="$withval"])
246 if test -z "${USE_FONTS}"; then
247 if test "${LATEX}" = no; then
251 echo '\nonstopmode\documentclass{article}\usepackage{bembo}\begin{document}\end{document}' > ${OUTPUT}
252 if ${LATEX} ${OUTPUT} </dev/null >& AC_FD_CC 2>&1 ; then
253 if test -z "${USE_FONTS}"; then
254 USE_FONTS="Adobe Bembo"
256 USE_FONTS="${USE_FONTS}, Adobe Bembo"
259 WITHOUT_FONTS_bembo='%'
261 echo '\nonstopmode\documentclass{article}\begin{document}{\fontfamily{pfu}\fontsize{10pt}{10}\selectfont test}\end{document}' > ${OUTPUT}
262 if retval=`${LATEX} ${OUTPUT} </dev/null 2>& AC_FD_CC`; then
263 if echo "$retval" | grep 'Some font shapes were not available' >& AC_FD_CC 2>&1 ; then
266 if test -z "${USE_FONTS}"; then
267 USE_FONTS="Adobe Futura"
269 USE_FONTS="${USE_FONTS}, Adobe Futura"
272 WITHOUT_FONTS_pfu='%'
275 echo '\nonstopmode\documentclass{article}\begin{document}{\fontfamily{bcr}\fontsize{10pt}{10}\selectfont test}\end{document}' > ${OUTPUT}
276 if retval=`${LATEX} ${OUTPUT} </dev/null 2>& AC_FD_CC`; then
277 if echo "$retval" | grep 'Some font shapes were not available' >& AC_FD_CC 2>&1 ; then
280 if test -z "${USE_FONTS}"; then
281 USE_FONTS="Bitstream Courier"
283 USE_FONTS="${USE_FONTS}, Bitstream Courier"
286 WITHOUT_FONTS_bcr='%'
289 rm -f ${OUTPUT} ${OUTPUT}.aux ${OUTPUT}.log ${OUTPUT}.dvi
291 elif test "${USE_FONTS}" = yes ; then
293 WITHOUT_FONTS_bembo='%'
295 WITHOUT_FONTS_pfu='%'
297 WITHOUT_FONTS_bcr='%'
299 AC_SUBST(WITH_FONTS_bembo)
300 AC_SUBST(WITHOUT_FONTS_bembo)
301 AC_SUBST(WITH_FONTS_pfu)
302 AC_SUBST(WITHOUT_FONTS_pfu)
303 AC_SUBST(WITH_FONTS_bcr)
304 AC_SUBST(WITHOUT_FONTS_bcr)
305 if test -z "${USE_FONTS}" ; then
308 USE_FONTS=`echo "${USE_FONTS}" | sed 's/,\([[^,]]*\)$/ and\1/'`
309 AC_MSG_RESULT("${USE_FONTS}")
310 if test "${USE_FONTS}" = yes ; then
311 USE_FONTS='Set in Adobe Bembo, Adobe Futura and Bitstream Courier.'
312 elif test "${USE_FONTS}" = no ; then
315 USE_FONTS="Set in ${USE_FONTS}."
320 AC_DEFUN(AC_EXAMINE_PACKAGEDIR,
321 [dnl Examine PACKAGEDIR.
322 AC_EMACS_LISP(PACKAGEDIR,
324 (if (boundp (quote early-packages))\
325 (let ((dirs (delq nil (append (if early-package-load-path\
327 (if late-package-load-path\
329 (if last-package-load-path\
331 (while (and dirs (not package-dir))\
332 (if (file-directory-p (car dirs))\
333 (setq package-dir (car dirs)\
334 dirs (cdr dirs))))))\
335 (or package-dir \"\")),
338 AC_DEFUN(AC_PATH_PACKAGEDIR,
339 [dnl Check for PACKAGEDIR.
340 if test ${EMACS_FLAVOR} = xemacs; then
341 AC_MSG_CHECKING([where the XEmacs package is])
342 AC_ARG_WITH(packagedir,
343 [ --with-packagedir=DIR package DIR for XEmacs],
344 [if test "$withval" != yes -a -n "$withval"; then
347 AC_EXAMINE_PACKAGEDIR
349 AC_EXAMINE_PACKAGEDIR)
350 if test -z "$PACKAGEDIR"; then
351 AC_MSG_RESULT(not found)
353 AC_MSG_RESULT($PACKAGEDIR)
358 AC_SUBST(PACKAGEDIR)])
360 AC_DEFUN(AC_ADD_LOAD_PATH,
361 [dnl Check for additional load path.
363 [ --with-addpath=PATH search Emacs-Lisp libraries with PATH
364 use colons to separate directory names],
365 [if test "$withval" != yes -a -n "$withval"; then
366 AC_MSG_CHECKING([where to find the additional elisp libraries])
367 ADDITIONAL_LOAD_PATH=$withval
368 AC_MSG_RESULT($ADDITIONAL_LOAD_PATH)
370 ADDITIONAL_LOAD_PATH=)
371 AC_SUBST(ADDITIONAL_LOAD_PATH)])