From 3276a2f5cff390511e9f4c4e882db765190263bd Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sun, 2 Jun 1996 22:00:34 +0000 Subject: [PATCH] Added Emacs Lisp handling --- ChangeLog | 18 +++++++++++++ Makefile.am | 20 ++++++++------- Makefile.in | 16 ++++++------ TODO | 19 ++++---------- aclocal.m4 | 32 +++++++++++++++++++++++ automake.in | 63 +++++++++++++++++++++++++++++++++++++++------- elisp-comp | 42 +++++++++++++++++++++++++++++++ lib/am/Makefile.am | 20 ++++++++------- lib/am/lisp.am | 33 ++++++++++++++++++++++++ lib/elisp-comp | 42 +++++++++++++++++++++++++++++++ lisp.am | 33 ++++++++++++++++++++++++ 11 files changed, 288 insertions(+), 50 deletions(-) create mode 100755 elisp-comp create mode 100644 lib/am/lisp.am create mode 100755 lib/elisp-comp create mode 100644 lisp.am diff --git a/ChangeLog b/ChangeLog index b1bb4a99..c0099aeb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,19 @@ Sun Jun 2 10:33:10 1996 Tom Tromey + * automake.in (handle_emacs_lisp): New function. + (initialize_global_constants): Added elisp-comp to + @common_sometimes. + (seen_lispdir): New global. + (scan_configure): Handle ud_PATH_LISPDIR. + + * elisp-comp: New file. + + * lisp.am: New file. + + * automake.in (generate_makefile): Run handle_emacs_lisp. + + * aclocal.m4 (ud_PATH_LISPDIR): New macro, from Ulrich Drepper. + * automake.in (initialize_global_constants): Removed version.texi from common_sometimes. (initialize_global_constants): Added texinfo.tex to common_files. @@ -14,6 +28,10 @@ Sun Jun 2 10:33:10 1996 Tom Tromey (read_am_file): Generate some extra variables when AC_CANONICAL_* used. (handle_options): Allow version number to have letters appended. + (handle_tests): Error if RUNTEST, RUNTESTFLAGS defined but dejagnu + option not specd. + (initialize_global_constants): install_man_format changed to + handle built man pages. Wed May 29 10:35:01 1996 Tom Tromey diff --git a/Makefile.am b/Makefile.am index 39c660a3..4d459ffa 100644 --- a/Makefile.am +++ b/Makefile.am @@ -18,10 +18,11 @@ mans-vars.am program.am programs.am remake-hdr.am remake-subd.am \ remake.am scripts.am subdirs.am tags.am tags-subd.am tags-clean.am \ texi-version.am texinfos-vars.am texinfos.am libraries-clean.am \ programs-clean.am data-clean.am COPYING INSTALL texinfo.tex ansi2knr.c \ -ansi2knr.1 aclocal.m4 +ansi2knr.1 aclocal.m4 lisp.am ## These must all be executable when installed. -pkgdata_SCRIPTS = config.guess config.sub install-sh mdate-sh mkinstalldirs +pkgdata_SCRIPTS = config.guess config.sub install-sh mdate-sh \ +mkinstalldirs elisp-comp CLEANFILES = automake @@ -40,22 +41,23 @@ installcheck-local: $(PERL) -e "exit ! -x '$(pkgdatadir)/mdate-sh';" $(PERL) -e "exit ! -x '$(pkgdatadir)/mkinstalldirs';" -# Some simple checks: -# * syntax check with perl4 and perl5. -# * make sure the scripts don't use 'true' -# * expect no instances of '${...}' -# These are only really guaranteed to work on my machine. +# Some simple checks, and then ordinary check. These are only really +# guaranteed to work on my machine. maintainer-check: automake -## Do syntax, etc, checks before make check. +## Syntax check with default Perl (on my machine, Perl 5). $(PERL) -c -w automake +## Ensure `true' is never used; I've accidentally used it before. @if grep '^[^#].*true' $(srcdir)/[a-z]*.am; then \ echo "can't use 'true' in GNU Makefile" 1>&2; \ exit 1; \ else :; fi - @if test `fgrep '$${' $(srcdir)/[a-z]*.am | wc -l` -ne 0; then \ +## expect no instances of '${...}'. However, $${...} is ok, since that +## is a shell construct, not a Makefile construct. + @if test `fgrep '$${' $(srcdir)/[a-z]*.am | fgrep -v '$$$$' | wc -l` -ne 0; then \ echo "found too many uses of '\$${'" 1>&2; \ exit 1; \ fi +## Another syntax check, this time with Perl 4, if it exists. if $(SHELL) -c 'perl4.036 -v' >/dev/null 2>&1; then \ perl4.036 -c -w automake; \ else :; fi diff --git a/Makefile.in b/Makefile.in index aee9c953..3c47ce18 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated automatically by automake 1.0 from Makefile.am +# Makefile.in generated automatically by automake 1.1a from Makefile.am # Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation @@ -56,9 +56,10 @@ mans-vars.am program.am programs.am remake-hdr.am remake-subd.am \ remake.am scripts.am subdirs.am tags.am tags-subd.am tags-clean.am \ texi-version.am texinfos-vars.am texinfos.am libraries-clean.am \ programs-clean.am data-clean.am COPYING INSTALL texinfo.tex ansi2knr.c \ -ansi2knr.1 aclocal.m4 +ansi2knr.1 aclocal.m4 lisp.am -pkgdata_SCRIPTS = config.guess config.sub install-sh mdate-sh mkinstalldirs +pkgdata_SCRIPTS = config.guess config.sub install-sh mdate-sh \ +mkinstalldirs elisp-comp CLEANFILES = automake @@ -410,18 +411,15 @@ installcheck-local: $(PERL) -e "exit ! -x '$(pkgdatadir)/mdate-sh';" $(PERL) -e "exit ! -x '$(pkgdatadir)/mkinstalldirs';" -# Some simple checks: -# * syntax check with perl4 and perl5. -# * make sure the scripts don't use 'true' -# * expect no instances of '${...}' -# These are only really guaranteed to work on my machine. +# Some simple checks, and then ordinary check. These are only really +# guaranteed to work on my machine. maintainer-check: automake $(PERL) -c -w automake @if grep '^[^#].*true' $(srcdir)/[a-z]*.am; then \ echo "can't use 'true' in GNU Makefile" 1>&2; \ exit 1; \ else :; fi - @if test `fgrep '$${' $(srcdir)/[a-z]*.am | wc -l` -ne 0; then \ + @if test `fgrep '$${' $(srcdir)/[a-z]*.am | fgrep -v '$$$$' | wc -l` -ne 0; then \ echo "found too many uses of '\$${'" 1>&2; \ exit 1; \ fi diff --git a/TODO b/TODO index a065d34e..3622f021 100644 --- a/TODO +++ b/TODO @@ -5,13 +5,6 @@ consider supporting "var+= stuff" syntax. rewrite to just var=... on output. This is sometimes convenient when you want to write a Makefile.am in more-or-less modular parts -dejagnu support: -* create site.exp based on known things: tool, srcdir, objdir, - maybe host_alias, host_triplet, target_alias, target_triplet, - build_triplet (depending on whether AC_CANONICAL_* is used) -* use RUNTEST_FOR_TARGET in some cases? -* defining RUNTEST, RUNTESTFLAGS should require dejagnu option - should be able to determine what is built by looking at rules (and configure.in). Then built man pages (eg) could automatically be omitted from the distribution. @@ -34,8 +27,6 @@ to fully support libtool ("grody compilation issue") If @LIBOBJS@ or @ALLOCA@ appears in _LDADD or _LIBADD, put it into dependencies automatically -Man pages can be generated - * ansi2knr.c needs STDC_HEADERS and HAVE_STRING_H [ I've asked François about this. The change should probably be in the fp_C_PROTOTYPES macro ] @@ -43,14 +34,11 @@ Man pages can be generated Think about: maybe "make check" should just bomb if error occurs? Then user must use "make -k check". This is probably more natural. -Consider: should Gnits require jm_MAINTAINER_MODE? - Consider: "cvs" option adds some cvs-specific rules? Consider adding an option that statically rewrites @MAINT@ to "#M#". (this would be useful at Cygnus) - Automake and Cygnus: info target separate from all. Always make install-info target. install-info separate from install. @@ -97,8 +85,6 @@ Need way to say there are no suffixes in a Makefile (Franc,ois' Check to make sure various scripts are executable (IE when looking for them in a directory) -Think about ways to make automake fit better with Cygnus-style trees. - Use recode in dist target when MAINT_CHARSET specified. Read caveats in automake.in before doing this. Note the same problem used to apply to the no-dependencies option; maybe it still should? Note also that @@ -229,6 +215,9 @@ some support for this. Here are some of the issues: * Should handle AC_CONFIG_SUBDIRS, ie must handle configure.in in subdirs * Must handle SUBDIRS in subdir Makefile.am's +dejagnu support: +* use RUNTEST_FOR_TARGET in some cases? + These can both be handled via dist-hook: . Consider supporting guile-style PLUGIN directories automatically? . Consider allowing eg "foo/bar" to appear in EXTRA_DIST, and generating @@ -284,6 +273,8 @@ document TAGS_DEPENDENCIES document new variables introduced when AC_CANONICAL_* used +document _LISP handling + ================================================================ Libraries: diff --git a/aclocal.m4 b/aclocal.m4 index 4f5c34dc..1b98e693 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -103,3 +103,35 @@ AC_DEFUN(jm_MAINTAINER_MODE, AC_SUBST(MAINT)dnl ] ) + +## ------------------------ +## Emacs LISP file handling +## ------------------------ +AC_DEFUN(ud_PATH_LISPDIR, + [AC_PATH_PROG(EMACS, emacs, no) + if test $EMACS != "no"; then + AC_MSG_CHECKING([where .elc files should go]) + dnl Set default value + lispdir="\$(datadir)/emacs/site-lisp" + if test "x$prefix" = "xNONE"; then + if test -d $ac_default_prefix/share/emacs/site-lisp; then + lispdir="\$(prefix)/share/emacs/site-lisp" + else + if test -d $ac_default_prefix/lib/emacs/site-lisp; then + lispdir="\$(prefix)/lib/emacs/site-lisp" + fi + fi + else + if test -d $prefix/share/emacs/site-lisp; then + lispdir="\$(prefix)/share/emacs/site-lisp" + else + if test -d $prefix/lib/emacs/site-lisp; then + lispdir="\$(prefix)/lib/emacs/site-lisp" + fi + fi + fi + AC_MSG_RESULT($lispdir) + ELCFILES="\$(ELCFILES)" + fi + AC_SUBST(lispdir) + AC_SUBST(ELCFILES)]) diff --git a/automake.in b/automake.in index da1b7654..e9dedc35 100755 --- a/automake.in +++ b/automake.in @@ -156,6 +156,9 @@ $seen_maint_mode = 0; $seen_package = 0; $seen_version = 0; +# TRUE if we've seen ud_PATH_LISPDIR. +$seen_lispdir = 0; + # Charsets used by maintainer and in distribution. MAINT_CHARSET is # handled in a funny way: if seen in the top-level Makefile.am, it is @@ -383,6 +386,7 @@ sub generate_makefile $contents{'OBJECTS'} = join (' ', @objects); &handle_texinfo; + &handle_emacs_lisp; &handle_man_pages; &handle_data; &handle_headers; @@ -1896,14 +1900,6 @@ sub handle_phony # Handle TESTS variable and other checks. sub handle_tests { - if (&variable_defined ('DEJATOOL') && ! defined $options{'dejagnu'}) - { - # Error. - &am_line_error ('DEJATOOL', - "\`DEJATOOL' defined but \`dejagnu' not in \`AUTOMAKE_OPTIONS'"); - return; - } - if (defined $options{'dejagnu'}) { push (@check, 'check-DEJAGNU'); @@ -1945,6 +1941,17 @@ sub handle_tests $output_rules .= ("\t\@echo '## All variables above are generated by configure. Do Not Edit ##' >> site.exp\n" . "\t-\@sed '1,/^## All variables above are.*##/ d' site.bak >> site.exp\n"); } + else + { + local ($c); + foreach $c ('DEJATOOL', 'RUNTEST', 'RUNTESTFLAGS') + { + if (&variable_defined ($c)) + { + &am_line_error ($c, "\`$c' defined but \`dejagnu' not in \`AUTOMAKE_OPTIONS'"); + } + } + } if (&variable_defined ('TESTS')) { @@ -1979,6 +1986,40 @@ sub handle_tests } } +# Handle Emacs Lisp. +sub handle_emacs_lisp +{ + local (@elfiles) = &am_install_var ('lisp', 'LISP', 'lisp', 'noinst'); + + if (@elfiles) + { + # Found some lisp. + $output_vars .= "lispdir = \@lispdir\@\n"; + $output_rules .= (".el.elc:\n" + . "\t\@echo 'WARNING: Warnings can be ignored. :-)'\n" + . "\t\$(SHELL) \$(srcdir)/elisp-comp \$<\n"); + push (@suffixes, '.el', '.elc'); + + # Generate .elc files. + grep ($_ .= 'c', @elfiles); + &pretty_print ('ELCFILES =', '', @elfiles); + + local ($varname); + if (&variable_defined ('lisp_LISP')) + { + $varname = 'lisp_LISP'; + &am_error ("\`lisp_LISP' defined but \`ud_PATH_LISPDIR' not in \`configure.in'") + if ! $seen_lispdir; + } + else + { + $varname = 'noinst_LISP'; + } + &require_file_with_line ($varname, $FOREIGN, 'elisp-comp'); + + } +} + ################################################################ # Scan configure.in for interesting things. @@ -2141,6 +2182,8 @@ sub scan_configure $seen_prog_install = 1 if ! $seen_prog_install && /AC_PROG_INSTALL/; $seen_prog_install = 2 if /fp_PROG_INSTALL/; + $seen_lispdir = 1 if /ud_PATH_LISPDIR/; + if (/AC_PROG_LIBTOOL/ || /gm_PROG_LIBTOOL/) { $seen_libtool = 1; @@ -2482,6 +2525,8 @@ sub initialize_global_constants ' @sect=@SECTION@; \\ inst=`echo "@MANBASE@" | sed \'$(transform)\'`.@FULLSECT@; \\ echo installing @MAN@ as $(mandir)/man$$sect/$$inst; \\ + if test -f $(srcdir)/@MAN@; then file=$(srcdir)/@MAN@; \\ + else file=@MAN@; fi; \\ $(INSTALL_DATA) $(srcdir)/@MAN@ $(mandir)/man$$sect/$$inst '; @@ -2506,7 +2551,7 @@ sub initialize_global_constants ( "aclocal.m4", "acconfig.h", "config.h.top", "config.h.bot", "stamp-h.in", "ansi2knr.c", - "ansi2knr.1", 'stamp-vti' + "ansi2knr.1", 'stamp-vti', 'elisp-comp' ); $USAGE = "\ diff --git a/elisp-comp b/elisp-comp new file mode 100755 index 00000000..d9adbfee --- /dev/null +++ b/elisp-comp @@ -0,0 +1,42 @@ +#!/bin/sh +# Copyright (C) 1995 Free Software Foundation, Inc. +# François Pinard , 1995. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# This script byte-compiles all `.el' files which are part of its +# arguments, using GNU Emacs, and put the resulting `.elc' files into +# the current directory, so disregarding the original directories used +# in `.el' arguments. +# +# This script manages in such a way that all Emacs LISP files to +# be compiled are made visible between themselves, in the event +# they require or load-library one another. + +if test $# = 0; then + echo 1>&2 "No files given to $0" +else + tempdir=elc.$$ + mkdir $tempdir + cp $* $tempdir + cd $tempdir + + echo "(setq load-path (cons nil load-path))" > script + emacs -batch -l script -f batch-byte-compile *.el + mv *.elc .. + + cd .. + rm -fr $tempdir +fi diff --git a/lib/am/Makefile.am b/lib/am/Makefile.am index 39c660a3..4d459ffa 100644 --- a/lib/am/Makefile.am +++ b/lib/am/Makefile.am @@ -18,10 +18,11 @@ mans-vars.am program.am programs.am remake-hdr.am remake-subd.am \ remake.am scripts.am subdirs.am tags.am tags-subd.am tags-clean.am \ texi-version.am texinfos-vars.am texinfos.am libraries-clean.am \ programs-clean.am data-clean.am COPYING INSTALL texinfo.tex ansi2knr.c \ -ansi2knr.1 aclocal.m4 +ansi2knr.1 aclocal.m4 lisp.am ## These must all be executable when installed. -pkgdata_SCRIPTS = config.guess config.sub install-sh mdate-sh mkinstalldirs +pkgdata_SCRIPTS = config.guess config.sub install-sh mdate-sh \ +mkinstalldirs elisp-comp CLEANFILES = automake @@ -40,22 +41,23 @@ installcheck-local: $(PERL) -e "exit ! -x '$(pkgdatadir)/mdate-sh';" $(PERL) -e "exit ! -x '$(pkgdatadir)/mkinstalldirs';" -# Some simple checks: -# * syntax check with perl4 and perl5. -# * make sure the scripts don't use 'true' -# * expect no instances of '${...}' -# These are only really guaranteed to work on my machine. +# Some simple checks, and then ordinary check. These are only really +# guaranteed to work on my machine. maintainer-check: automake -## Do syntax, etc, checks before make check. +## Syntax check with default Perl (on my machine, Perl 5). $(PERL) -c -w automake +## Ensure `true' is never used; I've accidentally used it before. @if grep '^[^#].*true' $(srcdir)/[a-z]*.am; then \ echo "can't use 'true' in GNU Makefile" 1>&2; \ exit 1; \ else :; fi - @if test `fgrep '$${' $(srcdir)/[a-z]*.am | wc -l` -ne 0; then \ +## expect no instances of '${...}'. However, $${...} is ok, since that +## is a shell construct, not a Makefile construct. + @if test `fgrep '$${' $(srcdir)/[a-z]*.am | fgrep -v '$$$$' | wc -l` -ne 0; then \ echo "found too many uses of '\$${'" 1>&2; \ exit 1; \ fi +## Another syntax check, this time with Perl 4, if it exists. if $(SHELL) -c 'perl4.036 -v' >/dev/null 2>&1; then \ perl4.036 -c -w automake; \ else :; fi diff --git a/lib/am/lisp.am b/lib/am/lisp.am new file mode 100644 index 00000000..cbfe5443 --- /dev/null +++ b/lib/am/lisp.am @@ -0,0 +1,33 @@ +## automake - create Makefile.in from Makefile.am +## Copyright (C) 1996 Free Software Foundation, Inc. + +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. + +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. + +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software +## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +## 02111-1307, USA. +install-@DIR@LISP: $(@DIR@_LISP) $(ELCFILES) + $(mkinstalldirs) $(@DIR@dir) +## Funny invocation because Makefile variable can be empty, leading to +## a syntax error in sh. + list="$(@DIR@_LISP)"; for p in $$list; do \ + $(INSTALL_DATA) $(srcdir)/$$p $(@DIR@dir)/$$p; \ +## Only install .elc file if it exists. + if test -f $${p}c; then + $(INSTALL_DATA) $${p}c $(@DIR@dir)/$${p}c; \ + else : ; fi; \ + done + +uninstall-@DIR@LISP: + list="$(@DIR@_LISP)"; for p in $$list; do \ + rm -f $(@DIR@dir)/$$p $(@DIR@dir)/$${p}c; \ + done diff --git a/lib/elisp-comp b/lib/elisp-comp new file mode 100755 index 00000000..d9adbfee --- /dev/null +++ b/lib/elisp-comp @@ -0,0 +1,42 @@ +#!/bin/sh +# Copyright (C) 1995 Free Software Foundation, Inc. +# François Pinard , 1995. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# This script byte-compiles all `.el' files which are part of its +# arguments, using GNU Emacs, and put the resulting `.elc' files into +# the current directory, so disregarding the original directories used +# in `.el' arguments. +# +# This script manages in such a way that all Emacs LISP files to +# be compiled are made visible between themselves, in the event +# they require or load-library one another. + +if test $# = 0; then + echo 1>&2 "No files given to $0" +else + tempdir=elc.$$ + mkdir $tempdir + cp $* $tempdir + cd $tempdir + + echo "(setq load-path (cons nil load-path))" > script + emacs -batch -l script -f batch-byte-compile *.el + mv *.elc .. + + cd .. + rm -fr $tempdir +fi diff --git a/lisp.am b/lisp.am new file mode 100644 index 00000000..cbfe5443 --- /dev/null +++ b/lisp.am @@ -0,0 +1,33 @@ +## automake - create Makefile.in from Makefile.am +## Copyright (C) 1996 Free Software Foundation, Inc. + +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. + +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. + +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software +## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +## 02111-1307, USA. +install-@DIR@LISP: $(@DIR@_LISP) $(ELCFILES) + $(mkinstalldirs) $(@DIR@dir) +## Funny invocation because Makefile variable can be empty, leading to +## a syntax error in sh. + list="$(@DIR@_LISP)"; for p in $$list; do \ + $(INSTALL_DATA) $(srcdir)/$$p $(@DIR@dir)/$$p; \ +## Only install .elc file if it exists. + if test -f $${p}c; then + $(INSTALL_DATA) $${p}c $(@DIR@dir)/$${p}c; \ + else : ; fi; \ + done + +uninstall-@DIR@LISP: + list="$(@DIR@_LISP)"; for p in $$list; do \ + rm -f $(@DIR@dir)/$$p $(@DIR@dir)/$${p}c; \ + done -- 2.43.5