1 ## ------------------------ -*- Autoconf -*-
2 ## Emacs LISP file handling
4 ## Almost entirely rewritten by Alexandre Oliva
5 ## ------------------------
6 # Copyright (C) 1996-2012 Free Software Foundation, Inc.
8 # This file is free software; the Free Software Foundation
9 # gives unlimited permission to copy and/or distribute it,
10 # with or without modifications, as long as this notice is preserved.
16 AC_DEFUN([AM_PATH_LISPDIR],
18 # If set to t, that means we are running in a shell under Emacs.
19 # If you have an Emacs named "t", then use the full path.
20 test x"$EMACS" = xt && EMACS=
21 AC_CHECK_PROGS([EMACS], [emacs xemacs], [no])
22 AC_ARG_VAR([EMACS], [the Emacs editor command])
23 AC_ARG_VAR([EMACSLOADPATH], [the Emacs library search path])
24 AC_ARG_WITH([lispdir],
25 [AS_HELP_STRING([--with-lispdir],
26 [override the default lisp directory])],
28 AC_MSG_CHECKING([where .elc files should go])
29 AC_MSG_RESULT([$lispdir])],
31 AC_CACHE_CHECK([where .elc files should go], [am_cv_lispdir], [
32 if test $EMACS != "no"; then
33 if test x${lispdir+set} != xset; then
34 # If $EMACS isn't GNU Emacs or XEmacs, this can blow up pretty badly
35 # Some emacsen will start up in interactive mode, requiring C-x C-c to exit,
36 # which is non-obvious for non-emacs users.
37 # Redirecting /dev/null should help a bit; pity we can't detect "broken"
38 # emacsen earlier and avoid running this altogether.
39 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])
40 am_cv_lispdir=`sed -n \
42 -e '/.*\/lib\/x*emacs\/site-lisp$/{s,.*/lib/\(x*emacs/site-lisp\)$,${libdir}/\1,;p;q;}' \
43 -e '/.*\/share\/x*emacs\/site-lisp$/{s,.*/share/\(x*emacs/site-lisp\),${datarootdir}/\1,;p;q;}' \
48 test -z "$am_cv_lispdir" && am_cv_lispdir='${datadir}/emacs/site-lisp'
50 lispdir="$am_cv_lispdir"
55 AU_DEFUN([ud_PATH_LISPDIR], [AM_PATH_LISPDIR])