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