From 7448c7f320d25c43dfd3da8d126a26ec65c33d3e Mon Sep 17 00:00:00 2001 From: Andrew Wood Date: Sat, 22 Jul 2023 19:35:43 +0100 Subject: [PATCH] Rewrote configure.in and replaced header.in with one generated by autoheader, added copyright notice to all source files as per GNU standards, and changed "pv --version" output to conform to GNU standards. --- autoconf/Makefile.in | 6 +- autoconf/configure.in | 117 +++----- autoconf/header.in | 342 ++++++++++++++------- autoconf/make/rules.mk | 2 +- autoconf/make/vars.mk | 2 +- autoconf/scripts/install-sh | 541 ++++++++++++++++++++++++++++++++++ autoconf/scripts/install.sh | 250 ---------------- autoconf/scripts/makemake.sh | 4 +- autoconf/scripts/po2table.sh | 2 - generate.sh | 26 +- src/include/config-aux.h | 46 +++ src/include/library/getopt.h | 4 + src/include/library/gettext.h | 3 + src/include/options.h | 4 + src/include/pv-internal.h | 24 +- src/include/pv.h | 6 +- src/library/getopt.c | 4 + src/library/gettext.c | 4 + src/main/debug.c | 6 +- src/main/help.c | 9 +- src/main/main.c | 6 +- src/main/options.c | 6 +- src/main/remote.c | 6 +- src/main/version.c | 36 +-- src/pv/cursor.c | 6 + src/pv/display.c | 16 +- src/pv/file.c | 6 + src/pv/loop.c | 14 +- src/pv/number.c | 10 +- src/pv/signal.c | 6 + src/pv/state.c | 6 + src/pv/transfer.c | 6 + src/pv/watchpid.c | 6 + 33 files changed, 1027 insertions(+), 505 deletions(-) create mode 100755 autoconf/scripts/install-sh delete mode 100755 autoconf/scripts/install.sh create mode 100644 src/include/config-aux.h diff --git a/autoconf/Makefile.in b/autoconf/Makefile.in index aee4384..57bde9a 100644 --- a/autoconf/Makefile.in +++ b/autoconf/Makefile.in @@ -3,12 +3,12 @@ # # package.mk # package name and distribution details # vars.mk # compilation, shell and linking variables -# filelist.mk~ # lists of files +# filelist.mk~ # lists of files (generated by "makemake.sh") # unreal.mk # phony targets -# modules.mk~ # module linking rules +# modules.mk~ # module linking rules (generated by "makemake.sh") # rules.mk # compilation rules # link.mk # real top-level targets -# depend.mk~ # dependencies +# depend.mk~ # dependencies (generated by "makemake.sh") # # diff --git a/autoconf/configure.in b/autoconf/configure.in index eb8dae9..7fc4448 100644 --- a/autoconf/configure.in +++ b/autoconf/configure.in @@ -1,53 +1,62 @@ dnl Process this file with autoconf to produce a configure script. - -AC_INIT(src/main/version.c) - -dnl We're using C. dnl -AC_LANG_C - -dnl Output a header file. +dnl Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023 Andrew Wood dnl -AC_CONFIG_HEADER(src/include/config.h:autoconf/header.in) +dnl Distributed under the Artistic License v2.0; see `doc/COPYING'. -dnl Set directory to check for Configure scripts in. -dnl +dnl Supported languages +ALL_LINGUAS="de fr pl pt" + +AC_INIT +AC_CONFIG_SRCDIR([src/main/version.c]) AC_CONFIG_AUX_DIR(autoconf/scripts) +AC_CONFIG_HEADERS([src/include/config.h:autoconf/header.in]) +AH_BOTTOM([#include "config-aux.h"]) -dnl Read in package details. -dnl +dnl Package identity PACKAGE=`cat $srcdir/doc/PACKAGE` VERSION=`cat $srcdir/doc/VERSION` UCPACKAGE=`tr a-z A-Z < $srcdir/doc/PACKAGE` AC_SUBST(PACKAGE) AC_SUBST(VERSION) AC_SUBST(UCPACKAGE) -AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE") -AC_DEFINE_UNQUOTED(PROGRAM_NAME, "$PACKAGE") -AC_DEFINE_UNQUOTED(VERSION, "$VERSION") +AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Package name]) +AC_DEFINE_UNQUOTED([PROGRAM_NAME], ["$PACKAGE"], [Name of this program]) +AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version of this program]) +AC_DEFINE([COPYRIGHT_YEAR], [_("2023")], [Copyright year]) +AC_DEFINE([COPYRIGHT_HOLDER], [_("Andrew Wood ")], [Copyright holder]) +AC_DEFINE([PROJECT_HOMEPAGE], ["http://www.ivarch.com/programs/" PROGRAM_NAME ".shtml"], [Project homepage]) +AC_DEFINE([BUG_REPORTS_TO], [_("")], [Bug reporting email address]) + +AC_LANG(C) +CFLAGS=${CFLAGS:-"-O"} +AC_PROG_CC +AC_PROG_INSTALL +AC_USE_SYSTEM_EXTENSIONS +AC_C_CONST +AC_HEADER_STDBOOL +AC_SYS_LARGEFILE +AC_HEADER_TIOCGWINSZ +AC_CHECK_FUNCS(getopt_long getopt) +AC_CHECK_HEADERS(getopt.h) +AC_CHECK_FUNCS(memcpy basename snprintf) +AC_CHECK_HEADERS(limits.h) -dnl Check for compile-time options. -dnl AC_ARG_ENABLE(debugging, [ --enable-debugging compile with debugging support], if test "$enable_debugging" = "yes"; then - CFLAGS="-g -Wall" - AC_DEFINE(ENABLE_DEBUGGING) + CFLAGS="$CFLAGS -g -Wall" + AC_DEFINE([ENABLE_DEBUGGING], [1], [Debugging support enabled]) fi ) + AC_ARG_ENABLE(profiling, [ --enable-profiling compile with profiling support], if test "$enable_profiling" = "yes"; then CFLAGS="-pg $CFLAGS" fi ) -LFS_SUPPORT="no" -AC_ARG_ENABLE(lfs, [ --disable-lfs disable LFS support], - if test "$enable_lfs" = "yes"; then - LFS_SUPPORT="yes" - fi, - LFS_SUPPORT="yes" -) + STATIC_NLS="no" AC_ARG_ENABLE(static-nls, [ --enable-static-nls hardcode NLS with no support files], if test "$enable_static_nls" = "yes"; then @@ -55,6 +64,7 @@ AC_ARG_ENABLE(static-nls, [ --enable-static-nls hardcode NLS with no suppor fi, STATIC_NLS="no" ) + NLS_SUPPORT="no" AC_ARG_ENABLE(nls, [ --disable-nls do not use Native Language Support], if test "$enable_nls" = "yes"; then @@ -62,6 +72,7 @@ AC_ARG_ENABLE(nls, [ --disable-nls do not use Native Language Support fi, NLS_SUPPORT="yes" ) + SPLICE_SUPPORT="no" AC_ARG_ENABLE(splice, [ --disable-splice do not use splice system call], if test "$enable_splice" = "yes"; then @@ -69,6 +80,7 @@ AC_ARG_ENABLE(splice, [ --disable-splice do not use splice system call], fi, SPLICE_SUPPORT="yes" ) + IPC_SUPPORT="no" AC_ARG_ENABLE(ipc, [ --disable-ipc turn off IPC messaging], if test "$enable_ipc" = "yes"; then @@ -77,25 +89,15 @@ AC_ARG_ENABLE(ipc, [ --disable-ipc turn off IPC messaging], IPC_SUPPORT="yes" ) -dnl Check for various programs. -dnl -CFLAGS=${CFLAGS:-"-O"} -AC_PROG_CC -AC_PROG_INSTALL -AC_PROG_MAKE_SET - dnl AIX needs -lc128 -dnl AC_EGREP_CPP([^yes$], [#ifdef _AIX yes #endif ], [LIBS="$LIBS -lc128"]) -dnl NLS stuff. -dnl -ALL_LINGUAS="de fr pl pt" +dnl Native Language Suppot if test "$NLS_SUPPORT" = "yes"; then - AC_DEFINE(ENABLE_NLS) + AC_DEFINE([ENABLE_NLS], [1], [Enable native language support]) AC_PATH_PROG(MSGFMT, msgfmt, NOMSGFMT) AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) AC_PATH_PROG(XGETTEXT, xgettext, xgettext) @@ -121,7 +123,7 @@ if test "$NLS_SUPPORT" = "yes"; then CATALOGS="" else AC_CHECK_FUNC(gettext, - [AC_DEFINE(HAVE_GETTEXT) + [AC_DEFINE([HAVE_GETTEXT], [1], [The gettext function is available]) NLSOBJ="" ], [CATALOGS=""; NLSOBJ="src/nls/table.o" ] @@ -140,30 +142,6 @@ AC_SUBST(POFILES) AC_SUBST(CATALOGS) AC_SUBST(NLSOBJ) -dnl Getopt checks. -dnl -AC_CHECK_FUNCS(getopt_long getopt) -AC_CHECK_HEADERS(getopt.h) - -dnl LFS checks. -dnl -if test "$LFS_SUPPORT" = "yes"; then - AC_CHECK_FUNCS(open64, AC_DEFINE(ENABLE_LARGEFILE)) -fi - -dnl Check for various header files and set various other macros. -dnl -AC_DEFINE(HAVE_CONFIG_H) -AC_HEADER_STDC -AC_HEADER_STDBOOL -AC_CHECK_FUNCS(memcpy basename snprintf) -dnl OSX 11 (apple silicon) lets you link stat64() but fails to compile -dnl so use a compile test for stat64() instead of a link test. -AC_COMPILE_IFELSE([AC_LANG_SOURCE([int main() { stat64(); }])], - [AC_DEFINE([HAVE_STAT64], [1], [Is stat64() available])], - []) -AC_CHECK_HEADERS(limits.h) - if test "$IPC_SUPPORT" = "yes"; then AC_CHECK_HEADERS(sys/ipc.h sys/param.h libgen.h) fi @@ -172,8 +150,8 @@ if test "$SPLICE_SUPPORT" = "yes"; then AC_CHECK_FUNCS(splice) fi -test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' -AC_SUBST(INSTALL_DATA) +dnl This must go after all the compiler based tests above. +AC_LANG_WERROR dnl Fudging for separate build directories. dnl @@ -192,13 +170,14 @@ done dnl Output files (and create build directory structure too). dnl -AC_OUTPUT(Makefile:$mk_segments doc/lsm:doc/lsm.in +AC_CONFIG_FILES([Makefile:$mk_segments doc/lsm:doc/lsm.in doc/quickref.1:doc/quickref.1.in - src/.dummy:doc/NEWS.md, - rm -f src/.dummy + src/.dummy:doc/NEWS.md]) +AC_CONFIG_COMMANDS([default],[rm -f src/.dummy for i in $subdirs; do test -d $i || mkdir $i done -, subdirs="$subdirs") +],[subdirs="$subdirs"]) +AC_OUTPUT dnl EOF diff --git a/autoconf/header.in b/autoconf/header.in index a827ab8..355cac4 100644 --- a/autoconf/header.in +++ b/autoconf/header.in @@ -1,114 +1,240 @@ -/*!NOINDEX*/ -/* Define if you have standard C headers. */ -#undef STDC_HEADERS +/* autoconf/header.in. Generated from autoconf/configure.in by autoheader. */ -/* Define if you have "config.h" (yes, you have). */ -#undef HAVE_CONFIG_H +/* Bug reporting email address */ +#undef BUG_REPORTS_TO -/* Various other header files. */ -#undef HAVE_GETOPT_H -#undef HAVE_LIMITS_H -#undef HAVE_SYS_IPC_H -#undef HAVE_SYS_PARAM_H -#undef HAVE_LIBGEN_H +/* Copyright holder */ +#undef COPYRIGHT_HOLDER -/* Functions. */ -#undef HAVE_GETOPT -#undef HAVE_GETOPT_LONG -#undef HAVE_MEMCPY -#undef HAVE_BASENAME -#undef HAVE_SNPRINTF -#undef HAVE_STAT64 +/* Copyright year */ +#undef COPYRIGHT_YEAR -#undef HAVE_SPLICE -#ifdef HAVE_SPLICE -# define _GNU_SOURCE 1 -#endif -/* NB the above must come before NLS, as NLS includes other system headers. */ - -/* NLS stuff. */ -#undef ENABLE_NLS -#undef HAVE_LIBINTL_H -#undef HAVE_LOCALE_H -#undef HAVE_GETTEXT -#ifdef ENABLE_NLS -# include "library/gettext.h" -#else -# define _(String) (String) -# define N_(String) (String) -#endif - -/* The name of the program. */ -#define PROGRAM_NAME "progname" - -/* The name of the package. */ -#define PACKAGE "" - -/* The current package version. */ -#define VERSION "0.0.0" - -/* Various identification and legal stuff. */ -#define COPYRIGHT_YEAR _("2015") -#define COPYRIGHT_HOLDER _("Andrew Wood ") -#define PROJECT_HOMEPAGE "http://www.ivarch.com/programs/" PROGRAM_NAME ".shtml" -#define BUG_REPORTS_TO _("") - -/* LFS support. */ -#undef ENABLE_LARGEFILE -#ifdef ENABLE_LARGEFILE -# define __USE_LARGEFILE64 1 -# define _LARGEFILE64_SOURCE 1 -#else -/* - * Some Macs have stat64 despite not having open64 while others don't have - * either, so here even if we don't have open64 or LFS is disabled, we have - * to check whether stat64 exists and only redefine it if it doesn't - * otherwise some Macs fail to compile. - */ -# ifdef __APPLE__ -# ifndef HAVE_STAT64 -# define stat64 stat -# define fstat64 fstat -# define lstat64 lstat -# endif -# else -# define stat64 stat -# define fstat64 fstat -# define lstat64 lstat -# endif -# define open64 open -# define lseek64 lseek -#endif - -#undef HAVE_IPC -#ifdef HAVE_SYS_IPC_H -#define HAVE_IPC 1 -#endif - -#undef CURSOR_ANSWERBACK_BYTE_BY_BYTE -#ifndef _AIX -#define CURSOR_ANSWERBACK_BYTE_BY_BYTE 1 -#endif - -/* Boolean type support. */ -#undef HAVE_STDBOOL_H -#ifdef HAVE_STDBOOL_H -# include -#else -# ifndef HAVE__BOOL -# ifdef __cplusplus -typedef bool _Bool; -# else -# define _Bool signed char -# endif -# endif -# define bool _Bool -# define false 0 -# define true 1 -# define __bool_true_false_are_defined 1 -#endif - -/* Support for debugging output. */ +/* Debugging support enabled */ #undef ENABLE_DEBUGGING -/* EOF */ +/* Enable native language support */ +#undef ENABLE_NLS + +/* Define to 1 if `TIOCGWINSZ' requires . */ +#undef GWINSZ_IN_SYS_IOCTL + +/* Define to 1 if you have the `basename' function. */ +#undef HAVE_BASENAME + +/* Define to 1 if you have the `getopt' function. */ +#undef HAVE_GETOPT + +/* Define to 1 if you have the header file. */ +#undef HAVE_GETOPT_H + +/* Define to 1 if you have the `getopt_long' function. */ +#undef HAVE_GETOPT_LONG + +/* The gettext function is available */ +#undef HAVE_GETTEXT + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_LIBGEN_H + +/* Define to 1 if you have the `i' library (-li). */ +#undef HAVE_LIBI + +/* Define to 1 if you have the `intl' library (-lintl). */ +#undef HAVE_LIBINTL + +/* Define to 1 if you have the header file. */ +#undef HAVE_LIBINTL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_LIMITS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_LOCALE_H + +/* Define to 1 if you have the `memcpy' function. */ +#undef HAVE_MEMCPY + +/* Define to 1 if you have the header file. */ +#undef HAVE_MINIX_CONFIG_H + +/* Define to 1 if you have the `snprintf' function. */ +#undef HAVE_SNPRINTF + +/* Define to 1 if you have the `splice' function. */ +#undef HAVE_SPLICE + +/* Define to 1 if stdbool.h conforms to C99. */ +#undef HAVE_STDBOOL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDIO_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_IPC_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_PARAM_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_WCHAR_H + +/* Define to 1 if the system has the type `_Bool'. */ +#undef HAVE__BOOL + +/* Package name */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the home page for this package. */ +#undef PACKAGE_URL + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Name of this program */ +#undef PROGRAM_NAME + +/* Project homepage */ +#undef PROJECT_HOMEPAGE + +/* Define to 1 if all of the C90 standard headers exist (not just the ones + required in a freestanding environment). This macro is provided for + backward compatibility; new code need not use it. */ +#undef STDC_HEADERS + +/* Enable extensions on AIX 3, Interix. */ +#ifndef _ALL_SOURCE +# undef _ALL_SOURCE +#endif +/* Enable general extensions on macOS. */ +#ifndef _DARWIN_C_SOURCE +# undef _DARWIN_C_SOURCE +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +# undef __EXTENSIONS__ +#endif +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# undef _GNU_SOURCE +#endif +/* Enable X/Open compliant socket functions that do not require linking + with -lxnet on HP-UX 11.11. */ +#ifndef _HPUX_ALT_XOPEN_SOCKET_API +# undef _HPUX_ALT_XOPEN_SOCKET_API +#endif +/* Identify the host operating system as Minix. + This macro does not affect the system headers' behavior. + A future release of Autoconf may stop defining this macro. */ +#ifndef _MINIX +# undef _MINIX +#endif +/* Enable general extensions on NetBSD. + Enable NetBSD compatibility extensions on Minix. */ +#ifndef _NETBSD_SOURCE +# undef _NETBSD_SOURCE +#endif +/* Enable OpenBSD compatibility extensions on NetBSD. + Oddly enough, this does nothing on OpenBSD. */ +#ifndef _OPENBSD_SOURCE +# undef _OPENBSD_SOURCE +#endif +/* Define to 1 if needed for POSIX-compatible behavior. */ +#ifndef _POSIX_SOURCE +# undef _POSIX_SOURCE +#endif +/* Define to 2 if needed for POSIX-compatible behavior. */ +#ifndef _POSIX_1_SOURCE +# undef _POSIX_1_SOURCE +#endif +/* Enable POSIX-compatible threading on Solaris. */ +#ifndef _POSIX_PTHREAD_SEMANTICS +# undef _POSIX_PTHREAD_SEMANTICS +#endif +/* Enable extensions specified by ISO/IEC TS 18661-5:2014. */ +#ifndef __STDC_WANT_IEC_60559_ATTRIBS_EXT__ +# undef __STDC_WANT_IEC_60559_ATTRIBS_EXT__ +#endif +/* Enable extensions specified by ISO/IEC TS 18661-1:2014. */ +#ifndef __STDC_WANT_IEC_60559_BFP_EXT__ +# undef __STDC_WANT_IEC_60559_BFP_EXT__ +#endif +/* Enable extensions specified by ISO/IEC TS 18661-2:2015. */ +#ifndef __STDC_WANT_IEC_60559_DFP_EXT__ +# undef __STDC_WANT_IEC_60559_DFP_EXT__ +#endif +/* Enable extensions specified by ISO/IEC TS 18661-4:2015. */ +#ifndef __STDC_WANT_IEC_60559_FUNCS_EXT__ +# undef __STDC_WANT_IEC_60559_FUNCS_EXT__ +#endif +/* Enable extensions specified by ISO/IEC TS 18661-3:2015. */ +#ifndef __STDC_WANT_IEC_60559_TYPES_EXT__ +# undef __STDC_WANT_IEC_60559_TYPES_EXT__ +#endif +/* Enable extensions specified by ISO/IEC TR 24731-2:2010. */ +#ifndef __STDC_WANT_LIB_EXT2__ +# undef __STDC_WANT_LIB_EXT2__ +#endif +/* Enable extensions specified by ISO/IEC 24747:2009. */ +#ifndef __STDC_WANT_MATH_SPEC_FUNCS__ +# undef __STDC_WANT_MATH_SPEC_FUNCS__ +#endif +/* Enable extensions on HP NonStop. */ +#ifndef _TANDEM_SOURCE +# undef _TANDEM_SOURCE +#endif +/* Enable X/Open extensions. Define to 500 only if necessary + to make mbstate_t available. */ +#ifndef _XOPEN_SOURCE +# undef _XOPEN_SOURCE +#endif + + +/* Version of this program */ +#undef VERSION + +/* Number of bits in a file offset, on hosts where this is settable. */ +#undef _FILE_OFFSET_BITS + +/* Define for large files, on AIX-style hosts. */ +#undef _LARGE_FILES + +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const + +#include "config-aux.h" diff --git a/autoconf/make/rules.mk b/autoconf/make/rules.mk index 96ed511..02b6153 100644 --- a/autoconf/make/rules.mk +++ b/autoconf/make/rules.mk @@ -12,7 +12,7 @@ $(CC) $< $(<:%.c=%) $(srcdir) $(CFLAGS) $(CPPFLAGS) > $@ # -# NLS stuff +# Native language support # %.mo: %.po diff --git a/autoconf/make/vars.mk b/autoconf/make/vars.mk index 262f463..87670c9 100644 --- a/autoconf/make/vars.mk +++ b/autoconf/make/vars.mk @@ -11,6 +11,7 @@ infodir = @infodir@ mandir = @mandir@ etcdir = @prefix@/etc datadir = @datadir@ +datarootdir = @datarootdir@ sbindir = @sbindir@ VPATH = $(srcdir) @@ -27,7 +28,6 @@ MSGMERGE = msgmerge CATOBJEXT = @CATOBJEXT@ INSTOBJEXT = @INSTOBJEXT@ -@SET_MAKE@ SHELL = /bin/sh CC = @CC@ INSTALL = @INSTALL@ diff --git a/autoconf/scripts/install-sh b/autoconf/scripts/install-sh new file mode 100755 index 0000000..ec298b5 --- /dev/null +++ b/autoconf/scripts/install-sh @@ -0,0 +1,541 @@ +#!/bin/sh +# install - install a program, script, or datafile + +scriptversion=2020-11-14.01; # UTC + +# This originates from X11R5 (mit/util/scripts/install.sh), which was +# later released in X11R6 (xc/config/util/install.sh) with the +# following copyright and license. +# +# Copyright (C) 1994 X Consortium +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- +# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name of the X Consortium shall not +# be used in advertising or otherwise to promote the sale, use or other deal- +# ings in this Software without prior written authorization from the X Consor- +# tium. +# +# +# FSF changes to this file are in the public domain. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# 'make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. + +tab=' ' +nl=' +' +IFS=" $tab$nl" + +# Set DOITPROG to "echo" to test this script. + +doit=${DOITPROG-} +doit_exec=${doit:-exec} + +# Put in absolute file names if you don't have them in your path; +# or use environment vars. + +chgrpprog=${CHGRPPROG-chgrp} +chmodprog=${CHMODPROG-chmod} +chownprog=${CHOWNPROG-chown} +cmpprog=${CMPPROG-cmp} +cpprog=${CPPROG-cp} +mkdirprog=${MKDIRPROG-mkdir} +mvprog=${MVPROG-mv} +rmprog=${RMPROG-rm} +stripprog=${STRIPPROG-strip} + +posix_mkdir= + +# Desired mode of installed file. +mode=0755 + +# Create dirs (including intermediate dirs) using mode 755. +# This is like GNU 'install' as of coreutils 8.32 (2020). +mkdir_umask=22 + +backupsuffix= +chgrpcmd= +chmodcmd=$chmodprog +chowncmd= +mvcmd=$mvprog +rmcmd="$rmprog -f" +stripcmd= + +src= +dst= +dir_arg= +dst_arg= + +copy_on_change=false +is_target_a_directory=possibly + +usage="\ +Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE + or: $0 [OPTION]... SRCFILES... DIRECTORY + or: $0 [OPTION]... -t DIRECTORY SRCFILES... + or: $0 [OPTION]... -d DIRECTORIES... + +In the 1st form, copy SRCFILE to DSTFILE. +In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. +In the 4th, create DIRECTORIES. + +Options: + --help display this help and exit. + --version display version info and exit. + + -c (ignored) + -C install only if different (preserve data modification time) + -d create directories instead of installing files. + -g GROUP $chgrpprog installed files to GROUP. + -m MODE $chmodprog installed files to MODE. + -o USER $chownprog installed files to USER. + -p pass -p to $cpprog. + -s $stripprog installed files. + -S SUFFIX attempt to back up existing files, with suffix SUFFIX. + -t DIRECTORY install into DIRECTORY. + -T report an error if DSTFILE is a directory. + +Environment variables override the default commands: + CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG + RMPROG STRIPPROG + +By default, rm is invoked with -f; when overridden with RMPROG, +it's up to you to specify -f if you want it. + +If -S is not specified, no backups are attempted. + +Email bug reports to bug-automake@gnu.org. +Automake home page: https://www.gnu.org/software/automake/ +" + +while test $# -ne 0; do + case $1 in + -c) ;; + + -C) copy_on_change=true;; + + -d) dir_arg=true;; + + -g) chgrpcmd="$chgrpprog $2" + shift;; + + --help) echo "$usage"; exit $?;; + + -m) mode=$2 + case $mode in + *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*) + echo "$0: invalid mode: $mode" >&2 + exit 1;; + esac + shift;; + + -o) chowncmd="$chownprog $2" + shift;; + + -p) cpprog="$cpprog -p";; + + -s) stripcmd=$stripprog;; + + -S) backupsuffix="$2" + shift;; + + -t) + is_target_a_directory=always + dst_arg=$2 + # Protect names problematic for 'test' and other utilities. + case $dst_arg in + -* | [=\(\)!]) dst_arg=./$dst_arg;; + esac + shift;; + + -T) is_target_a_directory=never;; + + --version) echo "$0 $scriptversion"; exit $?;; + + --) shift + break;; + + -*) echo "$0: invalid option: $1" >&2 + exit 1;; + + *) break;; + esac + shift +done + +# We allow the use of options -d and -T together, by making -d +# take the precedence; this is for compatibility with GNU install. + +if test -n "$dir_arg"; then + if test -n "$dst_arg"; then + echo "$0: target directory not allowed when installing a directory." >&2 + exit 1 + fi +fi + +if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then + # When -d is used, all remaining arguments are directories to create. + # When -t is used, the destination is already specified. + # Otherwise, the last argument is the destination. Remove it from $@. + for arg + do + if test -n "$dst_arg"; then + # $@ is not empty: it contains at least $arg. + set fnord "$@" "$dst_arg" + shift # fnord + fi + shift # arg + dst_arg=$arg + # Protect names problematic for 'test' and other utilities. + case $dst_arg in + -* | [=\(\)!]) dst_arg=./$dst_arg;; + esac + done +fi + +if test $# -eq 0; then + if test -z "$dir_arg"; then + echo "$0: no input file specified." >&2 + exit 1 + fi + # It's OK to call 'install-sh -d' without argument. + # This can happen when creating conditional directories. + exit 0 +fi + +if test -z "$dir_arg"; then + if test $# -gt 1 || test "$is_target_a_directory" = always; then + if test ! -d "$dst_arg"; then + echo "$0: $dst_arg: Is not a directory." >&2 + exit 1 + fi + fi +fi + +if test -z "$dir_arg"; then + do_exit='(exit $ret); exit $ret' + trap "ret=129; $do_exit" 1 + trap "ret=130; $do_exit" 2 + trap "ret=141; $do_exit" 13 + trap "ret=143; $do_exit" 15 + + # Set umask so as not to create temps with too-generous modes. + # However, 'strip' requires both read and write access to temps. + case $mode in + # Optimize common cases. + *644) cp_umask=133;; + *755) cp_umask=22;; + + *[0-7]) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw='% 200' + fi + cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; + *) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw=,u+rw + fi + cp_umask=$mode$u_plus_rw;; + esac +fi + +for src +do + # Protect names problematic for 'test' and other utilities. + case $src in + -* | [=\(\)!]) src=./$src;; + esac + + if test -n "$dir_arg"; then + dst=$src + dstdir=$dst + test -d "$dstdir" + dstdir_status=$? + # Don't chown directories that already exist. + if test $dstdir_status = 0; then + chowncmd="" + fi + else + + # Waiting for this to be detected by the "$cpprog $src $dsttmp" command + # might cause directories to be created, which would be especially bad + # if $src (and thus $dsttmp) contains '*'. + if test ! -f "$src" && test ! -d "$src"; then + echo "$0: $src does not exist." >&2 + exit 1 + fi + + if test -z "$dst_arg"; then + echo "$0: no destination specified." >&2 + exit 1 + fi + dst=$dst_arg + + # If destination is a directory, append the input filename. + if test -d "$dst"; then + if test "$is_target_a_directory" = never; then + echo "$0: $dst_arg: Is a directory" >&2 + exit 1 + fi + dstdir=$dst + dstbase=`basename "$src"` + case $dst in + */) dst=$dst$dstbase;; + *) dst=$dst/$dstbase;; + esac + dstdir_status=0 + else + dstdir=`dirname "$dst"` + test -d "$dstdir" + dstdir_status=$? + fi + fi + + case $dstdir in + */) dstdirslash=$dstdir;; + *) dstdirslash=$dstdir/;; + esac + + obsolete_mkdir_used=false + + if test $dstdir_status != 0; then + case $posix_mkdir in + '') + # With -d, create the new directory with the user-specified mode. + # Otherwise, rely on $mkdir_umask. + if test -n "$dir_arg"; then + mkdir_mode=-m$mode + else + mkdir_mode= + fi + + posix_mkdir=false + # The $RANDOM variable is not portable (e.g., dash). Use it + # here however when possible just to lower collision chance. + tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ + + trap ' + ret=$? + rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null + exit $ret + ' 0 + + # Because "mkdir -p" follows existing symlinks and we likely work + # directly in world-writeable /tmp, make sure that the '$tmpdir' + # directory is successfully created first before we actually test + # 'mkdir -p'. + if (umask $mkdir_umask && + $mkdirprog $mkdir_mode "$tmpdir" && + exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1 + then + if test -z "$dir_arg" || { + # Check for POSIX incompatibilities with -m. + # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or + # other-writable bit of parent directory when it shouldn't. + # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. + test_tmpdir="$tmpdir/a" + ls_ld_tmpdir=`ls -ld "$test_tmpdir"` + case $ls_ld_tmpdir in + d????-?r-*) different_mode=700;; + d????-?--*) different_mode=755;; + *) false;; + esac && + $mkdirprog -m$different_mode -p -- "$test_tmpdir" && { + ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"` + test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" + } + } + then posix_mkdir=: + fi + rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" + else + # Remove any dirs left behind by ancient mkdir implementations. + rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null + fi + trap '' 0;; + esac + + if + $posix_mkdir && ( + umask $mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" + ) + then : + else + + # mkdir does not conform to POSIX, + # or it failed possibly due to a race condition. Create the + # directory the slow way, step by step, checking for races as we go. + + case $dstdir in + /*) prefix='/';; + [-=\(\)!]*) prefix='./';; + *) prefix='';; + esac + + oIFS=$IFS + IFS=/ + set -f + set fnord $dstdir + shift + set +f + IFS=$oIFS + + prefixes= + + for d + do + test X"$d" = X && continue + + prefix=$prefix$d + if test -d "$prefix"; then + prefixes= + else + if $posix_mkdir; then + (umask $mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break + # Don't fail if two instances are running concurrently. + test -d "$prefix" || exit 1 + else + case $prefix in + *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; + *) qprefix=$prefix;; + esac + prefixes="$prefixes '$qprefix'" + fi + fi + prefix=$prefix/ + done + + if test -n "$prefixes"; then + # Don't fail if two instances are running concurrently. + (umask $mkdir_umask && + eval "\$doit_exec \$mkdirprog $prefixes") || + test -d "$dstdir" || exit 1 + obsolete_mkdir_used=true + fi + fi + fi + + if test -n "$dir_arg"; then + { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && + { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || + test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 + else + + # Make a couple of temp file names in the proper directory. + dsttmp=${dstdirslash}_inst.$$_ + rmtmp=${dstdirslash}_rm.$$_ + + # Trap to clean up those temp files at exit. + trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 + + # Copy the file name to the temp name. + (umask $cp_umask && + { test -z "$stripcmd" || { + # Create $dsttmp read-write so that cp doesn't create it read-only, + # which would cause strip to fail. + if test -z "$doit"; then + : >"$dsttmp" # No need to fork-exec 'touch'. + else + $doit touch "$dsttmp" + fi + } + } && + $doit_exec $cpprog "$src" "$dsttmp") && + + # and set any options; do chmod last to preserve setuid bits. + # + # If any of these fail, we abort the whole thing. If we want to + # ignore errors from any of these, just make sure not to ignore + # errors from the above "$doit $cpprog $src $dsttmp" command. + # + { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && + { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && + { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && + + # If -C, don't bother to copy if it wouldn't change the file. + if $copy_on_change && + old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && + new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && + set -f && + set X $old && old=:$2:$4:$5:$6 && + set X $new && new=:$2:$4:$5:$6 && + set +f && + test "$old" = "$new" && + $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 + then + rm -f "$dsttmp" + else + # If $backupsuffix is set, and the file being installed + # already exists, attempt a backup. Don't worry if it fails, + # e.g., if mv doesn't support -f. + if test -n "$backupsuffix" && test -f "$dst"; then + $doit $mvcmd -f "$dst" "$dst$backupsuffix" 2>/dev/null + fi + + # Rename the file to the real destination. + $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || + + # The rename failed, perhaps because mv can't rename something else + # to itself, or perhaps because mv is so ancient that it does not + # support -f. + { + # Now remove or move aside any old file at destination location. + # We try this two ways since rm can't unlink itself on some + # systems and the destination file might be busy for other + # reasons. In this case, the final cleanup might fail but the new + # file should still install successfully. + { + test ! -f "$dst" || + $doit $rmcmd "$dst" 2>/dev/null || + { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && + { $doit $rmcmd "$rmtmp" 2>/dev/null; :; } + } || + { echo "$0: cannot unlink or rename $dst" >&2 + (exit 1); exit 1 + } + } && + + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dst" + } + fi || exit 1 + + trap '' 0 + fi +done + +# Local variables: +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC0" +# time-stamp-end: "; # UTC" +# End: diff --git a/autoconf/scripts/install.sh b/autoconf/scripts/install.sh deleted file mode 100755 index ebc6691..0000000 --- a/autoconf/scripts/install.sh +++ /dev/null @@ -1,250 +0,0 @@ -#! /bin/sh -# -# install - install a program, script, or datafile -# This comes from X11R5 (mit/util/scripts/install.sh). -# -# Copyright 1991 by the Massachusetts Institute of Technology -# -# Permission to use, copy, modify, distribute, and sell this software and its -# documentation for any purpose is hereby granted without fee, provided that -# the above copyright notice appear in all copies and that both that -# copyright notice and this permission notice appear in supporting -# documentation, and that the name of M.I.T. not be used in advertising or -# publicity pertaining to distribution of the software without specific, -# written prior permission. M.I.T. makes no representations about the -# suitability of this software for any purpose. It is provided "as is" -# without express or implied warranty. -# -# Calling this script install-sh is preferred over install.sh, to prevent -# `make' implicit rules from creating a file called install from it -# when there is no Makefile. -# -# This script is compatible with the BSD install script, but was written -# from scratch. It can only install one file at a time, a restriction -# shared with many OS's install programs. - - -# set DOITPROG to echo to test this script - -# Don't use :- since 4.3BSD and earlier shells don't like it. -doit="${DOITPROG-}" - - -# put in absolute paths if you don't have them in your path; or use env. vars. - -mvprog="${MVPROG-mv}" -cpprog="${CPPROG-cp}" -chmodprog="${CHMODPROG-chmod}" -chownprog="${CHOWNPROG-chown}" -chgrpprog="${CHGRPPROG-chgrp}" -stripprog="${STRIPPROG-strip}" -rmprog="${RMPROG-rm}" -mkdirprog="${MKDIRPROG-mkdir}" - -transformbasename="" -transform_arg="" -instcmd="$mvprog" -chmodcmd="$chmodprog 0755" -chowncmd="" -chgrpcmd="" -stripcmd="" -rmcmd="$rmprog -f" -mvcmd="$mvprog" -src="" -dst="" -dir_arg="" - -while [ x"$1" != x ]; do - case $1 in - -c) instcmd="$cpprog" - shift - continue;; - - -d) dir_arg=true - shift - continue;; - - -m) chmodcmd="$chmodprog $2" - shift - shift - continue;; - - -o) chowncmd="$chownprog $2" - shift - shift - continue;; - - -g) chgrpcmd="$chgrpprog $2" - shift - shift - continue;; - - -s) stripcmd="$stripprog" - shift - continue;; - - -t=*) transformarg=`echo $1 | sed 's/-t=//'` - shift - continue;; - - -b=*) transformbasename=`echo $1 | sed 's/-b=//'` - shift - continue;; - - *) if [ x"$src" = x ] - then - src=$1 - else - # this colon is to work around a 386BSD /bin/sh bug - : - dst=$1 - fi - shift - continue;; - esac -done - -if [ x"$src" = x ] -then - echo "install: no input file specified" - exit 1 -else - true -fi - -if [ x"$dir_arg" != x ]; then - dst=$src - src="" - - if [ -d $dst ]; then - instcmd=: - else - instcmd=mkdir - fi -else - -# Waiting for this to be detected by the "$instcmd $src $dsttmp" command -# might cause directories to be created, which would be especially bad -# if $src (and thus $dsttmp) contains '*'. - - if [ -f $src -o -d $src ] - then - true - else - echo "install: $src does not exist" - exit 1 - fi - - if [ x"$dst" = x ] - then - echo "install: no destination specified" - exit 1 - else - true - fi - -# If destination is a directory, append the input filename; if your system -# does not like double slashes in filenames, you may need to add some logic - - if [ -d $dst ] - then - dst="$dst"/`basename $src` - else - true - fi -fi - -## this sed command emulates the dirname command -dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` - -# Make sure that the destination directory exists. -# this part is taken from Noah Friedman's mkinstalldirs script - -# Skip lots of stat calls in the usual case. -if [ ! -d "$dstdir" ]; then -defaultIFS=' -' -IFS="${IFS-${defaultIFS}}" - -oIFS="${IFS}" -# Some sh's can't handle IFS=/ for some reason. -IFS='%' -set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` -IFS="${oIFS}" - -pathcomp='' - -while [ $# -ne 0 ] ; do - pathcomp="${pathcomp}${1}" - shift - - if [ ! -d "${pathcomp}" ] ; - then - $mkdirprog "${pathcomp}" - else - true - fi - - pathcomp="${pathcomp}/" -done -fi - -if [ x"$dir_arg" != x ] -then - $doit $instcmd $dst && - - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi -else - -# If we're going to rename the final executable, determine the name now. - - if [ x"$transformarg" = x ] - then - dstfile=`basename $dst` - else - dstfile=`basename $dst $transformbasename | - sed $transformarg`$transformbasename - fi - -# don't allow the sed command to completely eliminate the filename - - if [ x"$dstfile" = x ] - then - dstfile=`basename $dst` - else - true - fi - -# Make a temp file name in the proper directory. - - dsttmp=$dstdir/#inst.$$# - -# Move or copy the file name to the temp name - - $doit $instcmd $src $dsttmp && - - trap "rm -f ${dsttmp}" 0 && - -# and set any options; do chmod last to preserve setuid bits - -# If any of these fail, we abort the whole thing. If we want to -# ignore errors from any of these, just make sure not to ignore -# errors from the above "$doit $instcmd $src $dsttmp" command. - - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && - -# Now rename the file to the real destination. - - $doit $rmcmd -f $dstdir/$dstfile && - $doit $mvcmd $dsttmp $dstdir/$dstfile - -fi && - - -exit 0 diff --git a/autoconf/scripts/makemake.sh b/autoconf/scripts/makemake.sh index 3eca6c6..886f328 100755 --- a/autoconf/scripts/makemake.sh +++ b/autoconf/scripts/makemake.sh @@ -16,8 +16,8 @@ outlink=$2 FIND=find GREP=grep -which gfind 2>/dev/null | grep /gfind >/dev/null && FIND=gfind -which ggrep 2>/dev/null | grep /ggrep >/dev/null && GREP=ggrep +command -v gfind 2>/dev/null | grep /gfind >/dev/null && FIND=gfind +command -v which ggrep 2>/dev/null | grep /ggrep >/dev/null && GREP=ggrep echo '# Automatically generated file listings' > $outlist echo '#' >> $outlist diff --git a/autoconf/scripts/po2table.sh b/autoconf/scripts/po2table.sh index 78f583b..fbfe7ae 100755 --- a/autoconf/scripts/po2table.sh +++ b/autoconf/scripts/po2table.sh @@ -8,9 +8,7 @@ cat < struct msgtable_s { diff --git a/generate.sh b/generate.sh index 4ed5c19..926b1e9 100755 --- a/generate.sh +++ b/generate.sh @@ -1,30 +1,42 @@ #!/bin/sh # -# Script to autogenerate the `configure' script, and rebuild the dependency -# list. +# Script to autogenerate the `configure' script, and the config header +# template if `autoconf' is available, and then rebuild the dependency list. set -e -cd `dirname $0` +cd $(dirname $0) -cd autoconf -autoconf configure.in > ../configure -cd .. +test -t 1 && echo "${0##*/}: running autoconf" +autoconf autoconf/configure.in > configure chmod 755 configure +if command -v autoheader >/dev/null; then + test -t 1 && echo "${0##*/}: running autoheader" + autoheader autoconf/configure.in +else + test -t 1 && echo "${0##*/}: autoheader not found, skipping" +fi + echo > autoconf/make/depend.mk~ echo > autoconf/make/filelist.mk~ echo > autoconf/make/modules.mk~ MAKE=make -which gmake >/dev/null 2>&1 && MAKE=gmake +command -v gmake >/dev/null 2>&1 && MAKE=gmake rm -rf .gen mkdir .gen cd .gen + +test -t 1 && echo "${0##*/}: running new \`configure' script" sh ../configure + +test -t 1 && echo "${0##*/}: regenerating Makefile fragments" $MAKE make $MAKE dep + +test -t 1 && echo "${0##*/}: cleaning up" cd .. rm -rf .gen rm -rf autoconf/autom4te.cache diff --git a/src/include/config-aux.h b/src/include/config-aux.h new file mode 100644 index 0000000..4bf3120 --- /dev/null +++ b/src/include/config-aux.h @@ -0,0 +1,46 @@ +/* + * Standard definitions to make use of the config.h values set by the + * `configure' script. Include this after config.h and before anything + * else. + * + * Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023 Andrew Wood + * + * Distributed under the Artistic License v2.0; see `doc/COPYING'. + */ + +#ifdef ENABLE_NLS +# include "library/gettext.h" +#else +# define _(String) (String) +# define N_(String) (String) +#endif + +#undef HAVE_IPC +#ifdef HAVE_SYS_IPC_H +#define HAVE_IPC 1 +#endif + +#undef CURSOR_ANSWERBACK_BYTE_BY_BYTE +#ifndef _AIX +#define CURSOR_ANSWERBACK_BYTE_BY_BYTE 1 +#endif + +/* Boolean type support */ +#undef HAVE_STDBOOL_H +#ifdef HAVE_STDBOOL_H +# include +#else +# ifndef HAVE__BOOL +# ifdef __cplusplus +typedef bool _Bool; +# else +# define _Bool signed char +# endif +# endif +# define bool _Bool +# define false 0 +# define true 1 +# define __bool_true_false_are_defined 1 +#endif + +/* EOF */ diff --git a/src/include/library/getopt.h b/src/include/library/getopt.h index 0f468b1..e85f863 100644 --- a/src/include/library/getopt.h +++ b/src/include/library/getopt.h @@ -1,5 +1,9 @@ /* * Replacement getopt function's header file. Include this AFTER config.h. + * + * Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023 Andrew Wood + * + * Distributed under the Artistic License v2.0; see `doc/COPYING'. */ #ifndef _LIBRARY_GETOPT_H diff --git a/src/include/library/gettext.h b/src/include/library/gettext.h index fef5ffa..821e0eb 100644 --- a/src/include/library/gettext.h +++ b/src/include/library/gettext.h @@ -9,6 +9,9 @@ * # define N_(String) (String) * #endif * + * Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023 Andrew Wood + * + * Distributed under the Artistic License v2.0; see `doc/COPYING'. */ #ifndef _LIBRARY_GETTEXT_H diff --git a/src/include/options.h b/src/include/options.h index c0e6204..0c6ae04 100644 --- a/src/include/options.h +++ b/src/include/options.h @@ -1,5 +1,9 @@ /* * Global program option structure and the parsing function prototype. + * + * Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023 Andrew Wood + * + * Distributed under the Artistic License v2.0; see `doc/COPYING'. */ #ifndef _OPTIONS_H diff --git a/src/include/pv-internal.h b/src/include/pv-internal.h index 87af94a..7f4041b 100644 --- a/src/include/pv-internal.h +++ b/src/include/pv-internal.h @@ -1,33 +1,19 @@ /* - * Functions internal to the PV library. + * Functions internal to the PV library. Include "config.h" first. + * + * Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023 Andrew Wood + * + * Distributed under the Artistic License v2.0; see `doc/COPYING'. */ #ifndef _PV_INTERNAL_H #define _PV_INTERNAL_H 1 -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#ifndef _PV_H -#include "pv.h" -#endif /* _PV_H */ - #include #include #include #include -/* - * Since macOS 10.6, stat64 variants are equivalent to plain stat, and the - * suffixed versions have been removed in macOS 11. See stat(2). - */ -#if defined(__APPLE__) || defined(APPLE) -#define stat64 stat -#define fstat64 fstat -#define lstat64 lstat -#endif - #ifdef __cplusplus extern "C" { #endif diff --git a/src/include/pv.h b/src/include/pv.h index 8e5651f..2d4705b 100644 --- a/src/include/pv.h +++ b/src/include/pv.h @@ -1,5 +1,9 @@ /* - * Functions used across the program. + * Functions used across the program. Include "config.h" first. + * + * Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023 Andrew Wood + * + * Distributed under the Artistic License v2.0; see `doc/COPYING'. */ #ifndef _PV_H diff --git a/src/library/getopt.c b/src/library/getopt.c index fe53a15..c714ed2 100644 --- a/src/library/getopt.c +++ b/src/library/getopt.c @@ -1,5 +1,9 @@ /* * Small reimplementation of getopt(). + * + * Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023 Andrew Wood + * + * Distributed under the Artistic License v2.0; see `doc/COPYING'. */ #include "config.h" diff --git a/src/library/gettext.c b/src/library/gettext.c index 7a31796..f417281 100644 --- a/src/library/gettext.c +++ b/src/library/gettext.c @@ -11,6 +11,10 @@ * returns a struct msg_table_s[] of msgid and msgstr pairs, with the end * of the table being marked by a NULL msgid. The po2table.sh script will do * this. + * + * Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023 Andrew Wood + * + * Distributed under the Artistic License v2.0; see `doc/COPYING'. */ #include "config.h" diff --git a/src/main/debug.c b/src/main/debug.c index 3c1a21e..e0b28ac 100644 --- a/src/main/debug.c +++ b/src/main/debug.c @@ -1,10 +1,12 @@ /* * Output debugging information. + * + * Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023 Andrew Wood + * + * Distributed under the Artistic License v2.0; see `doc/COPYING'. */ -#ifdef HAVE_CONFIG_H #include "config.h" -#endif #include "pv.h" #include diff --git a/src/main/help.c b/src/main/help.c index f4406d4..e53ddb3 100644 --- a/src/main/help.c +++ b/src/main/help.c @@ -1,18 +1,17 @@ /* * Output command-line help to stdout. + * + * Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023 Andrew Wood + * + * Distributed under the Artistic License v2.0; see `doc/COPYING'. */ -#ifdef HAVE_CONFIG_H #include "config.h" -#endif - #include #include #include #include -#define N_(String) (String) - struct optdesc_s { char *optshort; char *optlong; diff --git a/src/main/main.c b/src/main/main.c index 6d675c4..cd8385a 100644 --- a/src/main/main.c +++ b/src/main/main.c @@ -1,11 +1,13 @@ /* * Main program entry point - read the command line options, then perform * the appropriate actions. + * + * Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023 Andrew Wood + * + * Distributed under the Artistic License v2.0; see `doc/COPYING'. */ -#ifdef HAVE_CONFIG_H #include "config.h" -#endif #include "options.h" #include "pv.h" diff --git a/src/main/options.c b/src/main/options.c index b0e76e5..9394b86 100644 --- a/src/main/options.c +++ b/src/main/options.c @@ -1,10 +1,12 @@ /* * Parse command-line options. + * + * Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023 Andrew Wood + * + * Distributed under the Artistic License v2.0; see `doc/COPYING'. */ -#ifdef HAVE_CONFIG_H #include "config.h" -#endif #include "options.h" #include "library/getopt.h" #include "pv.h" diff --git a/src/main/remote.c b/src/main/remote.c index 4d8d7a7..51793ab 100644 --- a/src/main/remote.c +++ b/src/main/remote.c @@ -1,10 +1,12 @@ /* * Remote-control functions. + * + * Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023 Andrew Wood + * + * Distributed under the Artistic License v2.0; see `doc/COPYING'. */ -#ifdef HAVE_CONFIG_H #include "config.h" -#endif #include "options.h" #include "pv.h" diff --git a/src/main/version.c b/src/main/version.c index 6dcdc18..fef2798 100644 --- a/src/main/version.c +++ b/src/main/version.c @@ -1,34 +1,30 @@ /* * Output version information to stdout. + * + * Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023 Andrew Wood + * + * Distributed under the Artistic License v2.0; see `doc/COPYING'. */ -#ifdef HAVE_CONFIG_H #include "config.h" -#endif - #include - /* - * Display current package version. + * Display current package version as per GNU standards. */ void display_version(void) { - printf(_("%s %s - Copyright %s %s"), - PROGRAM_NAME, VERSION, COPYRIGHT_YEAR, COPYRIGHT_HOLDER); - printf("\n\n"); - printf(_("Web site: %s"), PROJECT_HOMEPAGE); - printf("\n\n"); - printf("%s", - _("This program is free software, and is being distributed " - "under the\nterms of the Artistic License 2.0.")); - printf("\n\n"); - printf("%s", - _ - ("This program is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.")); - printf("\n\n"); + /* GNU standard first line format: program and version only */ + printf("%s %s\n", PROGRAM_NAME, VERSION); + /* GNU standard second line format - "Copyright" always in English */ + printf("Copyright %s %s\n", + COPYRIGHT_YEAR, COPYRIGHT_HOLDER); + /* GNU standard license line and free software notice */ + printf("%s\n", _("License: Artistic v2.0 ")); + printf("%s\n", _("This is free software: you are free to change and redistribute it.")); + printf("%s\n", _("There is NO WARRANTY, to the extent permitted by law.")); + /* Project web site link */ + printf("\n%s: <%s>\n", _("Project web site"), PROJECT_HOMEPAGE); } /* EOF */ diff --git a/src/pv/cursor.c b/src/pv/cursor.c index 8594e30..31daad0 100644 --- a/src/pv/cursor.c +++ b/src/pv/cursor.c @@ -9,8 +9,14 @@ * However, some OSes (FreeBSD and MacOS X so far) don't allow locking of a * terminal, so we try to use a lockfile if terminal locking doesn't work, * and finally abort if even that is unavailable. + * + * Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023 Andrew Wood + * + * Distributed under the Artistic License v2.0; see `doc/COPYING'. */ +#include "config.h" +#include "pv.h" #include "pv-internal.h" #include diff --git a/src/pv/display.c b/src/pv/display.c index 0dad611..0a0d91f 100644 --- a/src/pv/display.c +++ b/src/pv/display.c @@ -1,7 +1,13 @@ /* * Display functions. + * + * Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023 Andrew Wood + * + * Distributed under the Artistic License v2.0; see `doc/COPYING'. */ +#include "config.h" +#include "pv.h" #include "pv-internal.h" #include @@ -12,8 +18,14 @@ #include #include #include -#include -#include + +#ifdef HAVE_TERMIOS_H +# include +#endif + +#ifdef GWINSZ_IN_SYS_IOCTL +# include +#endif /* diff --git a/src/pv/file.c b/src/pv/file.c index 71f1787..3a8da65 100644 --- a/src/pv/file.c +++ b/src/pv/file.c @@ -1,7 +1,13 @@ /* * Functions for opening and closing files. + * + * Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023 Andrew Wood + * + * Distributed under the Artistic License v2.0; see `doc/COPYING'. */ +#include "config.h" +#include "pv.h" #include "pv-internal.h" #include diff --git a/src/pv/loop.c b/src/pv/loop.c index 8aa0625..d11912d 100644 --- a/src/pv/loop.c +++ b/src/pv/loop.c @@ -1,8 +1,14 @@ /* * Main program entry point - read the command line options, then perform * the appropriate actions. + * + * Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023 Andrew Wood + * + * Distributed under the Artistic License v2.0; see `doc/COPYING'. */ +#include "config.h" +#include "pv.h" #include "pv-internal.h" #include @@ -544,27 +550,29 @@ int pv_watchpid_loop(pvstate_t state) format_string : state->default_format; if (NULL == strstr(original_format_string, "%N")) { #ifdef HAVE_SNPRINTF - snprintf(new_format_string, sizeof(new_format_string) - 1, + snprintf(new_format_string, sizeof(new_format_string), #else sprintf(new_format_string, #endif "%%N %s", original_format_string); } else { #ifdef HAVE_SNPRINTF - snprintf(new_format_string, sizeof(new_format_string) - 1, + snprintf(new_format_string, sizeof(new_format_string), #else sprintf(new_format_string, #endif "%s", original_format_string); } + new_format_string[sizeof(new_format_string)-1] = '\0'; state_copy.format_string = NULL; #ifdef HAVE_SNPRINTF snprintf(state_copy.default_format, - sizeof(state_copy.default_format) - 1, + sizeof(state_copy.default_format), #else sprintf(state_copy.default_format, #endif "%.510s", new_format_string); + state_copy.default_format[sizeof(state_copy.default_format)-1] = '\0'; /* * Get things ready for the main loop. diff --git a/src/pv/number.c b/src/pv/number.c index 409e468..ef8070f 100644 --- a/src/pv/number.c +++ b/src/pv/number.c @@ -1,14 +1,16 @@ /* * Functions for converting strings to numbers. + * + * Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023 Andrew Wood + * + * Distributed under the Artistic License v2.0; see `doc/COPYING'. */ -#include - -#ifdef HAVE_CONFIG_H #include "config.h" -#endif #include "pv.h" +#include + /* * This function is used instead of the macro from because diff --git a/src/pv/signal.c b/src/pv/signal.c index 2954ee7..6463f7e 100644 --- a/src/pv/signal.c +++ b/src/pv/signal.c @@ -1,7 +1,13 @@ /* * Signal handling functions. + * + * Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023 Andrew Wood + * + * Distributed under the Artistic License v2.0; see `doc/COPYING'. */ +#include "config.h" +#include "pv.h" #include "pv-internal.h" #include diff --git a/src/pv/state.c b/src/pv/state.c index e55a941..18f09a4 100644 --- a/src/pv/state.c +++ b/src/pv/state.c @@ -1,7 +1,13 @@ /* * State management functions. + * + * Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023 Andrew Wood + * + * Distributed under the Artistic License v2.0; see `doc/COPYING'. */ +#include "config.h" +#include "pv.h" #include "pv-internal.h" #include diff --git a/src/pv/transfer.c b/src/pv/transfer.c index 6e8f313..570d360 100644 --- a/src/pv/transfer.c +++ b/src/pv/transfer.c @@ -1,7 +1,13 @@ /* * Functions for transferring between file descriptors. + * + * Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023 Andrew Wood + * + * Distributed under the Artistic License v2.0; see `doc/COPYING'. */ +#include "config.h" +#include "pv.h" #include "pv-internal.h" #include diff --git a/src/pv/watchpid.c b/src/pv/watchpid.c index f8546e6..8a48f3e 100644 --- a/src/pv/watchpid.c +++ b/src/pv/watchpid.c @@ -1,7 +1,13 @@ /* * Functions for watching file descriptors in other processes. + * + * Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023 Andrew Wood + * + * Distributed under the Artistic License v2.0; see `doc/COPYING'. */ +#include "config.h" +#include "pv.h" #include "pv-internal.h" #include