Sync.
[elisp/gnus.git-] / aclocal.m4
1 dnl aclocal.m4 generated automatically by aclocal 1.4
2
3 dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
4 dnl This file is free software; the Free Software Foundation
5 dnl gives unlimited permission to copy and/or distribute it,
6 dnl with or without modifications, as long as this notice is preserved.
7
8 dnl This program is distributed in the hope that it will be useful,
9 dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
10 dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 dnl PARTICULAR PURPOSE.
12
13 dnl Copyright (C) 1999 NISHIDA Keisuke <knishida@ring.aist.go.jp>
14 dnl
15 dnl This program is free software; you can redistribute it and/or modify
16 dnl it under the terms of the GNU General Public License as published by
17 dnl the Free Software Foundation; either version 2, or (at your option)
18 dnl any later version.
19 dnl
20 dnl This program is distributed in the hope that it will be useful,
21 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
22 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23 dnl GNU General Public License for more details.
24 dnl
25 dnl You should have received a copy of the GNU General Public License
26 dnl along with this program; if not, write to the Free Software
27 dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
28 dnl 02111-1307, USA.
29
30 AC_DEFUN(AM_PATH_LISPDIR,
31  [dnl #
32   dnl # Check Emacs
33   dnl #
34   AC_ARG_WITH(emacs,
35     [  --with-emacs=EMACS      compile with EMACS [EMACS=emacs, xemacs...]],
36     [case "${withval}" in
37        yes)     EMACS= ;;
38        no)      AC_MSG_ERROR([emacs is not available]) ;;
39        *)       EMACS=${withval} ;;
40      esac], EMACS=)
41   if test "x$EMACS" = "xt" -o "x$EMACS" = x; then
42     AC_PATH_PROGS(EMACS, emacs xemacs mule, no)
43     if test $EMACS = no; then
44       AC_MSG_ERROR(you should install Emacs first)
45     fi
46   fi
47   dnl #
48   dnl # Check Emacs directories
49   dnl #
50   AC_MSG_CHECKING([where emacs files are in])
51   EMACS_BASENAME="`echo x$EMACS | sed -e 's/x//' -e 's/^.*\///'`"
52   if test "x$emacsdir" = x; then
53     if test "x$prefix" = "xNONE"; then
54       prefix=$ac_default_prefix
55     fi
56     emacsdir="\$(datadir)/emacs"
57     case "$EMACS_BASENAME" in
58     emacs|emacs-*)
59       if test -d $prefix/lib/emacs; then
60         emacsdir="$prefix/lib/emacs"
61       fi
62       if test -d $prefix/share/emacs; then
63         emacsdir="$prefix/share/emacs"
64       fi
65       ;;
66     xemacs|xemacs-*)
67       if test -d $prefix/lib/xemacs; then
68         emacsdir="$prefix/lib/xemacs"
69       fi
70       if test -d $prefix/share/xemacs; then
71         emacsdir="$prefix/share/xemacs"
72       fi
73       ;;
74     mule|mule-*)
75       if test -d $prefix/lib/emacs; then
76         emacsdir="$prefix/lib/emacs"
77       fi
78       if test -d $prefix/share/emacs; then
79         emacsdir="$prefix/share/emacs"
80       fi
81       if test -d $prefix/lib/mule; then
82         emacsdir="$prefix/lib/mule"
83       fi
84       if test -d $prefix/share/mule; then
85         emacsdir="$prefix/share/mule"
86       fi
87       ;;
88     esac
89   fi
90   AC_MSG_RESULT($emacsdir)
91   AC_SUBST(emacsdir)
92   dnl #
93   dnl # Check Emacs site-lisp directories
94   dnl #
95   AC_ARG_WITH(lispdir,
96     [  --with-lispdir=DIR      emacs lisp files go to DIR [guessed]],
97     [case "${withval}" in
98        yes)     lispdir= ;;
99        no)      AC_MSG_ERROR(lispdir is not available) ;;
100        *)       lispdir=${withval} ;;
101      esac], lispdir=)
102   AC_MSG_CHECKING([where .elc files should go])
103   if test "x$lispdir" = x; then
104     lispdir="$emacsdir/site-lisp"
105     if test -d $emacsdir/lisp; then
106       lispdir="$emacsdir/lisp"
107     fi
108     case "$EMACS_BASENAME" in
109     xemacs|xemacs-*)
110       lispdir="$lispdir/lookup"
111       ;;
112     esac
113   fi
114   AC_MSG_RESULT($lispdir)
115   AC_SUBST(lispdir)])
116
117 dnl AC_EMACS_LIST AC_XEMACS_P AC_PATH_LISPDIR and AC_EMACS_CHECK_LIB
118 dnl are stolen from w3.
119 dnl AC_PATH_LISPDIR obsoletes AM_PATH_LISPDIR.
120
121 AC_DEFUN(AC_EMACS_LISP, [
122 elisp="$2"
123 if test -z "$3"; then
124         AC_MSG_CHECKING(for $1)
125 fi
126 AC_CACHE_VAL(EMACS_cv_SYS_$1,[
127         OUTPUT=./conftest-$$
128         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
129         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
130         retval=`cat ${OUTPUT}`
131         echo "=> ${retval}" >& AC_FD_CC 2>&1
132         rm -f ${OUTPUT}
133         EMACS_cv_SYS_$1=$retval
134 ])
135 $1=${EMACS_cv_SYS_$1}
136 if test -z "$3"; then
137         AC_MSG_RESULT($$1)
138 fi
139 ])
140
141 AC_DEFUN(AC_XEMACS_P, [
142   AC_MSG_CHECKING([if $EMACS is really XEmacs])
143   AC_EMACS_LISP(xemacsp,(if (string-match \"XEmacs\" emacs-version) \"yes\" \"no\") ,"noecho")
144   XEMACSP=${EMACS_cv_SYS_xemacsp}
145   EMACS_FLAVOR=emacs
146   if test "$XEMACSP" = "yes"; then
147      EMACS_FLAVOR=xemacs
148   fi
149   AC_MSG_RESULT($XEMACSP)
150   AC_SUBST(EMACS_FLAVOR)
151 ])
152
153 AC_DEFUN(AC_PATH_LISPDIR, [
154   AC_XEMACS_P
155   if test "$prefix" = "NONE"; then
156         AC_MSG_CHECKING([prefix for your Emacs])
157         AC_EMACS_LISP(prefix,(expand-file-name \"..\" invocation-directory),"noecho")
158         prefix=${EMACS_cv_SYS_prefix}
159         AC_MSG_RESULT($prefix)
160   fi
161   AC_ARG_WITH(lispdir,[  --with-lispdir=DIR      Where to install lisp files], lispdir=${withval})
162   AC_MSG_CHECKING([where .elc files should go])
163   if test -z "$lispdir"; then
164     dnl Set default value
165     theprefix=$prefix
166     if test "x$theprefix" = "xNONE"; then
167         theprefix=$ac_default_prefix
168     fi
169     lispdir="\$(datadir)/${EMACS_FLAVOR}/site-lisp"
170     for thedir in share lib; do
171         potential=
172         if test -d ${theprefix}/${thedir}/${EMACS_FLAVOR}/site-lisp; then
173            lispdir="\$(prefix)/${thedir}/${EMACS_FLAVOR}/site-lisp"
174            break
175         fi
176     done
177   fi
178   AC_MSG_RESULT($lispdir)
179   AC_SUBST(lispdir)
180 ])
181
182 dnl
183 dnl Check whether a function exists in a library
184 dnl All '_' characters in the first argument are converted to '-'
185 dnl
186 AC_DEFUN(AC_EMACS_CHECK_LIB, [
187 if test -z "$3"; then
188         AC_MSG_CHECKING(for $2 in $1)
189 fi
190 library=`echo $1 | tr _ -`
191 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")
192 if test "${EMACS_cv_SYS_$1}" = "nil"; then
193         EMACS_cv_SYS_$1=no
194 fi
195 if test "${EMACS_cv_SYS_$1}" = "t"; then
196         EMACS_cv_SYS_$1=yes
197 fi
198 HAVE_$1=${EMACS_cv_SYS_$1}
199 AC_SUBST(HAVE_$1)
200 if test -z "$3"; then
201         AC_MSG_RESULT($HAVE_$1)
202 fi
203 ])
204
205 dnl
206 dnl Perform sanity checking and try to locate the W3 package
207 dnl
208 AC_DEFUN(AC_CHECK_W3, [
209 AC_MSG_CHECKING(for acceptable W3 version)
210 AC_CACHE_VAL(EMACS_cv_ACCEPTABLE_W3,[
211 AC_EMACS_CHECK_LIB(w3_forms, w3-form-encode-xwfu,"noecho")
212 if test "${HAVE_w3_forms}" = "yes"; then
213         EMACS_cv_ACCEPTABLE_W3=yes
214 else
215         EMACS_cv_ACCEPTABLE_W3=no
216 fi
217
218 if test "${EMACS_cv_ACCEPTABLE_W3}" = "yes"; then
219         AC_EMACS_LISP(w3_dir,(file-name-directory (locate-library \"w3-forms\")),"noecho")
220         EMACS_cv_ACCEPTABLE_W3=$EMACS_cv_SYS_w3_forms
221 fi
222 ])
223    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` ])
224    W3=${EMACS_cv_ACCEPTABLE_W3}
225    AC_SUBST(W3)
226    AC_MSG_RESULT("${W3}")
227 ])
228