Update autoconf to version 2.61
[msysgit.git] / share / aclocal-1.10 / lispdir.m4
blob62c2daf67b89434d4e50ad19beb73131b7f02d3e
1 ## ------------------------                                 -*- Autoconf -*-
2 ## Emacs LISP file handling
3 ## From Ulrich Drepper
4 ## Almost entirely rewritten by Alexandre Oliva
5 ## ------------------------
6 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
7 # 2006  Free Software Foundation, Inc.
9 # This file is free software; the Free Software Foundation
10 # gives unlimited permission to copy and/or distribute it,
11 # with or without modifications, as long as this notice is preserved.
13 # serial 10
15 # AM_PATH_LISPDIR
16 # ---------------
17 AC_DEFUN([AM_PATH_LISPDIR],
18 [AC_PREREQ([2.60])dnl
19  # If set to t, that means we are running in a shell under Emacs.
20  # If you have an Emacs named "t", then use the full path.
21  test x"$EMACS" = xt && EMACS=
22  AC_CHECK_PROGS([EMACS], [emacs xemacs], [no])
23  AC_ARG_VAR([EMACS], [the Emacs editor command])
24  AC_ARG_VAR([EMACSLOADPATH], [the Emacs library search path])
25  AC_ARG_WITH([lispdir],
26  [  --with-lispdir          override the default lisp directory],
27  [ lispdir="$withval"
28    AC_MSG_CHECKING([where .elc files should go])
29    AC_MSG_RESULT([$lispdir])],
30  [
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 \
41        -e 's,/$,,' \
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;}' \
44        conftest.out`
45        rm conftest.out
46      fi
47    fi
48    test -z "$am_cv_lispdir" && am_cv_lispdir='${datadir}/emacs/site-lisp'
49   ])
50   lispdir="$am_cv_lispdir"
52 AC_SUBST([lispdir])
53 ])# AM_PATH_LISPDIR
55 AU_DEFUN([ud_PATH_LISPDIR], [AM_PATH_LISPDIR])