lispdir.m4 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. ## ------------------------ -*- Autoconf -*-
  2. ## Emacs LISP file handling
  3. ## From Ulrich Drepper
  4. ## Almost entirely rewritten by Alexandre Oliva
  5. ## ------------------------
  6. # Copyright (C) 1996-2017 Free Software Foundation, Inc.
  7. #
  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.
  11. # AM_PATH_LISPDIR
  12. # ---------------
  13. AC_DEFUN([AM_PATH_LISPDIR],
  14. [AC_PREREQ([2.60])dnl
  15. # If set to t, that means we are running in a shell under Emacs.
  16. # If you have an Emacs named "t", then use the full path.
  17. test x"$EMACS" = xt && EMACS=
  18. AC_CHECK_PROGS([EMACS], [emacs xemacs], [no])
  19. AC_ARG_VAR([EMACS], [the Emacs editor command])
  20. AC_ARG_VAR([EMACSLOADPATH], [the Emacs library search path])
  21. AC_ARG_WITH([lispdir],
  22. [AS_HELP_STRING([--with-lispdir],
  23. [override the default lisp directory])],
  24. [ lispdir="$withval"
  25. AC_MSG_CHECKING([where .elc files should go])
  26. AC_MSG_RESULT([$lispdir])],
  27. [
  28. AC_CACHE_CHECK([where .elc files should go], [am_cv_lispdir], [
  29. if test $EMACS != "no"; then
  30. if test x${lispdir+set} != xset; then
  31. # If $EMACS isn't GNU Emacs or XEmacs, this can blow up pretty badly
  32. # Some emacsen will start up in interactive mode, requiring C-x C-c to exit,
  33. # which is non-obvious for non-emacs users.
  34. # Redirecting /dev/null should help a bit; pity we can't detect "broken"
  35. # emacsen earlier and avoid running this altogether.
  36. 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])
  37. am_cv_lispdir=`sed -n \
  38. -e 's,/$,,' \
  39. -e '/.*\/lib\/x*emacs\/site-lisp$/{s,.*/lib/\(x*emacs/site-lisp\)$,${libdir}/\1,;p;q;}' \
  40. -e '/.*\/share\/x*emacs\/site-lisp$/{s,.*/share/\(x*emacs/site-lisp\),${datarootdir}/\1,;p;q;}' \
  41. conftest.out`
  42. rm conftest.out
  43. fi
  44. fi
  45. test -z "$am_cv_lispdir" && am_cv_lispdir='${datadir}/emacs/site-lisp'
  46. ])
  47. lispdir="$am_cv_lispdir"
  48. ])
  49. AC_SUBST([lispdir])
  50. ])# AM_PATH_LISPDIR