tagging release
[dasher.git] / m4 / lispdir.m4
blob42e537e6cd3ebdea6203dece421e9414bd89df30
1 ## ------------------------                           -*- Autoconf -*-
2 ## Emacs LISP file handling
3 ## From Ulrich Drepper
4 ## Almost entirely rewritten by Alexandre Oliva
5 ## ------------------------
7 # Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002
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)
13 # any later version.
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
23 # 02111-1307, USA.
25 # serial 6
27 # AM_PATH_LISPDIR
28 # ---------------
29 AC_DEFUN([AM_PATH_LISPDIR],
30 [AC_ARG_WITH(lispdir,
31  [  --with-lispdir          Override the default lisp directory ],
32  [ lispdir="$withval"
33    AC_MSG_CHECKING([where .elc files should go])
34    AC_MSG_RESULT([$lispdir])],
35  [
36  # If set to t, that means we are running in a shell under Emacs.
37  # If you have an Emacs named "t", then use the full path.
38  test x"$EMACS" = xt && EMACS=
39  AC_CHECK_PROGS(EMACS, emacs xemacs, no)
40  if test $EMACS != "no"; then
41    if test x${lispdir+set} != xset; then
42      AC_CACHE_CHECK([where .elc files should go], [am_cv_lispdir],
43        [# If $EMACS isn't GNU Emacs or XEmacs, this can blow up pretty badly
44   # Some emacsen will start up in interactive mode, requiring C-x C-c to exit,
45   #  which is non-obvious for non-emacs users.
46   # Redirecting /dev/null should help a bit; pity we can't detect "broken"
47   #  emacsen earlier and avoid running this altogether.
48   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])
49         am_cv_lispdir=`sed -n \
50        -e 's,/$,,' \
51        -e '/.*\/lib\/\(x\?emacs\/site-lisp\)$/{s,,${libdir}/\1,;p;q;}' \
52        -e '/.*\/share\/\(x\?emacs\/site-lisp\)$/{s,,${datadir}/\1,;p;q;}' \
53        conftest.out`
54        rm conftest.out
55        if test -z "$am_cv_lispdir"; then
56          am_cv_lispdir='${datadir}/emacs/site-lisp'
57        fi
58      ])
59      lispdir="$am_cv_lispdir"
60    fi
61  fi
63 AC_SUBST(lispdir)
64 ])# AM_PATH_LISPDIR
66 AU_DEFUN([ud_PATH_LISPDIR], [AM_PATH_LISPDIR])