gitlog-to-changelog: don't use "no_"-prefixed variable name
[gnulib.git] / build-aux / elisp-comp
1 #!/bin/sh
2 # Copyright (C) 1995, 2000, 2003, 2004, 2005, 2009, 2010 Free Software
3 # Foundation, Inc.
4
5 scriptversion=2010-02-06.18; # UTC
6
7 # Franc,ois Pinard <pinard@iro.umontreal.ca>, 1995.
8 #
9 # This program is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 2, or (at your option)
12 # any later version.
13 #
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 # GNU General Public License for more details.
18 #
19 # You should have received a copy of the GNU General Public License
20 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
21
22 # As a special exception to the GNU General Public License, if you
23 # distribute this file as part of a program that contains a
24 # configuration script generated by Autoconf, you may include it under
25 # the same distribution terms that you use for the rest of that program.
26
27 # This file is maintained in Automake, please report
28 # bugs to <bug-automake@gnu.org> or send patches to
29 # <automake-patches@gnu.org>.
30
31 case $1 in
32   '')
33      echo "$0: No files.  Try '$0 --help' for more information." 1>&2
34      exit 1;
35      ;;
36   -h | --h*)
37     cat <<\EOF
38 Usage: elisp-comp [--help] [--version] FILES...
39
40 This script byte-compiles all '.el' files listed as FILES using GNU
41 Emacs, and put the resulting '.elc' files into the current directory,
42 so disregarding the original directories used in '.el' arguments.
43
44 This script manages in such a way that all Emacs LISP files to
45 be compiled are made visible between themselves, in the event
46 they require or load-library one another.
47
48 Report bugs to <bug-automake@gnu.org>.
49 EOF
50     exit $?
51     ;;
52   -v | --v*)
53     echo "elisp-comp $scriptversion"
54     exit $?
55     ;;
56 esac
57
58 if test -z "$EMACS" || test "$EMACS" = "t"; then
59   # Value of "t" means we are running in a shell under Emacs.
60   # Just assume Emacs is called "emacs".
61   EMACS=emacs
62 fi
63
64 tempdir=elc.$$
65
66 # Cleanup the temporary directory on exit.
67 trap 'ret=$?; rm -rf "$tempdir" && exit $ret' 0
68 do_exit='(exit $ret); exit $ret'
69 trap "ret=129; $do_exit" 1
70 trap "ret=130; $do_exit" 2
71 trap "ret=141; $do_exit" 13
72 trap "ret=143; $do_exit" 15
73
74 mkdir $tempdir
75 cp "$@" $tempdir
76
77 (
78   cd $tempdir
79   echo "(setq load-path (cons nil load-path))" > script
80   $EMACS -batch -q -l script -f batch-byte-compile *.el || exit $?
81   mv *.elc ..
82 ) || exit $?
83
84 (exit 0); exit 0
85
86 # Local Variables:
87 # mode: shell-script
88 # sh-indentation: 2
89 # eval: (add-hook 'write-file-hooks 'time-stamp)
90 # time-stamp-start: "scriptversion="
91 # time-stamp-format: "%:y-%02m-%02d.%02H"
92 # time-stamp-time-zone: "UTC"
93 # time-stamp-end: "; # UTC"
94 # End: