1 dnl aclocal.m4 generated automatically by aclocal 1.4
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.
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.
13 dnl Copyright (C) 1999 NISHIDA Keisuke <knishida@ring.aist.go.jp>
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.
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.
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
30 AC_DEFUN(AM_PATH_LISPDIR,
35 [ --with-emacs=EMACS compile with EMACS [EMACS=emacs, xemacs...]],
38 no) AC_MSG_ERROR([emacs is not available]) ;;
39 *) EMACS=${withval} ;;
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)
48 dnl # Check Emacs directories
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
56 emacsdir="\$(datadir)/emacs"
57 case "$EMACS_BASENAME" in
59 if test -d $prefix/lib/emacs; then
60 emacsdir="$prefix/lib/emacs"
62 if test -d $prefix/share/emacs; then
63 emacsdir="$prefix/share/emacs"
67 if test -d $prefix/lib/xemacs; then
68 emacsdir="$prefix/lib/xemacs"
70 if test -d $prefix/share/xemacs; then
71 emacsdir="$prefix/share/xemacs"
75 if test -d $prefix/lib/emacs; then
76 emacsdir="$prefix/lib/emacs"
78 if test -d $prefix/share/emacs; then
79 emacsdir="$prefix/share/emacs"
81 if test -d $prefix/lib/mule; then
82 emacsdir="$prefix/lib/mule"
84 if test -d $prefix/share/mule; then
85 emacsdir="$prefix/share/mule"
90 AC_MSG_RESULT($emacsdir)
93 dnl # Check Emacs site-lisp directories
96 [ --with-lispdir=DIR emacs lisp files go to DIR [guessed]],
99 no) AC_MSG_ERROR(lispdir is not available) ;;
100 *) lispdir=${withval} ;;
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"
108 case "$EMACS_BASENAME" in
110 lispdir="$lispdir/lookup"
114 AC_MSG_RESULT($lispdir)
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.
121 AC_DEFUN(AC_EMACS_LISP, [
123 if test -z "$3"; then
124 AC_MSG_CHECKING(for $1)
126 AC_CACHE_VAL(EMACS_cv_SYS_$1,[
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
133 EMACS_cv_SYS_$1=$retval
135 $1=${EMACS_cv_SYS_$1}
136 if test -z "$3"; then
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}
146 if test "$XEMACSP" = "yes"; then
149 AC_MSG_RESULT($XEMACSP)
150 AC_SUBST(EMACS_FLAVOR)
153 AC_DEFUN(AC_PATH_LISPDIR, [
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)
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
166 if test "x$theprefix" = "xNONE"; then
167 theprefix=$ac_default_prefix
169 lispdir="\$(datadir)/${EMACS_FLAVOR}/site-lisp"
170 for thedir in share lib; do
172 if test -d ${theprefix}/${thedir}/${EMACS_FLAVOR}/site-lisp; then
173 lispdir="\$(prefix)/${thedir}/${EMACS_FLAVOR}/site-lisp"
178 AC_MSG_RESULT($lispdir)
183 dnl Check whether a function exists in a library
184 dnl All '_' characters in the first argument are converted to '-'
186 AC_DEFUN(AC_EMACS_CHECK_LIB, [
187 if test -z "$3"; then
188 AC_MSG_CHECKING(for $2 in $1)
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
195 if test "${EMACS_cv_SYS_$1}" = "t"; then
198 HAVE_$1=${EMACS_cv_SYS_$1}
200 if test -z "$3"; then
201 AC_MSG_RESULT($HAVE_$1)
206 dnl Perform sanity checking and try to locate the W3 package
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
215 EMACS_cv_ACCEPTABLE_W3=no
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
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}
226 AC_MSG_RESULT("${W3}")