1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265
|
AC_DEFUN(AC_SET_VANILLA_FLAG,
[dnl Determine arguments to run Emacs as vanilla.
retval=`echo ${EMACS}| ${EGREP} xemacs| ${EGREP} -v '^$'`
if test -z "${retval}"; then
VANILLA_FLAG="-q -no-site-file"
else
VANILLA_FLAG="-vanilla"
fi
AC_SUBST(VANILLA_FLAG)])
AC_DEFUN(AC_EMACS_LISP, [
elisp="$2"
if test -z "$3"; then
AC_MSG_CHECKING(for $1)
fi
AC_CACHE_VAL(EMACS_cv_SYS_$1,[
OUTPUT=./conftest-$$
echo ${EMACS}' '${VANILLA_FLAG}' -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
eval ${EMACS}' '${VANILLA_FLAG}' -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
retval="`cat ${OUTPUT}`"
echo "=> ${retval}" >& AC_FD_CC 2>&1
rm -f ${OUTPUT}
EMACS_cv_SYS_$1="${retval}"
])
$1="${EMACS_cv_SYS_$1}"
if test -z "$3"; then
AC_MSG_RESULT($$1)
fi
])
AC_DEFUN(AC_PATH_EMACS,
[dnl Check for Emacsen.
dnl Apparently, if you run a shell window in Emacs, it sets the EMACS
dnl environment variable to 't'. Lets undo the damage.
test x${EMACS} = xt && EMACS=
dnl Ignore cache.
unset ac_cv_prog_EMACS; unset EMACS_cv_SYS_flavor;
AC_ARG_WITH(emacs,
[ --with-emacs=EMACS compile with EMACS [EMACS=emacs, xemacs, mule...]],
[if test "${withval}" = yes -o -z "${withval}"; then
AC_PATH_PROGS(EMACS, emacs xemacs mule, emacs)
else
AC_PATH_PROG(EMACS, ${withval}, ${withval}, emacs)
fi])
AC_ARG_WITH(xemacs,
[ --with-xemacs=XEMACS compile with XEMACS [XEMACS=xemacs]],
[if test x$withval = xyes -o x$withval = x; then
AC_PATH_PROG(EMACS, xemacs, xemacs, xemacs)
else
AC_PATH_PROG(EMACS, $withval, $withval, xemacs)
fi])
test -z "${EMACS}" && AC_PATH_PROGS(EMACS, emacs xemacs mule, emacs)
AC_SUBST(EMACS)
AC_SET_VANILLA_FLAG
AC_MSG_CHECKING([what a flavor does ${EMACS} have])
AC_EMACS_LISP(flavor,
(cond ((featurep (quote xemacs)) \"XEmacs\")\
((and (boundp (quote emacs-major-version))\
(>= emacs-major-version 21))\
(format \"Emacs %d\" emacs-major-version))\
((boundp (quote MULE)) \"MULE\")\
(t \"Emacs\")),
noecho)
case "${flavor}" in
XEmacs)
EMACS_FLAVOR=xemacs;;
MULE)
EMACS_FLAVOR=mule;;
Emacs\ 2[[123]])
EMACS_FLAVOR=emacs21;;
*)
EMACS_FLAVOR=emacs;;
esac
AC_MSG_RESULT(${flavor})])
AC_DEFUN(AC_EXAMINE_PACKAGEDIR,
[dnl Examine PACKAGEDIR.
AC_EMACS_LISP(PACKAGEDIR,
(let ((prefix \"${prefix}\")\
(dirs (append\
(if (and (boundp (quote configure-package-path))\
(listp configure-package-path))\
(delete \"\" configure-package-path))\
(if (boundp (quote early-packages))\
(append (if early-package-load-path early-packages)\
(if late-package-load-path late-packages)\
(if last-package-load-path last-packages)))))\
package-dir)\
(while (and dirs (not package-dir))\
(if (file-directory-p (car dirs))\
(setq package-dir (car dirs)\
dirs (cdr dirs))))\
(if package-dir\
(progn\
(if (string-match \"/\$\" package-dir)\
(setq package-dir (substring package-dir 0\
(match-beginning 0))))\
(if (and prefix\
(progn\
(setq prefix (file-name-as-directory prefix))\
(eq 0 (string-match (regexp-quote prefix)\
package-dir))))\
(replace-match \"\$(prefix)/\" nil nil package-dir)\
package-dir))\
\"NONE\")),
noecho)])
AC_DEFUN(AC_PATH_PACKAGEDIR,
[dnl Check for PACKAGEDIR.
if test ${EMACS_FLAVOR} = xemacs; then
AC_MSG_CHECKING([where the XEmacs package is])
AC_ARG_WITH(packagedir,
[ --with-packagedir=DIR package DIR for XEmacs],
[if test "${withval}" = yes -o -z "${withval}"; then
AC_EXAMINE_PACKAGEDIR
else
PACKAGEDIR="${withval}"
fi],
AC_EXAMINE_PACKAGEDIR)
if test -z "${PACKAGEDIR}"; then
AC_MSG_RESULT(not found)
else
AC_MSG_RESULT(${PACKAGEDIR})
fi
else
PACKAGEDIR=NONE
fi
AC_SUBST(PACKAGEDIR)])
AC_DEFUN(AC_PATH_LISPDIR, [
if test ${EMACS_FLAVOR} = emacs21; then
tribe=emacs
else
tribe=${EMACS_FLAVOR}
fi
if test ${prefix} = NONE; then
AC_MSG_CHECKING([prefix for ${EMACS}])
AC_EMACS_LISP(prefix,(expand-file-name \"..\" invocation-directory),noecho)
prefix=${EMACS_cv_SYS_prefix}
AC_MSG_RESULT(${prefix})
fi
AC_ARG_WITH(lispdir,
[ --with-lispdir=DIR where lisp files should go
(use --with-packagedir for XEmacs package)],
lispdir="${withval}")
AC_MSG_CHECKING([where lisp files should go])
if test -z "${lispdir}"; then
dnl Set the default value.
theprefix=${prefix}
if test x${theprefix} = xNONE; then
theprefix=${ac_default_prefix}
fi
lispdir="\$(datadir)/${tribe}/site-lisp/w3m"
for thedir in share lib; do
potential=
if test -d ${theprefix}/${thedir}/${tribe}/site-lisp; then
lispdir="\$(prefix)/${thedir}/${tribe}/site-lisp/w3m"
break
fi
done
fi
if test ${EMACS_FLAVOR} = xemacs; then
AC_MSG_RESULT(${lispdir}/
(it will be ignored when \"make install-package\" is done))
else
AC_MSG_RESULT(${lispdir}/)
fi
AC_SUBST(lispdir)])
AC_DEFUN(AC_PATH_ICONDIR,
[dnl Examin icon directory.
dnl Ignore cache.
unset EMACS_cv_SYS_icondir;
if test ${EMACS_FLAVOR} = xemacs -o ${EMACS_FLAVOR} = emacs21; then
AC_ARG_WITH(icondir,
[ --with-icondir=ICONDIR directory for icons [\$(data-directory)/images/w3m]],
ICONDIR="${withval}")
AC_MSG_CHECKING([where icon files should go])
if test -z "${ICONDIR}"; then
dnl Set the default value.
AC_EMACS_LISP(icondir,
(let ((prefix \"${prefix}\")\
(default (expand-file-name \"images/w3m\" data-directory)))\
(if (and prefix\
(progn\
(setq prefix (file-name-as-directory prefix))\
(eq 0 (string-match (regexp-quote prefix) default))))\
(replace-match \"\$(prefix)/\" nil nil default)\
default)),
${prefix},noecho)
ICONDIR=${EMACS_cv_SYS_icondir}
fi
if test ${EMACS_FLAVOR} = xemacs; then
AC_MSG_RESULT(${ICONDIR}/
(it will be ignored when \"make install-package\" is done))
else
AC_MSG_RESULT(${ICONDIR})
fi
else
ICONDIR=NONE
fi
AC_SUBST(ICONDIR)])
AC_DEFUN(AC_ADD_LOAD_PATH,
[dnl Check for additional load path.
AC_ARG_WITH(addpath,
[ --with-addpath=PATHs specify additional PATHs for load-path
use colons to separate directory names],
[AC_MSG_CHECKING([where to find the additional elisp libraries])
if test "x${withval}" != xyes -a "x${withval}" != x; then
ADDITIONAL_LOAD_PATH="${withval}"
else
if test x"$USER" != xroot -a x"$HOME" != x -a -f "$HOME"/.emacs; then
ADDITIONAL_LOAD_PATH=`"$EMACS" -batch -l "$HOME"/.emacs -l w3mhack.el NONE -f w3mhack-load-path 2>/dev/null | $EGREP -v '^$'`
else
ADDITIONAL_LOAD_PATH=`"$EMACS" -batch -l w3mhack.el NONE -f w3mhack-load-path 2>/dev/null | $EGREP -v '^$'`
fi
fi
AC_MSG_RESULT(${ADDITIONAL_LOAD_PATH})],
ADDITIONAL_LOAD_PATH=NONE)
AC_ARG_WITH(attic,
[ --with-attic use attic libraries for compiling [default: no]
(it does not mean installing attic libraries)],
[if test "x${withval}" = xyes; then
if test x"$ADDITIONAL_LOAD_PATH" = xNONE; then
ADDITIONAL_LOAD_PATH=`pwd`/attic
else
ADDITIONAL_LOAD_PATH=${ADDITIONAL_LOAD_PATH}:`pwd`/attic
fi
fi])
retval=`eval $EMACS' '${VANILLA_FLAG}' -batch -l w3mhack.el '${ADDITIONAL_LOAD_PATH}' -f w3mhack-print-status'`
if test x"$retval" != xOK; then
AC_MSG_ERROR([Process couldn't proceed. See the above messages.])
fi
AC_SUBST(ADDITIONAL_LOAD_PATH)])
AC_DEFUN(AC_CHECK_ELISP,
[dnl Check for requried elisp library.
AC_MSG_CHECKING(for $1)
retval=`eval $EMACS' '${VANILLA_FLAG}' -batch -l w3mhack.el '${ADDITIONAL_LOAD_PATH}' -f w3mhack-locate-library '$1' 2>/dev/null | $EGREP -v '\''^$'\'`
if test x"$retval" != x; then
AC_MSG_RESULT(${retval})
else
AC_MSG_ERROR($1.el is missing)
fi])
AC_DEFUN(AC_CHECK_XML,
[RSS=no
AC_ARG_WITH(xml,
[ --with-xml compile shimbun modules using xml.el [default: no]],
[if test "x${withval}" = xyes; then
RSS=yes
else
RSS=no
fi]
[])
if test "x${RSS}" = xyes; then
AC_CHECK_ELISP(xml)
fi])
|