1 ## ------------------------ -*- Autoconf -*-
2 ## Emacs LISP file handling
4 ## Almost entirely rewritten by Alexandre Oliva
5 ## ------------------------
7 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
8 # Free Software Foundation, Inc.
10 # This program is free software; you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation; either version 2, or (at your option)
15 # This program is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 # GNU General Public License for more details.
20 # You should have received a copy of the GNU General Public License
21 # along with this program; if not, write to the Free Software
22 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
29 AC_DEFUN([AM_PATH_LISPDIR],
30 [ # If set to t, that means we are running in a shell under Emacs.
31 # If you have an Emacs named "t", then use the full path.
32 test x"$EMACS" = xt && EMACS=
33 AC_CHECK_PROGS([EMACS], [emacs xemacs], [no])
34 AC_ARG_VAR([EMACS], [the Emacs editor command])
35 AC_ARG_VAR([EMACSLOADPATH], [the Emacs library search path])
36 AC_ARG_WITH([lispdir],
37 [ --with-lispdir override the default lisp directory],
39 AC_MSG_CHECKING([where .elc files should go])
40 AC_MSG_RESULT([$lispdir])],
42 AC_CACHE_CHECK([where .elc files should go], [am_cv_lispdir], [
43 if test $EMACS != "no"; then
44 if test x${lispdir+set} != xset; then
45 # If $EMACS isn't GNU Emacs or XEmacs, this can blow up pretty badly
46 # Some emacsen will start up in interactive mode, requiring C-x C-c to exit,
47 # which is non-obvious for non-emacs users.
48 # Redirecting /dev/null should help a bit; pity we can't detect "broken"
49 # emacsen earlier and avoid running this altogether.
50 AC_RUN_LOG([$EMACS -batch -q -eval '(while load-path (princ (concat (car load-path) "\n")) (setq load-path (cdr load-path)))' </dev/null >conftest.out])
51 am_cv_lispdir=`sed -n \
53 -e '/.*\/lib\/x*emacs\/site-lisp$/{s,.*/lib/\(x*emacs/site-lisp\)$,${libdir}/\1,;p;q;}' \
54 -e '/.*\/share\/x*emacs\/site-lisp$/{s,.*/share/\(x*emacs/site-lisp\),${datadir}/\1,;p;q;}' \
59 test -z "$am_cv_lispdir" && am_cv_lispdir='${datadir}/emacs/site-lisp'
61 lispdir="$am_cv_lispdir"
66 AU_DEFUN([ud_PATH_LISPDIR], [AM_PATH_LISPDIR])