bug-automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AM_PATH_LISPDIR and dist_lisp_DATA when emacs is not installed break


From: Alexandre Duret-Lutz
Subject: Re: AM_PATH_LISPDIR and dist_lisp_DATA when emacs is not installed breaks
Date: Tue, 21 Oct 2003 16:12:39 +0200
User-agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3 (gnu/linux)

>>> "Simon" == Simon Josefsson <address@hidden> writes:

[...]

 Simon> I rather liked the lisp_DATA construct.  In any case, I think doing
 Simon> what it did (i.e., no byte compilation) should be simple.  For many
 Simon> (if not most) packages, byte compiling is only harmful, so the
 Simon> developer should not have to go through weird workarounds to get that
 Simon> working.  I consider ELCFILES a weird workaround.

 Simon> Another alternative, that I prefer, would be to have lisp_DATA install
 Simon> into $prefix/share/emacs/site-lisp/ if $(lispdir) is empty.  Then it
 Simon> would consistent with other _DATA variables (unconditional install)
 Simon> and simple to use.

Great idea!  How about the following patch?

The only drawback is that $lispdir now has to be always defined,
and it was not the case previously.  I hope nobody was relying
on this (as Automake did in is uninstall/install rules for
_LISP, the lisp.am chunk of the patch).


2003-10-21  Alexandre Duret-Lutz  <address@hidden>

        * m4/lispdir.m4 (AM_PATH_LISPDIR): Always check for Emacs.
        Always define lispdir.
        * lib/am/lisp.am (install-%DIR%LISP, uninstall-%DIR%LISP): Check
        $(EMACS) to decide whether _LISP files must be installed,
        not $(lispdir).
        * doc/automake.texi (Emacs Lisp): Mention the two ways to install
        non byte-compiled Emacs lisp files.
        * tests/lisp4.test, tests/lisp5.test: Check "make install"
        when EMACS=no.
        Suggested by Simon Josefsson.

Index: NEWS
===================================================================
RCS file: /cvs/automake/automake/NEWS,v
retrieving revision 1.232
diff -u -r1.232 NEWS
--- NEWS        21 Oct 2003 13:11:38 -0000      1.232
+++ NEWS        21 Oct 2003 14:09:47 -0000
@@ -102,12 +102,14 @@
     (Former versions would try to use only the first of the input
     files.)
 
-* Obsolete features
-
   - lisp_DATA is now allowed.  If you are using the empty ELCFILES
     idiom to disable byte-compilation of lisp_LISP files, it is
-    recommended that you switch to using lisp_DATA.  ELCFILES is no
-    longer documented.
+    recommended that you switch to using lisp_DATA.  Note that
+    this is not strictly equivalent: lisp_DATA will install elisp
+    files even if emacs is not installed, while *_LISP do not
+    install anything unless emacs is found.
+
+* Obsolete features
 
   - AM_PROG_CC_STDC is now empty.  The content of this macro was
     merged in AC_PROG_CC.  If your code uses $am_cv_prog_cc_stdc, you
Index: doc/automake.texi
===================================================================
RCS file: /cvs/automake/automake/doc/automake.texi,v
retrieving revision 1.5
diff -u -r1.5 automake.texi
--- doc/automake.texi   30 Sep 2003 19:05:54 -0000      1.5
+++ doc/automake.texi   21 Oct 2003 14:09:52 -0000
@@ -4357,9 +4357,7 @@
 @code{AM_PATH_LISPDIR} (@pxref{Macros}).
 
 Automake will byte-compile all Emacs Lisp source files using the Emacs
-found by @code{AM_PATH_LISPDIR}, if any was found.  If you wish to
-avoid byte-compiling, use @code{lisp_DATA} instead of
address@hidden
+found by @code{AM_PATH_LISPDIR}, if any was found.
 
 Byte-compiled Emacs Lisp files are not portable among all versions of
 Emacs, so it makes sense to turn this off if you expect sites to have
@@ -4368,6 +4366,28 @@
 that you byte-compile your Emacs Lisp sources.  It is probably better
 for sites with strange setups to cope for themselves than to make the
 installation less nice for everybody else.
+
+There are two ways to avoid byte-compiling.  Historically, we have
+recommended the following construct.
address@hidden
+lisp_LISP = file1.el file2.el
+ELCFILES =
address@hidden example
address@hidden
address@hidden is an internal Automake variables that normally lists
+all @file{.elc} files that must be byte-compiled.  Automake defines
address@hidden automatically from @code{lisp_LISP}.  Emptying this
+variables explicitly prevents byte-compilation to occur.
+
+Since Automake 1.8, we now recommend using @code{lisp_DATA} instead.  As
+in
address@hidden
+lisp_DATA = file1.el file2.el
address@hidden example
+
+Note that these two constructs are not equivalent.  @code{_LISP} will
+not install a file if Emacs is not installed, while @code{_DATA} will
+always install its files.
 
 @node gettext
 @section Gettext
Index: lib/am/lisp.am
===================================================================
RCS file: /cvs/automake/automake/lib/am/lisp.am,v
retrieving revision 1.36
diff -u -r1.36 lisp.am
--- lib/am/lisp.am      6 Sep 2003 05:36:57 -0000       1.36
+++ lib/am/lisp.am      21 Oct 2003 14:09:52 -0000
@@ -58,8 +58,8 @@
 ?!EXEC?.PHONY install-data-am: install-%DIR%LISP
 install-%DIR%LISP: $(%DIR%_LISP) $(ELCFILES)
        @$(NORMAL_INSTALL)
-## lispdir might not be defined.
-       @if test -n "$(lispdir)"; then \
+## Do not install anything if EMACS was not found.
+       @if test "$(EMACS)" != no; then \
          $(mkinstalldirs) $(DESTDIR)$(%NDIR%dir); \
 ## Funny invocation because Makefile variable can be empty, leading to
 ## a syntax error in sh.
@@ -88,8 +88,8 @@
 .PHONY uninstall-am: uninstall-%DIR%LISP
 uninstall-%DIR%LISP:
        @$(NORMAL_UNINSTALL)
-## lispdir might not be defined.
-       @if test -n "$(lispdir)"; then \
+## Do not uninstall anything if EMACS was not found.
+       @if test "$(EMACS)" != no; then \
          list='$(%DIR%_LISP)'; for p in $$list; do \
 ?BASE?     f="`echo $$p | sed -e 's|^.*/||'`"; \
 ?!BASE?            f="$$p"; \
Index: m4/lispdir.m4
===================================================================
RCS file: /cvs/automake/automake/m4/lispdir.m4,v
retrieving revision 1.21
diff -u -r1.21 lispdir.m4
--- m4/lispdir.m4       15 Jun 2003 16:19:48 -0000      1.21
+++ m4/lispdir.m4       21 Oct 2003 14:09:52 -0000
@@ -27,7 +27,10 @@
 # AM_PATH_LISPDIR
 # ---------------
 AC_DEFUN([AM_PATH_LISPDIR],
-[AC_ARG_WITH([lispdir],
+[AC_CHECK_PROGS([EMACS], [emacs xemacs], [no])
+ AC_ARG_VAR([EMACS], [the Emacs editor command])
+ AC_ARG_VAR([EMACSLOADPATH], [the Emacs library search path])
+ AC_ARG_WITH([lispdir],
  [  --with-lispdir          Override the default lisp directory ],
  [ lispdir="$withval"
    AC_MSG_CHECKING([where .elc files should go])
@@ -36,13 +39,10 @@
  # If set to t, that means we are running in a shell under Emacs.
  # If you have an Emacs named "t", then use the full path.
  test x"$EMACS" = xt && EMACS=
- AC_CHECK_PROGS([EMACS], [emacs xemacs], [no])
- AC_ARG_VAR([EMACS], [the Emacs editor command])
- AC_ARG_VAR([EMACSLOADPATH], [the Emacs library search path])
- if test $EMACS != "no"; then
-   if test x${lispdir+set} != xset; then
-     AC_CACHE_CHECK([where .elc files should go], [am_cv_lispdir],
-       [# If $EMACS isn't GNU Emacs or XEmacs, this can blow up pretty badly
+ AC_CACHE_CHECK([where .elc files should go], [am_cv_lispdir], [
+   if test $EMACS != "no"; then
+     if test x${lispdir+set} != xset; then
+  # If $EMACS isn't GNU Emacs or XEmacs, this can blow up pretty badly
   # Some emacsen will start up in interactive mode, requiring C-x C-c to exit,
   #  which is non-obvious for non-emacs users.
   # Redirecting /dev/null should help a bit; pity we can't detect "broken"
@@ -54,13 +54,11 @@
        -e 
'/.*\/share\/x\?emacs\/site-lisp$/{s,.*/share/\(x\?emacs/site-lisp\),${datadir}/\1,;p;q;}'
 \
        conftest.out`
        rm conftest.out
-       if test -z "$am_cv_lispdir"; then
-        am_cv_lispdir='${datadir}/emacs/site-lisp'
-       fi
-     ])
-     lispdir="$am_cv_lispdir"
+     fi
    fi
- fi
+   test -z "$am_cv_lispdir" && am_cv_lispdir='${datadir}/emacs/site-lisp'
+  ])
+  lispdir="$am_cv_lispdir"
 ])
 AC_SUBST([lispdir])
 ])# AM_PATH_LISPDIR
Index: tests/lisp4.test
===================================================================
RCS file: /cvs/automake/automake/tests/lisp4.test,v
retrieving revision 1.1
diff -u -r1.1 lisp4.test
--- tests/lisp4.test    26 Feb 2003 20:11:18 -0000      1.1
+++ tests/lisp4.test    21 Oct 2003 14:09:52 -0000
@@ -34,6 +34,12 @@
        echo "(provide 'am-three)" > $@
 CLEANFILES = am-three.el
 
+test:
+       test ! -f am-one.elc
+       test ! -f am-two.elc
+       test ! -f am-three.elc
+       test ! -f elc-stamp
+
 install-test: install
        test -f $(lispdir)/am-one.el
        test -f $(lispdir)/am-two.el
@@ -41,6 +47,14 @@
        test ! -f $(lispdir)/am-one.elc
        test ! -f $(lispdir)/am-two.elc
        test ! -f $(lispdir)/am-three.elc
+
+install-test2: install
+       test ! -f $(lispdir)/am-one.el
+       test ! -f $(lispdir)/am-two.el
+       test ! -f $(lispdir)/am-three.el
+       test ! -f $(lispdir)/am-one.elc
+       test ! -f $(lispdir)/am-two.elc
+       test ! -f $(lispdir)/am-three.elc
 EOF
 
 cat >> configure.in << 'EOF'
@@ -55,13 +69,16 @@
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE --add-missing
-./configure --prefix "`pwd`"
 
+./configure --prefix "`pwd`"
 $MAKE
-
-test ! -f am-one.elc
-test ! -f am-two.elc
-test ! -f am-three.elc
-test ! -f elc-stamp
-
+$MAKE test
 $MAKE install-test
+$MAKE uninstall
+
+# Fake the absence of emacs.
+# *.el files should not be installed.
+./configure EMACS=no --prefix "`pwd`"
+$MAKE
+$MAKE test
+$MAKE install-test2
Index: tests/lisp5.test
===================================================================
RCS file: /cvs/automake/automake/tests/lisp5.test,v
retrieving revision 1.1
diff -u -r1.1 lisp5.test
--- tests/lisp5.test    26 Feb 2003 20:53:48 -0000      1.1
+++ tests/lisp5.test    21 Oct 2003 14:09:52 -0000
@@ -33,6 +33,12 @@
        echo "(provide 'am-three)" > $@
 CLEANFILES = am-three.el
 
+test:
+       test ! -f am-one.elc
+       test ! -f am-two.elc
+       test ! -f am-three.elc
+       test ! -f elc-stamp
+
 install-test: install
        test -f $(lispdir)/am-one.el
        test -f $(lispdir)/am-two.el
@@ -54,13 +60,16 @@
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE --add-missing
-./configure --prefix "`pwd`"
 
+./configure --prefix "`pwd`"
 $MAKE
-
-test ! -f am-one.elc
-test ! -f am-two.elc
-test ! -f am-three.elc
-test ! -f elc-stamp
-
+$MAKE test
+$MAKE install-test
+$MAKE uninstall
+
+# Fake the absence of emacs.
+# *.el files SHOULD be installed.
+./configure EMACS=no --prefix "`pwd`"
+$MAKE
+$MAKE test
 $MAKE install-test

-- 
Alexandre Duret-Lutz





reply via email to

[Prev in Thread] Current Thread [Next in Thread]