543 |
# AC_LISPIFY_DIR |
# AC_LISPIFY_DIR |
544 |
# First argument is a variable name where a lisp expression is to be |
# First argument is a variable name where a lisp expression is to be |
545 |
# substituted with AC_SUBST and "lisp" prepended. |
# substituted with AC_SUBST and "lisp" prepended. |
546 |
# If the expression is not an absolute path, it is evaluated relative |
# lispdir is used for two purposes: any relative names are resolved |
547 |
# to the current file name. |
# relative to lispdir, and the lispification uses relative file names |
548 |
|
# in relation to the second argument if the target dir is in the |
549 |
|
# lispdir hierarchy. |
550 |
AC_DEFUN(AC_LISPIFY_DIR,[ |
AC_DEFUN(AC_LISPIFY_DIR,[ |
551 |
tmpdir="[$]{$1}" |
tmpdir="[$]{$1}" |
552 |
AC_FULL_EXPAND(tmpdir) |
AC_FULL_EXPAND(tmpdir) |
553 |
|
explispdir="[$]{lispdir}" |
554 |
|
AC_FULL_EXPAND(explispdir) |
555 |
|
expstartup=$2 |
556 |
|
AC_FULL_EXPAND(expstartup) |
557 |
EMACS_LISP([lisp$1],[[(progn (setq path (directory-file-name path)) |
EMACS_LISP([lisp$1],[[(progn (setq path (directory-file-name path)) |
558 |
(unless (string= (car load-path) (directory-file-name (car load-path))) |
(unless (string= (car load-path) (directory-file-name (car load-path))) |
559 |
(setq path (file-name-as-directory path))) |
(setq path (file-name-as-directory path))) |
560 |
|
(setq path (expand-file-name path lispdir)) |
561 |
|
(setq startup (expand-file-name startup lispdir)) |
562 |
(prin1-to-string |
(prin1-to-string |
563 |
(if (file-name-absolute-p path) |
(if (or (string-match \"\\\\\`\\\\.\\\\.\" |
564 |
(expand-file-name path) |
(setq relname (file-relative-name startup lispdir))) |
565 |
(backquote (expand-file-name (, path) |
(file-name-absolute-p relname) |
566 |
(file-name-directory load-file-name))))))]],-no-site-file,path,["${tmpdir}"]) |
(string-match \"\\\\\`\\\\.\\\\.\" |
567 |
AC_SUBST([lisp$1])]) |
(setq relname (file-relative-name path lispdir))) |
568 |
|
(file-name-absolute-p relname)) |
569 |
# AC_MAKE_FILENAME_ABSOLUTE |
path |
570 |
# This makes variable $1 absolute if it is not already so, by prepending |
\`(expand-file-name |
571 |
# $2 as a string. This won't work in Windows with drive-relative path names. |
,(file-relative-name path (file-name-directory startup)) |
572 |
# Just don't use them. |
load-file-name))))]],-no-site-file,[[path lispdir startup]], |
573 |
AC_DEFUN(AC_MAKE_FILENAME_ABSOLUTE,[ |
[["${tmpdir}" "${explispdir}" "${expstartup}"]]) |
574 |
tmpdir="[$]{$1}" |
AC_SUBST([lisp$1]) |
575 |
AC_FULL_EXPAND(tmpdir) |
AC_SUBST([$1])]) |
|
case "${tmpdir}" in |
|
|
[[\\/]]* | ?:[[\\/]]* ) # Absolute |
|
|
;; |
|
|
*) |
|
|
$1=$2"[$]{$1}";; |
|
|
esac |
|
|
AC_SUBST([$1])]) |
|
|
|
|
|
AC_DEFUN(EMACS_LISP_RELATIVE,[ |
|
|
AC_ARG_WITH($1,[[ --with-$1=DIR Where to find $2, |
|
|
relative to the Lisp startup file.]], |
|
|
[$1=["${withval}"]]) |
|
|
AC_LISPIFY_DIR([$1])]) |
|