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