* message.el (message-setup-1): Don't call
[elisp/gnus.git-] / aclocal.m4
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)])
7
8 AC_DEFUN(AC_CHECK_EMACS,
9  [dnl Check for Emacsen.
10
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=
14
15   dnl Ignore cache.
16   unset ac_cv_prog_EMACS; unset ac_cv_prog_XEMACS;
17
18   AC_ARG_WITH(emacs,
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)
22     else
23       AC_CHECK_PROG(EMACS, $withval, $withval, emacs)
24     fi])
25   AC_ARG_WITH(xemacs,
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)
29     else
30       AC_CHECK_PROG(XEMACS, $withval, $withval, xemacs)
31     fi
32     EMACS=$XEMACS],
33    [XEMACS=xemacs
34     test -z "$EMACS" && AC_CHECK_PROGS(EMACS, emacs xemacs mule, emacs)])
35   AC_SUBST(EMACS)
36   AC_SUBST(XEMACS)])
37
38 AC_DEFUN(AC_EMACS_LISP, [
39 elisp="$2"
40 if test -z "$3"; then
41         AC_MSG_CHECKING(for $1)
42 fi
43 AC_CACHE_VAL(EMACS_cv_SYS_$1,[
44         OUTPUT=./conftest-$$
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
49         rm -f ${OUTPUT}
50         EMACS_cv_SYS_$1=$retval
51 ])
52 $1=${EMACS_cv_SYS_$1}
53 if test -z "$3"; then
54         AC_MSG_RESULT($$1)
55 fi
56 ])
57
58 AC_DEFUN(AC_CHECK_EMACS_FLAVOR,
59  [AC_MSG_CHECKING([what a flavor does $EMACS have])
60
61   dnl Ignore cache.
62   unset EMACS_cv_SYS_flavor;
63
64   AC_EMACS_LISP(flavor,
65     (cond ((featurep (quote xemacs)) \"XEmacs\")\
66           ((boundp (quote MULE)) \"MULE\")\
67           (t \"FSF Emacs\")),
68     "noecho")
69   case $EMACS_cv_SYS_flavor in
70   XEmacs)
71     EMACS_FLAVOR=xemacs;;
72   MULE)
73     EMACS_FLAVOR=mule;;
74   *)
75     EMACS_FLAVOR=emacs;;
76   esac
77   AC_MSG_RESULT($EMACS_cv_SYS_flavor)])
78
79 AC_DEFUN(AC_PATH_LISPDIR, [
80   AC_CHECK_EMACS_FLAVOR
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)
86   fi
87   AC_ARG_WITH(lispdir,
88     [  --with-lispdir=DIR      Where to install lisp files
89                           (for XEmacs package, use --with-packagedir instead)],
90     lispdir=${withval})
91   AC_MSG_CHECKING([where lisp files should go])
92   if test -z "$lispdir"; then
93     dnl Set default value
94     theprefix=$prefix
95     if test "$theprefix" = NONE; then
96         theprefix=$ac_default_prefix
97     fi
98     if test "$EMACS_FLAVOR" = "xemacs"; then
99         lispdir="\$(datadir)/${EMACS_FLAVOR}/site-packages/lisp/${GNUS_PRODUCT_NAME}"
100     else
101         lispdir="\$(datadir)/${EMACS_FLAVOR}/site-lisp/${GNUS_PRODUCT_NAME}"
102     fi
103     for thedir in share lib; do
104         potential=
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}"
108            else
109                lispdir="\$(prefix)/${thedir}/${EMACS_FLAVOR}/site-lisp/${GNUS_PRODUCT_NAME}"
110            fi
111            break
112         fi
113     done
114   fi
115   if test ${EMACS_FLAVOR} = xemacs; then
116     AC_MSG_RESULT([$lispdir
117          (it will be ignored when \"make install-package[[-ja]]\" is done)])
118   else
119     AC_MSG_RESULT([$lispdir])
120   fi
121   AC_SUBST(lispdir)
122 ])
123
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"
131     else
132     etcdir="\$(lispdir)/../etc"
133     fi
134   fi
135   AC_MSG_RESULT($etcdir)
136   AC_SUBST(etcdir)
137 ])
138
139 dnl 
140 dnl This is a bit on the "evil hack" side of things.  It is so we can
141 dnl have a different default infodir for XEmacs.  A user can still specify
142 dnl someplace else with '--infodir=DIR'.
143 dnl
144 AC_DEFUN(AC_PATH_INFO_DIR, [
145   AC_MSG_CHECKING([where the TeXinfo docs should go])
146   dnl Set default value.  This must be an absolute path.
147   if test "$infodir" = "\${prefix}/info"; then
148     if test "$EMACS_FLAVOR" = "xemacs"; then
149       info_dir="\$(prefix)/${thedir}/${EMACS_FLAVOR}/site-packages/info"
150     else
151       info_dir="\$(prefix)/info"
152     fi
153   else
154     info_dir=$infodir
155   fi
156   AC_MSG_RESULT($info_dir)
157   AC_SUBST(info_dir)
158 ])
159
160 dnl
161 dnl Check whether a function exists in a library
162 dnl All '_' characters in the first argument are converted to '-'
163 dnl
164 AC_DEFUN(AC_EMACS_CHECK_LIB, [
165 if test -z "$3"; then
166         AC_MSG_CHECKING(for $2 in $1)
167 fi
168 library=`echo $1 | tr _ -`
169 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")
170 if test "${EMACS_cv_SYS_$1}" = nil; then
171         EMACS_cv_SYS_$1=no
172 fi
173 if test "${EMACS_cv_SYS_$1}" = t; then
174         EMACS_cv_SYS_$1=yes
175 fi
176 HAVE_$1=${EMACS_cv_SYS_$1}
177 AC_SUBST(HAVE_$1)
178 if test -z "$3"; then
179         AC_MSG_RESULT($HAVE_$1)
180 fi
181 ])
182
183 dnl
184 dnl Perform sanity checking and try to locate the W3 package
185 dnl
186 AC_DEFUN(AC_CHECK_W3, [
187 AC_MSG_CHECKING(for acceptable W3 version)
188
189 dnl Ignore cache.
190 unset EMACS_cv_ACCEPTABLE_W3;
191 unset EMACS_cv_SYS_w3_dir;
192 unset EMACS_cv_SYS_w3_forms;
193
194 AC_CACHE_VAL(EMACS_cv_ACCEPTABLE_W3,[
195 AC_EMACS_CHECK_LIB(w3_forms, w3-form-encode-xwfu,"noecho")
196 if test "${HAVE_w3_forms}" = yes; then
197         EMACS_cv_ACCEPTABLE_W3=yes
198 else
199         EMACS_cv_ACCEPTABLE_W3=
200 fi
201
202 if test "${EMACS_cv_ACCEPTABLE_W3}" = yes; then
203         AC_EMACS_LISP(w3_dir,(file-name-directory (locate-library \"w3-forms\")),"noecho")
204         EMACS_cv_ACCEPTABLE_W3=$EMACS_cv_SYS_w3_dir
205 fi
206 ])
207    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` ])
208    W3=${EMACS_cv_ACCEPTABLE_W3}
209    AC_SUBST(W3)
210    if test -z "${EMACS_cv_ACCEPTABLE_W3}"; then
211         AC_MSG_RESULT(not found)
212    else
213         AC_MSG_RESULT(${W3})
214    fi
215 ])
216
217 dnl
218 dnl Perform sanity checking and try to locate the W3 package
219 dnl
220 AC_DEFUN(AC_CHECK_URL, [
221 AC_MSG_CHECKING(for acceptable URL version)
222
223 dnl Ignore cache.
224 unset EMACS_cv_ACCEPTABLE_URL;
225 unset EMACS_cv_SYS_url_dir;
226 unset EMACS_cv_SYS_url;
227
228 AC_CACHE_VAL(EMACS_cv_ACCEPTABLE_URL,[
229 AC_EMACS_CHECK_LIB(url, url-retrieve, "noecho")
230 if test "${HAVE_url}" = yes; then
231         EMACS_cv_ACCEPTABLE_URL=yes
232 else
233         EMACS_cv_ACCEPTABLE_URL=
234 fi
235
236 if test "${EMACS_cv_ACCEPTABLE_URL}" = yes; then
237         AC_EMACS_LISP(url_dir,(file-name-directory (locate-library \"url\")),"noecho")
238         EMACS_cv_ACCEPTABLE_URL=$EMACS_cv_SYS_url_dir
239 fi
240 ])
241    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` ])
242    URL=${EMACS_cv_ACCEPTABLE_URL}
243    AC_SUBST(URL)
244    if test -z "${EMACS_cv_ACCEPTABLE_URL}"; then
245         AC_MSG_RESULT(not found)
246    else
247         AC_MSG_RESULT("${URL}")
248    fi
249 ])
250
251 dnl
252 dnl Perform checking available fonts: Adobe Bembo, Adobe Futura and 
253 dnl Bitstream Courier.
254 dnl
255
256 AC_DEFUN(GNUS_CHECK_FONTS, [
257 test "$LATEX" = t && LATEX=
258 test "$LATEX" || AC_PATH_PROGS(LATEX, latex, no)
259 AC_MSG_CHECKING(for available fonts)
260 AC_ARG_WITH(fonts,[  --with-fonts            Assume all fonts required are available],[USE_FONTS="$withval"])
261 WITH_FONTS_bembo='%'
262 WITHOUT_FONTS_bembo=
263 WITH_FONTS_pfu='%'
264 WITHOUT_FONTS_pfu=
265 WITH_FONTS_bcr='%'
266 WITHOUT_FONTS_bcr=
267 if test -z "${USE_FONTS}"; then
268   if test "${LATEX}" = no; then
269         :
270   else
271     OUTPUT=./conftest-$$
272     echo '\nonstopmode\documentclass{article}\usepackage{bembo}\begin{document}\end{document}' > ${OUTPUT}
273     if ${LATEX} ${OUTPUT} </dev/null >& AC_FD_CC 2>&1  ; then  
274       if test -z "${USE_FONTS}"; then
275         USE_FONTS="Adobe Bembo"
276       else
277         USE_FONTS="${USE_FONTS}, Adobe Bembo"
278       fi
279       WITH_FONTS_bembo=
280       WITHOUT_FONTS_bembo='%'
281     fi
282     echo '\nonstopmode\documentclass{article}\begin{document}{\fontfamily{pfu}\fontsize{10pt}{10}\selectfont test}\end{document}' > ${OUTPUT}
283     if retval=`${LATEX} ${OUTPUT} </dev/null 2>& AC_FD_CC`; then
284       if echo "$retval" | grep 'Some font shapes were not available' >& AC_FD_CC 2>&1  ; then  
285         :
286       else
287          if test -z "${USE_FONTS}"; then
288           USE_FONTS="Adobe Futura"
289          else
290           USE_FONTS="${USE_FONTS}, Adobe Futura"
291          fi
292          WITH_FONTS_pfu=
293          WITHOUT_FONTS_pfu='%'
294       fi
295     fi
296     echo '\nonstopmode\documentclass{article}\begin{document}{\fontfamily{bcr}\fontsize{10pt}{10}\selectfont test}\end{document}' > ${OUTPUT}
297     if retval=`${LATEX} ${OUTPUT} </dev/null 2>& AC_FD_CC`; then
298       if echo "$retval" | grep 'Some font shapes were not available' >& AC_FD_CC 2>&1  ; then  
299         :
300       else
301          if test -z "${USE_FONTS}"; then
302           USE_FONTS="Bitstream Courier"
303          else
304           USE_FONTS="${USE_FONTS}, Bitstream Courier"
305          fi
306          WITH_FONTS_bcr=
307          WITHOUT_FONTS_bcr='%'
308       fi
309     fi
310     rm -f ${OUTPUT} ${OUTPUT}.aux ${OUTPUT}.log ${OUTPUT}.dvi
311   fi
312 elif test "${USE_FONTS}" = yes ; then
313   WITH_FONTS_bembo=
314   WITHOUT_FONTS_bembo='%'
315   WITH_FONTS_pfu=
316   WITHOUT_FONTS_pfu='%'
317   WITH_FONTS_bcr=
318   WITHOUT_FONTS_bcr='%'
319 fi
320 AC_SUBST(WITH_FONTS_bembo)
321 AC_SUBST(WITHOUT_FONTS_bembo)
322 AC_SUBST(WITH_FONTS_pfu)
323 AC_SUBST(WITHOUT_FONTS_pfu)
324 AC_SUBST(WITH_FONTS_bcr)
325 AC_SUBST(WITHOUT_FONTS_bcr)
326 if test -z "${USE_FONTS}" ; then
327   USE_FONTS=no
328 fi
329 USE_FONTS=`echo "${USE_FONTS}" | sed 's/,\([[^,]]*\)$/ and\1/'`
330 AC_MSG_RESULT("${USE_FONTS}")
331 if test "${USE_FONTS}" = yes ; then
332   USE_FONTS='Set in Adobe Bembo, Adobe Futura and Bitstream Courier.'
333 elif test "${USE_FONTS}" = no ; then
334   USE_FONTS=''
335 else
336   USE_FONTS="Set in ${USE_FONTS}."
337 fi
338 AC_SUBST(USE_FONTS)
339 ])
340
341 AC_DEFUN(AC_EXAMINE_PACKAGEDIR,
342  [dnl Examine PACKAGEDIR.
343   AC_EMACS_LISP(PACKAGEDIR,
344     (let (package-dir)\
345       (if (boundp (quote early-packages))\
346           (let ((dirs (delq nil (append (if early-package-load-path\
347                                             early-packages)\
348                                         (if late-package-load-path\
349                                             late-packages)\
350                                         (if last-package-load-path\
351                                             last-packages)))))\
352             (while (and dirs (not package-dir))\
353               (if (file-directory-p (car dirs))\
354                   (setq package-dir (car dirs)\
355                         dirs (cdr dirs))))))\
356       (or package-dir \"\")),
357     "noecho")])
358
359 AC_DEFUN(AC_PATH_PACKAGEDIR,
360  [dnl Check for PACKAGEDIR.
361   if test ${EMACS_FLAVOR} = xemacs; then
362     AC_MSG_CHECKING([where the XEmacs package is])
363     AC_ARG_WITH(packagedir,
364       [  --with-packagedir=DIR   package DIR for XEmacs],
365       [if test "$withval" != yes -a -n "$withval"; then
366         PACKAGEDIR=$withval
367       else
368         AC_EXAMINE_PACKAGEDIR
369       fi],
370       AC_EXAMINE_PACKAGEDIR)
371     if test -z "$PACKAGEDIR"; then
372       AC_MSG_RESULT(not found)
373     else
374       AC_MSG_RESULT($PACKAGEDIR)
375     fi
376   else
377     PACKAGEDIR=
378   fi
379   AC_SUBST(PACKAGEDIR)])
380
381 AC_DEFUN(AC_ADD_LOAD_PATH,
382  [dnl Check for additional load path.
383   AC_ARG_WITH(addpath,
384    [  --with-addpath=PATH     search Emacs-Lisp libraries with PATH
385                           use colons to separate directory names],
386    [if test "$withval" != yes -a -n "$withval"; then
387       AC_MSG_CHECKING([where to find the additional elisp libraries])
388       ADDITIONAL_LOAD_PATH=$withval
389       AC_MSG_RESULT($ADDITIONAL_LOAD_PATH)
390     fi],
391     ADDITIONAL_LOAD_PATH=)
392   AC_SUBST(ADDITIONAL_LOAD_PATH)])