3 AC_DEFUN(AM_PATH_LISPDIR,
4 [# If set to t, that means we are running in a shell under Emacs.
5 # If you have an Emacs named "t", then use the full path.
6 test "$EMACS" = t && EMACS=
7 test "$EMACS" || AC_PATH_PROGS(EMACS, emacs xemacs, no)
8 if test "$EMACS" != "no"; then
9 AC_MSG_CHECKING([where .elc files should go])
11 lispdir="\$(datadir)/emacs/site-lisp"
12 if test "x$prefix" = "xNONE"; then
13 if test -d $ac_default_prefix/share/emacs/site-lisp; then
14 lispdir="\$(prefix)/share/emacs/site-lisp"
16 if test -d $ac_default_prefix/lib/emacs/site-lisp; then
17 lispdir="\$(prefix)/lib/emacs/site-lisp"
21 if test -d $prefix/share/emacs/site-lisp; then
22 lispdir="\$(prefix)/share/emacs/site-lisp"
24 if test -d $prefix/lib/emacs/site-lisp; then
25 lispdir="\$(prefix)/lib/emacs/site-lisp"
29 AC_MSG_RESULT($lispdir)
33 dnl AC_EMACS_LIST AC_XEMACS_P AC_PATH_LISPDIR and AC_EMACS_CHECK_LIB
34 dnl are stolen from w3.
35 dnl AC_PATH_LISPDIR obsoletes AM_PATH_LISPDIR.
37 AC_DEFUN(AC_EMACS_LISP, [
40 AC_MSG_CHECKING(for $1)
42 AC_CACHE_VAL(EMACS_cv_SYS_$1,[
44 echo ${EMACS} -batch -eval "(let ((x ${elisp})) (write-region (if (stringp x) (princ x) (prin1-to-string x)) nil \"${OUTPUT}\"))" >& AC_FD_CC 2>&1
45 ${EMACS} -batch -eval "(let ((x ${elisp})) (write-region (if (stringp x) (princ x 'ignore) (prin1-to-string x)) nil \"${OUTPUT}\"nil 5))" >& AC_FD_CC 2>&1
46 retval=`cat ${OUTPUT}`
47 echo "=> ${retval}" >& AC_FD_CC 2>&1
49 EMACS_cv_SYS_$1=$retval
57 AC_DEFUN(AC_XEMACS_P, [
58 AC_MSG_CHECKING([if $EMACS is really XEmacs])
59 AC_EMACS_LISP(xemacsp,(if (string-match \"XEmacs\" emacs-version) \"yes\" \"no\") ,"noecho")
60 XEMACS=${EMACS_cv_SYS_xemacsp}
62 if test "$XEMACS" = "yes"; then
65 AC_MSG_RESULT($XEMACS)
67 AC_SUBST(EMACS_FLAVOR)
70 AC_DEFUN(AC_PATH_LISPDIR, [
72 if test "$prefix" = "NONE"; then
73 AC_MSG_CHECKING([prefix for your Emacs])
74 AC_EMACS_LISP(prefix,(expand-file-name \"..\" invocation-directory),"noecho")
75 prefix=${EMACS_cv_SYS_prefix}
76 AC_MSG_RESULT($prefix)
78 AC_ARG_WITH(lispdir,[ --with-lispdir=DIR Where to install lisp files], lispdir=${withval})
79 AC_MSG_CHECKING([where .elc files should go])
80 if test -z "$lispdir"; then
83 if test "x$theprefix" = "xNONE"; then
84 theprefix=$ac_default_prefix
86 if test "$EMACS_FLAVOR" = "xemacs"; then
87 datadir="\$(prefix)/lib"
88 lispdir="\$(datadir)/${EMACS_FLAVOR}/site-packages/lisp/gnus"
90 lispdir="\$(datadir)/${EMACS_FLAVOR}/site-lisp/gnus"
92 for thedir in share lib; do
94 dnl The directory name should be quoted because it might contain spaces.
95 if test -d "${theprefix}/${thedir}/${EMACS_FLAVOR}/site-lisp"; then
96 if test "$EMACS_FLAVOR" = "xemacs"; then
97 lispdir="\$(prefix)/${thedir}/${EMACS_FLAVOR}/site-packages/lisp/gnus"
99 lispdir="\$(datadir)/${EMACS_FLAVOR}/site-lisp/gnus"
105 AC_MSG_RESULT($lispdir)
109 AC_DEFUN(AC_PATH_ETCDIR, [
110 AC_ARG_WITH(etcdir,[ --with-etcdir=DIR Where to install etc files], etcdir=${withval})
111 AC_MSG_CHECKING([where etc files should go])
112 if test -z "$etcdir"; then
113 dnl Set default value.
114 if test "$EMACS_FLAVOR" = "xemacs"; then
115 etcdir="\$(lispdir)/../../etc"
117 etcdir="\$(lispdir)/../../etc"
120 AC_MSG_RESULT($etcdir)
125 dnl This is a bit on the "evil hack" side of things. It is so we can
126 dnl have a different default infodir for XEmacs. A user can still specify
127 dnl someplace else with '--infodir=DIR'.
129 AC_DEFUN(AC_PATH_INFO_DIR, [
130 AC_MSG_CHECKING([where the TeXinfo docs should go])
131 dnl Set default value. This must be an absolute path.
132 if test "$infodir" = "\${prefix}/info"; then
133 if test "$EMACS_FLAVOR" = "xemacs"; then
134 info_dir="\$(prefix)/${thedir}/${EMACS_FLAVOR}/site-packages/info"
136 info_dir="\$(prefix)/info"
141 AC_MSG_RESULT($info_dir)
146 dnl This will set the XEmacs command line options to be slightly different
147 dnl from the Emacs ones. If building with XEmacs the options will be
148 dnl "-batch -no-autoloads..." to give a much cleaner build environment.
150 AC_DEFUN(AC_SET_BUILD_FLAGS, [
151 AC_MSG_CHECKING([which options to pass on to (X)Emacs])
152 if test "x$FLAGS" = "x"; then
153 if test "$EMACS_FLAVOR" = "xemacs"; then
154 FLAGS="-batch -no-autoloads -l \$(srcdir)/dgnushack.el"
156 FLAGS="-batch -q -no-site-file -l \$(srcdir)/dgnushack.el"
161 AC_MSG_RESULT($FLAGS)
166 dnl Check whether a function exists in a library
167 dnl All '_' characters in the first argument are converted to '-'
169 AC_DEFUN(AC_EMACS_CHECK_LIB, [
170 if test -z "$3"; then
171 AC_MSG_CHECKING(for $2 in $1)
173 library=`echo $1 | tr _ -`
174 AC_EMACS_LISP($1,(progn (fmakunbound '$2) (condition-case nil (progn (require '$library) (fboundp '$2)) (error (prog1 nil (message \"$library not found\"))))),"noecho")
175 if test "${EMACS_cv_SYS_$1}" = "nil"; then
178 if test "${EMACS_cv_SYS_$1}" = "t"; then
181 HAVE_$1=${EMACS_cv_SYS_$1}
183 if test -z "$3"; then
184 AC_MSG_RESULT($HAVE_$1)
189 dnl Perform sanity checking and try to locate the W3 package
191 AC_DEFUN(AC_CHECK_W3, [
192 AC_MSG_CHECKING(for acceptable W3 version)
193 AC_CACHE_VAL(EMACS_cv_ACCEPTABLE_W3,[
194 AC_EMACS_CHECK_LIB(w3_forms, w3-form-encode-xwfu,"noecho")
195 if test "${HAVE_w3_forms}" = "yes"; then
196 EMACS_cv_ACCEPTABLE_W3=yes
198 EMACS_cv_ACCEPTABLE_W3=no
201 if test "${EMACS_cv_ACCEPTABLE_W3}" = "yes"; then
202 AC_EMACS_LISP(w3_dir,(file-name-directory (locate-library \"w3-forms\")),"noecho")
203 EMACS_cv_ACCEPTABLE_W3=$EMACS_cv_SYS_w3_dir
206 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` ])
207 W3=${EMACS_cv_ACCEPTABLE_W3}
209 AC_MSG_RESULT("${W3}")
213 dnl Perform sanity checking and try to locate the W3 package
215 AC_DEFUN(AC_CHECK_URL, [
216 AC_MSG_CHECKING(for acceptable URL version)
217 AC_CACHE_VAL(EMACS_cv_ACCEPTABLE_URL,[
218 AC_EMACS_CHECK_LIB(url, url-retrieve, "noecho")
219 if test "${HAVE_url}" = "yes"; then
220 EMACS_cv_ACCEPTABLE_URL=yes
222 EMACS_cv_ACCEPTABLE_URL=no
225 if test "${EMACS_cv_ACCEPTABLE_URL}" = "yes"; then
226 AC_EMACS_LISP(url_dir,(file-name-directory (locate-library \"url\")),"noecho")
227 EMACS_cv_ACCEPTABLE_URL=$EMACS_cv_SYS_url_dir
230 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` ])
231 URL=${EMACS_cv_ACCEPTABLE_URL}
233 AC_MSG_RESULT("${URL}")
237 dnl Perform checking available fonts: Adobe Bembo, Adobe Futura and
238 dnl Bitstream Courier.
241 AC_DEFUN(GNUS_CHECK_FONTS, [
242 test "$LATEX" = t && LATEX=
243 test "$LATEX" || AC_PATH_PROGS(LATEX, latex, no)
244 AC_MSG_CHECKING(for available fonts)
245 AC_ARG_WITH(fonts,[ --with-fonts Assume all fonts required are available],[USE_FONTS="$withval"])
252 if test -z "${USE_FONTS}"; then
253 if test "${LATEX}" = no; then
257 echo '\nonstopmode\documentclass{article}\usepackage{bembo}\begin{document}\end{document}' > ${OUTPUT}
258 if ${LATEX} ${OUTPUT} </dev/null >& AC_FD_CC 2>&1 ; then
259 if test -z "${USE_FONTS}"; then
260 USE_FONTS="Adobe Bembo"
262 USE_FONTS="${USE_FONTS}, Adobe Bembo"
265 WITHOUT_FONTS_bembo='%'
267 echo '\nonstopmode\documentclass{article}\begin{document}{\fontfamily{pfu}\fontsize{10pt}{10}\selectfont test}\end{document}' > ${OUTPUT}
268 if retval=`${LATEX} ${OUTPUT} </dev/null 2>& AC_FD_CC`; then
269 if echo "$retval" | grep 'Some font shapes were not available' >& AC_FD_CC 2>&1 ; then
272 if test -z "${USE_FONTS}"; then
273 USE_FONTS="Adobe Futura"
275 USE_FONTS="${USE_FONTS}, Adobe Futura"
278 WITHOUT_FONTS_pfu='%'
281 echo '\nonstopmode\documentclass{article}\begin{document}{\fontfamily{bcr}\fontsize{10pt}{10}\selectfont test}\end{document}' > ${OUTPUT}
282 if retval=`${LATEX} ${OUTPUT} </dev/null 2>& AC_FD_CC`; then
283 if echo "$retval" | grep 'Some font shapes were not available' >& AC_FD_CC 2>&1 ; then
286 if test -z "${USE_FONTS}"; then
287 USE_FONTS="Bitstream Courier"
289 USE_FONTS="${USE_FONTS}, Bitstream Courier"
292 WITHOUT_FONTS_bcr='%'
295 rm -f ${OUTPUT} ${OUTPUT}.aux ${OUTPUT}.log ${OUTPUT}.dvi
297 elif test "${USE_FONTS}" = yes ; then
299 WITHOUT_FONTS_bembo='%'
301 WITHOUT_FONTS_pfu='%'
303 WITHOUT_FONTS_bcr='%'
305 AC_SUBST(WITH_FONTS_bembo)
306 AC_SUBST(WITHOUT_FONTS_bembo)
307 AC_SUBST(WITH_FONTS_pfu)
308 AC_SUBST(WITHOUT_FONTS_pfu)
309 AC_SUBST(WITH_FONTS_bcr)
310 AC_SUBST(WITHOUT_FONTS_bcr)
311 if test -z "${USE_FONTS}" ; then
314 USE_FONTS=`echo "${USE_FONTS}" | sed 's/,\([[^,]]*\)$/ and\1/'`
315 AC_MSG_RESULT("${USE_FONTS}")
316 if test "${USE_FONTS}" = yes ; then
317 USE_FONTS='Set in Adobe Bembo, Adobe Futura and Bitstream Courier.'
318 elif test "${USE_FONTS}" = no ; then
321 USE_FONTS="Set in ${USE_FONTS}."