From 210797967ab1c23332a32de3e691c98d4e018cdd Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Sun, 9 Nov 2003 00:10:50 +0000 Subject: [PATCH] * lib/mkinstalldirs: Mention automake-patches@gnu.org and bug-automake@gnu.org. * lib/compile, lib/depcomp, lib/elisp-comp, lib/mdate-sh: Likewise. Also add support for --help and --version. * lib/py-compile, lib/ylwrap: Likewise, and reindent. --- ChangeLog | 8 ++ NEWS | 3 +- lib/compile | 105 +++++++++++++++------- lib/depcomp | 43 ++++++++- lib/elisp-comp | 53 ++++++++--- lib/mdate-sh | 37 ++++++++ lib/mkinstalldirs | 12 ++- lib/py-compile | 60 ++++++++----- lib/ylwrap | 220 +++++++++++++++++++++++++++------------------- 9 files changed, 378 insertions(+), 163 deletions(-) diff --git a/ChangeLog b/ChangeLog index b0aaf657a..d1e04bed7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2003-11-09 Alexandre Duret-Lutz + + * lib/mkinstalldirs: Mention automake-patches@gnu.org and + bug-automake@gnu.org. + * lib/compile, lib/depcomp, lib/elisp-comp, lib/mdate-sh: + Likewise. Also add support for --help and --version. + * lib/py-compile, lib/ylwrap: Likewise, and reindent. + 2003-11-08 Alexandre Duret-Lutz * lib/am/tags.am (ETAGSFLAGS, CTAGSFLAGS): Remove. diff --git a/NEWS b/NEWS index 8e8139040..9179e408a 100644 --- a/NEWS +++ b/NEWS @@ -80,7 +80,8 @@ New in 1.7a: - New option no-dist. - - install-sh now understands --version and --help. + - compile, depcomp, elisp-comp, install-sh, mdate-sh, mkinstalldirs, + py-compile, and ylwrap, now all understand --version and --help. - Automake will now recognize AC_CONFIG_LINKS so far as removing created links as part of the distclean target and including source files in diff --git a/lib/compile b/lib/compile index 9bb997a6a..a81e000ae 100755 --- a/lib/compile +++ b/lib/compile @@ -1,8 +1,9 @@ #! /bin/sh - # Wrapper for compilers which do not understand `-c -o'. -# Copyright 1999, 2000 Free Software Foundation, Inc. +scriptversion=2003-11-09.00 + +# Copyright (C) 1999, 2000, 2003 Free Software Foundation, Inc. # Written by Tom Tromey . # # This program is free software; you can redistribute it and/or modify @@ -24,9 +25,36 @@ # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. -# Usage: -# compile PROGRAM [ARGS]... -# `-o FOO.o' is removed from the args passed to the actual compile. +# This file is maintained in Automake, please report +# bugs to or send patches to +# . + +case $1 in + '') + echo "$0: No command. Try \`$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: compile [--help] [--version] PROGRAM [ARGS] + +Wrapper for compilers which do not understand `-c -o'. +Remove `-o dest.o' from ARGS, run PROGRAM with the remaining +arguments, and rename the output as expected. + +If you are trying to build a whole package this is not the +right script to run: please start by reading the file `INSTALL'. + +Report bugs to . +EOF + exit 0 + ;; + -v | --v*) + echo "compile $scriptversion" + exit 0 + ;; +esac + prog=$1 shift @@ -35,39 +63,39 @@ ofile= cfile= args= while test $# -gt 0; do - case "$1" in + case "$1" in -o) - # configure might choose to run compile as `compile cc -o foo foo.c'. - # So we do something ugly here. - ofile=$2 - shift - case "$ofile" in + # configure might choose to run compile as `compile cc -o foo foo.c'. + # So we do something ugly here. + ofile=$2 + shift + case "$ofile" in *.o | *.obj) - ;; + ;; *) - args="$args -o $ofile" - ofile= - ;; - esac + args="$args -o $ofile" + ofile= + ;; + esac ;; *.c) - cfile=$1 - args="$args $1" - ;; + cfile=$1 + args="$args $1" + ;; *) - args="$args $1" - ;; - esac - shift + args="$args $1" + ;; + esac + shift done if test -z "$ofile" || test -z "$cfile"; then - # If no `-o' option was seen then we might have been invoked from a - # pattern rule where we don't need one. That is ok -- this is a - # normal compilation that the losing compiler can handle. If no - # `.c' file was seen then we are probably linking. That is also - # ok. - exec "$prog" $args + # If no `-o' option was seen then we might have been invoked from a + # pattern rule where we don't need one. That is ok -- this is a + # normal compilation that the losing compiler can handle. If no + # `.c' file was seen then we are probably linking. That is also + # ok. + exec "$prog" $args fi # Name of file we expect compiler to create. @@ -79,10 +107,10 @@ cofile=`echo $cfile | sed -e 's|^.*/||' -e 's/\.c$/.o/'` # object file name, since that is what matters with a parallel build. lockdir=`echo $cofile | sed -e 's|[/.-]|_|g'`.d while true; do - if mkdir $lockdir > /dev/null 2>&1; then - break - fi - sleep 1 + if mkdir $lockdir > /dev/null 2>&1; then + break + fi + sleep 1 done # FIXME: race condition here if user kills between mkdir and trap. trap "rmdir $lockdir; exit 1" 1 2 15 @@ -92,8 +120,17 @@ trap "rmdir $lockdir; exit 1" 1 2 15 status=$? if test -f "$cofile"; then - mv "$cofile" "$ofile" + mv "$cofile" "$ofile" fi rmdir $lockdir exit $status + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/lib/depcomp b/lib/depcomp index dcb2b19d5..9e5522d04 100755 --- a/lib/depcomp +++ b/lib/depcomp @@ -1,6 +1,8 @@ #! /bin/sh - # depcomp - compile a program generating dependencies as side-effects + +scriptversion=2003-11-08.23 + # Copyright (C) 1999, 2000, 2003 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify @@ -25,6 +27,36 @@ # Originally written by Alexandre Oliva . +case $1 in + '') + echo "$0: No command. Try \`$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: depcomp [--help] [--version] PROGRAM [ARGS] + +Run PROGRAMS ARGS to compile a file, generating dependencies +as side-effects. + +Environment variables: + depmode Dependency tracking mode. + source Source file read by `PROGRAMS ARGS'. + object Object file output by `PROGRAMS ARGS'. + depfile Dependency file to output. + tmpdepfile Temporary file to use when outputing dependencies. + libtool Whether libtool is used (yes/no). + +Report bugs to . +EOF + exit 0 + ;; + -v | --v*) + echo "depcomp $scriptversion" + exit 0 + ;; +esac + if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 @@ -477,3 +509,12 @@ none) esac exit 0 + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/lib/elisp-comp b/lib/elisp-comp index 00898596b..489ae83d7 100755 --- a/lib/elisp-comp +++ b/lib/elisp-comp @@ -1,5 +1,8 @@ #!/bin/sh # Copyright (C) 1995, 2000, 2003 Free Software Foundation, Inc. + +scriptversion=2003-11-08.23 + # Franc,ois Pinard , 1995. # # This program is free software; you can redistribute it and/or modify @@ -21,19 +24,36 @@ # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. -# 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. +# This file is maintained in Automake, please report +# bugs to or send patches to +# . -if test $# = 0; then - echo 1>&2 "No files given to $0" - exit 1 -fi +case $1 in + '') + echo "$0: No files. Try \`$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: elisp-comp [--help] [--version] FILES... + +This script byte-compiles all `.el' files listed as FILES 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. + +Report bugs to . +EOF + exit 0 + ;; + -v | --v*) + echo "elisp-comp $scriptversion" + exit 0 + ;; +esac if test -z "$EMACS" || test "$EMACS" = "t"; then # Value of "t" means we are running in a shell under Emacs. @@ -58,3 +78,12 @@ cp "$@" $tempdir ) || exit $? (exit 0); exit + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/lib/mdate-sh b/lib/mdate-sh index b610b47a6..05e828b08 100755 --- a/lib/mdate-sh +++ b/lib/mdate-sh @@ -1,5 +1,8 @@ #!/bin/sh # Get modification time of a file or directory and pretty-print it. + +scriptversion=2003-11-09.00 + # Copyright (C) 1995, 1996, 1997, 2003 Free Software Foundation, Inc. # written by Ulrich Drepper , June 1995 # @@ -22,6 +25,31 @@ # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. +# This file is maintained in Automake, please report +# bugs to or send patches to +# . + +case $1 in + '') + echo "$0: No file. Try \`$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: mdate-sh [--help] [--version] FILE + +Pretty-print the modification time of FILE. + +Report bugs to . +EOF + exit 0 + ;; + -v | --v*) + echo "mdate-sh $scriptversion" + exit 0 + ;; +esac + # Prevent date giving response in another language. LANG=C export LANG @@ -131,3 +159,12 @@ esac # The result. echo $day $month $year + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/lib/mkinstalldirs b/lib/mkinstalldirs index a55cff670..6504b744b 100755 --- a/lib/mkinstalldirs +++ b/lib/mkinstalldirs @@ -1,10 +1,15 @@ #! /bin/sh # mkinstalldirs --- make directory hierarchy + +scriptversion=2003-11-08.23 + # Original author: Noah Friedman # Created: 1993-05-16 # Public domain. - -scriptversion=2003-09-26.19 +# +# This file is maintained in Automake, please report +# bugs to or send patches to +# . errstatus=0 dirmode="" @@ -14,7 +19,8 @@ Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ... Create each directory DIR (with mode MODE, if specified), including all leading file name components. -" + +Report bugs to ." # process command line arguments while test $# -gt 0 ; do diff --git a/lib/py-compile b/lib/py-compile index 4c84b678a..e712f4bf9 100755 --- a/lib/py-compile +++ b/lib/py-compile @@ -1,7 +1,9 @@ #!/bin/sh - # py-compile - Compile a Python program -# Copyright 2000, 2001 Free Software Foundation, Inc. + +scriptversion=2003-11-09.01 + +# Copyright (C) 2000, 2001, 2003 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 @@ -23,7 +25,9 @@ # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. -# called as "py-compile [--basedir DIR] PY_FILES ... +# This file is maintained in Automake, please report +# bugs to or send patches to +# . if [ -z "$PYTHON" ]; then PYTHON=python @@ -32,26 +36,30 @@ fi basedir= case "$1" in - --basedir) - basedir=$2 - shift 2 - ;; - --help) - echo "Usage: py-compile [--basedir DIR] PY_FILES ..." - echo "Byte compile some python scripts. This should be performed" - echo "after they have been moved to the final installation location" - exit 0 - ;; - --version) - echo "py-compile version 0.0" - exit 0 - ;; -esac - -if [ $# = 0 ]; then - echo "No files given to $0" 1>&2 + '') + echo "$0: No files given. Try \`$0 --help' for more information." 1>&2 exit 1 -fi + ;; + --basedir) + basedir=$2 + shift 2 + ;; + -h|--h*) + cat <<\EOF +Usage: py-compile [--help] [--version] [--basedir DIR] FILES..." + +Byte compile some python scripts FILES. This should be performed +after they have been moved to the final installation location + +Report bugs to . +EOF + exit 0 + ;; + -v|--v*) + echo "py-compile $scriptversion" + exit 0 + ;; +esac # if basedir was given, then it should be prepended to filenames before # byte compilation. @@ -90,3 +98,11 @@ for file in string.split(files): py_compile.compile(path) print" 2>/dev/null || : +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/lib/ylwrap b/lib/ylwrap index ced3af3d6..f5d0c30f6 100755 --- a/lib/ylwrap +++ b/lib/ylwrap @@ -1,8 +1,10 @@ #! /bin/sh # ylwrap - wrapper for lex/yacc invocations. -# -# Copyright (C) 1996, 1997, 1998, 1999, 2001, 2002, 2003 Free Software -# Foundation, Inc. + +scriptversion=2003-11-09.00 + +# Copyright (C) 1996, 1997, 1998, 1999, 2001, 2002, 2003 +# Free Software Foundation, Inc. # # Written by Tom Tromey . # @@ -25,23 +27,52 @@ # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. -# Usage: -# ylwrap INPUT [OUTPUT DESIRED]... -- PROGRAM [ARGS]... -# * INPUT is the input file -# * OUTPUT is file PROG generates -# * DESIRED is file we actually want -# * PROGRAM is program to run -# * ARGS are passed to PROG -# Any number of OUTPUT,DESIRED pairs may be used. +# This file is maintained in Automake, please report +# bugs to or send patches to +# . + +case "$1" in + '') + echo "$0: No files given. Try \`$0 --help' for more information." 1>&2 + exit 1 + ;; + --basedir) + basedir=$2 + shift 2 + ;; + -h|--h*) + cat <<\EOF +Usage: ylwrap [--help|--version] INPUT [OUTPUT DESIRED]... -- PROGRAM [ARGS]... + +Wrapper for lex/yacc invocations, renaming files as desired. + + INPUT is the input file + OUTPUT is one file PROG generates + DESIRED is the file we actually want instead of OUTPUT + PROGRAM is program to run + ARGS are passed to PROG + +Any number of OUTPUT,DESIRED pairs may be used. + +Report bugs to . +EOF + exit 0 + ;; + -v|--v*) + echo "ylwrap $scriptversion" + exit 0 + ;; +esac + # The input. input="$1" shift case "$input" in - [\\/]* | ?:[\\/]*) + [\\/]* | ?:[\\/]*) # Absolute path; do nothing. ;; - *) + *) # Relative path. Make it absolute. input="`pwd`/$input" ;; @@ -49,12 +80,12 @@ esac pairlist= while test "$#" -ne 0; do - if test "$1" = "--"; then - shift - break - fi - pairlist="$pairlist $1" - shift + if test "$1" = "--"; then + shift + break + fi + pairlist="$pairlist $1" + shift done # The program to run. @@ -62,8 +93,8 @@ prog="$1" shift # Make any relative path in $prog absolute. case "$prog" in - [\\/]* | ?:[\\/]*) ;; - *[\\/]*) prog="`pwd`/$prog" ;; + [\\/]* | ?:[\\/]*) ;; + *[\\/]*) prog="`pwd`/$prog" ;; esac # FIXME: add hostname here for parallel makes that run commands on @@ -75,82 +106,82 @@ mkdir $dirname || exit 1 cd $dirname case $# in - 0) $prog "$input" ;; - *) $prog "$@" "$input" ;; + 0) $prog "$input" ;; + *) $prog "$@" "$input" ;; esac status=$? if test $status -eq 0; then - set X $pairlist - shift - first=yes - # Since DOS filename conventions don't allow two dots, - # the DOS version of Bison writes out y_tab.c instead of y.tab.c - # and y_tab.h instead of y.tab.h. Test to see if this is the case. - y_tab_nodot="no" - if test -f y_tab.c || test -f y_tab.h; then - y_tab_nodot="yes" - fi - - # The directory holding the input. - input_dir=`echo "$input" | sed -e 's,\([\\/]\)[^\\/]*$,\1,'` - # Quote $INPUT_DIR so we can use it in a regexp. - # FIXME: really we should care about more than `.' and `\'. - input_rx=`echo "$input_dir" | sed 's,\\\\,\\\\\\\\,g;s,\\.,\\\\.,g'` - - while test "$#" -ne 0; do - from="$1" - # Handle y_tab.c and y_tab.h output by DOS - if test $y_tab_nodot = "yes"; then - if test $from = "y.tab.c"; then - from="y_tab.c" - else - if test $from = "y.tab.h"; then - from="y_tab.h" - fi - fi - fi - if test -f "$from"; then - # If $2 is an absolute path name, then just use that, - # otherwise prepend `../'. - case "$2" in - [\\/]* | ?:[\\/]*) target="$2";; - *) target="../$2";; - esac - - # Edit out `#line' or `#' directives. - # - # We don't want the resulting debug information to point at - # an absolute srcdir; it is better for it to just mention the - # .y file with no path. - # - # We want to use the real output file name, not yy.lex.c for - # instance. - # - # We want the include guards to be adjusted too. - FROM=`echo "$from" | sed \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'\ - -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'` - TARGET=`echo "$2" | sed \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'\ - -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'` - sed "/^#/{s,$input_rx,,;s,$from,$2,;s,$FROM,$TO,;}" "$from" >"$target" || - status=$? + set X $pairlist + shift + first=yes + # Since DOS filename conventions don't allow two dots, + # the DOS version of Bison writes out y_tab.c instead of y.tab.c + # and y_tab.h instead of y.tab.h. Test to see if this is the case. + y_tab_nodot="no" + if test -f y_tab.c || test -f y_tab.h; then + y_tab_nodot="yes" + fi + + # The directory holding the input. + input_dir=`echo "$input" | sed -e 's,\([\\/]\)[^\\/]*$,\1,'` + # Quote $INPUT_DIR so we can use it in a regexp. + # FIXME: really we should care about more than `.' and `\'. + input_rx=`echo "$input_dir" | sed 's,\\\\,\\\\\\\\,g;s,\\.,\\\\.,g'` + + while test "$#" -ne 0; do + from="$1" + # Handle y_tab.c and y_tab.h output by DOS + if test $y_tab_nodot = "yes"; then + if test $from = "y.tab.c"; then + from="y_tab.c" else - # A missing file is only an error for the first file. This - # is a blatant hack to let us support using "yacc -d". If -d - # is not specified, we don't want an error when the header - # file is "missing". - if test $first = yes; then - status=1 - fi + if test $from = "y.tab.h"; then + from="y_tab.h" + fi fi - shift - shift - first=no - done + fi + if test -f "$from"; then + # If $2 is an absolute path name, then just use that, + # otherwise prepend `../'. + case "$2" in + [\\/]* | ?:[\\/]*) target="$2";; + *) target="../$2";; + esac + + # Edit out `#line' or `#' directives. + # + # We don't want the resulting debug information to point at + # an absolute srcdir; it is better for it to just mention the + # .y file with no path. + # + # We want to use the real output file name, not yy.lex.c for + # instance. + # + # We want the include guards to be adjusted too. + FROM=`echo "$from" | sed \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'\ + -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'` + TARGET=`echo "$2" | sed \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'\ + -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'` + sed "/^#/{s,$input_rx,,;s,$from,$2,;s,$FROM,$TO,;}" "$from" >"$target" || + status=$? + else + # A missing file is only an error for the first file. This + # is a blatant hack to let us support using "yacc -d". If -d + # is not specified, we don't want an error when the header + # file is "missing". + if test $first = yes; then + status=1 + fi + fi + shift + shift + first=no + done else - status=$? + status=$? fi # Remove the directory. @@ -158,3 +189,12 @@ cd .. rm -rf $dirname exit $status + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: -- 2.47.2