summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Smith <psmith@nuodb.com>2018-07-01 12:28:25 -0400
committerPaul Smith <psmith@gnu.org>2018-07-02 07:54:07 -0400
commit63b42fa235835cbeac6c1b9182f32798ea135dfd (patch)
tree69d0ded9d9a149842a889360987ab42cf6372a1f
parenta7b0dfddac435eab6017f99f8f5cb18860fb90ac (diff)
downloadmake-git-63b42fa235835cbeac6c1b9182f32798ea135dfd.tar.gz
Convert GNU make to use the gnulib portability library
Move content from glob/* and config/* into standard GNU directory locations lib/* and m4/*. Install the gnulib bootstrap script and its configuration file, and create a bootstrap.bat file for Windows. Update the README.git file with new requirements and instructions for building from Git. At this point we only install the alloca, getloadavg, and FDL modules from gnulib. We keep our old glob/fnmatch implementation since the gnulib versions require significant amounts of infrastructure which doesn't exist on Windows yet. Further work is required here. Due to a problem with gnulib's version of getloadavg, we need to bump the minimum required version of automake to 1.16.1 unfortunately. * README.git: Update instructions * NEWS: Move developer news to a separate section * configure.ac: Update for use with gnulib modules * bootstrap: Bootstrap from Git workspace (import from gnulib) * bootstrap.conf: Bootstrap configuration for GNU make * bootstrap.bat: Bootstrap from Git workspace for Windows * gl/modules/make-glob: Support our local fnmatch/glob implementation * config/acinclude.m4: Move to m4/ * config/dospaths.m4: Move to m4/ * glob/fnmatch.c: Move to lib/ * glob/fnmatch.h.in: Move to lib/ * glob/glob.c: Move to lib/ * glob/glob.h.in: Move to lib/ * Makefile.am: Update for new directories * build.template: Update for new directories * build_w32.bat: Update for new directories * builddos.bat: Update for new directories * maintMakefile: Update for new directories * makefile.com: Update for new directories * mk/Amiga.mk: Update for new directories * mk/Posix.mk.in: Update for new directories * mk/VMS.mk: Update for new directories * mk/Windows32.mk: Update for new directories * mk/msdosdjgpp.mk: Update for new directories * po/LINGUAS: One language per line (needed by gnulib) * INSTALL: Remove (obtained from gnulib) * src/alloca.c: Remove (obtained from gnulib) * src/getloadavg.c: Remove (obtained from gnulib) * po/Makevars: Remove (created by bootstrap) * config/*: Remove leftover files * glob/*: Remove leftover files
-rw-r--r--.gitignore5
-rw-r--r--Basic.mk.template16
-rw-r--r--INSTALL239
-rw-r--r--Makefile.am94
-rw-r--r--NEWS19
-rw-r--r--README.git86
-rwxr-xr-xbootstrap1070
-rw-r--r--bootstrap.bat34
-rw-r--r--bootstrap.conf51
-rw-r--r--build.template51
-rwxr-xr-xbuild_w32.bat15
-rw-r--r--builddos.bat68
-rw-r--r--config/.gitignore12
-rw-r--r--config/ChangeLog.149
-rw-r--r--config/Makefile.am18
-rw-r--r--configure.ac61
-rw-r--r--gl/modules/make-glob44
-rw-r--r--glob/COPYING.LIB481
-rw-r--r--glob/ChangeLog191
-rw-r--r--glob/Makefile.am29
-rw-r--r--lib/.gitignore11
-rw-r--r--lib/fnmatch.c (renamed from glob/fnmatch.c)0
-rw-r--r--lib/fnmatch.in.h (renamed from glob/fnmatch.h)0
-rw-r--r--lib/glob.c (renamed from glob/glob.c)25
-rw-r--r--lib/glob.in.h (renamed from glob/glob.h)0
-rw-r--r--m4/.gitignore5
-rw-r--r--m4/acinclude.m4 (renamed from config/acinclude.m4)0
-rw-r--r--m4/dospaths.m4 (renamed from config/dospaths.m4)0
-rw-r--r--maintMakefile91
-rw-r--r--makefile.com23
-rw-r--r--mk/Amiga.mk4
-rw-r--r--mk/Posix.mk.in5
-rw-r--r--mk/VMS.mk10
-rw-r--r--mk/Windows32.mk6
-rw-r--r--mk/msdosdjgpp.mk4
-rw-r--r--po/.gitignore19
-rw-r--r--po/LINGUAS32
-rw-r--r--po/Makevars65
-rw-r--r--src/alloca.c503
-rw-r--r--src/getloadavg.c1026
40 files changed, 1549 insertions, 2913 deletions
diff --git a/.gitignore b/.gitignore
index 596f33d0..b304956e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,20 +10,22 @@ TAGS
# Configure artifacts
ABOUT-NLS
+INSTALL
Makefile
Makefile.in
Basic.mk
aclocal.m4
autom4te.cache
+build-aux/
config.cache
config.h
config.h.in
config.log
config.status
configure
+/mk/Posix.mk
stamp-h1
.dirstamp
-mk/Posix.mk
# Build artifacts
.deps
@@ -31,6 +33,7 @@ gmk-default.h
loadavg
make
*.o
+*.a
*.exe
*.dll.a
*.obj
diff --git a/Basic.mk.template b/Basic.mk.template
index 4372334b..9eab3560 100644
--- a/Basic.mk.template
+++ b/Basic.mk.template
@@ -8,7 +8,7 @@
# Once you have a GNU make program created, you can use it with this makefile
# to keep it up to date if you make changes, as:
#
-# make.exe -f Makew32.mk
+# make.exe -f Basic.mk
#
# Copyright (C) 2017-2018 Free Software Foundation, Inc.
# This file is part of GNU Make.
@@ -29,7 +29,7 @@
all:
src = src/
-glob = glob/
+lib = lib/
make_SOURCES = %make_SOURCES%
glob_SOURCES = %glob_SOURCES%
@@ -57,6 +57,8 @@ PROG = $(OUTDIR)make$(EXEEXT)
prog_SOURCES = $(make_SOURCES) $(remote_SOURCES)
+BUILT_SOURCES =
+
OBJECTS = $(patsubst %.c,$(OUTDIR)%.$(OBJEXT),$(prog_SOURCES))
OBJDIRS = $(addsuffix .,$(sort $(dir $(OBJECTS))))
@@ -69,7 +71,7 @@ CPPFLAGS =
CFLAGS = -g -O2
LDFLAGS =
-extra_CPPFLAGS = -DHAVE_CONFIG_H -I$(OUTDIR)src -I$(SRCDIR)/src \
+extra_CPPFLAGS = -DHAVE_CONFIG_H -I$(OUTDIR)src -I$(SRCDIR)/src -I$(OUTDIR)lib -I$(SRCDIR)/lib \
-DLIBDIR=\"$(LIBDIR)\" -DINCLUDEDIR=\"$(INCLUDEDIR)\" -DLOCALEDIR=\"$(LOCALDIR)\"
extra_CFLAGS =
extra_LDFLAGS = $(extra_CFLAGS) $(CFLAGS)
@@ -93,7 +95,7 @@ MKDIR = mkdir -p
MKDIR.cmd = $(MKDIR) $@
RM = rm -f
-RM.cmd = $(RM) $(OBJECTS) $(PROG)
+RM.cmd = $(RM) $(OBJECTS) $(PROG) $(BUILT_SOURCES)
# Load overrides for the above variables.
include $(firstword $(wildcard $(SRCDIR)/mk/$(lastword $(subst -, ,$(MAKE_HOST)).mk) $(OUTDIR)mk/Posix.mk $(SRCDIR)/mk/Posix.mk))
@@ -110,7 +112,7 @@ $(PROG): $(OBJECTS)
$(OBJECTS): $(OUTDIR)%.$(OBJEXT): %.c
$(COMPILE.cmd)
-$(OBJECTS): | $(OBJDIRS)
+$(OBJECTS): | $(OBJDIRS) $(BUILT_SOURCES)
$(OBJDIRS):
$(MKDIR.cmd)
@@ -121,4 +123,8 @@ check: $(PROG)
clean:
$(RM.cmd)
+$(filter %.h,$(BUILT_SOURCES)): %.h : %.in.h
+ $(RM) $<
+ $(CP.cmd)
+
.PHONY: all check clean
diff --git a/INSTALL b/INSTALL
deleted file mode 100644
index 870703e1..00000000
--- a/INSTALL
+++ /dev/null
@@ -1,239 +0,0 @@
-Installation Instructions
-*************************
-
-Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004 Free
-Software Foundation, Inc.
-
-This file is free documentation; the Free Software Foundation gives
-unlimited permission to copy, distribute and modify it.
-
-Installation From Git
-=====================
-
-If you are trying to build GNU make from a Git clone rather than a
-downloaded source distribution file, see README.git for steps you
-must take to configure your workspace before you can use the
-instructions below.
-
-
-Basic Installation
-==================
-
-These are generic installation instructions.
-
- The `configure' shell script attempts to guess correct values for
-various system-dependent variables used during compilation. It uses
-those values to create a `Makefile' in each directory of the package.
-It may also create one or more `.h' files containing system-dependent
-definitions. Finally, it creates a shell script `config.status' that
-you can run in the future to recreate the current configuration, and a
-file `config.log' containing compiler output (useful mainly for
-debugging `configure').
-
- It can also use an optional file (typically called `config.cache'
-and enabled with `--cache-file=config.cache' or simply `-C') that saves
-the results of its tests to speed up reconfiguring. (Caching is
-disabled by default to prevent problems with accidental use of stale
-cache files.)
-
- If you need to do unusual things to compile the package, please try
-to figure out how `configure' could check whether to do them, and mail
-diffs or instructions to the address given in the `README' so they can
-be considered for the next release. If you are using the cache, and at
-some point `config.cache' contains results you don't want to keep, you
-may remove or edit it.
-
- The file `configure.ac' (or `configure.in') is used to create
-`configure' by a program called `autoconf'. You only need
-`configure.ac' if you want to change it or regenerate `configure' using
-a newer version of `autoconf'.
-
-The simplest way to compile this package is:
-
- 1. `cd' to the directory containing the package's source code and type
- `./configure' to configure the package for your system. If you're
- using `csh' on an old version of System V, you might need to type
- `sh ./configure' instead to prevent `csh' from trying to execute
- `configure' itself.
-
- Running `configure' takes awhile. While running, it prints some
- messages telling which features it is checking for.
-
- 2. Type `make' to compile the package.
-
- 3. Optionally, type `make check' to run any self-tests that come with
- the package.
-
- 4. Type `make install' to install the programs and any data files and
- documentation.
-
- 5. You can remove the program binaries and object files from the
- source code directory by typing `make clean'. To also remove the
- files that `configure' created (so you can compile the package for
- a different kind of computer), type `make distclean'. There is
- also a `make maintainer-clean' target, but that is intended mainly
- for the package's developers. If you use it, you may have to get
- all sorts of other programs in order to regenerate files that came
- with the distribution.
-
-Compilers and Options
-=====================
-
-Some systems require unusual options for compilation or linking that the
-`configure' script does not know about. Run `./configure --help' for
-details on some of the pertinent environment variables.
-
- You can give `configure' initial values for configuration parameters
-by setting variables in the command line or in the environment. Here
-is an example:
-
- ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix
-
- *Note Defining Variables::, for more details.
-
-Compiling For Multiple Architectures
-====================================
-
-You can compile the package for more than one kind of computer at the
-same time, by placing the object files for each architecture in their
-own directory. To do this, you must use a version of `make' that
-supports the `VPATH' variable, such as GNU `make'. `cd' to the
-directory where you want the object files and executables to go and run
-the `configure' script. `configure' automatically checks for the
-source code in the directory that `configure' is in and in `..'.
-
- If you have to use a `make' that does not support the `VPATH'
-variable, you have to compile the package for one architecture at a
-time in the source code directory. After you have installed the
-package for one architecture, use `make distclean' before reconfiguring
-for another architecture.
-
-Installation Names
-==================
-
-By default, `make install' will install the package's files in
-`/usr/local/bin', `/usr/local/man', etc. You can specify an
-installation prefix other than `/usr/local' by giving `configure' the
-option `--prefix=PREFIX'.
-
- You can specify separate installation prefixes for
-architecture-specific files and architecture-independent files. If you
-give `configure' the option `--exec-prefix=PREFIX', the package will
-use PREFIX as the prefix for installing programs and libraries.
-Documentation and other data files will still use the regular prefix.
-
- In addition, if you use an unusual directory layout you can give
-options like `--bindir=DIR' to specify different values for particular
-kinds of files. Run `configure --help' for a list of the directories
-you can set and what kinds of files go in them.
-
- If the package supports it, you can cause programs to be installed
-with an extra prefix or suffix on their names by giving `configure' the
-option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
-
-Optional Features
-=================
-
-Some packages pay attention to `--enable-FEATURE' options to
-`configure', where FEATURE indicates an optional part of the package.
-They may also pay attention to `--with-PACKAGE' options, where PACKAGE
-is something like `gnu-as' or `x' (for the X Window System). The
-`README' should mention any `--enable-' and `--with-' options that the
-package recognizes.
-
- For packages that use the X Window System, `configure' can usually
-find the X include and library files automatically, but if it doesn't,
-you can use the `configure' options `--x-includes=DIR' and
-`--x-libraries=DIR' to specify their locations.
-
-Specifying the System Type
-==========================
-
-There may be some features `configure' cannot figure out automatically,
-but needs to determine by the type of machine the package will run on.
-Usually, assuming the package is built to be run on the _same_
-architectures, `configure' can figure that out, but if it prints a
-message saying it cannot guess the machine type, give it the
-`--build=TYPE' option. TYPE can either be a short name for the system
-type, such as `sun4', or a canonical name which has the form:
-
- CPU-COMPANY-SYSTEM
-
-where SYSTEM can have one of these forms:
-
- OS KERNEL-OS
-
- See the file `config.sub' for the possible values of each field. If
-`config.sub' isn't included in this package, then this package doesn't
-need to know the machine type.
-
- If you are _building_ compiler tools for cross-compiling, you should
-use the `--target=TYPE' option to select the type of system they will
-produce code for.
-
- If you want to _use_ a cross compiler, that generates code for a
-platform different from the build platform, you should specify the
-"host" platform (i.e., that on which the generated programs will
-eventually be run) with `--host=TYPE'.
-
-Sharing Defaults
-================
-
-If you want to set default values for `configure' scripts to share, you
-can create a site shell script called `config.site' that gives default
-values for variables like `CC', `cache_file', and `prefix'.
-`configure' looks for `PREFIX/share/config.site' if it exists, then
-`PREFIX/etc/config.site' if it exists. Or, you can set the
-`CONFIG_SITE' environment variable to the location of the site script.
-A warning: not all `configure' scripts look for a site script.
-
-Defining Variables
-==================
-
-Variables not defined in a site shell script can be set in the
-environment passed to `configure'. However, some packages may run
-configure again during the build, and the customized values of these
-variables may be lost. In order to avoid this problem, you should set
-them in the `configure' command line, using `VAR=value'. For example:
-
- ./configure CC=/usr/local2/bin/gcc
-
-will cause the specified gcc to be used as the C compiler (unless it is
-overridden in the site shell script).
-
-`configure' Invocation
-======================
-
-`configure' recognizes the following options to control how it operates.
-
-`--help'
-`-h'
- Print a summary of the options to `configure', and exit.
-
-`--version'
-`-V'
- Print the version of Autoconf used to generate the `configure'
- script, and exit.
-
-`--cache-file=FILE'
- Enable the cache: use and save the results of the tests in FILE,
- traditionally `config.cache'. FILE defaults to `/dev/null' to
- disable caching.
-
-`--config-cache'
-`-C'
- Alias for `--cache-file=config.cache'.
-
-`--quiet'
-`--silent'
-`-q'
- Do not print messages saying which checks are being made. To
- suppress all normal output, redirect it to `/dev/null' (any error
- messages will still be shown).
-
-`--srcdir=DIR'
- Look for the package's source code in directory DIR. Usually
- `configure' can determine that directory automatically.
-
-`configure' also accepts some other, not widely useful, options. Run
-`configure --help' for more details.
diff --git a/Makefile.am b/Makefile.am
index 8097d7b7..3540c555 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -17,11 +17,11 @@
# this program. If not, see <http://www.gnu.org/licenses/>.
AUTOMAKE_OPTIONS = dist-bzip2 silent-rules std-options subdir-objects nostdinc
-ACLOCAL_AMFLAGS = -I config
+ACLOCAL_AMFLAGS = -I m4
MAKE_HOST = @MAKE_HOST@
-SUBDIRS = glob config po doc
+SUBDIRS = lib po doc
bin_PROGRAMS = make
include_HEADERS = src/gnumake.h
@@ -38,12 +38,6 @@ make_SRCS = src/ar.c src/arscan.c src/commands.c src/commands.h \
src/rule.c src/rule.h src/signame.c src/strcache.c \
src/variable.c src/variable.h src/version.c src/vpath.c
-glob_SRCS = glob/fnmatch.c glob/fnmatch.h glob/glob.c glob/glob.h
-
-loadavg_SRCS = src/getloadavg.c
-
-alloca_SRCS = src/alloca.c
-
w32_SRCS = src/w32/pathstuff.c src/w32/w32os.c src/w32/compat/dirent.c \
src/w32/compat/posixfcn.c src/w32/include/dirent.h \
src/w32/include/dlfcn.h src/w32/include/pathstuff.h \
@@ -56,16 +50,23 @@ vms_SRCS = src/vms_exit.c src/vms_export_symbol.c src/vms_progname.c \
amiga_SRCS = src/amiga.c src/amiga.h
+glob_SRCS = lib/fnmatch.c lib/fnmatch.h lib/glob.c lib/glob.h
+
+alloca_SRCS = lib/alloca.c
+
+loadavg_SRCS = lib/getloadavg.c
+
make_SOURCES = $(make_SRCS)
EXTRA_make_SOURCES = $(amiga_SRCS) $(vms_SRCS)
-make_LDADD = $(GUILE_LIBS) $(LIBOBJS) $(ALLOCA) $(GLOBLIB) \
- @GETLOADAVG_LIBS@ @LIBINTL@
+make_LDADD = $(LIBOBJS) $(GUILE_LIBS) lib/libgnu.a $(GETLOADAVG_LIBS) \
+ @LIBINTL@
localedir = $(datadir)/locale
-AM_CPPFLAGS = -Isrc -I$(srcdir)/src $(GLOBINC) -DLIBDIR=\"$(libdir)\" \
- -DINCLUDEDIR=\"$(includedir)\" -DLOCALEDIR=\"$(localedir)\"
+AM_CPPFLAGS = -Isrc -I$(top_srcdir)/src -Ilib -I$(top_srcdir)/lib \
+ -DLIBDIR=\"$(libdir)\" -DINCLUDEDIR=\"$(includedir)\" \
+ -DLOCALEDIR=\"$(localedir)\"
AM_CFLAGS = $(GUILE_CFLAGS)
@@ -88,6 +89,8 @@ mk_FILES = Basic.mk mk/msdosdjgpp.mk mk/Amiga.mk mk/VMS.mk mk/Windows32.mk
# We don't need this, since the standard automake output will do.
#mk/Posix.mk.in
+m4_FILES = m4/gnulib-cache.m4
+
test_FILES = tests/run_make_tests tests/run_make_tests.bat \
tests/run_make_tests.pl tests/test_driver.pl \
tests/config-flags.pm.in tests/config_flags_pm.com \
@@ -102,49 +105,20 @@ EXTRA_DIST = ChangeLog README build.sh.in $(man_MANS) \
README.VMS makefile.com src/config.h-vms src/vmsjobs.c \
vms_export_symbol_test.com \
src/gmk-default.scm src/gmk-default.h \
- $(mk_FILES) $(test_FILES)
+ $(mk_FILES) $(m4_FILES) $(test_FILES)
# This is built during configure, but behind configure's back
DISTCLEANFILES = build.sh
-# --------------- Local INSTALL Section
-
-# If necessary, change the gid of the app and turn on the setgid flag.
-#
-
-# Whether or not make needs to be installed setgid.
-# The value should be either 'true' or 'false'.
-# On some systems, the getloadavg function (used to implement the '-l'
-# switch) will not work unless make is installed setgid kmem.
-#
-inst_setgid = @NEED_SETGID@
-
-# Install make setgid to this group so it can get the load average.
-#
-inst_group = @KMEM_GROUP@
-
-install-exec-local:
- @if $(inst_setgid); then \
- app=$(DESTDIR)$(bindir)/`echo $(bin_PROGRAMS)|sed '$(transform)'`; \
- if chgrp $(inst_group) $$app && chmod g+s $$app; then \
- echo "chgrp $(inst_group) $$app && chmod g+s $$app"; \
- else \
- echo "$$app needs to be owned by group $(inst_group) and setgid;"; \
- echo "otherwise the '-l' option will probably not work."; \
- echo "You may need special privileges to complete the installation"; \
- echo "of $$app."; \
- fi; \
- else true; fi
-
# --------------- Generate the Guile default module content
src/guile.$(OBJEXT): src/gmk-default.h
-src/gmk-default.h: $(srcdir)/src/gmk-default.scm
+src/gmk-default.h: $(top_srcdir)/src/gmk-default.scm
(echo 'static const char *const GUILE_module_defn = " '\\ \
&& sed -e 's/;.*//' -e '/^[ \t]*$$/d' -e 's/"/\\"/g' -e 's/$$/ \\/' \
- $(srcdir)/src/gmk-default.scm \
+ $(top_srcdir)/src/gmk-default.scm \
&& echo '";') > src/gmk-default.h
# --------------- Local DIST Section
@@ -152,7 +126,7 @@ src/gmk-default.h: $(srcdir)/src/gmk-default.scm
# Install the mk and tests subdirectories
#
dist-hook:
- (cd $(srcdir); \
+ (cd $(top_srcdir); \
sub=`find tests/scripts -follow \( -name .git -o -name .deps -o -name work -o -name .gitignore -o -name \*.orig -o -name \*.rej -o -name \*~ -o -name \*.out -o -name Makefile \) -prune -o -type f -print`; \
tar chf - $$sub) \
| (cd $(distdir); tar xfBp -)
@@ -160,7 +134,7 @@ dist-hook:
# --------------- Local CHECK Section
-check-local: check-regression check-loadavg
+check-local: check-regression
@banner=" Regression PASSED: GNU Make $(VERSION) ($(MAKE_HOST)) built with $(CC) "; \
dashes=`echo "$$banner" | sed s/./=/g`; \
echo; \
@@ -169,20 +143,6 @@ check-local: check-regression check-loadavg
echo "$$dashes"; \
echo
-.PHONY: check-loadavg check-regression
-
-check-loadavg: loadavg$(EXEEXT)
- @echo The system uptime program believes the load average to be:
- -uptime
- @echo The GNU load average checking code thinks:
- -./loadavg$(EXEEXT)
-
-# The loadavg function is invoked during "make check" to test getloadavg.
-check_PROGRAMS = loadavg
-nodist_loadavg_SOURCES = $(loadavg_SRCS)
-loadavg_CPPFLAGS = -Isrc -I$(srcdir)/src -DTEST
-loadavg_LDADD = @GETLOADAVG_LIBS@
-
# > check-regression
#
# Look for the make test suite, and run it if found and we can find perl.
@@ -191,25 +151,27 @@ loadavg_LDADD = @GETLOADAVG_LIBS@
#
MAKETESTFLAGS =
+.PHONY: check-regression
+
check-regression: tests/config-flags.pm
- @if test -f '$(srcdir)/tests/run_make_tests'; then \
+ @if test -f '$(top_srcdir)/tests/run_make_tests'; then \
ulimit -n 128; \
if $(PERL) -v >/dev/null 2>&1; then \
- case `cd '$(srcdir)'; pwd` in `pwd`) : ;; \
+ case `cd '$(top_srcdir)'; pwd` in `pwd`) : ;; \
*) test -d tests || mkdir tests; \
rm -f srctests; \
- if ln -s '$(srcdir)/tests' srctests; then \
+ if ln -s '$(top_srcdir)/tests' srctests; then \
for f in run_make_tests run_make_tests.pl test_driver.pl scripts jhelp.pl; do \
rm -f tests/$$f; ln -s ../srctests/$$f tests; \
done; fi ;; \
esac; \
- echo "cd tests && $(PERL) ./run_make_tests.pl -srcdir $(abs_srcdir) -make ../make$(EXEEXT) $(MAKETESTFLAGS)"; \
- cd tests && $(PERL) ./run_make_tests.pl -srcdir '$(abs_srcdir)' -make '../make$(EXEEXT)' $(MAKETESTFLAGS); \
+ echo "cd tests && $(PERL) ./run_make_tests.pl -srcdir $(abs_top_srcdir) -make ../make$(EXEEXT) $(MAKETESTFLAGS)"; \
+ cd tests && $(PERL) ./run_make_tests.pl -srcdir '$(abs_top_srcdir)' -make '../make$(EXEEXT)' $(MAKETESTFLAGS); \
else \
echo "Can't find a working Perl ($(PERL)); the test suite requires Perl."; \
fi; \
else \
- echo "Can't find the GNU Make test suite ($(srcdir)/tests)."; \
+ echo "Can't find the GNU Make test suite ($(top_srcdir)/tests)."; \
fi
diff --git a/NEWS b/NEWS
index bc2ac874..eb3f824c 100644
--- a/NEWS
+++ b/NEWS
@@ -24,8 +24,8 @@ http://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=108&set
foo := $(shell echo '\#')
Now this latter will resolve to "\#". If you want to write makefiles
portable to both versions, assign the number sign to a variable:
- C := \#
- foo := $(shell echo '$C')
+ H := \#
+ foo := $(shell echo '$H')
This was claimed to be fixed in 3.81, but wasn't, for some reason.
To detect this change search for 'nocomment' in the .FEATURES variable.
@@ -36,16 +36,13 @@ http://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=108&set
add a trailing space.
* WARNING: Backward-incompatibility!
- On Linux, and other systems that provide a /proc/loadavg with similar
+ On Linux, and any other systems that provide a /proc/loadavg with similar
syntax, the -l/--load-average option will use the contents of that file to
determine how many jobs are running at any given instant, and compare that
value to the load value requested. This allows usage such as "-j -lN" for
- N-processor systems with less fear of overload.
+ N-processor systems without fear of overload.
Patch provided by Sven C. Dack <sven.c.dack@sky.com>
-* Rework the source distribution to move source files into the src/*
- subdirectory. This aligns with modern best practices in GNU.
-
* The previous limit of 63 jobs under -jN on MS-Windows is now
increased to 4095. That limit includes the subprocess started by
the $(shell) function.
@@ -55,6 +52,14 @@ http://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=108&set
* A new option -E has been added as a short alias for --eval.
+GNU make Developer News
+
+* Import the GNU standard bootstrap script to replace the hand-rolled
+ "make update" method for building code from a GNU make Git repository.
+
+* Rework the source distribution to move source files into the src/*
+ subdirectory. This aligns with modern best practices in GNU.
+
Version 4.2.1 (10 Jun 2016)
diff --git a/README.git b/README.git
index 5182cee0..8e3b10a4 100644
--- a/README.git
+++ b/README.git
@@ -73,62 +73,66 @@ It should build with any C compiler conforming to the ANSI C89 / ISO C90
standard.
-Building From Git
------------------
-
-To build GNU make from Git, you will need Autoconf, Automake, and
-Gettext, and any tools that those utilities require (GNU m4, Perl,
-etc.). See the configure.ac file to find the minimum versions of each
-of these tools. You will also need a copy of wget and gnulib.
-
-When building from Git you must build in the source directory: "VPATH
-builds" from remote directories are not supported. Once you've created
-a distribution, of course, you can unpack it and do a VPATH build from
-there.
+Building From Git for POSIX
+---------------------------
-After checking out the code, you will need to perform these steps to get
-to the point where you can run "make".
+To build GNU make from Git on POSIX systems such as GNU/Linux, you will
+need to install the following extra software:
- 1) $ autoreconf -i
+* autoconf
+* automake >= 1.16.1
+* gettext
+* autopoint
+* pkg-config
+* texinfo (for makeinfo)
- This rebuilds all the things that need rebuilding, installing
- missing files as symbolic links.
+And any tools that those utilities require (GNU m4, Perl, etc.)
- You may get warnings here about missing files like README, etc.
- Ignore them, they are harmless.
+GNU make requires gnulib to provide some facilities. If you want to maintain
+a local installation of gnulib you can set GNULIB_SRCDIR to point to it.
+Otherwise, ./bootstrap will obtain a clone for you.
- 2) $ ./configure
+Unfortunately due to issues with gnulib's getloadavg, you must have automake
+1.16.1 or above. This version is not yet widely available in GNU/Linux
+package managers. If you need to install from source be sure to set
+ACLOCAL_PATH to point to the pkg-config location (e.g., /usr/share/aclocal).
- Generate a Makefile
- 3) $ make update
+When building from Git you must build in the source directory: "VPATH
+builds" from remote directories are not supported. Once you've created
+a distribution, of course, you can unpack it and do a VPATH build from
+there.
- Use wget to retrieve various other files that GNU make relies on,
- but does not keep in its own source tree.
+After checking out the code, you will need to run the bootstrap script:
- NB: You may need GNU make to correctly perform this step; if you use
- a platform-local make you may get problems with missing files in doc/.
+ $ ./bootstrap
At this point you have successfully brought your Git copy of the GNU
make source directory up to the point where it can be treated
more-or-less like the official package you would get from ftp.gnu.org.
That is, you can just run:
- $ make && make check && make install
+ $ ./configure
+ $ make check
+ $ make install
to build and install GNU make.
-Windows builds from Git
------------------------
+Building From Git for Windows
+-----------------------------
If you have a UNIX emulation like CYGWIN you can opt to run the general
-build procedure above; it will work. Be sure to read
-README.W32.template for information on options you might want to use
-when running ./configure.
+build procedure above; it will work. Consult README.W32.template for
+information on options you might want to use when running ./configure.
-If you can't or don't want to do that, then rename the file
-README.W32.template to README.W32 and follow those instructions.
+If you can't or don't want to do that, then first run the .\bootstrap.bat
+script to prime your Git workspace:
+
+ > .\bootstrap.bat
+
+Next, rename the file README.W32.template to README.W32 and follow those
+instructions.
Creating a Package
@@ -277,16 +281,10 @@ prerequisites are available of course).
This list is eminently suitable for a quick swipe o' the mouse and a
swift click o' mouse-2 into an xterm. Go for it!
-autoreconf -i
-./configure
-make update
-make
-make check
-
-Or, for a debugging version:
+For a debugging version:
-autoreconf -i && ./configure CFLAGS=-g && make update && make && make check
+./bootstrap && ./configure CFLAGS=-g && make check
-Or, all-in-one:
+For a release version
-autoreconf -i && ./configure && make update && make && make check
+./bootstrap && ./configure && make check
diff --git a/bootstrap b/bootstrap
new file mode 100755
index 00000000..ed3b0a4b
--- /dev/null
+++ b/bootstrap
@@ -0,0 +1,1070 @@
+#! /bin/sh
+# Print a version string.
+scriptversion=2018-07-01.02; # UTC
+
+# Bootstrap this package from checked-out sources.
+
+# Copyright (C) 2003-2018 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
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+# Originally written by Paul Eggert. The canonical version of this
+# script is maintained as build-aux/bootstrap in gnulib, however, to
+# be useful to your project, you should place a copy of it under
+# version control in the top-level directory of your project. The
+# intent is that all customization can be done with a bootstrap.conf
+# file also maintained in your version control; gnulib comes with a
+# template build-aux/bootstrap.conf to get you started.
+
+# Please report bugs or propose patches to bug-gnulib@gnu.org.
+
+nl='
+'
+
+# Ensure file names are sorted consistently across platforms.
+LC_ALL=C
+export LC_ALL
+
+# Ensure that CDPATH is not set. Otherwise, the output from cd
+# would cause trouble in at least one use below.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+local_gl_dir=gl
+
+# Honor $PERL, but work even if there is none.
+PERL="${PERL-perl}"
+
+me=$0
+
+default_gnulib_url=git://git.sv.gnu.org/gnulib
+
+usage() {
+ cat <<EOF
+Usage: $me [OPTION]...
+Bootstrap this package from the checked-out sources.
+
+Options:
+ --gnulib-srcdir=DIRNAME specify the local directory where gnulib
+ sources reside. Use this if you already
+ have gnulib sources on your machine, and
+ do not want to waste your bandwidth downloading
+ them again. Defaults to \$GNULIB_SRCDIR
+ --bootstrap-sync if this bootstrap script is not identical to
+ the version in the local gnulib sources,
+ update this script, and then restart it with
+ /bin/sh or the shell \$CONFIG_SHELL
+ --no-bootstrap-sync do not check whether bootstrap is out of sync
+ --copy copy files instead of creating symbolic links
+ --force attempt to bootstrap even if the sources seem
+ not to have been checked out
+ --no-git do not use git to update gnulib. Requires that
+ --gnulib-srcdir point to a correct gnulib snapshot
+ --skip-po do not download po files
+
+If the file $me.conf exists in the same directory as this script, its
+contents are read as shell variables to configure the bootstrap.
+
+For build prerequisites, environment variables like \$AUTOCONF and \$AMTAR
+are honored.
+
+Gnulib sources can be fetched in various ways:
+
+ * If this package is in a git repository with a 'gnulib' submodule
+ configured, then that submodule is initialized and updated and sources
+ are fetched from there. If \$GNULIB_SRCDIR is set (directly or via
+ --gnulib-srcdir) and is a git repository, then it is used as a reference.
+
+ * Otherwise, if \$GNULIB_SRCDIR is set (directly or via --gnulib-srcdir),
+ then sources are fetched from that local directory. If it is a git
+ repository and \$GNULIB_REVISION is set, then that revision is checked
+ out.
+
+ * Otherwise, if this package is in a git repository with a 'gnulib'
+ submodule configured, then that submodule is initialized and updated and
+ sources are fetched from there.
+
+ * Otherwise, if the 'gnulib' directory does not exist, Gnulib sources are
+ cloned into that directory using git from \$GNULIB_URL, defaulting to
+ $default_gnulib_url.
+ If \$GNULIB_REVISION is set, then that revision is checked out.
+
+ * Otherwise, the existing Gnulib sources in the 'gnulib' directory are
+ used. If it is a git repository and \$GNULIB_REVISION is set, then that
+ revision is checked out.
+
+If you maintain a package and want to pin a particular revision of the
+Gnulib sources that has been tested with your package, then there are two
+possible approaches: either configure a 'gnulib' submodule with the
+appropriate revision, or set \$GNULIB_REVISION (and if necessary
+\$GNULIB_URL) in $me.conf.
+
+Running without arguments will suffice in most cases.
+EOF
+}
+
+# warnf_ FORMAT-STRING ARG1...
+warnf_ ()
+{
+ warnf_format_=$1
+ shift
+ nl='
+'
+ case $* in
+ *$nl*) me_=$(printf "$me"|tr "$nl|" '??')
+ printf "$warnf_format_" "$@" | sed "s|^|$me_: |" ;;
+ *) printf "$me: $warnf_format_" "$@" ;;
+ esac >&2
+}
+
+# warn_ WORD1...
+warn_ ()
+{
+ # If IFS does not start with ' ', set it and emit the warning in a subshell.
+ case $IFS in
+ ' '*) warnf_ '%s\n' "$*";;
+ *) (IFS=' '; warn_ "$@");;
+ esac
+}
+
+# die WORD1...
+die() { warn_ "$@"; exit 1; }
+
+# Configuration.
+
+# List of gnulib modules needed.
+gnulib_modules=
+
+# Any gnulib files needed that are not in modules.
+gnulib_files=
+
+: ${AUTOPOINT=autopoint}
+: ${AUTORECONF=autoreconf}
+
+# A function to be called right after gnulib-tool is run.
+# Override it via your own definition in bootstrap.conf.
+bootstrap_post_import_hook() { :; }
+
+# A function to be called after everything else in this script.
+# Override it via your own definition in bootstrap.conf.
+bootstrap_epilogue() { :; }
+
+# The command to download all .po files for a specified domain into
+# a specified directory. Fill in the first %s is the domain name, and
+# the second with the destination directory. Use rsync's -L and -r
+# options because the latest/%s directory and the .po files within are
+# all symlinks.
+po_download_command_format=\
+"rsync --delete --exclude '*.s1' -Lrtvz \
+ 'translationproject.org::tp/latest/%s/' '%s'"
+
+# Fallback for downloading .po files (if rsync fails).
+po_download_command_format2=\
+"wget --mirror -nd -q -np -A.po -P '%s' \
+ https://translationproject.org/latest/%s/"
+
+# Prefer a non-empty tarname (4th argument of AC_INIT if given), else
+# fall back to the package name (1st argument with munging)
+extract_package_name='
+ /^AC_INIT(\[*/{
+ s///
+ /^[^,]*,[^,]*,[^,]*,[ []*\([^][ ,)]\)/{
+ s//\1/
+ s/[],)].*//
+ p
+ q
+ }
+ s/[],)].*//
+ s/^GNU //
+ y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
+ s/[^abcdefghijklmnopqrstuvwxyz0123456789_]/-/g
+ p
+ }
+'
+package=$(sed -n "$extract_package_name" configure.ac) \
+ || die 'cannot find package name in configure.ac'
+gnulib_name=lib$package
+
+build_aux=build-aux
+source_base=lib
+m4_base=m4
+doc_base=doc
+tests_base=tests
+gnulib_extra_files="
+ build-aux/install-sh
+ build-aux/mdate-sh
+ build-aux/texinfo.tex
+ build-aux/depcomp
+ build-aux/config.guess
+ build-aux/config.sub
+ doc/INSTALL
+"
+
+# Additional gnulib-tool options to use. Use "\newline" to break lines.
+gnulib_tool_option_extras=
+
+# Other locale categories that need message catalogs.
+EXTRA_LOCALE_CATEGORIES=
+
+# Additional xgettext options to use. Use "\\\newline" to break lines.
+XGETTEXT_OPTIONS='\\\
+ --flag=_:1:pass-c-format\\\
+ --flag=N_:1:pass-c-format\\\
+ --flag=error:3:c-format --flag=error_at_line:5:c-format\\\
+'
+
+# Package bug report address and copyright holder for gettext files
+COPYRIGHT_HOLDER='Free Software Foundation, Inc.'
+MSGID_BUGS_ADDRESS=bug-$package@gnu.org
+
+# Files we don't want to import.
+excluded_files=
+
+# File that should exist in the top directory of a checked out hierarchy,
+# but not in a distribution tarball.
+checkout_only_file=README-hacking
+
+# Whether to use copies instead of symlinks.
+copy=false
+
+# Set this to '.cvsignore .gitignore' in bootstrap.conf if you want
+# those files to be generated in directories like lib/, m4/, and po/.
+# Or set it to 'auto' to make this script select which to use based
+# on which version control system (if any) is used in the source directory.
+vc_ignore=auto
+
+# Set this to true in bootstrap.conf to enable --bootstrap-sync by
+# default.
+bootstrap_sync=false
+
+# Use git to update gnulib sources
+use_git=true
+
+check_exists() {
+ if test "$1" = "--verbose"; then
+ ($2 --version </dev/null) >/dev/null 2>&1
+ if test $? -ge 126; then
+ # If not found, run with diagnostics as one may be
+ # presented with env variables to set to find the right version
+ ($2 --version </dev/null)
+ fi
+ else
+ ($1 --version </dev/null) >/dev/null 2>&1
+ fi
+
+ test $? -lt 126
+}
+
+# find_tool ENVVAR NAMES...
+# -------------------------
+# Search for a required program. Use the value of ENVVAR, if set,
+# otherwise find the first of the NAMES that can be run.
+# If found, set ENVVAR to the program name, die otherwise.
+#
+# FIXME: code duplication, see also gnu-web-doc-update.
+find_tool ()
+{
+ find_tool_envvar=$1
+ shift
+ find_tool_names=$@
+ eval "find_tool_res=\$$find_tool_envvar"
+ if test x"$find_tool_res" = x; then
+ for i; do
+ if check_exists $i; then
+ find_tool_res=$i
+ break
+ fi
+ done
+ fi
+ if test x"$find_tool_res" = x; then
+ warn_ "one of these is required: $find_tool_names;"
+ die "alternatively set $find_tool_envvar to a compatible tool"
+ fi
+ eval "$find_tool_envvar=\$find_tool_res"
+ eval "export $find_tool_envvar"
+}
+
+# Override the default configuration, if necessary.
+# Make sure that bootstrap.conf is sourced from the current directory
+# if we were invoked as "sh bootstrap".
+case "$0" in
+ */*) test -r "$0.conf" && . "$0.conf" ;;
+ *) test -r "$0.conf" && . ./"$0.conf" ;;
+esac
+
+if test "$vc_ignore" = auto; then
+ vc_ignore=
+ test -d .git && vc_ignore=.gitignore
+ test -d CVS && vc_ignore="$vc_ignore .cvsignore"
+fi
+
+if test x"$gnulib_modules$gnulib_files$gnulib_extra_files" = x; then
+ use_gnulib=false
+else
+ use_gnulib=true
+fi
+
+# Translate configuration into internal form.
+
+# Parse options.
+
+for option
+do
+ case $option in
+ --help)
+ usage
+ exit;;
+ --gnulib-srcdir=*)
+ GNULIB_SRCDIR=${option#--gnulib-srcdir=};;
+ --skip-po)
+ SKIP_PO=t;;
+ --force)
+ checkout_only_file=;;
+ --copy)
+ copy=true;;
+ --bootstrap-sync)
+ bootstrap_sync=true;;
+ --no-bootstrap-sync)
+ bootstrap_sync=false;;
+ --no-git)
+ use_git=false;;
+ *)
+ die "$option: unknown option";;
+ esac
+done
+
+$use_git || test -d "$GNULIB_SRCDIR" \
+ || die "Error: --no-git requires --gnulib-srcdir"
+
+if test -n "$checkout_only_file" && test ! -r "$checkout_only_file"; then
+ die "Bootstrapping from a non-checked-out distribution is risky."
+fi
+
+# Strip blank and comment lines to leave significant entries.
+gitignore_entries() {
+ sed '/^#/d; /^$/d' "$@"
+}
+
+# If $STR is not already on a line by itself in $FILE, insert it at the start.
+# Entries are inserted at the start of the ignore list to ensure existing
+# entries starting with ! are not overridden. Such entries support
+# whitelisting exceptions after a more generic blacklist pattern.
+insert_if_absent() {
+ file=$1
+ str=$2
+ test -f $file || touch $file
+ test -r $file || die "Error: failed to read ignore file: $file"
+ duplicate_entries=$(gitignore_entries $file | sort | uniq -d)
+ if [ "$duplicate_entries" ] ; then
+ die "Error: Duplicate entries in $file: " $duplicate_entries
+ fi
+ linesold=$(gitignore_entries $file | wc -l)
+ linesnew=$( { echo "$str"; cat $file; } | gitignore_entries | sort -u | wc -l)
+ if [ $linesold != $linesnew ] ; then
+ { echo "$str" | cat - $file > $file.bak && mv $file.bak $file; } \
+ || die "insert_if_absent $file $str: failed"
+ fi
+}
+
+# Adjust $PATTERN for $VC_IGNORE_FILE and insert it with
+# insert_if_absent.
+insert_vc_ignore() {
+ vc_ignore_file="$1"
+ pattern="$2"
+ case $vc_ignore_file in
+ *.gitignore)
+ # A .gitignore entry that does not start with '/' applies
+ # recursively to subdirectories, so prepend '/' to every
+ # .gitignore entry.
+ pattern=$(echo "$pattern" | sed s,^,/,);;
+ esac
+ insert_if_absent "$vc_ignore_file" "$pattern"
+}
+
+# Die if there is no AC_CONFIG_AUX_DIR($build_aux) line in configure.ac.
+found_aux_dir=no
+grep '^[ ]*AC_CONFIG_AUX_DIR(\['"$build_aux"'\])' configure.ac \
+ >/dev/null && found_aux_dir=yes
+grep '^[ ]*AC_CONFIG_AUX_DIR('"$build_aux"')' configure.ac \
+ >/dev/null && found_aux_dir=yes
+test $found_aux_dir = yes \
+ || die "configure.ac lacks 'AC_CONFIG_AUX_DIR([$build_aux])'; add it"
+
+# If $build_aux doesn't exist, create it now, otherwise some bits
+# below will malfunction. If creating it, also mark it as ignored.
+if test ! -d $build_aux; then
+ mkdir $build_aux
+ for dot_ig in x $vc_ignore; do
+ test $dot_ig = x && continue
+ insert_vc_ignore $dot_ig $build_aux
+ done
+fi
+
+# Note this deviates from the version comparison in automake
+# in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a
+# but this should suffice as we won't be specifying old
+# version formats or redundant trailing .0 in bootstrap.conf.
+# If we did want full compatibility then we should probably
+# use m4_version_compare from autoconf.
+sort_ver() { # sort -V is not generally available
+ ver1="$1"
+ ver2="$2"
+
+ # split on '.' and compare each component
+ i=1
+ while : ; do
+ p1=$(echo "$ver1" | cut -d. -f$i)
+ p2=$(echo "$ver2" | cut -d. -f$i)
+ if [ ! "$p1" ]; then
+ echo "$1 $2"
+ break
+ elif [ ! "$p2" ]; then
+ echo "$2 $1"
+ break
+ elif [ ! "$p1" = "$p2" ]; then
+ if [ "$p1" -gt "$p2" ] 2>/dev/null; then # numeric comparison
+ echo "$2 $1"
+ elif [ "$p2" -gt "$p1" ] 2>/dev/null; then # numeric comparison
+ echo "$1 $2"
+ else # numeric, then lexicographic comparison
+ lp=$(printf "$p1\n$p2\n" | LANG=C sort -n | tail -n1)
+ if [ "$lp" = "$p2" ]; then
+ echo "$1 $2"
+ else
+ echo "$2 $1"
+ fi
+ fi
+ break
+ fi
+ i=$(($i+1))
+ done
+}
+
+get_version_sed='
+# Move version to start of line.
+s/.*[v ]\([0-9]\)/\1/
+
+# Skip lines that do not start with version.
+/^[0-9]/!d
+
+# Remove characters after the version.
+s/[^.a-z0-9-].*//
+
+# The first component must be digits only.
+s/^\([0-9]*\)[a-z-].*/\1/
+
+#the following essentially does s/5.005/5.5/
+s/\.0*\([1-9]\)/.\1/g
+p
+q'
+
+get_version() {
+ app=$1
+
+ $app --version >/dev/null 2>&1 || { $app --version; return 1; }
+
+ $app --version 2>&1 | sed -n "$get_version_sed"
+}
+
+check_versions() {
+ ret=0
+
+ while read app req_ver; do
+ # We only need libtoolize from the libtool package.
+ if test "$app" = libtool; then
+ app=libtoolize
+ fi
+ # Exempt git if --no-git is in effect.
+ if test "$app" = git; then
+ $use_git || continue
+ fi
+ # Honor $APP variables ($TAR, $AUTOCONF, etc.)
+ appvar=$(echo $app | LC_ALL=C tr '[a-z]-' '[A-Z]_')
+ test "$appvar" = TAR && appvar=AMTAR
+ case $appvar in
+ GZIP) ;; # Do not use $GZIP: it contains gzip options.
+ PERL::*) ;; # Keep perl modules as-is
+ *) eval "app=\${$appvar-$app}" ;;
+ esac
+
+ # Handle the still-experimental Automake-NG programs specially.
+ # They remain named as the mainstream Automake programs ("automake",
+ # and "aclocal") to avoid gratuitous incompatibilities with
+ # pre-existing usages (by, say, autoreconf, or custom autogen.sh
+ # scripts), but correctly identify themselves (as being part of
+ # "GNU automake-ng") when asked their version.
+ case $app in
+ automake-ng|aclocal-ng)
+ app=${app%-ng}
+ ($app --version | grep '(GNU automake-ng)') >/dev/null 2>&1 || {
+ warn_ "Error: '$app' not found or not from Automake-NG"
+ ret=1
+ continue
+ } ;;
+ # Another check is for perl modules. These can be written as
+ # e.g. perl::XML::XPath in case of XML::XPath module, etc.
+ perl::*)
+ # Extract module name
+ app="${app#perl::}"
+ if ! $PERL -m"$app" -e 'exit 0' >/dev/null 2>&1; then
+ warn_ "Error: perl module '$app' not found"
+ ret=1
+ fi
+ continue
+ ;;
+ esac
+ if [ "$req_ver" = "-" ]; then
+ # Merely require app to exist; not all prereq apps are well-behaved
+ # so we have to rely on $? rather than get_version.
+ if ! check_exists --verbose $app; then
+ warn_ "Error: '$app' not found"
+ ret=1
+ fi
+ else
+ # Require app to produce a new enough version string.
+ inst_ver=$(get_version $app)
+ if [ ! "$inst_ver" ]; then
+ warn_ "Error: '$app' not found"
+ ret=1
+ else
+ latest_ver=$(sort_ver $req_ver $inst_ver | cut -d' ' -f2)
+ if [ ! "$latest_ver" = "$inst_ver" ]; then
+ warnf_ '%s\n' \
+ "Error: '$app' version == $inst_ver is too old" \
+ " '$app' version >= $req_ver is required"
+ ret=1
+ fi
+ fi
+ fi
+ done
+
+ return $ret
+}
+
+print_versions() {
+ echo "Program Min_version"
+ echo "----------------------"
+ printf %s "$buildreq"
+ echo "----------------------"
+ # can't depend on column -t
+}
+
+# Find sha1sum, named gsha1sum on MacPorts, shasum on Mac OS X 10.6.
+# Also find the compatible sha1 utility on the BSDs
+if test x"$SKIP_PO" = x; then
+ find_tool SHA1SUM sha1sum gsha1sum shasum sha1
+fi
+
+use_libtool=0
+# We'd like to use grep -E, to see if any of LT_INIT,
+# AC_PROG_LIBTOOL, AM_PROG_LIBTOOL is used in configure.ac,
+# but that's not portable enough (e.g., for Solaris).
+grep '^[ ]*A[CM]_PROG_LIBTOOL' configure.ac >/dev/null \
+ && use_libtool=1
+grep '^[ ]*LT_INIT' configure.ac >/dev/null \
+ && use_libtool=1
+if test $use_libtool = 1; then
+ find_tool LIBTOOLIZE glibtoolize libtoolize
+fi
+
+# gnulib-tool requires at least automake and autoconf.
+# If either is not listed, add it (with minimum version) as a prerequisite.
+case $buildreq in
+ *automake*) ;;
+ *) buildreq="automake 1.9
+$buildreq" ;;
+esac
+case $buildreq in
+ *autoconf*) ;;
+ *) buildreq="autoconf 2.59
+$buildreq" ;;
+esac
+
+# When we can deduce that gnulib-tool will require patch,
+# and when patch is not already listed as a prerequisite, add it, too.
+if test -d "$local_gl_dir" \
+ && ! find "$local_gl_dir" -name '*.diff' -exec false {} +; then
+ case $buildreq in
+ *patch*) ;;
+ *) buildreq="patch -
+$buildreq" ;;
+ esac
+fi
+
+if ! printf "$buildreq" | check_versions; then
+ echo >&2
+ if test -f README-prereq; then
+ die "See README-prereq for how to get the prerequisite programs"
+ else
+ die "Please install the prerequisite programs"
+ fi
+fi
+
+# Warn the user if autom4te appears to be broken; this causes known
+# issues with at least gettext 0.18.3.
+probe=$(echo 'm4_quote([hi])' | autom4te -l M4sugar -t 'm4_quote:$%' -)
+if test "x$probe" != xhi; then
+ warn_ "WARNING: your autom4te wrapper eats stdin;"
+ warn_ "if bootstrap fails, consider upgrading your autotools"
+fi
+
+echo "$0: Bootstrapping from checked-out $package sources..."
+
+# See if we can use gnulib's git-merge-changelog merge driver.
+if $use_git && test -d .git && check_exists git; then
+ if git config merge.merge-changelog.driver >/dev/null ; then
+ :
+ elif check_exists git-merge-changelog; then
+ echo "$0: initializing git-merge-changelog driver"
+ git config merge.merge-changelog.name 'GNU-style ChangeLog merge driver'
+ git config merge.merge-changelog.driver 'git-merge-changelog %O %A %B'
+ else
+ echo "$0: consider installing git-merge-changelog from gnulib"
+ fi
+fi
+
+
+cleanup_gnulib() {
+ status=$?
+ rm -fr "$gnulib_path"
+ exit $status
+}
+
+git_modules_config () {
+ test -f .gitmodules && git config --file .gitmodules "$@"
+}
+
+if $use_gnulib; then
+ if $use_git; then
+ gnulib_path=$(git_modules_config submodule.gnulib.path)
+ test -z "$gnulib_path" && gnulib_path=gnulib
+ fi
+
+ # Get gnulib files. Populate $GNULIB_SRCDIR, possibly updating a
+ # submodule, for use in the rest of the script.
+
+ case ${GNULIB_SRCDIR--} in
+ -)
+ # Note that $use_git is necessarily true in this case.
+ if git_modules_config submodule.gnulib.url >/dev/null; then
+ echo "$0: getting gnulib files..."
+ git submodule init -- "$gnulib_path" || exit $?
+ git submodule update -- "$gnulib_path" || exit $?
+
+ elif [ ! -d "$gnulib_path" ]; then
+ echo "$0: getting gnulib files..."
+
+ trap cleanup_gnulib 1 2 13 15
+
+ shallow=
+ if test -z "$GNULIB_REVISION"; then
+ git clone -h 2>&1 | grep -- --depth > /dev/null && shallow='--depth 2'
+ fi
+ git clone $shallow ${GNULIB_URL:-$default_gnulib_url} "$gnulib_path" \
+ || cleanup_gnulib
+
+ trap - 1 2 13 15
+ fi
+ GNULIB_SRCDIR=$gnulib_path
+ ;;
+ *)
+ # Use GNULIB_SRCDIR directly or as a reference.
+ if $use_git && test -d "$GNULIB_SRCDIR"/.git && \
+ git_modules_config submodule.gnulib.url >/dev/null; then
+ echo "$0: getting gnulib files..."
+ if git submodule -h|grep -- --reference > /dev/null; then
+ # Prefer the one-liner available in git 1.6.4 or newer.
+ git submodule update --init --reference "$GNULIB_SRCDIR" \
+ "$gnulib_path" || exit $?
+ else
+ # This fallback allows at least git 1.5.5.
+ if test -f "$gnulib_path"/gnulib-tool; then
+ # Since file already exists, assume submodule init already complete.
+ git submodule update -- "$gnulib_path" || exit $?
+ else
+ # Older git can't clone into an empty directory.
+ rmdir "$gnulib_path" 2>/dev/null
+ git clone --reference "$GNULIB_SRCDIR" \
+ "$(git_modules_config submodule.gnulib.url)" "$gnulib_path" \
+ && git submodule init -- "$gnulib_path" \
+ && git submodule update -- "$gnulib_path" \
+ || exit $?
+ fi
+ fi
+ GNULIB_SRCDIR=$gnulib_path
+ fi
+ ;;
+ esac
+
+ if test -d "$GNULIB_SRCDIR"/.git && test -n "$GNULIB_REVISION" \
+ && ! git_modules_config submodule.gnulib.url >/dev/null; then
+ (cd "$GNULIB_SRCDIR" && git checkout "$GNULIB_REVISION") || cleanup_gnulib
+ fi
+
+ # $GNULIB_SRCDIR now points to the version of gnulib to use, and
+ # we no longer need to use git or $gnulib_path below here.
+
+ if $bootstrap_sync; then
+ cmp -s "$0" "$GNULIB_SRCDIR/build-aux/bootstrap" || {
+ echo "$0: updating bootstrap and restarting..."
+ case $(sh -c 'echo "$1"' -- a) in
+ a) ignored=--;;
+ *) ignored=ignored;;
+ esac
+ exec sh -c \
+ 'cp "$1" "$2" && shift && exec "${CONFIG_SHELL-/bin/sh}" "$@"' \
+ $ignored "$GNULIB_SRCDIR/build-aux/bootstrap" \
+ "$0" "$@" --no-bootstrap-sync
+ }
+ fi
+
+ gnulib_tool=$GNULIB_SRCDIR/gnulib-tool
+ <$gnulib_tool || exit $?
+fi
+
+# Get translations.
+
+download_po_files() {
+ subdir=$1
+ domain=$2
+ echo "$me: getting translations into $subdir for $domain..."
+ cmd=$(printf "$po_download_command_format" "$domain" "$subdir")
+ eval "$cmd" && return
+ # Fallback to HTTPS.
+ cmd=$(printf "$po_download_command_format2" "$subdir" "$domain")
+ eval "$cmd"
+}
+
+# Mirror .po files to $po_dir/.reference and copy only the new
+# or modified ones into $po_dir. Also update $po_dir/LINGUAS.
+# Note po files that exist locally only are left in $po_dir but will
+# not be included in LINGUAS and hence will not be distributed.
+update_po_files() {
+ # Directory containing primary .po files.
+ # Overwrite them only when we're sure a .po file is new.
+ po_dir=$1
+ domain=$2
+
+ # Mirror *.po files into this dir.
+ # Usually contains *.s1 checksum files.
+ ref_po_dir="$po_dir/.reference"
+
+ test -d $ref_po_dir || mkdir $ref_po_dir || return
+ download_po_files $ref_po_dir $domain \
+ && ls "$ref_po_dir"/*.po 2>/dev/null |
+ sed 's|.*/||; s|\.po$||' > "$po_dir/LINGUAS" || return
+
+ langs=$(cd $ref_po_dir && echo *.po | sed 's/\.po//g')
+ test "$langs" = '*' && langs=x
+ for po in $langs; do
+ case $po in x) continue;; esac
+ new_po="$ref_po_dir/$po.po"
+ cksum_file="$ref_po_dir/$po.s1"
+ if ! test -f "$cksum_file" ||
+ ! test -f "$po_dir/$po.po" ||
+ ! $SHA1SUM -c "$cksum_file" < "$new_po" > /dev/null 2>&1; then
+ echo "$me: updated $po_dir/$po.po..."
+ cp "$new_po" "$po_dir/$po.po" \
+ && $SHA1SUM < "$new_po" > "$cksum_file" || return
+ fi
+ done
+}
+
+case $SKIP_PO in
+'')
+ if test -d po; then
+ update_po_files po $package || exit
+ fi
+
+ if test -d runtime-po; then
+ update_po_files runtime-po $package-runtime || exit
+ fi;;
+esac
+
+symlink_to_dir()
+{
+ src=$1/$2
+ dst=${3-$2}
+
+ test -f "$src" && {
+
+ # If the destination directory doesn't exist, create it.
+ # This is required at least for "lib/uniwidth/cjk.h".
+ dst_dir=$(dirname "$dst")
+ if ! test -d "$dst_dir"; then
+ mkdir -p "$dst_dir"
+
+ # If we've just created a directory like lib/uniwidth,
+ # tell version control system(s) it's ignorable.
+ # FIXME: for now, this does only one level
+ parent=$(dirname "$dst_dir")
+ for dot_ig in x $vc_ignore; do
+ test $dot_ig = x && continue
+ ig=$parent/$dot_ig
+ insert_vc_ignore $ig "${dst_dir##*/}"
+ done
+ fi
+
+ if $copy; then
+ {
+ test ! -h "$dst" || {
+ echo "$me: rm -f $dst" &&
+ rm -f "$dst"
+ }
+ } &&
+ test -f "$dst" &&
+ cmp -s "$src" "$dst" || {
+ echo "$me: cp -fp $src $dst" &&
+ cp -fp "$src" "$dst"
+ }
+ else
+ # Leave any existing symlink alone, if it already points to the source,
+ # so that broken build tools that care about symlink times
+ # aren't confused into doing unnecessary builds. Conversely, if the
+ # existing symlink's timestamp is older than the source, make it afresh,
+ # so that broken tools aren't confused into skipping needed builds. See
+ # <https://lists.gnu.org/r/bug-gnulib/2011-05/msg00326.html>.
+ test -h "$dst" &&
+ src_ls=$(ls -diL "$src" 2>/dev/null) && set $src_ls && src_i=$1 &&
+ dst_ls=$(ls -diL "$dst" 2>/dev/null) && set $dst_ls && dst_i=$1 &&
+ test "$src_i" = "$dst_i" &&
+ both_ls=$(ls -dt "$src" "$dst") &&
+ test "X$both_ls" = "X$dst$nl$src" || {
+ dot_dots=
+ case $src in
+ /*) ;;
+ *)
+ case /$dst/ in
+ *//* | */../* | */./* | /*/*/*/*/*/)
+ die "invalid symlink calculation: $src -> $dst";;
+ /*/*/*/*/) dot_dots=../../../;;
+ /*/*/*/) dot_dots=../../;;
+ /*/*/) dot_dots=../;;
+ esac;;
+ esac
+
+ echo "$me: ln -fs $dot_dots$src $dst" &&
+ ln -fs "$dot_dots$src" "$dst"
+ }
+ fi
+ }
+}
+
+version_controlled_file() {
+ parent=$1
+ file=$2
+ if test -d .git; then
+ git rm -n "$file" > /dev/null 2>&1
+ elif test -d .svn; then
+ svn log -r HEAD "$file" > /dev/null 2>&1
+ elif test -d CVS; then
+ grep -F "/${file##*/}/" "$parent/CVS/Entries" 2>/dev/null |
+ grep '^/[^/]*/[0-9]' > /dev/null
+ else
+ warn_ "no version control for $file?"
+ false
+ fi
+}
+
+# NOTE: we have to be careful to run both autopoint and libtoolize
+# before gnulib-tool, since gnulib-tool is likely to provide newer
+# versions of files "installed" by these two programs.
+# Then, *after* gnulib-tool (see below), we have to be careful to
+# run autoreconf in such a way that it does not run either of these
+# two just-pre-run programs.
+
+# Import from gettext.
+with_gettext=yes
+grep '^[ ]*AM_GNU_GETTEXT_VERSION(' configure.ac >/dev/null || \
+ with_gettext=no
+
+if test $with_gettext = yes || test $use_libtool = 1; then
+
+ tempbase=.bootstrap$$
+ trap "rm -f $tempbase.0 $tempbase.1" 1 2 13 15
+
+ > $tempbase.0 > $tempbase.1 &&
+ find . ! -type d -print | sort > $tempbase.0 || exit
+
+ if test $with_gettext = yes; then
+ # Released autopoint has the tendency to install macros that have been
+ # obsoleted in current gnulib, so run this before gnulib-tool.
+ echo "$0: $AUTOPOINT --force"
+ $AUTOPOINT --force || exit
+ fi
+
+ # Autoreconf runs aclocal before libtoolize, which causes spurious
+ # warnings if the initial aclocal is confused by the libtoolized
+ # (or worse out-of-date) macro directory.
+ # libtoolize 1.9b added the --install option; but we support back
+ # to libtoolize 1.5.22, where the install action was default.
+ if test $use_libtool = 1; then
+ install=
+ case $($LIBTOOLIZE --help) in
+ *--install*) install=--install ;;
+ esac
+ echo "running: $LIBTOOLIZE $install --copy"
+ $LIBTOOLIZE $install --copy
+ fi
+
+ find . ! -type d -print | sort >$tempbase.1
+ old_IFS=$IFS
+ IFS=$nl
+ for file in $(comm -13 $tempbase.0 $tempbase.1); do
+ IFS=$old_IFS
+ parent=${file%/*}
+ version_controlled_file "$parent" "$file" || {
+ for dot_ig in x $vc_ignore; do
+ test $dot_ig = x && continue
+ ig=$parent/$dot_ig
+ insert_vc_ignore "$ig" "${file##*/}"
+ done
+ }
+ done
+ IFS=$old_IFS
+
+ rm -f $tempbase.0 $tempbase.1
+ trap - 1 2 13 15
+fi
+
+# Import from gnulib.
+
+if $use_gnulib; then
+ gnulib_tool_options="\
+ --no-changelog\
+ --aux-dir=$build_aux\
+ --doc-base=$doc_base\
+ --lib=$gnulib_name\
+ --m4-base=$m4_base/\
+ --source-base=$source_base/\
+ --tests-base=$tests_base\
+ --local-dir=$local_gl_dir\
+ $gnulib_tool_option_extras\
+ "
+ if test $use_libtool = 1; then
+ case "$gnulib_tool_options " in
+ *' --libtool '*) ;;
+ *) gnulib_tool_options="$gnulib_tool_options --libtool" ;;
+ esac
+ fi
+ echo "$0: $gnulib_tool $gnulib_tool_options --import ..."
+ $gnulib_tool $gnulib_tool_options --import $gnulib_modules \
+ || die "gnulib-tool failed"
+
+ for file in $gnulib_files; do
+ symlink_to_dir "$GNULIB_SRCDIR" $file \
+ || die "failed to symlink $file"
+ done
+fi
+
+bootstrap_post_import_hook \
+ || die "bootstrap_post_import_hook failed"
+
+# Remove any dangling symlink matching "*.m4" or "*.[ch]" in some
+# gnulib-populated directories. Such .m4 files would cause aclocal to fail.
+# The following requires GNU find 4.2.3 or newer. Considering the usual
+# portability constraints of this script, that may seem a very demanding
+# requirement, but it should be ok. Ignore any failure, which is fine,
+# since this is only a convenience to help developers avoid the relatively
+# unusual case in which a symlinked-to .m4 file is git-removed from gnulib
+# between successive runs of this script.
+find "$m4_base" "$source_base" \
+ -depth \( -name '*.m4' -o -name '*.[ch]' \) \
+ -type l -xtype l -delete > /dev/null 2>&1
+
+# Invoke autoreconf with --force --install to ensure upgrades of tools
+# such as ylwrap.
+AUTORECONFFLAGS="--verbose --install --force -I $m4_base $ACLOCAL_FLAGS"
+
+# Some systems (RHEL 5) are using ancient autotools, for which the
+# --no-recursive option had not been invented. Detect that lack and
+# omit the option when it's not supported. FIXME in 2017: remove this
+# hack when RHEL 5 autotools are updated, or when they become irrelevant.
+case $($AUTORECONF --help) in
+ *--no-recursive*) AUTORECONFFLAGS="$AUTORECONFFLAGS --no-recursive";;
+esac
+
+# Tell autoreconf not to invoke autopoint or libtoolize; they were run above.
+echo "running: AUTOPOINT=true LIBTOOLIZE=true $AUTORECONF $AUTORECONFFLAGS"
+AUTOPOINT=true LIBTOOLIZE=true $AUTORECONF $AUTORECONFFLAGS \
+ || die "autoreconf failed"
+
+# Get some extra files from gnulib, overriding existing files.
+for file in $gnulib_extra_files; do
+ case $file in
+ */INSTALL) dst=INSTALL;;
+ build-aux/*) dst=$build_aux/${file#build-aux/};;
+ *) dst=$file;;
+ esac
+ symlink_to_dir "$GNULIB_SRCDIR" $file $dst \
+ || die "failed to symlink $file"
+done
+
+if test $with_gettext = yes; then
+ # Create gettext configuration.
+ echo "$0: Creating po/Makevars from po/Makevars.template ..."
+ rm -f po/Makevars
+ sed '
+ /^EXTRA_LOCALE_CATEGORIES *=/s/=.*/= '"$EXTRA_LOCALE_CATEGORIES"'/
+ /^COPYRIGHT_HOLDER *=/s/=.*/= '"$COPYRIGHT_HOLDER"'/
+ /^MSGID_BUGS_ADDRESS *=/s|=.*|= '"$MSGID_BUGS_ADDRESS"'|
+ /^XGETTEXT_OPTIONS *=/{
+ s/$/ \\/
+ a\
+ '"$XGETTEXT_OPTIONS"' $${end_of_xgettext_options+}
+ }
+ ' po/Makevars.template >po/Makevars \
+ || die 'cannot generate po/Makevars'
+
+ # If the 'gettext' module is in use, grab the latest Makefile.in.in.
+ # If only the 'gettext-h' module is in use, assume autopoint already
+ # put the correct version of this file into place.
+ case $gnulib_modules in
+ *gettext-h*) ;;
+ *gettext*)
+ cp $GNULIB_SRCDIR/build-aux/po/Makefile.in.in po/Makefile.in.in \
+ || die "cannot create po/Makefile.in.in"
+ ;;
+ esac
+
+ if test -d runtime-po; then
+ # Similarly for runtime-po/Makevars, but not quite the same.
+ rm -f runtime-po/Makevars
+ sed '
+ /^DOMAIN *=.*/s/=.*/= '"$package"'-runtime/
+ /^subdir *=.*/s/=.*/= runtime-po/
+ /^MSGID_BUGS_ADDRESS *=/s/=.*/= bug-'"$package"'@gnu.org/
+ /^XGETTEXT_OPTIONS *=/{
+ s/$/ \\/
+ a\
+ '"$XGETTEXT_OPTIONS_RUNTIME"' $${end_of_xgettext_options+}
+ }
+ ' po/Makevars.template >runtime-po/Makevars \
+ || die 'cannot generate runtime-po/Makevars'
+
+ # Copy identical files from po to runtime-po.
+ (cd po && cp -p Makefile.in.in *-quot *.header *.sed *.sin ../runtime-po)
+ fi
+fi
+
+bootstrap_epilogue
+
+echo "$0: done. Now you can run './configure'."
+
+# 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/bootstrap.bat b/bootstrap.bat
new file mode 100644
index 00000000..10fe1a27
--- /dev/null
+++ b/bootstrap.bat
@@ -0,0 +1,34 @@
+@echo off
+:: Copyright (C) 2018 Free Software Foundation, Inc.
+:: This file is part of GNU Make.
+::
+:: GNU Make is free software; you can redistribute it and/or modify it under
+:: the terms of the GNU General Public License as published by the Free
+:: Software Foundation; either version 3 of the License, or (at your option)
+:: any later version.
+::
+:: GNU Make is distributed in the hope that it will be useful, but WITHOUT
+:: ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+:: FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for.
+:: more details.
+::
+:: You should have received a copy of the GNU General Public License along
+:: with this program. If not, see <http://www.gnu.org/licenses/>.
+
+setlocal
+set "svurl=https://git.savannah.gnu.org/cgit"
+set "gnuliburl=%svurl%/gnulib.git/plain"
+
+call :Download lib getloadavg.c
+call :Download lib intprops.h
+goto :Done
+
+:Download
+echo Downloading %1\%2
+curl -sS -o %1\%2 "%gnuliburl%/%1/%2"
+if ERRORLEVEL 1 exit /b 1
+goto :EOF
+
+:Done
+echo Done. Run buld_w32.bat to build GNU make.
+goto :EOF
diff --git a/bootstrap.conf b/bootstrap.conf
new file mode 100644
index 00000000..ad12d483
--- /dev/null
+++ b/bootstrap.conf
@@ -0,0 +1,51 @@
+# Bootstrap configuration. -*-shell-script-*-
+
+# Copyright (C) 2018 Free Software Foundation, Inc.
+
+# GNU Make is free software: you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free
+# Software Foundation; either version 3 of the License, or (at your option)
+# any later version.
+
+# GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+# details.
+
+# You should have received a copy of the GNU General Public License along with
+# this program. If not, see <https://www.gnu.org/licenses/>.
+
+# Allow bootstrap to know that this is not a package
+checkout_only_file=README.git
+
+# Additional xgettext options to use. Use "\\\newline" to break lines.
+# Ensure that all our magical output macros are correctly marked as
+# C (printf) format strings.
+XGETTEXT_OPTIONS='\\\
+ --from-code=UTF-8\\\
+ --flag=_:1:pass-c-format\\\
+ --flag=N_:1:pass-c-format\\\
+ --flag=DB:2:c-format --flag=DBF:2:c-format --flag=DBS:2:c-format\\\
+ --flag=O:3:c-format --flag=OSN:3:c-format --flag=ONS:3:c-format\\\
+ --flag=OS:3:c-format --flag=OSS:3:c-format --flag=OSSS:3:c-format\\\
+ --flag=ON:3:c-format --flag=ONN:3:c-format\\\
+'
+
+# We manage our own .gitignore files
+vc_ignore=
+
+# Build prerequisites
+buildreq="\
+autoconf 2.69
+automake 1.16.1
+"
+
+gnulib_name=libgnu
+gnulib_files=doc/make-stds.texi
+
+gnulib_modules="\
+alloca
+fdl
+getloadavg
+host-cpu-c-abi
+make-glob"
diff --git a/build.template b/build.template
index 52ccd4b7..645a57f1 100644
--- a/build.template
+++ b/build.template
@@ -20,22 +20,26 @@
# See Makefile.in for comments describing these variables.
-srcdir='@srcdir@'
-CC='@CC@'
-CFLAGS='@CFLAGS@ @GUILE_CFLAGS@'
-CPPFLAGS='@CPPFLAGS@'
-LDFLAGS='@AM_LDFLAGS@ @LDFLAGS@'
-ALLOCA='@ALLOCA@'
-LOADLIBES='@LIBS@ @GUILE_LIBS@ @LIBINTL@'
-eval extras=\'@LIBOBJS@\'
-REMOTE='@REMOTE@'
-GLOBLIB='@GLOBLIB@'
-PATH_SEPARATOR='@PATH_SEPARATOR@'
-OBJEXT='@OBJEXT@'
-EXEEXT='@EXEEXT@'
+LIBOBJDIR=lib/
+U=
+
+top_srcdir="@top_srcdir@"
+CC="@CC@"
+CFLAGS="@CFLAGS@ @GUILE_CFLAGS@"
+CPPFLAGS="@CPPFLAGS@"
+LDFLAGS="@AM_LDFLAGS@ @LDFLAGS@"
+ALLOCA="@ALLOCA@"
+LOADLIBES="@LIBS@ @GUILE_LIBS@ @LIBINTL@"
+LIBOBJS="@LIBOBJS@"
+REMOTE="@REMOTE@"
+OBJEXT="@OBJEXT@"
+EXEEXT="@EXEEXT@"
+
+# Use our old-style glob implementation
+test x"@USE_SYSTEM_GLOB@" = xno && LIBOBJS="${LIBOBJS} ${LIBOBJDIR}fnmatch.$OBJEXT ${LIBOBJDIR}glob.$OBJEXT"
# Common prefix for machine-independent installed files.
-prefix='@prefix@'
+prefix="@prefix@"
# Common prefix for machine-dependent installed files.
exec_prefix=`eval echo @exec_prefix@`
# Directory to find libraries in for '-lXXX'.
@@ -45,24 +49,29 @@ includedir=${prefix}/include
localedir=${prefix}/share/locale
-defines="-DLOCALEDIR=\"${localedir}\" -DLIBDIR=\"${libdir}\" -DINCLUDEDIR=\"${includedir}\""' @DEFS@'
+defines="-DLOCALEDIR=\"${localedir}\" -DLIBDIR=\"${libdir}\" -DINCLUDEDIR=\"${includedir}\" @DEFS@"
# Exit as soon as any command fails.
set -e
# These are all the objects we need to link together.
-objs="%objs% src/remote-${REMOTE}.${OBJEXT} ${extras} ${ALLOCA}"
+objs="%objs% src/remote-${REMOTE}.${OBJEXT} ${LIBOBJS}"
-if [ x"$GLOBLIB" != x ]; then
- objs="$objs %globobjs%"
- globinc=-I${srcdir}/glob
-fi
+case $LIBOBJS in
+ (*alloca*) cp "$top_srcdir"/lib/alloca.in.h lib/alloca.h ;;
+esac
+case $LIBOBJS in
+ (*fnmatch*) cp "$top_srcdir"/lib/fnmatch.in.h lib/fnmatch.h ;;
+esac
+case $LIBOBJS in
+ (*glob*) cp "$top_srcdir"/lib/glob.in.h lib/glob.h ;;
+esac
# Compile the source files into those objects.
for file in `echo ${objs} | sed 's/\.'${OBJEXT}'/.c/g'`; do
echo compiling ${file}...
$CC $defines $CPPFLAGS $CFLAGS \
- -c -Isrc -I${srcdir}/src ${globinc} ${srcdir}/$file
+ -c -Isrc -I"$top_srcdir"/src -Ilib -I"$top_srcdir"/lib "$top_srcdir"/$file
done
# The object files were actually all put in the current directory.
diff --git a/build_w32.bat b/build_w32.bat
index fcfd7c69..ab67a642 100755
--- a/build_w32.bat
+++ b/build_w32.bat
@@ -179,7 +179,7 @@ mkdir %OUTDIR%\src
mkdir %OUTDIR%\src\w32
mkdir %OUTDIR%\src\w32\compat
mkdir %OUTDIR%\src\w32\subproc
-mkdir %OUTDIR%\glob
+mkdir %OUTDIR%\lib
if "%GUILE%" == "Y" call :ChkGuile
@@ -189,6 +189,9 @@ echo Compiling %OUTDIR% version
if exist src\config.h.W32.template call :ConfigSCM
copy src\config.h.W32 %OUTDIR%\src\config.h
+copy lib\glob.in.h %OUTDIR%\lib\glob.h
+copy lib\fnmatch.in.h %OUTDIR%\lib\fnmatch.h
+
if exist %OUTDIR%\link.sc del %OUTDIR%\link.sc
call :Compile src\ar
@@ -199,7 +202,6 @@ call :Compile src\dir
call :Compile src\expand
call :Compile src\file
call :Compile src\function
-call :Compile src\getloadavg
call :Compile src\getopt
call :Compile src\getopt1
call :Compile src\guile GUILE
@@ -226,8 +228,9 @@ call :Compile src\w32\compat\posixfcn
call :Compile src\w32\subproc\misc
call :Compile src\w32\subproc\sub_proc
call :Compile src\w32\subproc\w32err
-call :Compile glob\fnmatch
-call :Compile glob\glob
+call :Compile lib\fnmatch
+call :Compile lib\glob
+call :Compile lib\getloadavg
if not "%COMPILER%" == "gcc" call :Compile src\w32\compat\dirent
@@ -257,14 +260,14 @@ if "%COMPILER%" == "gcc" goto GccCompile
:: MSVC Compile
echo on
-%COMPILER% /nologo /MT /W4 /EHsc %OPTS% /I %OUTDIR%/src /I src /I glob /I src/w32/include /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR%OUTDIR% /Fp%OUTDIR%\%MAKE%.pch /Fo%OUTDIR%\%1.%O% /Fd%OUTDIR%\%MAKE%.pdb %EXTRAS% /c %1.c
+%COMPILER% /nologo /MT /W4 /EHsc %OPTS% /I %OUTDIR%/src /I src /I %OUTDIR%/lib /I lib /I src/w32/include /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR%OUTDIR% /Fp%OUTDIR%\%MAKE%.pch /Fo%OUTDIR%\%1.%O% /Fd%OUTDIR%\%MAKE%.pdb %EXTRAS% /c %1.c
@echo off
goto CompileDone
:GccCompile
:: GCC Compile
echo on
-%COMPILER% -mthreads -Wall -std=gnu99 -gdwarf-2 -g3 %OPTS% -I%OUTDIR%/src -I./src -I./glob -I./src/w32/include -DWINDOWS32 -DHAVE_CONFIG_H %EXTRAS% -o %OUTDIR%\%1.%O% -c %1.c
+%COMPILER% -mthreads -Wall -std=gnu99 -gdwarf-2 -g3 %OPTS% -I%OUTDIR%/src -I./src -I%OUTDIR%/lib -I./lib -I./src/w32/include -DWINDOWS32 -DHAVE_CONFIG_H %EXTRAS% -o %OUTDIR%\%1.%O% -c %1.c
@echo off
:CompileDone
diff --git a/builddos.bat b/builddos.bat
index 0f95dd6d..f06ab08b 100644
--- a/builddos.bat
+++ b/builddos.bat
@@ -26,50 +26,56 @@ rem Where is the srcdir?
set XSRC=.
if not "%XSRC%"=="." goto SmallEnv
if "%1%"=="" goto SrcDone
+if "%1%"=="." goto SrcDone
set XSRC=%1
+
if not "%XSRC%"=="%1" goto SmallEnv
:SrcDone
-copy /Y %XSRC%/src/configh.dos ./src/config.h
+if not exist src mkdir src
+if not exist lib mkdir lib
+
+copy /Y %XSRC%\src\configh.dos .\src\config.h
-if not exist glob mkdir glob
+copy /Y %XSRC%\lib\glob.in.h .\lib\glob.h
+copy /Y %XSRC%\lib\fnmatch.in.h .\lib\fnmatch.h
rem Echo ON so they will see what is going on.
@echo on
-gcc -c -I%XSRC%/src -I%XSRC%/glob -DHAVE_CONFIG_H -O2 -g %XSRC%/src/commands.c -o commands.o
-gcc -c -I%XSRC%/src -I%XSRC%/glob -DHAVE_CONFIG_H -O2 -g %XSRC%/src/output.c -o output.o
-gcc -c -I%XSRC%/src -I%XSRC%/glob -DHAVE_CONFIG_H -O2 -g %XSRC%/src/job.c -o job.o
-gcc -c -I%XSRC%/src -I%XSRC%/glob -DHAVE_CONFIG_H -O2 -g %XSRC%/src/dir.c -o dir.o
-gcc -c -I%XSRC%/src -I%XSRC%/glob -DHAVE_CONFIG_H -O2 -g %XSRC%/src/file.c -o file.o
-gcc -c -I%XSRC%/src -I%XSRC%/glob -DHAVE_CONFIG_H -O2 -g %XSRC%/src/misc.c -o misc.o
-gcc -c -I%XSRC%/src -I%XSRC%/glob -DHAVE_CONFIG_H -O2 -g %XSRC%/src/main.c -o main.o
-gcc -c -I%XSRC%/src -I%XSRC%/glob -DHAVE_CONFIG_H -DINCLUDEDIR=\"c:/djgpp/include\" -O2 -g %XSRC%/src/read.c -o read.o
-gcc -c -I%XSRC%/src -I%XSRC%/glob -DHAVE_CONFIG_H -DLIBDIR=\"c:/djgpp/lib\" -O2 -g %XSRC%/src/remake.c -o remake.o
-gcc -c -I%XSRC%/src -I%XSRC%/glob -DHAVE_CONFIG_H -O2 -g %XSRC%/src/rule.c -o rule.o
-gcc -c -I%XSRC%/src -I%XSRC%/glob -DHAVE_CONFIG_H -O2 -g %XSRC%/src/implicit.c -o implicit.o
-gcc -c -I%XSRC%/src -I%XSRC%/glob -DHAVE_CONFIG_H -O2 -g %XSRC%/src/default.c -o default.o
-gcc -c -I%XSRC%/src -I%XSRC%/glob -DHAVE_CONFIG_H -O2 -g %XSRC%/src/variable.c -o variable.o
-gcc -c -I%XSRC%/src -I%XSRC%/glob -DHAVE_CONFIG_H -O2 -g %XSRC%/src/expand.c -o expand.o
-gcc -c -I%XSRC%/src -I%XSRC%/glob -DHAVE_CONFIG_H -O2 -g %XSRC%/src/function.c -o function.o
-gcc -c -I%XSRC%/src -I%XSRC%/glob -DHAVE_CONFIG_H -O2 -g %XSRC%/src/vpath.c -o vpath.o
-gcc -c -I%XSRC%/src -I%XSRC%/glob -DHAVE_CONFIG_H -O2 -g %XSRC%/src/hash.c -o hash.o
-gcc -c -I%XSRC%/src -I%XSRC%/glob -DHAVE_CONFIG_H -O2 -g %XSRC%/src/strcache.c -o strcache.o
-gcc -c -I%XSRC%/src -I%XSRC%/glob -DHAVE_CONFIG_H -O2 -g %XSRC%/src/version.c -o version.o
-gcc -c -I%XSRC%/src -I%XSRC%/glob -DHAVE_CONFIG_H -O2 -g %XSRC%/src/ar.c -o ar.o
-gcc -c -I%XSRC%/src -I%XSRC%/glob -DHAVE_CONFIG_H -O2 -g %XSRC%/src/arscan.c -o arscan.o
-gcc -c -I%XSRC%/src -I%XSRC%/glob -DHAVE_CONFIG_H -O2 -g %XSRC%/src/signame.c -o signame.o
-gcc -c -I%XSRC%/src -I%XSRC%/glob -DHAVE_CONFIG_H -O2 -g %XSRC%/src/remote-stub.c -o remote-stub.o
-gcc -c -I%XSRC%/src -I%XSRC%/glob -DHAVE_CONFIG_H -O2 -g %XSRC%/src/getopt.c -o getopt.o
-gcc -c -I%XSRC%/src -I%XSRC%/glob -DHAVE_CONFIG_H -O2 -g %XSRC%/src/getopt1.c -o getopt1.o
-gcc -c -I%XSRC%/src -I%XSRC%/glob -DHAVE_CONFIG_H -O2 -g %XSRC%/glob/glob.c -o glob/glob.o
-gcc -c -I%XSRC%/src -I%XSRC%/glob -DHAVE_CONFIG_H -O2 -g %XSRC%/glob/fnmatch.c -o glob/fnmatch.o
+gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/src/commands.c -o commands.o
+gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/src/output.c -o output.o
+gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/src/job.c -o job.o
+gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/src/dir.c -o dir.o
+gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/src/file.c -o file.o
+gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/src/misc.c -o misc.o
+gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/src/main.c -o main.o
+gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -DINCLUDEDIR=\"c:/djgpp/include\" -O2 -g %XSRC%/src/read.c -o read.o
+gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -DLIBDIR=\"c:/djgpp/lib\" -O2 -g %XSRC%/src/remake.c -o remake.o
+gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/src/rule.c -o rule.o
+gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/src/implicit.c -o implicit.o
+gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/src/default.c -o default.o
+gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/src/variable.c -o variable.o
+gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/src/expand.c -o eyxpand.o
+gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/src/function.c -o function.o
+gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/src/vpath.c -o vpath.o
+gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/src/hash.c -o hash.o
+gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/src/strcache.c -o strcache.o
+gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/src/version.c -o version.o
+gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/src/ar.c -o ar.o
+gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/src/arscan.c -o arscan.o
+gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/src/signame.c -o signame.o
+gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/src/remote-stub.c -o remote-stub.o
+gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/src/getopt.c -o getopt.o
+gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/src/getopt1.c -o getopt1.o
+gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/lib/glob.c -o lib/glob.o
+gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/lib/fnmatch.c -o lib/fnmatch.o
@echo off
echo commands.o > respf.$$$
for %%f in (job output dir file misc main read remake rule implicit default variable) do echo %%f.o >> respf.$$$
for %%f in (expand function vpath hash strcache version ar arscan signame remote-stub getopt getopt1) do echo %%f.o >> respf.$$$
-for %%f in (glob/glob glob/fnmatch) do echo %%f.o >> respf.$$$
-rem gcc -c -I%XSRC% -I%XSRC%/glob -DHAVE_CONFIG_H -O2 -g %XSRC%/guile.c -o guile.o
+for %%f in (lib\glob lib\fnmatch) do echo %%f.o >> respf.$$$
+rem gcc -c -I./src -I%XSRC% -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/guile.c -o guile.o
rem echo guile.o >> respf.$$$
@echo Linking...
@echo on
diff --git a/config/.gitignore b/config/.gitignore
deleted file mode 100644
index d11a4881..00000000
--- a/config/.gitignore
+++ /dev/null
@@ -1,12 +0,0 @@
-ar-lib
-compile
-config.guess
-config.rpath
-config.sub
-depcomp
-install-sh
-mdate-sh
-missing
-texinfo.tex
-*.m4
-!dospaths.m4
diff --git a/config/ChangeLog.1 b/config/ChangeLog.1
deleted file mode 100644
index d46fef6f..00000000
--- a/config/ChangeLog.1
+++ /dev/null
@@ -1,49 +0,0 @@
-2012-01-15 Paul Smith <psmith@gnu.org>
-
- * dospaths.m4: Use AC_LANG_PROGRAM to encapsulate the test code.
- Fixes Savannah bug #35256. Patch from Sebastian Pipping.
-
-2006-03-09 Paul Smith <psmith@gnu.org>
-
- * dospaths.m4: Add MSYS to the list of targets allowing DOS-style
- pathnames. Reported by David Ergo <david.ergo@alterface.com>.
-
-2005-07-01 Paul D. Smith <psmith@gnu.org>
-
- * Makefile.am (EXTRA_DIST): Added more M4 files to EXTRA_DIST, so
- users can re-run aclocal.
-
-2003-04-30 Paul D. Smith <psmith@gnu.org>
-
- * dospaths.m4: New macro to test for DOS-style pathnames, based on
- coreutils 5.0 "dos.m4" by Jim Meyering.
-
-2002-04-21 gettextize <bug-gnu-gettext@gnu.org>
-
- * codeset.m4: New file, from gettext-0.11.1.
- * gettext.m4: New file, from gettext-0.11.1.
- * glibc21.m4: New file, from gettext-0.11.1.
- * iconv.m4: New file, from gettext-0.11.1.
- * isc-posix.m4: New file, from gettext-0.11.1.
- * lcmessage.m4: New file, from gettext-0.11.1.
- * lib-ld.m4: New file, from gettext-0.11.1.
- * lib-link.m4: New file, from gettext-0.11.1.
- * lib-prefix.m4: New file, from gettext-0.11.1.
- * progtest.m4: New file, from gettext-0.11.1.
- * Makefile.am: New file.
-
-
-Copyright (C) 2002-2017 Free Software Foundation, Inc.
-This file is part of GNU Make.
-
-GNU Make is free software; you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation; either version 3 of the License, or (at your option) any later
-version.
-
-GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY
-WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License along with
-this program. If not, see <http://www.gnu.org/licenses/>.
diff --git a/config/Makefile.am b/config/Makefile.am
deleted file mode 100644
index 490c6ba9..00000000
--- a/config/Makefile.am
+++ /dev/null
@@ -1,18 +0,0 @@
-# -*-Makefile-*-, or close enough
-# Copyright (C) 2002-2018 Free Software Foundation, Inc.
-# This file is part of GNU Make.
-#
-# GNU Make is free software; you can redistribute it and/or modify it under
-# the terms of the GNU General Public License as published by the Free
-# Software Foundation; either version 3 of the License, or (at your option)
-# any later version.
-#
-# GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY
-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-# details.
-#
-# You should have received a copy of the GNU General Public License along with
-# this program. If not, see <http://www.gnu.org/licenses/>.
-
-# Autoconf / automake know how to handle this directory.
diff --git a/configure.ac b/configure.ac
index af6f746c..1d91c36e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -21,20 +21,27 @@ AC_INIT([GNU make],[4.2.90],[bug-make@gnu.org])
AC_PREREQ([2.69])
# Autoconf setup
-AC_CONFIG_AUX_DIR([config])
+AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_SRCDIR([src/vpath.c])
AC_CONFIG_HEADERS([src/config.h])
-# For now all our libobj code is in src/
-AC_CONFIG_LIBOBJ_DIR([src])
+AC_CONFIG_LIBOBJ_DIR([lib])
# Automake setup
# We have to enable "foreign" because ChangeLog is auto-generated
-AM_INIT_AUTOMAKE([1.15 foreign -Werror -Wall])
+# Automake 1.15 and gnulib don't get along: gnulib has some strange error
+# in the way it handles getloadavg.c which causes make distcheck to fail.
+# http://lists.gnu.org/archive/html/bug-gnulib/2018-06/msg00024.html
+AM_INIT_AUTOMAKE([1.16.1 foreign -Werror -Wall])
# Checks for programs.
AC_USE_SYSTEM_EXTENSIONS
AC_PROG_CC
+
+# Configure gnulib
+gl_EARLY
+gl_INIT
+
AC_PROG_INSTALL
AC_PROG_RANLIB
AC_PROG_CPP
@@ -154,8 +161,6 @@ AC_CHECK_FUNCS([strcasecmp strncasecmp strcmpi strncmpi stricmp strnicmp])
# strcoll() is used by the GNU glob library
AC_FUNC_STRCOLL
-
-AC_FUNC_ALLOCA
AC_FUNC_CLOSEDIR_VOID
# See if the user wants to add (or not) GNU Guile support
@@ -183,24 +188,6 @@ AS_IF([test "x$with_guile" != xno],
AM_CONDITIONAL([HAVE_GUILE], [test "$have_guile" = yes])
-AC_FUNC_GETLOADAVG
-
-# AC_FUNC_GETLOADAVG is documented to set the NLIST_STRUCT value, but it
-# doesn't. So, we will.
-
-AS_IF([test "$ac_cv_header_nlist_h" = yes],
-[ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <nlist.h>]],
- [[struct nlist nl;
- nl.n_name = "string";
- return 0;]])],
- [make_cv_nlist_struct=yes],
- [make_cv_nlist_struct=no])
- AS_IF([test "$make_cv_nlist_struct" = yes],
- [ AC_DEFINE([NLIST_STRUCT], [1],
- [Define to 1 if struct nlist.n_name is a pointer rather than an array.])
- ])
-])
-
AC_CHECK_DECLS([sys_siglist, _sys_siglist, __sys_siglist], , ,
[AC_INCLUDES_DEFAULT
#include <signal.h>
@@ -412,15 +399,21 @@ AC_CACHE_CHECK([if system libc has GNU glob], [make_cv_sys_gnu_glob],
#endif],
[make_cv_sys_gnu_glob=yes],
[make_cv_sys_gnu_glob=no])])
-AS_IF([test "$make_cv_sys_gnu_glob" = no],
-[ GLOBINC='-I$(srcdir)/glob'
- GLOBLIB=glob/libglob.a
-])
-AC_SUBST([GLOBINC])
-AC_SUBST([GLOBLIB])
# Tell automake about this, so it can build the right .c files.
-AM_CONDITIONAL([USE_LOCAL_GLOB], [test "$make_cv_sys_gnu_glob" = no])
+AM_CONDITIONAL([USE_SYSTEM_GLOB], [test "$make_cv_sys_gnu_glob" = yes])
+
+# Tell build.sh which to use
+USE_SYSTEM_GLOB="$make_cv_sys_gnu_glob"
+AC_SUBST([USE_SYSTEM_GLOB])
+
+# See if we need a replacement for getloadavg()
+gl_GETLOADAVG
+if test $HAVE_GETLOADAVG = 0; then
+ AC_LIBOBJ([getloadavg])
+ gl_PREREQ_GETLOADAVG
+fi
+gl_STDLIB_MODULE_INDICATOR([getloadavg])
# Let the makefile know what our build host is
@@ -505,9 +498,9 @@ AS_IF([test "x$make_cv_load" = xno && test "x$user_load" = xyes],
])
# Specify what files are to be created.
-AC_CONFIG_FILES([Makefile glob/Makefile po/Makefile.in config/Makefile \
- doc/Makefile tests/config-flags.pm])
-# We don't need this, since the standard automake output will do.
+AC_CONFIG_FILES([Makefile lib/Makefile po/Makefile.in doc/Makefile \
+ tests/config-flags.pm])
+# We don't need this: the standard automake output suffices for POSIX systems.
#mk/Posix.mk
# OK, do it!
diff --git a/gl/modules/make-glob b/gl/modules/make-glob
new file mode 100644
index 00000000..81bf50f7
--- /dev/null
+++ b/gl/modules/make-glob
@@ -0,0 +1,44 @@
+Description:
+GNU make version of fnmatch()/glob() functions. This is a holdover from
+a very old version of the globbing library.
+
+Makefile.am:
+if !USE_SYSTEM_GLOB
+libgnu_a_SOURCES += fnmatch.c
+
+BUILT_SOURCES += fnmatch.h
+
+fnmatch.h: fnmatch.in.h $(top_builddir)/config.status
+ $(AM_V_GEN)rm -f $@-t $@ && \
+ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+ cat $(srcdir)/fnmatch.in.h; \
+ } > $@-t && \
+ mv -f $@-t $@
+
+MOSTLYCLEANFILES += fnmatch.h fnmatch.h-t
+
+libgnu_a_SOURCES += glob.c
+
+BUILT_SOURCES += glob.h
+
+glob.h: glob.in.h $(top_builddir)/config.status
+ $(AM_V_GEN)rm -f $@-t $@ && \
+ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+ cat $(srcdir)/glob.in.h; \
+ } > $@-t && \
+ mv -f $@-t $@
+
+MOSTLYCLEANFILES += glob.h glob.h-t
+endif
+
+EXTRA_DIST += fnmatch.in.h glob.in.h
+
+
+Include:
+<glob.h>
+
+License:
+LGPLv2+
+
+Maintainer:
+all, glibc
diff --git a/glob/COPYING.LIB b/glob/COPYING.LIB
deleted file mode 100644
index bbe3fe19..00000000
--- a/glob/COPYING.LIB
+++ /dev/null
@@ -1,481 +0,0 @@
- GNU LIBRARY GENERAL PUBLIC LICENSE
- Version 2, June 1991
-
- Copyright (C) 1991 Free Software Foundation, Inc.
- 675 Mass Ave, Cambridge, MA 02139, USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-[This is the first released version of the library GPL. It is
- numbered 2 because it goes with version 2 of the ordinary GPL.]
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-Licenses are intended to guarantee your freedom to share and change
-free software--to make sure the software is free for all its users.
-
- This license, the Library General Public License, applies to some
-specially designated Free Software Foundation software, and to any
-other libraries whose authors decide to use it. You can use it for
-your libraries, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
- To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if
-you distribute copies of the library, or if you modify it.
-
- For example, if you distribute copies of the library, whether gratis
-or for a fee, you must give the recipients all the rights that we gave
-you. You must make sure that they, too, receive or can get the source
-code. If you link a program with the library, you must provide
-complete object files to the recipients so that they can relink them
-with the library, after making changes to the library and recompiling
-it. And you must show them these terms so they know their rights.
-
- Our method of protecting your rights has two steps: (1) copyright
-the library, and (2) offer you this license which gives you legal
-permission to copy, distribute and/or modify the library.
-
- Also, for each distributor's protection, we want to make certain
-that everyone understands that there is no warranty for this free
-library. If the library is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original
-version, so that any problems introduced by others will not reflect on
-the original authors' reputations.
-
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that companies distributing free
-software will individually obtain patent licenses, thus in effect
-transforming the program into proprietary software. To prevent this,
-we have made it clear that any patent must be licensed for everyone's
-free use or not licensed at all.
-
- Most GNU software, including some libraries, is covered by the ordinary
-GNU General Public License, which was designed for utility programs. This
-license, the GNU Library General Public License, applies to certain
-designated libraries. This license is quite different from the ordinary
-one; be sure to read it in full, and don't assume that anything in it is
-the same as in the ordinary license.
-
- The reason we have a separate public license for some libraries is that
-they blur the distinction we usually make between modifying or adding to a
-program and simply using it. Linking a program with a library, without
-changing the library, is in some sense simply using the library, and is
-analogous to running a utility program or application program. However, in
-a textual and legal sense, the linked executable is a combined work, a
-derivative of the original library, and the ordinary General Public License
-treats it as such.
-
- Because of this blurred distinction, using the ordinary General
-Public License for libraries did not effectively promote software
-sharing, because most developers did not use the libraries. We
-concluded that weaker conditions might promote sharing better.
-
- However, unrestricted linking of non-free programs would deprive the
-users of those programs of all benefit from the free status of the
-libraries themselves. This Library General Public License is intended to
-permit developers of non-free programs to use free libraries, while
-preserving your freedom as a user of such programs to change the free
-libraries that are incorporated in them. (We have not seen how to achieve
-this as regards changes in header files, but we have achieved it as regards
-changes in the actual functions of the Library.) The hope is that this
-will lead to faster development of free libraries.
-
- The precise terms and conditions for copying, distribution and
-modification follow. Pay close attention to the difference between a
-"work based on the library" and a "work that uses the library". The
-former contains code derived from the library, while the latter only
-works together with the library.
-
- Note that it is possible for a library to be covered by the ordinary
-General Public License rather than by this special one.
-
- GNU LIBRARY GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License Agreement applies to any software library which
-contains a notice placed by the copyright holder or other authorized
-party saying it may be distributed under the terms of this Library
-General Public License (also called "this License"). Each licensee is
-addressed as "you".
-
- A "library" means a collection of software functions and/or data
-prepared so as to be conveniently linked with application programs
-(which use some of those functions and data) to form executables.
-
- The "Library", below, refers to any such software library or work
-which has been distributed under these terms. A "work based on the
-Library" means either the Library or any derivative work under
-copyright law: that is to say, a work containing the Library or a
-portion of it, either verbatim or with modifications and/or translated
-straightforwardly into another language. (Hereinafter, translation is
-included without limitation in the term "modification".)
-
- "Source code" for a work means the preferred form of the work for
-making modifications to it. For a library, complete source code means
-all the source code for all modules it contains, plus any associated
-interface definition files, plus the scripts used to control compilation
-and installation of the library.
-
- Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running a program using the Library is not restricted, and output from
-such a program is covered only if its contents constitute a work based
-on the Library (independent of the use of the Library in a tool for
-writing it). Whether that is true depends on what the Library does
-and what the program that uses the Library does.
-
- 1. You may copy and distribute verbatim copies of the Library's
-complete source code as you receive it, in any medium, provided that
-you conspicuously and appropriately publish on each copy an
-appropriate copyright notice and disclaimer of warranty; keep intact
-all the notices that refer to this License and to the absence of any
-warranty; and distribute a copy of this License along with the
-Library.
-
- You may charge a fee for the physical act of transferring a copy,
-and you may at your option offer warranty protection in exchange for a
-fee.
-
- 2. You may modify your copy or copies of the Library or any portion
-of it, thus forming a work based on the Library, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) The modified work must itself be a software library.
-
- b) You must cause the files modified to carry prominent notices
- stating that you changed the files and the date of any change.
-
- c) You must cause the whole of the work to be licensed at no
- charge to all third parties under the terms of this License.
-
- d) If a facility in the modified Library refers to a function or a
- table of data to be supplied by an application program that uses
- the facility, other than as an argument passed when the facility
- is invoked, then you must make a good faith effort to ensure that,
- in the event an application does not supply such function or
- table, the facility still operates, and performs whatever part of
- its purpose remains meaningful.
-
- (For example, a function in a library to compute square roots has
- a purpose that is entirely well-defined independent of the
- application. Therefore, Subsection 2d requires that any
- application-supplied function or table used by this function must
- be optional: if the application does not supply it, the square
- root function must still compute square roots.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Library,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Library, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote
-it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Library.
-
-In addition, mere aggregation of another work not based on the Library
-with the Library (or with a work based on the Library) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may opt to apply the terms of the ordinary GNU General Public
-License instead of this License to a given copy of the Library. To do
-this, you must alter all the notices that refer to this License, so
-that they refer to the ordinary GNU General Public License, version 2,
-instead of to this License. (If a newer version than version 2 of the
-ordinary GNU General Public License has appeared, then you can specify
-that version instead if you wish.) Do not make any other change in
-these notices.
-
- Once this change is made in a given copy, it is irreversible for
-that copy, so the ordinary GNU General Public License applies to all
-subsequent copies and derivative works made from that copy.
-
- This option is useful when you wish to copy part of the code of
-the Library into a program that is not a library.
-
- 4. You may copy and distribute the Library (or a portion or
-derivative of it, under Section 2) in object code or executable form
-under the terms of Sections 1 and 2 above provided that you accompany
-it with the complete corresponding machine-readable source code, which
-must be distributed under the terms of Sections 1 and 2 above on a
-medium customarily used for software interchange.
-
- If distribution of object code is made by offering access to copy
-from a designated place, then offering equivalent access to copy the
-source code from the same place satisfies the requirement to
-distribute the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 5. A program that contains no derivative of any portion of the
-Library, but is designed to work with the Library by being compiled or
-linked with it, is called a "work that uses the Library". Such a
-work, in isolation, is not a derivative work of the Library, and
-therefore falls outside the scope of this License.
-
- However, linking a "work that uses the Library" with the Library
-creates an executable that is a derivative of the Library (because it
-contains portions of the Library), rather than a "work that uses the
-library". The executable is therefore covered by this License.
-Section 6 states terms for distribution of such executables.
-
- When a "work that uses the Library" uses material from a header file
-that is part of the Library, the object code for the work may be a
-derivative work of the Library even though the source code is not.
-Whether this is true is especially significant if the work can be
-linked without the Library, or if the work is itself a library. The
-threshold for this to be true is not precisely defined by law.
-
- If such an object file uses only numerical parameters, data
-structure layouts and accessors, and small macros and small inline
-functions (ten lines or less in length), then the use of the object
-file is unrestricted, regardless of whether it is legally a derivative
-work. (Executables containing this object code plus portions of the
-Library will still fall under Section 6.)
-
- Otherwise, if the work is a derivative of the Library, you may
-distribute the object code for the work under the terms of Section 6.
-Any executables containing that work also fall under Section 6,
-whether or not they are linked directly with the Library itself.
-
- 6. As an exception to the Sections above, you may also compile or
-link a "work that uses the Library" with the Library to produce a
-work containing portions of the Library, and distribute that work
-under terms of your choice, provided that the terms permit
-modification of the work for the customer's own use and reverse
-engineering for debugging such modifications.
-
- You must give prominent notice with each copy of the work that the
-Library is used in it and that the Library and its use are covered by
-this License. You must supply a copy of this License. If the work
-during execution displays copyright notices, you must include the
-copyright notice for the Library among them, as well as a reference
-directing the user to the copy of this License. Also, you must do one
-of these things:
-
- a) Accompany the work with the complete corresponding
- machine-readable source code for the Library including whatever
- changes were used in the work (which must be distributed under
- Sections 1 and 2 above); and, if the work is an executable linked
- with the Library, with the complete machine-readable "work that
- uses the Library", as object code and/or source code, so that the
- user can modify the Library and then relink to produce a modified
- executable containing the modified Library. (It is understood
- that the user who changes the contents of definitions files in the
- Library will not necessarily be able to recompile the application
- to use the modified definitions.)
-
- b) Accompany the work with a written offer, valid for at
- least three years, to give the same user the materials
- specified in Subsection 6a, above, for a charge no more
- than the cost of performing this distribution.
-
- c) If distribution of the work is made by offering access to copy
- from a designated place, offer equivalent access to copy the above
- specified materials from the same place.
-
- d) Verify that the user has already received a copy of these
- materials or that you have already sent this user a copy.
-
- For an executable, the required form of the "work that uses the
-Library" must include any data and utility programs needed for
-reproducing the executable from it. However, as a special exception,
-the source code distributed need not include anything that is normally
-distributed (in either source or binary form) with the major
-components (compiler, kernel, and so on) of the operating system on
-which the executable runs, unless that component itself accompanies
-the executable.
-
- It may happen that this requirement contradicts the license
-restrictions of other proprietary libraries that do not normally
-accompany the operating system. Such a contradiction means you cannot
-use both them and the Library together in an executable that you
-distribute.
-
- 7. You may place library facilities that are a work based on the
-Library side-by-side in a single library together with other library
-facilities not covered by this License, and distribute such a combined
-library, provided that the separate distribution of the work based on
-the Library and of the other library facilities is otherwise
-permitted, and provided that you do these two things:
-
- a) Accompany the combined library with a copy of the same work
- based on the Library, uncombined with any other library
- facilities. This must be distributed under the terms of the
- Sections above.
-
- b) Give prominent notice with the combined library of the fact
- that part of it is a work based on the Library, and explaining
- where to find the accompanying uncombined form of the same work.
-
- 8. You may not copy, modify, sublicense, link with, or distribute
-the Library except as expressly provided under this License. Any
-attempt otherwise to copy, modify, sublicense, link with, or
-distribute the Library is void, and will automatically terminate your
-rights under this License. However, parties who have received copies,
-or rights, from you under this License will not have their licenses
-terminated so long as such parties remain in full compliance.
-
- 9. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Library or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Library (or any work based on the
-Library), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Library or works based on it.
-
- 10. Each time you redistribute the Library (or any work based on the
-Library), the recipient automatically receives a license from the
-original licensor to copy, distribute, link with or modify the Library
-subject to these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
- 11. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Library at all. For example, if a patent
-license would not permit royalty-free redistribution of the Library by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Library.
-
-If any portion of this section is held invalid or unenforceable under any
-particular circumstance, the balance of the section is intended to apply,
-and the section as a whole is intended to apply in other circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 12. If the distribution and/or use of the Library is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Library under this License may add
-an explicit geographical distribution limitation excluding those countries,
-so that distribution is permitted only in or among countries not thus
-excluded. In such case, this License incorporates the limitation as if
-written in the body of this License.
-
- 13. The Free Software Foundation may publish revised and/or new
-versions of the Library General Public License from time to time.
-Such new versions will be similar in spirit to the present version,
-but may differ in detail to address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Library
-specifies a version number of this License which applies to it and
-"any later version", you have the option of following the terms and
-conditions either of that version or of any later version published by
-the Free Software Foundation. If the Library does not specify a
-license version number, you may choose any version ever published by
-the Free Software Foundation.
-
- 14. If you wish to incorporate parts of the Library into other free
-programs whose distribution conditions are incompatible with these,
-write to the author to ask for permission. For software which is
-copyrighted by the Free Software Foundation, write to the Free
-Software Foundation; we sometimes make exceptions for this. Our
-decision will be guided by the two goals of preserving the free status
-of all derivatives of our free software and of promoting the sharing
-and reuse of software generally.
-
- NO WARRANTY
-
- 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
-WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
-EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
-OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
-KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
-LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
-THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
-WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
-AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
-FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
-CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
-LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
-FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
-SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- Appendix: How to Apply These Terms to Your New Libraries
-
- If you develop a new library, and you want it to be of the greatest
-possible use to the public, we recommend making it free software that
-everyone can redistribute and change. You can do so by permitting
-redistribution under these terms (or, alternatively, under the terms of the
-ordinary General Public License).
-
- To apply these terms, attach the following notices to the library. It is
-safest to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least the
-"copyright" line and a pointer to where the full notice is found.
-
- <one line to give the library's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-Also add information on how to contact you by electronic and paper mail.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the library, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the
- library `Frob' (a library for tweaking knobs) written by James Random Hacker.
-
- <signature of Ty Coon>, 1 April 1990
- Ty Coon, President of Vice
-
-That's all there is to it!
diff --git a/glob/ChangeLog b/glob/ChangeLog
deleted file mode 100644
index c543c850..00000000
--- a/glob/ChangeLog
+++ /dev/null
@@ -1,191 +0,0 @@
-2013-10-20 Paul Smith <psmith@gnu.org>
-
- * glob.c (glob): Cherry-pick a471e96a5352a5f0bde6d32dd36d33524811a2b1
- from git://sourceware.org/git/glibc.git to fix SV 18123,
- https://sourceware.org/bugzilla/show_bug.cgi?id=10278
-
-2008-09-28 Juan Manuel Guerrero <juan.guerrero@gmx.de>
-
- * glob.c (my_realloc) [__DJGPP__]: Don't define, and don't
- redefine realloc to call it, since the DJGPP's realloc handles
- NULL pointers correctly.
-
-2007-12-22 Juan Manuel Guerrero <juan.guerrero@gmx.de> (tiny change)
-
- * glob.c [__GNU_LIBRARY__ && __DJGPP__]: Add a realloc
- declaration that matches the one in the DJGPP libc.
-
-2006-02-24 Eli Zaretskii <eliz@gnu.org>
-
- * glob.c (my_malloc) [WINDOWS32]: Provide a full ISO C prototype,
- to avoid compiler warnings.
-
-2005-06-25 Paul D. Smith <psmith@gnu.org>
-
- * fnmatch.h, glob.h [WINDOWS32]: Fix ifdefs in headers.
- Fixes Savannah bug #13477.
-
-2005-03-11 Paul D. Smith <psmith@gnu.org>
-
- * glob.c (glob_in_dir): Change FNM_CASEFOLD to be enabled if
- HAVE_CASE_INSENSITIVE_FS is defined.
-
-2003-01-30 Paul D. Smith <psmith@gnu.org>
-
- * glob.h: Patch for FreeBSD by Mike Barcroft <mike@freebsd.org>
- Reported by Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at>. On
- FreeBSD, declare __size_t to simply size_t.
-
-2002-04-22 Paul D. Smith <psmith@gnu.org>
-
- * Makefile.am: Use automake 1.6.
- Use new automake condition USE_LOCAL_GLOB to decide whether or not
- to build the local GNU glob library or use the system one.
-
-1999-09-12 Paul D. Smith <psmith@gnu.org>
-
- * fnmatch.c: Last GLIBC version wouldn't compile outside of GLIBC
- (undefined reference to internal_function). Update to the latest
- version
-
-1999-09-11 Paul Eggert <eggert@twinsun.com>
-
- * glob.h (glob): If #defining to glob64, do this before
- declaring it, so that all declarations and uses match, and
- do not declare glob64, to avoid a declaration clash.
- (globfree): Likewise with globfree64.
-
-1999-09-08 Eli Zaretskii <eliz@is.elta.co.il>
-
- * glob.c (prefix_array) [__MSDOS__,WINDOWS32]: Keep the trailing
- slash unless DIRNAME is just "x:/".
-
-1999-09-06 Paul D. Smith <psmith@gnu.org>
-
- * fnmatch.c: Update to latest version from GLIBC.
-
-1999-07-21 Paul D. Smith <psmith@gnu.org>
-
- * glob.c, glob.h, fnmatch.c, fnmatch.h: Update to latest version
- from GLIBC.
-
- * fnmatch.c (internal_fnmatch): Use K&R definition syntax, not ANSI.
- (__strchrnul): This won't exist outside GLIBC, so create one.
-
- * glob.c: Move getlogin{,_r} prototypes below glob.h to get __P()
- macro.
-
-1998-08-05 Paul D. Smith <psmith@gnu.org>
-
- * configure.in: Remove; configuration for glob is handled by the
- make configure.in.
-
-1998-07-29 Paul D. Smith <psmith@gnu.org>
-
- * glob.c, fnmatch.c: New versions from the GLIBC folks (Ulrich
- Drepper). Fixes a bug reported by Eli Zaretski. Integrates
- DOS/Windows32 support.
-
-1998-07-27 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * glob.c (glob): Cast away const on assignment of pattern to dirname.
- Cast the return type of __alloca() for traditional C compilers.
-
-1998-07-23 Paul D. Smith <psmith@gnu.org>
-
- * glob.c, fnmatch.c: New versions of these files from the GLIBC
- folks (Ulrich Drepper). Had to re-integrate some DOS/Windows
- code.
-
-1998-07-10 Paul D. Smith <psmith@gnu.org>
-
- * glob.c (glob_in_dir): If no meta chars exist in PATTERN and
- GLOB_NOCHECK is present, don't look for the file--whether it's
- found or not, we'll always return it, so why bother searching?
-
- Also, if we are searching and there are no meta chars, don't
- bother trying fnmatch() if the strcmp() fails.
-
-1998-05-30 Eli Zaretskii <eliz@is.elta.co.il>
-
- * glob.c (glob) [__MSDOS__, WINDOWS32]: Compute the directory and
- filename parts of the pattern correctly when it includes a drive
- spec. Disallow wildcards in the drive spec. Prevent recursion
- when dirname is of the form "d:/" or "d:".
- (prefix_array) [__MSDOS__, WINDOWS32]: Don't append a slash to
- "d:/" and "d:".
-
-1998-05-13 Paul D. Smith <psmith@gnu.org>
-
- * SMakefile, Makefile.ami, glob.c, glob.h, fnmatch.c: Updated from
- the latest glibc version.
-
-1998-04-17 Paul D. Smith <psmith@gnu.org>
-
- * configure.in: Create a config.h file instead of setting things
- on the compile line. This is because when build.sh runs it merely
- passes -DHAVE_CONFIG_H to the glob files, just as it does to the
- make files.
- * config.h.in: Created by autoheader.
-
-Tue Aug 12 10:52:34 1997 Paul D. Smith <psmith@baynetworks.com>
-
- * configure.in: Require autoconf 2.12.
-
- * glob: Updates from latest GNU libc glob code.
-
- * glob.c,glob.h,fnmatch.h: Change all WIN32 references to WINDOWS32.
-
- * glob.h: OSF4 defines macros in such a way that GLOB_ALTDIRFUNC
- is not defined. Added a test to the #if which defines it if
- _GNU_SOURCE is defined; that's set by both glob.c and GNU make.
-
- * glob.c: SunOS4 w/ cc needs #include <stdio.h>, since assert.h
- requires stderr but doesn't include stdio.h :-/.
- (next_brace_sub): De-protoize function definition.
- (glob): Cast __alloca(); on SunOS4 it uses the default return type
- of int.
- (glob): Irix defines getlogin_r() to return a char*; move the
- extern for that into the _LIBC area since it isn't used except in
- LIBC anyway. Likewise, move extern getlogin() into the "else".
-
-Sat Jul 20 21:55:31 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
-
- Win32 hacks from <Rob_Tulloh@tivoli.com>.
- * posix/glob.c [WIN32]: Don't include <pwd.h>; don't use d_ino;
- use void * for my_realloc; include <malloc.h> for alloca.
- (glob) [WIN32]: Use "c:/users/default" for ~ if no HOME variable.
- * posix/fnmatch.h [WIN32]: Use prototypes even if [!__STDC__].
- * posix/glob.h: Likewise.
-
-Fri Jul 19 16:56:41 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
-
- * posix/glob.h [!_AMIGA && !VMS]: Check this instead of just [!_AMIGA]
- for `struct stat;' forward decl.
-
-Sat Jun 22 10:44:09 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
-
- * posix/glob.c: Include <alloca.h> only [HAVE_ALLOCA_H], not [sparc].
-
-Fri Jun 21 00:27:51 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
-
- * posix/fnmatch.c (fnmatch): Fix \*[*?]+ case to increment name ptr
- only for ?s, not for *s. Fix from Chet Ramey.
-
-
-Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
-1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software
-Foundation, Inc.
-This file is part of GNU Make.
-
-GNU Make is free software; you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation; either version 3 of the License, or (at your option) any later
-version.
-
-GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY
-WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License along with
-this program. If not, see <http://www.gnu.org/licenses/>.
diff --git a/glob/Makefile.am b/glob/Makefile.am
deleted file mode 100644
index b5adf0a2..00000000
--- a/glob/Makefile.am
+++ /dev/null
@@ -1,29 +0,0 @@
-# -*-Makefile-*-, or close enough
-# Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
-# This file is part of GNU Make.
-#
-# GNU Make is free software; you can redistribute it and/or modify it under
-# the terms of the GNU General Public License as published by the Free Software
-# Foundation; either version 3 of the License, or (at your option) any later
-# version.
-#
-# GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY
-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-# details.
-#
-# You should have received a copy of the GNU General Public License along with
-# this program. If not, see <http://www.gnu.org/licenses/>.
-
-AUTOMAKE_OPTIONS = foreign
-
-# Only build the library when the system doesn't already have GNU glob.
-if USE_LOCAL_GLOB
- noinst_LIBRARIES = libglob.a
-endif
-
-libglob_a_SOURCES = glob.c glob.h fnmatch.c fnmatch.h
-
-
-EXTRA_DIST = COPYING.LIB
diff --git a/lib/.gitignore b/lib/.gitignore
new file mode 100644
index 00000000..cb391c43
--- /dev/null
+++ b/lib/.gitignore
@@ -0,0 +1,11 @@
+*
+!/.gitignore
+
+!/fnmatch.c
+!/fnmatch.in.h
+/fnmatch.h
+
+!/glob.c
+!/glob.in.h
+/glob.h
+
diff --git a/glob/fnmatch.c b/lib/fnmatch.c
index 4da8c5fb..4da8c5fb 100644
--- a/glob/fnmatch.c
+++ b/lib/fnmatch.c
diff --git a/glob/fnmatch.h b/lib/fnmatch.in.h
index a788c8e1..a788c8e1 100644
--- a/glob/fnmatch.h
+++ b/lib/fnmatch.in.h
diff --git a/glob/glob.c b/lib/glob.c
index f3911bcd..df2b23e6 100644
--- a/glob/glob.c
+++ b/lib/glob.c
@@ -226,9 +226,6 @@ extern char *alloca ();
# endif /* Not _AIX. */
# endif /* sparc or HAVE_ALLOCA_H. */
# endif /* GCC. */
-
-# define __alloca alloca
-
#endif
#ifndef __GNU_LIBRARY__
@@ -283,6 +280,14 @@ extern char *alloca ();
#endif
#include <glob.h>
+#if !defined __alloca
+# define __alloca alloca
+#endif
+
+#if !defined __stat
+# define __stat stat
+#endif
+
#ifdef HAVE_GETLOGIN_R
extern int getlogin_r __P ((char *, size_t));
#else
@@ -369,7 +374,7 @@ glob (pattern, flags, errfunc, pglob)
const char *dirname;
size_t dirlen;
int status;
- int oldcount;
+ size_t oldcount;
if (pattern == NULL || pglob == NULL || (flags & ~__GLOB_FLAGS) != 0)
{
@@ -389,7 +394,7 @@ glob (pattern, flags, errfunc, pglob)
{
/* Allocate working buffer large enough for our work. Note that
we have at least an opening and closing brace. */
- int firstc;
+ size_t firstc;
char *alt_start;
const char *p;
const char *next;
@@ -860,7 +865,7 @@ glob (pattern, flags, errfunc, pglob)
have to glob for the directory, and then glob for
the pattern in each directory found. */
glob_t dirs;
- register int i;
+ register size_t i;
status = glob (dirname,
((flags & (GLOB_ERR | GLOB_NOCHECK | GLOB_NOESCAPE))
@@ -1010,7 +1015,7 @@ glob (pattern, flags, errfunc, pglob)
if (dirlen > 0)
{
/* Stick the directory on the front of each name. */
- int ignore = oldcount;
+ size_t ignore = oldcount;
if ((flags & GLOB_DOOFFS) && ignore < pglob->gl_offs)
ignore = pglob->gl_offs;
@@ -1028,7 +1033,7 @@ glob (pattern, flags, errfunc, pglob)
if (flags & GLOB_MARK)
{
/* Append slashes to directory names. */
- int i;
+ size_t i;
struct stat st;
for (i = oldcount; i < pglob->gl_pathc; ++i)
if (((flags & GLOB_ALTDIRFUNC)
@@ -1072,7 +1077,7 @@ globfree (pglob)
{
if (pglob->gl_pathv != NULL)
{
- register int i;
+ register size_t i;
for (i = 0; i < pglob->gl_pathc; ++i)
if (pglob->gl_pathv[i] != NULL)
free ((__ptr_t) pglob->gl_pathv[i]);
@@ -1413,7 +1418,7 @@ glob_in_dir (pattern, directory, flags, errfunc, pglob)
memory_error:
{
- int save = errno;
+ save = errno;
if (flags & GLOB_ALTDIRFUNC)
(*pglob->gl_closedir) (stream);
else
diff --git a/glob/glob.h b/lib/glob.in.h
index 0992de36..0992de36 100644
--- a/glob/glob.h
+++ b/lib/glob.in.h
diff --git a/m4/.gitignore b/m4/.gitignore
new file mode 100644
index 00000000..244385ac
--- /dev/null
+++ b/m4/.gitignore
@@ -0,0 +1,5 @@
+*
+!/.gitignore
+!/aclocal.m4
+!/dospaths.m4
+
diff --git a/config/acinclude.m4 b/m4/acinclude.m4
index 8d7074df..8d7074df 100644
--- a/config/acinclude.m4
+++ b/m4/acinclude.m4
diff --git a/config/dospaths.m4 b/m4/dospaths.m4
index 482cd624..482cd624 100644
--- a/config/dospaths.m4
+++ b/m4/dospaths.m4
diff --git a/maintMakefile b/maintMakefile
index 56b37d9b..5d6a7632 100644
--- a/maintMakefile
+++ b/maintMakefile
@@ -2,6 +2,13 @@
# only if you have the full copy of the GNU make sources from the Git
# tree, not a dist copy.
+# --------------------- #
+# Updating everything. #
+# --------------------- #
+
+.PHONY: update
+update:
+
BUGLIST := bug-make@gnu.org
# These are related to my personal setup.
@@ -38,6 +45,8 @@ AM_CPPFLAGS += $(MAKE_MAINTAINER_MODE)
TEMPLATES = README README.DOS README.W32 README.OS2 \
src/config.ami src/configh.dos src/config.h.W32 src/config.h-vms
+all: $(TEMPLATES)
+
# Create preprocessor output files--GCC specific!
%.i : %.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) -E -dD -o $@ $<
@@ -53,17 +62,17 @@ $(TEMPLATES) : % : %.template Makefile
# Construct Makefiles by adding on dependencies, etc.
#
-srccvt = $(patsubst src/%,$$(src)%,$(filter %.c,$1))
+cvt = $(patsubst $1/%,$$($1)%,$(filter %.c,$2))
Basic.mk: Basic.mk.template .dep_segment Makefile
rm -f $@
sed -e 's@%VERSION%@$(VERSION)@g' \
- -e 's@%make_SOURCES%@$(call srccvt,$(make_SRCS))@g' \
- -e 's@%glob_SOURCES%@$(patsubst glob/%,$$(glob)%,$(filter %.c,$(glob_SRCS)))@g' \
- -e 's@%loadavg_SOURCES%@$(call srccvt,$(loadavg_SRCS))@g' \
- -e 's@%alloca_SOURCES%@$(call srccvt,$(alloca_SRCS))@g' \
- -e 's@%w32_SOURCES%@$(call srccvt,$(w32_SRCS))@g' \
- -e 's@%vms_SOURCES%@$(call srccvt,$(vms_SRCS))@g' \
- -e 's@%amiga_SOURCES%@$(call srccvt,$(amiga_SRCS))@g' \
+ -e 's@%make_SOURCES%@$(call cvt,src,$(make_SRCS))@g' \
+ -e 's@%w32_SOURCES%@$(call cvt,src,$(w32_SRCS))@g' \
+ -e 's@%vms_SOURCES%@$(call cvt,src,$(vms_SRCS))@g' \
+ -e 's@%amiga_SOURCES%@$(call cvt,src,$(amiga_SRCS))@g' \
+ -e 's@%loadavg_SOURCES%@$(call cvt,lib,$(loadavg_SRCS))@g' \
+ -e 's@%alloca_SOURCES%@$(call cvt,lib,$(alloca_SRCS))@g' \
+ -e 's@%glob_SOURCES%@$(call cvt,lib,$(glob_SRCS))@g' \
$< > $@
echo >>$@; echo '# --------------- DEPENDENCIES' >>$@; echo '#' >>$@; \
sed -e 's@^\([^ ]*\)\.o:@$$(OUTDIR)\1.$$(OBJEXT):@' \
@@ -77,10 +86,11 @@ Basic.mk: Basic.mk.template .dep_segment Makefile
build.sh.in: build.template Makefile
rm -f $@
sed -e 's@%objs%@$(patsubst %.o,%.$${OBJEXT},$(filter-out src/remote-%,$(make_OBJECTS)))@g' \
- -e 's@%globobjs%@$(patsubst %.c,%.$${OBJEXT},$(filter %.c,$(glob_SRCS)))@g' \
$< > $@
chmod a-w+x $@
+all: build.sh.in
+
# Use automake to build a dependency list file, for Makebase.mk.
#
@@ -154,6 +164,11 @@ move_if_change = if test -r $(target) && cmp -s $(target).t $(target); then \
# Updating PO files. #
# ------------------- #
+# NOTE: This is handled by the bootstrap script now
+
+#update: po-update
+update: po-check
+
# PO archive mirrors --- Be careful; some might not be fully populated!
# ftp://ftp.unex.es/pub/gnu-i18n/po/maint/
# http://translation.sf.net/maint/
@@ -181,6 +196,13 @@ po-update:
# Updating GNU build files. #
# -------------------------- #
+# Note: this is handled by the bootstrap script now
+#update: scm-update
+
+.PHONY: scm-update
+scm-update: get-build-aux/texinfo.tex get-build-aux/config.guess \
+ get-build-aux/config.sub get-doc/make-stds.texi get-doc/fdl.texi
+
# The following pseudo table associates a local directory and a URL
# with each of the files that belongs to some other package and is
# regularly updated from the specified URL.
@@ -189,14 +211,14 @@ cvs-url = https://savannah.gnu.org/cgi-bin/viewcvs/~checkout~
git-url = https://git.savannah.gnu.org/cgit
target = $(patsubst get-%,%,$@)
-config-url = $(git-url)/config.git/plain/$(patsubst get-config/%,%,$@)
-get-config/config.guess get-config/config.sub:
+config-url = $(git-url)/config.git/plain/$(patsubst get-build-aux/%,%,$@)
+get-build-aux/config.guess get-build-aux/config.sub:
@echo $(WGET) $(config-url) -O $(target) \
&& $(WGET) $(config-url) -O $(target).t \
&& $(move_if_change)
-gnulib-url = $(git-url)/gnulib.git/plain/build-aux/$(patsubst get-config/%,%,$@)
-get-config/texinfo.tex:
+gnulib-url = $(git-url)/gnulib.git/plain/build-aux/$(patsubst get-build-aux/%,%,$@)
+get-build-aux/texinfo.tex:
@echo $(WGET) $(gnulib-url) -O $(target) \
&& $(WGET) $(gnulib-url) -O $(target).t \
&& $(move_if_change)
@@ -207,71 +229,66 @@ get-doc/make-stds.texi get-doc/fdl.texi:
&& $(WGET) $(gnustandards-url) -O $(target).t \
&& $(move_if_change)
-.PHONY: scm-update
-scm-update: get-config/texinfo.tex get-config/config.guess get-config/config.sub get-doc/make-stds.texi get-doc/fdl.texi
-
-
-# --------------------- #
-# Updating everything. #
-# --------------------- #
-
-.PHONY: update
-update: po-update scm-update
-
# ---------------------------------- #
# Alternative configuration checks. #
# ---------------------------------- #
-.PHONY: check-alt-config
-check-alt-config: \
+CONFIG_CHECKS := \
checkcfg.--disable-job-server \
checkcfg.--disable-load \
checkcfg.--without-guile \
+ checkcfg.make_cv_sys_gnu_glob^no \
+ checkcfg.ac_cv_func_getloadavg^no+ac_cv_have_decl_getloadavg^no+gl_cv_have_raw_decl_getloadavg^no+ac_cv_lib_util_getloadavg^no+ac_cv_lib_getloadavg_getloadavg^no \
checkcfg.CPPFLAGS^-DNO_OUTPUT_SYNC \
checkcfg.CPPFLAGS^-DNO_ARCHIVES
+.PHONY: check-alt-config
+check-alt-config: $(CONFIG_CHECKS)
+
# Trick GNU make so it doesn't run the submake as a recursive make.
NR_MAKE = $(MAKE)
-# Check builds both with build.sh and with make and with Basic.mk
-checkcfg.%: distdir
+# Check builds both with build.sh and with make
+$(CONFIG_CHECKS): checkcfg.%: distdir
@echo "Building $@ (output in checkcfg.$*.log)"
exec >'checkcfg.$*.log' 2>&1; \
+ echo "Testing configure with $(subst ^,=,$(subst +, ,$*))"; set -x; \
rm -rf $(distdir)/_build \
&& mkdir $(distdir)/_build \
&& cd $(distdir)/_build \
- && echo "Testing configure with $(subst ^,=,$*)" \
- && ../configure --srcdir=.. $(subst ^,=,$*) \
+ && ../configure --srcdir=.. $(subst ^,=,$(subst +, ,$*)) \
$(AM_DISTCHECK_CONFIGURE_FLAGS) $(DISTCHECK_CONFIGURE_FLAGS)
- exec >>'checkcfg.$*.log' 2>&1; \
+ exec >>'checkcfg.$*.log' 2>&1; set -x; \
cd $(distdir)/_build \
&& ./build.sh \
&& ./make $(AM_MAKEFLAGS) check \
&& ./make $(AM_MAKEFLAGS) clean
- exec >>'checkcfg.$*.log' 2>&1; \
+ exec >>'checkcfg.$*.log' 2>&1; set -x; \
cd $(distdir)/_build \
&& $(NR_MAKE) $(AM_MAKEFLAGS) CFLAGS='$(AM_CFLAGS)' \
&& ./make $(AM_MAKEFLAGS) check \
&& ./make $(AM_MAKEFLAGS) clean
-# Try the different build methods
+# Try using Basic.mk. I can't test this on POSIX systems because it is only
+# used for non-POSIX systems; POSIX systems can just use normal
+# configure/Makefile.in etc.
checkcfg.basicmk: checkcfg.% : distdir
@echo "Building $@ (output in checkcfg.$*.log)"
exec >'checkcfg.$*.log' 2>&1; \
+ echo "Testing Basic.mk SRCDIR=.."; set -x; \
rm -rf $(distdir)/_build \
&& mkdir $(distdir)/_build \
&& cd $(distdir)/_build \
- && echo "Testing Basic.mk SRCDIR=.." \
&& ../configure --srcdir=.. \
$(AM_DISTCHECK_CONFIGURE_FLAGS) $(DISTCHECK_CONFIGURE_FLAGS)
- exec >>'checkcfg.$*.log' 2>&1; \
+ exec >>'checkcfg.$*.log' 2>&1; set -x; \
cd $(distdir)/_build \
- && $(NR_MAKE) $(AM_MAKEFLAGS) -f ../Basic.mk CFLAGS='$(AM_CFLAGS)' SRCDIR=.. \
+ && $(NR_MAKE) $(AM_MAKEFLAGS) -f ../Basic.mk SRCDIR=.. CFLAGS='$(AM_CFLAGS)' \
&& ./make $(AM_MAKEFLAGS) -f ../Basic.mk SRCDIR=.. check \
&& ./make $(AM_MAKEFLAGS) -f ../Basic.mk SRCDIR=.. clean
exec >>'checkcfg.$*.log' 2>&1; \
- echo "Testing Basic.mk SRCDIR=." \
+ echo "Testing Basic.mk SRCDIR=."; set -x; \
&& rm -rf $(distdir)/_build \
&& cd $(distdir) \
&& ./configure \
diff --git a/makefile.com b/makefile.com
index 96cd5ae5..a65ca9da 100644
--- a/makefile.com
+++ b/makefile.com
@@ -71,14 +71,19 @@ $ if (p3.nes."WALL")
$ then
$ gosub check_cc_qual
$ endif
-$ filelist = "alloca ar arscan commands default dir expand file function " + -
- "guile hash implicit job load main misc read remake " + -
- "remote-stub rule output signame variable version " + -
- "vmsfunctions vmsify vpath vms_progname vms_exit " + -
- "vms_export_symbol [.glob]glob [.glob]fnmatch getopt1 " + -
- "getopt strcache"
-$!
-$ copy config.h-vms config.h
+$ filelist = "[.src]ar [.src]arscan [.src]commands [.src]default [.src]dir " + -
+ "[.src]expand [.src]file [.src]function [.src]guile " + -
+ "[.src]hash [.src]implicit [.src]job [.src]load [.src]main " + -
+ "[.src]misc [.src]read [.src]remake [.src]remote-stub " + -
+ "[.src]rule [.src]output [.src]signame [.src]variable " + -
+ "[.src]version [.src]strcache [.src]vpath " + -
+ "[.src]vmsfunctions [.src]vmsify [.src]vms_progname " + -
+ "[.src]vms_exit [.src]vms_export_symbol " + -
+ "[.lib]alloca [.lib]fnmatch [.lib]glob [.src]getopt1 [.src]getopt"
+$!
+$ copy [.src]config.h-vms [.src]config.h
+$ copy [.lib]fnmatch.in.h [.lib]fnmatch.h
+$ copy [.lib]glob.in.h [.lib]glob.h
$ n=0
$ open/write optf make.opt
$ loop:
@@ -141,7 +146,7 @@ $ else
$ objdir := []
$ write optf objdir+p1
$ endif
-$ cc'ccopt'/nested=none/include=([],[.glob])/obj='objdir' -
+$ cc'ccopt'/nested=none/include=([],[.src],[.lib])/obj='objdir' -
/define=("allocated_variable_expand_for_file=alloc_var_expand_for_file",-
"unlink=remove","HAVE_CONFIG_H","VMS") -
'p1'
diff --git a/mk/Amiga.mk b/mk/Amiga.mk
index 61733a3c..79f9b6ae 100644
--- a/mk/Amiga.mk
+++ b/mk/Amiga.mk
@@ -32,7 +32,9 @@ LDFLAGS =
prog_SOURCES += $(alloca_SOURCES) $(loadavg_SOURCES) $(glob_SOURCES) $(amiga_SOURCES)
-extra_CPPFLAGS = IDir $(OUTDIR)src IDir $(SRCDIR)/src IDir $(SRCDIR)/glob
+BUILT_SOURCES += $(lib)alloca.h $(lib)fnmatch.h $(lib)glob.h
+
+extra_CPPFLAGS = IDir $(OUTDIR)src IDir $(SRCDIR)/src IDir $(OUTDIR)lib IDir $(SRCDIR)/lib
C_SOURCE =
OUTPUT_OPTION =
diff --git a/mk/Posix.mk.in b/mk/Posix.mk.in
index 73bb645a..88ac3096 100644
--- a/mk/Posix.mk.in
+++ b/mk/Posix.mk.in
@@ -22,6 +22,7 @@
prog_SOURCES += $(posix_SOURCES)
-extra_CPPFLAGS += @GUILE_CFLAGS@ @GLOBINC@
+extra_CPPFLAGS += @GUILE_CFLAGS@
extra_LDFLAGS += @AM_LDFLAGS@
-LDLIBS += @GUILE_LIBS@ @LIBOBJS@ @GETLOADAVG_LIBS@ @GLOBLIB@ @ALLOCA@ @LIBINTL@ @LIBS@
+LDLIBS += @LIBOBJS@ @gl_LIBOBS@ @ALLOCA@
+LDLIBS += @GUILE_LIBS@ @GETLOADAVG_LIBS@ @LIBINTL@ @LIBS@
diff --git a/mk/VMS.mk b/mk/VMS.mk
index fcce24c6..1fbc858b 100644
--- a/mk/VMS.mk
+++ b/mk/VMS.mk
@@ -19,7 +19,7 @@
# this program. If not, see <http://www.gnu.org/licenses/>.
src = [.src]
-glob = [.glob]
+lib = [.lib]
SRCDIR = []
OBJEXT = .obj
@@ -46,7 +46,7 @@ endif
extra_CPPFLAGS = /define=($(subst $s,$c,$(patsubst %,"%",$(defs))))
-cinclude = /nested=none/include=($(src),$(glob))
+cinclude = /nested=none/include=($(src),$(lib))
ifeq ($(CC),cc)
cprefix = /prefix=(all,except=(glob,globfree))
cwarn = /standard=relaxed/warn=(disable=questcompare)
@@ -71,8 +71,14 @@ endif
# uncomment this
#ALLOCA = $(alloca_SOURCES)
+# If your system doesn't have alloca.h, or the one provided is bad,
+# uncomment this
+#BUILT_SOURCES += $(lib)alloca.h
+
prog_SOURCES += $(ALLOCA) $(glob_SOURCES) $(vms_SOURCES)
+BUILT_SOURCES += $(lib)fnmatch.h $(lib)glob.h
+
COMPILE.cmd = $(CC) $(extra_CFLAGS)$(CFLAGS)/obj=$@ $(extra_CPPFLAGS)$(CPPFLAGS) $<
LINK.cmd = $(LD)$(extra_LDFLAGS)$(LDFLAGS)/exe=$@ $(subst $s,$c,$^)$(LDLIBS)
diff --git a/mk/Windows32.mk b/mk/Windows32.mk
index d658c465..1cbe80b7 100644
--- a/mk/Windows32.mk
+++ b/mk/Windows32.mk
@@ -27,6 +27,8 @@ TOOLCHAIN = msvc
prog_SOURCES += $(loadavg_SOURCES) $(glob_SOURCES) $(w32_SOURCES)
+BUILT_SOURCES += $(lib)fnmatch.h $(lib)glob.h
+
w32_LIBS = kernel32 user32 gdi32 winspool comdlg32 advapi32 shell32 ole32 \
oleaut32 uuid odbc32 odbccp32
@@ -39,7 +41,7 @@ msvc_CC = cl.exe
msvc_LD = link.exe
msvc_CPPFLAGS = /DHAVE_CONFIG_H /DWINDOWS32 /DWIN32 /D_CONSOLE
-msvc_CPPFLAGS += /I$(OUTDIR)src /I$(SRCDIR)/src /I$(SRCDIR)/glob /I$(SRCDIR)/src/w32/include
+msvc_CPPFLAGS += /I$(OUTDIR)src /I$(SRCDIR)/src /I$(SRCDIR)/src/w32/include /I$(OUTDIR)lib /I$(SRCDIR)/lib
msvc_CFLAGS = /nologo /MT /W4 /EHsc
msvc_CFLAGS += /FR$(OUTDIR) /Fp$(BASE_PROG).pch /Fd$(BASE_PROG).pdb
@@ -68,7 +70,7 @@ gcc_LD = $(gcc_CC)
release_gcc_OUTDIR = ./GccRel/
debug_gcc_OUTDIR = ./GccDebug/
-gcc_CPPFLAGS = -DHAVE_CONFIG_H -I$(OUTDIR)src -I$(SRCDIR)/src -I$(SRCDIR)/glob -I$(SRCDIR)/src/w32/include
+gcc_CPPFLAGS = -DHAVE_CONFIG_H -I$(OUTDIR)src -I$(SRCDIR)/src -I$(SRCDIR)/src/w32/include -I$(OUTDIR)lib -I$(SRCDIR)/lib
gcc_CFLAGS = -mthreads -Wall -std=gnu99 -gdwarf-2 -g3
gcc_LDFLAGS = -mthreads -gdwarf-2 -g3
gcc_LDLIBS = $(addprefix -l,$(w32_libs))
diff --git a/mk/msdosdjgpp.mk b/mk/msdosdjgpp.mk
index cec58ef9..2da5bc50 100644
--- a/mk/msdosdjgpp.mk
+++ b/mk/msdosdjgpp.mk
@@ -25,12 +25,12 @@ CC = gcc
prog_SOURCES += $(loadavg_SOURCES) $(glob_SOURCES)
+BUILT_SOURCES += $(lib)fnmatch.h $(lib)glob.h
+
INCLUDEDIR = c:/djgpp/include
LIBDIR = c:/djgpp/lib
LOCALEDIR = c:/djgpp/share
-extra_CPPFLAGS = -I$(SRCDIR)/glob
-
MKDIR = command.com /c mkdir
MKDIR.cmd = $(MKDIR) $(subst /,\\,$@)
diff --git a/po/.gitignore b/po/.gitignore
index d7261f59..df669c5d 100644
--- a/po/.gitignore
+++ b/po/.gitignore
@@ -1,15 +1,4 @@
-Makefile.in.in
-Makevars.template
-POTFILES
-Rules-quot
-boldquot.sed
-en@boldquot.header
-en@quot.header
-insert-header.sin
-make.pot
-quot.sed
-remove-potcdate.sin
-remove-potcdate.sed
-stamp-po
-*.gmo
-*.po
+*
+!.gitignore
+!LINGUAS
+!POTFILES.in
diff --git a/po/LINGUAS b/po/LINGUAS
index 6e9eb56d..3b67c0d3 100644
--- a/po/LINGUAS
+++ b/po/LINGUAS
@@ -1,5 +1,27 @@
-# Set of available languages: 27 languages
-
-be cs da de es fi fr ga gl he hr id it ja ko lt nl pl pt_BR ru sr sv tr uk vi zh_CN zh_TW
-
-# Can't seem to get en@quot and en@boldquot to build properly?
+be
+cs
+da
+de
+es
+fi
+fr
+ga
+gl
+he
+hr
+id
+it
+ja
+ko
+lt
+nl
+pl
+pt_BR
+ru
+sr
+sv
+tr
+uk
+vi
+zh_CN
+zh_TW
diff --git a/po/Makevars b/po/Makevars
deleted file mode 100644
index c1cfdbc9..00000000
--- a/po/Makevars
+++ /dev/null
@@ -1,65 +0,0 @@
-# This is a -*-Makefile-*-
-# Copyright (C) 2002-2018 Free Software Foundation, Inc.
-# This file is part of GNU Make.
-#
-# GNU Make is free software; you can redistribute it and/or modify it under
-# the terms of the GNU General Public License as published by the Free
-# Software Foundation; either version 3 of the License, or (at your option)
-# any later version.
-#
-# GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY
-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-# details.
-#
-# You should have received a copy of the GNU General Public License along with
-# this program. If not, see <http://www.gnu.org/licenses/>.
-
-
-# Makefile variables for PO directory in any package using GNU gettext.
-
-# Usually the message domain is the same as the package name.
-DOMAIN = $(PACKAGE)
-
-# These two variables depend on the location of this directory.
-subdir = po
-top_builddir = ..
-
-# These options get passed to xgettext.
-# Ensure that all our magical output macros are correctly marked as
-# C (printf) format strings.
-XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ \
- --flag=DB:2:c-format --flag=DBF:2:c-format --flag=DBS:2:c-format \
- --flag=O:3:c-format --flag=OSN:3:c-format --flag=ONS:3:c-format \
- --flag=OS:3:c-format --flag=OSS:3:c-format --flag=OSSS:3:c-format \
- --flag=ON:3:c-format --flag=ONN:3:c-format
-
-# This is the copyright holder that gets inserted into the header of the
-# $(DOMAIN).pot file. Set this to the copyright holder of the surrounding
-# package. (Note that the msgstr strings, extracted from the package's
-# sources, belong to the copyright holder of the package.) Translators are
-# expected to transfer the copyright for their translations to this person
-# or entity, or to disclaim their copyright. The empty string stands for
-# the public domain; in this case the translators are expected to disclaim
-# their copyright.
-COPYRIGHT_HOLDER = Free Software Foundation, Inc.
-
-# This is the email address or URL to which the translators shall report
-# bugs in the untranslated strings:
-# - Strings which are not entire sentences, see the maintainer guidelines
-# in the GNU gettext documentation, section 'Preparing Strings'.
-# - Strings which use unclear terms or require additional context to be
-# understood.
-# - Strings which make invalid assumptions about notation of date, time or
-# money.
-# - Pluralisation problems.
-# - Incorrect English spelling.
-# - Incorrect formatting.
-# It can be your email address, or a mailing list address where translators
-# can write to without being subscribed, or the URL of a web page through
-# which the translators can contact you.
-MSGID_BUGS_ADDRESS = bug-make@gnu.org
-
-# This is the list of locale categories, beyond LC_MESSAGES, for which the
-# message catalogs shall be used. It is usually empty.
-EXTRA_LOCALE_CATEGORIES =
diff --git a/src/alloca.c b/src/alloca.c
deleted file mode 100644
index 02ac9211..00000000
--- a/src/alloca.c
+++ /dev/null
@@ -1,503 +0,0 @@
-/* alloca.c -- allocate automatically reclaimed memory
- (Mostly) portable public-domain implementation -- D A Gwyn
-
- This implementation of the PWB library alloca function,
- which is used to allocate space off the run-time stack so
- that it is automatically reclaimed upon procedure exit,
- was inspired by discussions with J. Q. Johnson of Cornell.
- J.Otto Tennant <jot@cray.com> contributed the Cray support.
-
- There are some preprocessor constants that can
- be defined when compiling for your specific system, for
- improved efficiency; however, the defaults should be okay.
-
- The general concept of this implementation is to keep
- track of all alloca-allocated blocks, and reclaim any
- that are found to be deeper in the stack than the current
- invocation. This heuristic does not reclaim storage as
- soon as it becomes invalid, but it will do so eventually.
-
- As a special case, alloca(0) reclaims storage without
- allocating any. It is a good idea to use alloca(0) in
- your main control loop, etc. to force garbage collection. */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-
-#ifdef emacs
-#include "blockinput.h"
-#endif
-
-/* If compiling with GCC 2, this file's not needed. */
-#if !defined (__GNUC__) || __GNUC__ < 2
-
-/* If someone has defined alloca as a macro,
- there must be some other way alloca is supposed to work. */
-#ifndef alloca
-
-#ifdef emacs
-#ifdef static
-/* actually, only want this if static is defined as ""
- -- this is for usg, in which emacs must undefine static
- in order to make unexec workable
- */
-#ifndef STACK_DIRECTION
-you
-lose
--- must know STACK_DIRECTION at compile-time
-#endif /* STACK_DIRECTION undefined */
-#endif /* static */
-#endif /* emacs */
-
-/* If your stack is a linked list of frames, you have to
- provide an "address metric" ADDRESS_FUNCTION macro. */
-
-#if defined (CRAY) && defined (CRAY_STACKSEG_END)
-long i00afunc ();
-#define ADDRESS_FUNCTION(arg) (char *) i00afunc (&(arg))
-#else
-#define ADDRESS_FUNCTION(arg) &(arg)
-#endif
-
-#if __STDC__
-typedef void *pointer;
-#else
-typedef char *pointer;
-#endif
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-/* Different portions of Emacs need to call different versions of
- malloc. The Emacs executable needs alloca to call xmalloc, because
- ordinary malloc isn't protected from input signals. On the other
- hand, the utilities in lib-src need alloca to call malloc; some of
- them are very simple, and don't have an xmalloc routine.
-
- Non-Emacs programs expect this to call use xmalloc.
-
- Callers below should use malloc. */
-
-#ifndef emacs
-#define malloc xmalloc
-#endif
-extern pointer malloc ();
-
-/* Define STACK_DIRECTION if you know the direction of stack
- growth for your system; otherwise it will be automatically
- deduced at run-time.
-
- STACK_DIRECTION > 0 => grows toward higher addresses
- STACK_DIRECTION < 0 => grows toward lower addresses
- STACK_DIRECTION = 0 => direction of growth unknown */
-
-#ifndef STACK_DIRECTION
-#define STACK_DIRECTION 0 /* Direction unknown. */
-#endif
-
-#if STACK_DIRECTION != 0
-
-#define STACK_DIR STACK_DIRECTION /* Known at compile-time. */
-
-#else /* STACK_DIRECTION == 0; need run-time code. */
-
-static int stack_dir; /* 1 or -1 once known. */
-#define STACK_DIR stack_dir
-
-static void
-find_stack_direction (void)
-{
- static char *addr = NULL; /* Address of first 'dummy', once known. */
- auto char dummy; /* To get stack address. */
-
- if (addr == NULL)
- { /* Initial entry. */
- addr = ADDRESS_FUNCTION (dummy);
-
- find_stack_direction (); /* Recurse once. */
- }
- else
- {
- /* Second entry. */
- if (ADDRESS_FUNCTION (dummy) > addr)
- stack_dir = 1; /* Stack grew upward. */
- else
- stack_dir = -1; /* Stack grew downward. */
- }
-}
-
-#endif /* STACK_DIRECTION == 0 */
-
-/* An "alloca header" is used to:
- (a) chain together all alloca'ed blocks;
- (b) keep track of stack depth.
-
- It is very important that sizeof(header) agree with malloc
- alignment chunk size. The following default should work okay. */
-
-#ifndef ALIGN_SIZE
-#define ALIGN_SIZE sizeof(double)
-#endif
-
-typedef union hdr
-{
- char align[ALIGN_SIZE]; /* To force sizeof(header). */
- struct
- {
- union hdr *next; /* For chaining headers. */
- char *deep; /* For stack depth measure. */
- } h;
-} header;
-
-static header *last_alloca_header = NULL; /* -> last alloca header. */
-
-/* Return a pointer to at least SIZE bytes of storage,
- which will be automatically reclaimed upon exit from
- the procedure that called alloca. Originally, this space
- was supposed to be taken from the current stack frame of the
- caller, but that method cannot be made to work for some
- implementations of C, for example under Gould's UTX/32. */
-
-pointer
-alloca (unsigned size)
-{
- auto char probe; /* Probes stack depth: */
- register char *depth = ADDRESS_FUNCTION (probe);
-
-#if STACK_DIRECTION == 0
- if (STACK_DIR == 0) /* Unknown growth direction. */
- find_stack_direction ();
-#endif
-
- /* Reclaim garbage, defined as all alloca'd storage that
- was allocated from deeper in the stack than currently. */
-
- {
- register header *hp; /* Traverses linked list. */
-
-#ifdef emacs
- BLOCK_INPUT;
-#endif
-
- for (hp = last_alloca_header; hp != NULL;)
- if ((STACK_DIR > 0 && hp->h.deep > depth)
- || (STACK_DIR < 0 && hp->h.deep < depth))
- {
- register header *np = hp->h.next;
-
- free ((pointer) hp); /* Collect garbage. */
-
- hp = np; /* -> next header. */
- }
- else
- break; /* Rest are not deeper. */
-
- last_alloca_header = hp; /* -> last valid storage. */
-
-#ifdef emacs
- UNBLOCK_INPUT;
-#endif
- }
-
- if (size == 0)
- return NULL; /* No allocation required. */
-
- /* Allocate combined header + user data storage. */
-
- {
- register pointer new = malloc (sizeof (header) + size);
- /* Address of header. */
-
- if (new == 0)
- abort();
-
- ((header *) new)->h.next = last_alloca_header;
- ((header *) new)->h.deep = depth;
-
- last_alloca_header = (header *) new;
-
- /* User storage begins just after header. */
-
- return (pointer) ((char *) new + sizeof (header));
- }
-}
-
-#if defined (CRAY) && defined (CRAY_STACKSEG_END)
-
-#ifdef DEBUG_I00AFUNC
-#include <stdio.h>
-#endif
-
-#ifndef CRAY_STACK
-#define CRAY_STACK
-#ifndef CRAY2
-/* Stack structures for CRAY-1, CRAY X-MP, and CRAY Y-MP */
-struct stack_control_header
- {
- long shgrow:32; /* Number of times stack has grown. */
- long shaseg:32; /* Size of increments to stack. */
- long shhwm:32; /* High water mark of stack. */
- long shsize:32; /* Current size of stack (all segments). */
- };
-
-/* The stack segment linkage control information occurs at
- the high-address end of a stack segment. (The stack
- grows from low addresses to high addresses.) The initial
- part of the stack segment linkage control information is
- 0200 (octal) words. This provides for register storage
- for the routine which overflows the stack. */
-
-struct stack_segment_linkage
- {
- long ss[0200]; /* 0200 overflow words. */
- long sssize:32; /* Number of words in this segment. */
- long ssbase:32; /* Offset to stack base. */
- long:32;
- long sspseg:32; /* Offset to linkage control of previous
- segment of stack. */
- long:32;
- long sstcpt:32; /* Pointer to task common address block. */
- long sscsnm; /* Private control structure number for
- microtasking. */
- long ssusr1; /* Reserved for user. */
- long ssusr2; /* Reserved for user. */
- long sstpid; /* Process ID for pid based multi-tasking. */
- long ssgvup; /* Pointer to multitasking thread giveup. */
- long sscray[7]; /* Reserved for Cray Research. */
- long ssa0;
- long ssa1;
- long ssa2;
- long ssa3;
- long ssa4;
- long ssa5;
- long ssa6;
- long ssa7;
- long sss0;
- long sss1;
- long sss2;
- long sss3;
- long sss4;
- long sss5;
- long sss6;
- long sss7;
- };
-
-#else /* CRAY2 */
-/* The following structure defines the vector of words
- returned by the STKSTAT library routine. */
-struct stk_stat
- {
- long now; /* Current total stack size. */
- long maxc; /* Amount of contiguous space which would
- be required to satisfy the maximum
- stack demand to date. */
- long high_water; /* Stack high-water mark. */
- long overflows; /* Number of stack overflow ($STKOFEN) calls. */
- long hits; /* Number of internal buffer hits. */
- long extends; /* Number of block extensions. */
- long stko_mallocs; /* Block allocations by $STKOFEN. */
- long underflows; /* Number of stack underflow calls ($STKRETN). */
- long stko_free; /* Number of deallocations by $STKRETN. */
- long stkm_free; /* Number of deallocations by $STKMRET. */
- long segments; /* Current number of stack segments. */
- long maxs; /* Maximum number of stack segments so far. */
- long pad_size; /* Stack pad size. */
- long current_address; /* Current stack segment address. */
- long current_size; /* Current stack segment size. This
- number is actually corrupted by STKSTAT to
- include the fifteen word trailer area. */
- long initial_address; /* Address of initial segment. */
- long initial_size; /* Size of initial segment. */
- };
-
-/* The following structure describes the data structure which trails
- any stack segment. I think that the description in 'asdef' is
- out of date. I only describe the parts that I am sure about. */
-
-struct stk_trailer
- {
- long this_address; /* Address of this block. */
- long this_size; /* Size of this block (does not include
- this trailer). */
- long unknown2;
- long unknown3;
- long link; /* Address of trailer block of previous
- segment. */
- long unknown5;
- long unknown6;
- long unknown7;
- long unknown8;
- long unknown9;
- long unknown10;
- long unknown11;
- long unknown12;
- long unknown13;
- long unknown14;
- };
-
-#endif /* CRAY2 */
-#endif /* not CRAY_STACK */
-
-#ifdef CRAY2
-/* Determine a "stack measure" for an arbitrary ADDRESS.
- I doubt that "lint" will like this much. */
-
-static long
-i00afunc (long *address)
-{
- struct stk_stat status;
- struct stk_trailer *trailer;
- long *block, size;
- long result = 0;
-
- /* We want to iterate through all of the segments. The first
- step is to get the stack status structure. We could do this
- more quickly and more directly, perhaps, by referencing the
- $LM00 common block, but I know that this works. */
-
- STKSTAT (&status);
-
- /* Set up the iteration. */
-
- trailer = (struct stk_trailer *) (status.current_address
- + status.current_size
- - 15);
-
- /* There must be at least one stack segment. Therefore it is
- a fatal error if "trailer" is null. */
-
- if (trailer == 0)
- abort ();
-
- /* Discard segments that do not contain our argument address. */
-
- while (trailer != 0)
- {
- block = (long *) trailer->this_address;
- size = trailer->this_size;
- if (block == 0 || size == 0)
- abort ();
- trailer = (struct stk_trailer *) trailer->link;
- if ((block <= address) && (address < (block + size)))
- break;
- }
-
- /* Set the result to the offset in this segment and add the sizes
- of all predecessor segments. */
-
- result = address - block;
-
- if (trailer == 0)
- {
- return result;
- }
-
- do
- {
- if (trailer->this_size <= 0)
- abort ();
- result += trailer->this_size;
- trailer = (struct stk_trailer *) trailer->link;
- }
- while (trailer != 0);
-
- /* We are done. Note that if you present a bogus address (one
- not in any segment), you will get a different number back, formed
- from subtracting the address of the first block. This is probably
- not what you want. */
-
- return (result);
-}
-
-#else /* not CRAY2 */
-/* Stack address function for a CRAY-1, CRAY X-MP, or CRAY Y-MP.
- Determine the number of the cell within the stack,
- given the address of the cell. The purpose of this
- routine is to linearize, in some sense, stack addresses
- for alloca. */
-
-static long
-i00afunc (long address)
-{
- long stkl = 0;
-
- long size, pseg, this_segment, stack;
- long result = 0;
-
- struct stack_segment_linkage *ssptr;
-
- /* Register B67 contains the address of the end of the
- current stack segment. If you (as a subprogram) store
- your registers on the stack and find that you are past
- the contents of B67, you have overflowed the segment.
-
- B67 also points to the stack segment linkage control
- area, which is what we are really interested in. */
-
- stkl = CRAY_STACKSEG_END ();
- ssptr = (struct stack_segment_linkage *) stkl;
-
- /* If one subtracts 'size' from the end of the segment,
- one has the address of the first word of the segment.
-
- If this is not the first segment, 'pseg' will be
- nonzero. */
-
- pseg = ssptr->sspseg;
- size = ssptr->sssize;
-
- this_segment = stkl - size;
-
- /* It is possible that calling this routine itself caused
- a stack overflow. Discard stack segments which do not
- contain the target address. */
-
- while (!(this_segment <= address && address <= stkl))
- {
-#ifdef DEBUG_I00AFUNC
- fprintf (stderr, "%011o %011o %011o\n", this_segment, address, stkl);
-#endif
- if (pseg == 0)
- break;
- stkl = stkl - pseg;
- ssptr = (struct stack_segment_linkage *) stkl;
- size = ssptr->sssize;
- pseg = ssptr->sspseg;
- this_segment = stkl - size;
- }
-
- result = address - this_segment;
-
- /* If you subtract pseg from the current end of the stack,
- you get the address of the previous stack segment's end.
- This seems a little convoluted to me, but I'll bet you save
- a cycle somewhere. */
-
- while (pseg != 0)
- {
-#ifdef DEBUG_I00AFUNC
- fprintf (stderr, "%011o %011o\n", pseg, size);
-#endif
- stkl = stkl - pseg;
- ssptr = (struct stack_segment_linkage *) stkl;
- size = ssptr->sssize;
- pseg = ssptr->sspseg;
- result += size;
- }
- return (result);
-}
-
-#endif /* not CRAY2 */
-#endif /* CRAY */
-
-#endif /* no alloca */
-#endif /* not GCC version 2 */
diff --git a/src/getloadavg.c b/src/getloadavg.c
deleted file mode 100644
index 7cf4c673..00000000
--- a/src/getloadavg.c
+++ /dev/null
@@ -1,1026 +0,0 @@
-/* Get the system load averages.
-Copyright (C) 1985-2018 Free Software Foundation, Inc.
-
-GNU Make is free software; you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation; either version 3 of the License, or (at your option) any later
-version.
-
-GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY
-WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License along with
-this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* Compile-time symbols that this file uses:
-
- HAVE_PSTAT_GETDYNAMIC Define this if your system has the
- pstat_getdynamic function. I think it
- is unique to HPUX9. The best way to get the
- definition is through the AC_FUNC_GETLOADAVG
- macro that comes with autoconf 2.13 or newer.
- If that isn't an option, then just put
- AC_CHECK_FUNCS(pstat_getdynamic) in your
- configure.in file.
- FIXUP_KERNEL_SYMBOL_ADDR() Adjust address in returned struct nlist.
- KERNEL_FILE Pathname of the kernel to nlist.
- LDAV_CVT() Scale the load average from the kernel.
- Returns a double.
- LDAV_SYMBOL Name of kernel symbol giving load average.
- LOAD_AVE_TYPE Type of the load average array in the kernel.
- Must be defined unless one of
- apollo, DGUX, NeXT, or UMAX is defined;
- or we have libkstat;
- otherwise, no load average is available.
- NLIST_STRUCT Include nlist.h, not a.out.h, and
- the nlist n_name element is a pointer,
- not an array.
- HAVE_STRUCT_NLIST_N_UN_N_NAME struct nlist has an n_un member, not n_name.
- LINUX_LDAV_FILE [__linux__]: File containing load averages.
-
- Specific system predefines this file uses, aside from setting
- default values if not emacs:
-
- apollo
- BSD Real BSD, not just BSD-like.
- convex
- DGUX
- eunice UNIX emulator under VMS.
- hpux
- __MSDOS__ No-op for MSDOS.
- NeXT
- sgi
- sequent Sequent Dynix 3.x.x (BSD)
- _SEQUENT_ Sequent DYNIX/ptx 1.x.x (SYSV)
- sony_news NEWS-OS (works at least for 4.1C)
- UMAX
- UMAX4_3
- VMS
- WINDOWS32 No-op for Windows95/NT.
- __linux__ Linux: assumes /proc filesystem mounted.
- Support from Michael K. Johnson.
- __NetBSD__ NetBSD: assumes /kern filesystem mounted.
-
- In addition, to avoid nesting many #ifdefs, we internally set
- LDAV_DONE to indicate that the load average has been computed.
-
- We also #define LDAV_PRIVILEGED if a program will require
- special installation to be able to call getloadavg. */
-
-/* This should always be first. */
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <sys/types.h>
-
-/* Both the Emacs and non-Emacs sections want this. Some
- configuration files' definitions for the LOAD_AVE_CVT macro (like
- sparc.h's) use macros like FSCALE, defined here. */
-#if defined (unix) || defined (__unix)
-# include <sys/param.h>
-#endif
-
-
-/* Exclude all the code except the test program at the end
- if the system has its own 'getloadavg' function.
-
- The declaration of 'errno' is needed by the test program
- as well as the function itself, so it comes first. */
-
-#include <errno.h>
-
-#ifndef errno
-extern int errno;
-#endif
-
-#if HAVE_LOCALE_H
-# include <locale.h>
-#endif
-#if !HAVE_SETLOCALE
-# define setlocale(Category, Locale) /* empty */
-#endif
-
-#ifndef HAVE_GETLOADAVG
-
-
-/* The existing Emacs configuration files define a macro called
- LOAD_AVE_CVT, which accepts a value of type LOAD_AVE_TYPE, and
- returns the load average multiplied by 100. What we actually want
- is a macro called LDAV_CVT, which returns the load average as an
- unmultiplied double.
-
- For backwards compatibility, we'll define LDAV_CVT in terms of
- LOAD_AVE_CVT, but future machine config files should just define
- LDAV_CVT directly. */
-
-# if !defined(LDAV_CVT) && defined(LOAD_AVE_CVT)
-# define LDAV_CVT(n) (LOAD_AVE_CVT (n) / 100.0)
-# endif
-
-# if !defined (BSD) && defined (ultrix)
-/* Ultrix behaves like BSD on Vaxen. */
-# define BSD
-# endif
-
-# ifdef NeXT
-/* NeXT in the 2.{0,1,2} releases defines BSD in <sys/param.h>, which
- conflicts with the definition understood in this file, that this
- really is BSD. */
-# undef BSD
-
-/* NeXT defines FSCALE in <sys/param.h>. However, we take FSCALE being
- defined to mean that the nlist method should be used, which is not true. */
-# undef FSCALE
-# endif
-
-/* Same issues as for NeXT apply to the HURD-based GNU system. */
-# ifdef __GNU__
-# undef BSD
-# undef FSCALE
-# endif /* __GNU__ */
-
-/* Set values that are different from the defaults, which are
- set a little farther down with #ifndef. */
-
-
-/* Some shorthands. */
-
-# if defined (HPUX) && !defined (hpux)
-# define hpux
-# endif
-
-# if defined (__hpux) && !defined (hpux)
-# define hpux
-# endif
-
-# if defined (__sun) && !defined (sun)
-# define sun
-# endif
-
-# if defined(hp300) && !defined(hpux)
-# define MORE_BSD
-# endif
-
-# if defined(ultrix) && defined(mips)
-# define decstation
-# endif
-
-# if defined (__SVR4) && !defined (SVR4)
-# define SVR4
-# endif
-
-# if (defined(sun) && defined(SVR4)) || defined (SOLARIS2)
-# define SUNOS_5
-# endif
-
-# if defined (__osf__) && (defined (__alpha) || defined (__alpha__))
-# define OSF_ALPHA
-# include <sys/mbuf.h>
-# include <sys/socket.h>
-# include <net/route.h>
-# include <sys/table.h>
-# endif
-
-# if defined (__osf__) && (defined (mips) || defined (__mips__))
-# define OSF_MIPS
-# include <sys/table.h>
-# endif
-
-/* UTek's /bin/cc on the 4300 has no architecture specific cpp define by
- default, but _MACH_IND_SYS_TYPES is defined in <sys/types.h>. Combine
- that with a couple of other things and we'll have a unique match. */
-# if !defined (tek4300) && defined (unix) && defined (m68k) && defined (mc68000) && defined (mc68020) && defined (_MACH_IND_SYS_TYPES)
-# define tek4300 /* Define by emacs, but not by other users. */
-# endif
-
-/* AC_FUNC_GETLOADAVG thinks QNX is SVR4, but it isn't. */
-# if defined(__QNX__)
-# undef SVR4
-# endif
-
-/* VAX C can't handle multi-line #ifs, or lines longer than 256 chars. */
-# ifndef LOAD_AVE_TYPE
-
-# ifdef MORE_BSD
-# define LOAD_AVE_TYPE long
-# endif
-
-# ifdef sun
-# define LOAD_AVE_TYPE long
-# endif
-
-# ifdef decstation
-# define LOAD_AVE_TYPE long
-# endif
-
-# ifdef _SEQUENT_
-# define LOAD_AVE_TYPE long
-# endif
-
-# ifdef sgi
-# define LOAD_AVE_TYPE long
-# endif
-
-# ifdef SVR4
-# define LOAD_AVE_TYPE long
-# endif
-
-# ifdef sony_news
-# define LOAD_AVE_TYPE long
-# endif
-
-# ifdef sequent
-# define LOAD_AVE_TYPE long
-# endif
-
-# ifdef OSF_ALPHA
-# define LOAD_AVE_TYPE long
-# endif
-
-# if defined (ardent) && defined (titan)
-# define LOAD_AVE_TYPE long
-# endif
-
-# ifdef tek4300
-# define LOAD_AVE_TYPE long
-# endif
-
-# if defined(alliant) && defined(i860) /* Alliant FX/2800 */
-# define LOAD_AVE_TYPE long
-# endif
-
-# ifdef _AIX
-# define LOAD_AVE_TYPE long
-# endif
-
-# ifdef convex
-# define LOAD_AVE_TYPE double
-# ifndef LDAV_CVT
-# define LDAV_CVT(n) (n)
-# endif
-# endif
-
-# endif /* No LOAD_AVE_TYPE. */
-
-# ifdef OSF_ALPHA
-/* <sys/param.h> defines an incorrect value for FSCALE on Alpha OSF/1,
- according to ghazi@noc.rutgers.edu. */
-# undef FSCALE
-# define FSCALE 1024.0
-# endif
-
-# if defined(alliant) && defined(i860) /* Alliant FX/2800 */
-/* <sys/param.h> defines an incorrect value for FSCALE on an
- Alliant FX/2800 Concentrix 2.2, according to ghazi@noc.rutgers.edu. */
-# undef FSCALE
-# define FSCALE 100.0
-# endif
-
-
-# ifndef FSCALE
-
-/* SunOS and some others define FSCALE in sys/param.h. */
-
-# ifdef MORE_BSD
-# define FSCALE 2048.0
-# endif
-
-# if defined(MIPS) || defined(SVR4) || defined(decstation)
-# define FSCALE 256
-# endif
-
-# if defined (sgi) || defined (sequent)
-/* Sometimes both MIPS and sgi are defined, so FSCALE was just defined
- above under #ifdef MIPS. But we want the sgi value. */
-# undef FSCALE
-# define FSCALE 1000.0
-# endif
-
-# if defined (ardent) && defined (titan)
-# define FSCALE 65536.0
-# endif
-
-# ifdef tek4300
-# define FSCALE 100.0
-# endif
-
-# ifdef _AIX
-# define FSCALE 65536.0
-# endif
-
-# endif /* Not FSCALE. */
-
-# if !defined (LDAV_CVT) && defined (FSCALE)
-# define LDAV_CVT(n) (((double) (n)) / FSCALE)
-# endif
-
-
-# if defined(sgi) || (defined(mips) && !defined(BSD))
-# define FIXUP_KERNEL_SYMBOL_ADDR(nl) ((nl)[0].n_value &= ~(1 << 31))
-# endif
-
-
-# if !defined (KERNEL_FILE) && defined (sequent)
-# define KERNEL_FILE "/dynix"
-# endif
-
-# if !defined (KERNEL_FILE) && defined (hpux)
-# define KERNEL_FILE "/hp-ux"
-# endif
-
-# if !defined(KERNEL_FILE) && (defined(_SEQUENT_) || defined(MIPS) || defined(SVR4) || defined(ISC) || defined (sgi) || (defined (ardent) && defined (titan)))
-# define KERNEL_FILE "/unix"
-# endif
-
-
-# if !defined (LDAV_SYMBOL) && defined (alliant)
-# define LDAV_SYMBOL "_Loadavg"
-# endif
-
-# if !defined(LDAV_SYMBOL) && ((defined(hpux) && !defined(hp9000s300)) || defined(_SEQUENT_) || defined(SVR4) || defined(ISC) || defined(sgi) || (defined (ardent) && defined (titan)) || defined (_AIX))
-# define LDAV_SYMBOL "avenrun"
-# endif
-
-# ifdef HAVE_UNISTD_H
-# include <unistd.h>
-# endif
-
-# include <stdio.h>
-
-/* LOAD_AVE_TYPE should only get defined if we're going to use the
- nlist method. */
-# if !defined(LOAD_AVE_TYPE) && (defined(BSD) || defined(LDAV_CVT) || defined(KERNEL_FILE) || defined(LDAV_SYMBOL)) && !defined(__riscos__)
-# define LOAD_AVE_TYPE double
-# endif
-
-# ifdef LOAD_AVE_TYPE
-
-# ifndef VMS
-# ifndef __linux__
-# ifdef HAVE_NLIST_H
-# include <nlist.h>
-# else
-# include <a.out.h>
-# endif
-
-# ifdef SUNOS_5
-# include <fcntl.h>
-# include <kvm.h>
-# include <kstat.h>
-# endif
-
-# if defined (hpux) && defined (HAVE_PSTAT_GETDYNAMIC)
-# include <sys/pstat.h>
-# endif
-
-# ifndef KERNEL_FILE
-# define KERNEL_FILE "/vmunix"
-# endif /* KERNEL_FILE */
-
-# ifndef LDAV_SYMBOL
-# define LDAV_SYMBOL "_avenrun"
-# endif /* LDAV_SYMBOL */
-# endif /* __linux__ */
-
-# else /* VMS */
-
-# ifndef eunice
-# include <iodef.h>
-# include <descrip.h>
-# else /* eunice */
-# include <vms/iodef.h>
-# endif /* eunice */
-# endif /* VMS */
-
-# ifndef LDAV_CVT
-# define LDAV_CVT(n) ((double) (n))
-# endif /* !LDAV_CVT */
-
-# endif /* LOAD_AVE_TYPE */
-
-# if defined(__GNU__) && !defined (NeXT)
-/* Note that NeXT Openstep defines __GNU__ even though it should not. */
-/* GNU system acts much like NeXT, for load average purposes,
- but not exactly. */
-# define NeXT
-# define host_self mach_host_self
-# endif
-
-# ifdef NeXT
-# ifdef HAVE_MACH_MACH_H
-# include <mach/mach.h>
-# else
-# include <mach.h>
-# endif
-# endif /* NeXT */
-
-# ifdef sgi
-# include <sys/sysmp.h>
-# endif /* sgi */
-
-# ifdef UMAX
-# include <stdio.h>
-# include <signal.h>
-# include <sys/time.h>
-# include <sys/wait.h>
-# include <sys/syscall.h>
-
-# ifdef UMAX_43
-# include <machine/cpu.h>
-# include <inq_stats/statistics.h>
-# include <inq_stats/sysstats.h>
-# include <inq_stats/cpustats.h>
-# include <inq_stats/procstats.h>
-# else /* Not UMAX_43. */
-# include <sys/sysdefs.h>
-# include <sys/statistics.h>
-# include <sys/sysstats.h>
-# include <sys/cpudefs.h>
-# include <sys/cpustats.h>
-# include <sys/procstats.h>
-# endif /* Not UMAX_43. */
-# endif /* UMAX */
-
-# ifdef DGUX
-# include <sys/dg_sys_info.h>
-# endif
-
-# if defined(HAVE_FCNTL_H) || defined(_POSIX_VERSION)
-# include <fcntl.h>
-# else
-# include <sys/file.h>
-# endif
-
-
-/* Avoid static vars inside a function since in HPUX they dump as pure. */
-
-# ifdef NeXT
-static processor_set_t default_set;
-static int getloadavg_initialized;
-# endif /* NeXT */
-
-# ifdef UMAX
-static unsigned int cpus = 0;
-static unsigned int samples;
-# endif /* UMAX */
-
-# ifdef DGUX
-static struct dg_sys_info_load_info load_info; /* what-a-mouthful! */
-# endif /* DGUX */
-
-#if !defined(HAVE_LIBKSTAT) && defined(LOAD_AVE_TYPE)
-/* File descriptor open to /dev/kmem or VMS load ave driver. */
-static int channel;
-/* Nonzero iff channel is valid. */
-static int getloadavg_initialized;
-/* Offset in kmem to seek to read load average, or 0 means invalid. */
-static long offset;
-
-#if !defined(VMS) && !defined(sgi) && !defined(__linux__)
-static struct nlist nl[2];
-#endif /* Not VMS or sgi */
-
-#ifdef SUNOS_5
-static kvm_t *kd;
-#endif /* SUNOS_5 */
-
-#endif /* LOAD_AVE_TYPE && !HAVE_LIBKSTAT */
-
-/* Put the 1 minute, 5 minute and 15 minute load averages
- into the first NELEM elements of LOADAVG.
- Return the number written (never more than 3, but may be less than NELEM),
- or -1 if an error occurred. */
-
-int
-getloadavg (double loadavg[], int nelem)
-{
- int elem = 0; /* Return value. */
-
-# ifdef NO_GET_LOAD_AVG
-# define LDAV_DONE
- /* Set errno to zero to indicate that there was no particular error;
- this function just can't work at all on this system. */
- errno = 0;
- elem = -1;
-# endif
-
-# if !defined (LDAV_DONE) && defined (HAVE_LIBKSTAT)
-/* Use libkstat because we don't have to be root. */
-# define LDAV_DONE
- kstat_ctl_t *kc;
- kstat_t *ksp;
- kstat_named_t *kn;
-
- kc = kstat_open ();
- if (kc == 0)
- return -1;
- ksp = kstat_lookup (kc, "unix", 0, "system_misc");
- if (ksp == 0 )
- return -1;
- if (kstat_read (kc, ksp, 0) == -1)
- return -1;
-
-
- kn = kstat_data_lookup (ksp, "avenrun_1min");
- if (kn == 0)
- {
- /* Return -1 if no load average information is available. */
- nelem = 0;
- elem = -1;
- }
-
- if (nelem >= 1)
- loadavg[elem++] = (double) kn->value.ul/FSCALE;
-
- if (nelem >= 2)
- {
- kn = kstat_data_lookup (ksp, "avenrun_5min");
- if (kn != 0)
- {
- loadavg[elem++] = (double) kn->value.ul/FSCALE;
-
- if (nelem >= 3)
- {
- kn = kstat_data_lookup (ksp, "avenrun_15min");
- if (kn != 0)
- loadavg[elem++] = (double) kn->value.ul/FSCALE;
- }
- }
- }
-
- kstat_close (kc);
-# endif /* HAVE_LIBKSTAT */
-
-# if !defined (LDAV_DONE) && defined (hpux) && defined (HAVE_PSTAT_GETDYNAMIC)
-/* Use pstat_getdynamic() because we don't have to be root. */
-# define LDAV_DONE
-# undef LOAD_AVE_TYPE
-
- struct pst_dynamic dyn_info;
- if (pstat_getdynamic (&dyn_info, sizeof (dyn_info), 0, 0) < 0)
- return -1;
- if (nelem > 0)
- loadavg[elem++] = dyn_info.psd_avg_1_min;
- if (nelem > 1)
- loadavg[elem++] = dyn_info.psd_avg_5_min;
- if (nelem > 2)
- loadavg[elem++] = dyn_info.psd_avg_15_min;
-
-# endif /* hpux && HAVE_PSTAT_GETDYNAMIC */
-
-# if !defined (LDAV_DONE) && defined (__linux__)
-# define LDAV_DONE
-# undef LOAD_AVE_TYPE
-
-# ifndef LINUX_LDAV_FILE
-# define LINUX_LDAV_FILE "/proc/loadavg"
-# endif
-
- char ldavgbuf[40];
- double load_ave[3];
- int fd, count;
-
- fd = open (LINUX_LDAV_FILE, O_RDONLY);
- if (fd == -1)
- return -1;
- count = read (fd, ldavgbuf, 40);
- (void) close (fd);
- if (count <= 0)
- return -1;
-
- /* The following sscanf must use the C locale. */
- setlocale (LC_NUMERIC, "C");
- count = sscanf (ldavgbuf, "%lf %lf %lf",
- &load_ave[0], &load_ave[1], &load_ave[2]);
- setlocale (LC_NUMERIC, "");
- if (count < 1)
- return -1;
-
- for (elem = 0; elem < nelem && elem < count; elem++)
- loadavg[elem] = load_ave[elem];
-
- return elem;
-
-# endif /* __linux__ */
-
-# if !defined (LDAV_DONE) && defined (__NetBSD__)
-# define LDAV_DONE
-# undef LOAD_AVE_TYPE
-
-# ifndef NETBSD_LDAV_FILE
-# define NETBSD_LDAV_FILE "/kern/loadavg"
-# endif
-
- unsigned long int load_ave[3], scale;
- int count;
- FILE *fp;
-
- fp = fopen (NETBSD_LDAV_FILE, "r");
- if (fp == NULL)
- return -1;
- count = fscanf (fp, "%lu %lu %lu %lu\n",
- &load_ave[0], &load_ave[1], &load_ave[2],
- &scale);
- (void) fclose (fp);
- if (count != 4)
- return -1;
-
- for (elem = 0; elem < nelem; elem++)
- loadavg[elem] = (double) load_ave[elem] / (double) scale;
-
- return elem;
-
-# endif /* __NetBSD__ */
-
-# if !defined (LDAV_DONE) && defined (NeXT)
-# define LDAV_DONE
- /* The NeXT code was adapted from iscreen 3.2. */
-
- host_t host;
- struct processor_set_basic_info info;
- unsigned info_count;
-
- /* We only know how to get the 1-minute average for this system,
- so even if the caller asks for more than 1, we only return 1. */
-
- if (!getloadavg_initialized)
- {
- if (processor_set_default (host_self (), &default_set) == KERN_SUCCESS)
- getloadavg_initialized = 1;
- }
-
- if (getloadavg_initialized)
- {
- info_count = PROCESSOR_SET_BASIC_INFO_COUNT;
- if (processor_set_info (default_set, PROCESSOR_SET_BASIC_INFO, &host,
- (processor_set_info_t) &info, &info_count)
- != KERN_SUCCESS)
- getloadavg_initialized = 0;
- else
- {
- if (nelem > 0)
- loadavg[elem++] = (double) info.load_average / LOAD_SCALE;
- }
- }
-
- if (!getloadavg_initialized)
- return -1;
-# endif /* NeXT */
-
-# if !defined (LDAV_DONE) && defined (UMAX)
-# define LDAV_DONE
-/* UMAX 4.2, which runs on the Encore Multimax multiprocessor, does not
- have a /dev/kmem. Information about the workings of the running kernel
- can be gathered with inq_stats system calls.
- We only know how to get the 1-minute average for this system. */
-
- struct proc_summary proc_sum_data;
- struct stat_descr proc_info;
- double load;
- register unsigned int i, j;
-
- if (cpus == 0)
- {
- register unsigned int c, i;
- struct cpu_config conf;
- struct stat_descr desc;
-
- desc.sd_next = 0;
- desc.sd_subsys = SUBSYS_CPU;
- desc.sd_type = CPUTYPE_CONFIG;
- desc.sd_addr = (char *) &conf;
- desc.sd_size = sizeof conf;
-
- if (inq_stats (1, &desc))
- return -1;
-
- c = 0;
- for (i = 0; i < conf.config_maxclass; ++i)
- {
- struct class_stats stats;
- memset (&stats, '\0', sizeof stats);
-
- desc.sd_type = CPUTYPE_CLASS;
- desc.sd_objid = i;
- desc.sd_addr = (char *) &stats;
- desc.sd_size = sizeof stats;
-
- if (inq_stats (1, &desc))
- return -1;
-
- c += stats.class_numcpus;
- }
- cpus = c;
- samples = cpus < 2 ? 3 : (2 * cpus / 3);
- }
-
- proc_info.sd_next = 0;
- proc_info.sd_subsys = SUBSYS_PROC;
- proc_info.sd_type = PROCTYPE_SUMMARY;
- proc_info.sd_addr = (char *) &proc_sum_data;
- proc_info.sd_size = sizeof (struct proc_summary);
- proc_info.sd_sizeused = 0;
-
- if (inq_stats (1, &proc_info) != 0)
- return -1;
-
- load = proc_sum_data.ps_nrunnable;
- j = 0;
- for (i = samples - 1; i > 0; --i)
- {
- load += proc_sum_data.ps_nrun[j];
- if (j++ == PS_NRUNSIZE)
- j = 0;
- }
-
- if (nelem > 0)
- loadavg[elem++] = load / samples / cpus;
-# endif /* UMAX */
-
-# if !defined (LDAV_DONE) && defined (DGUX)
-# define LDAV_DONE
- /* This call can return -1 for an error, but with good args
- it's not supposed to fail. The first argument is for no
- apparent reason of type 'long int *'. */
- dg_sys_info ((long int *) &load_info,
- DG_SYS_INFO_LOAD_INFO_TYPE,
- DG_SYS_INFO_LOAD_VERSION_0);
-
- if (nelem > 0)
- loadavg[elem++] = load_info.one_minute;
- if (nelem > 1)
- loadavg[elem++] = load_info.five_minute;
- if (nelem > 2)
- loadavg[elem++] = load_info.fifteen_minute;
-# endif /* DGUX */
-
-# if !defined (LDAV_DONE) && defined (apollo)
-# define LDAV_DONE
-/* Apollo code from lisch@mentorg.com (Ray Lischner).
-
- This system call is not documented. The load average is obtained as
- three long integers, for the load average over the past minute,
- five minutes, and fifteen minutes. Each value is a scaled integer,
- with 16 bits of integer part and 16 bits of fraction part.
-
- I'm not sure which operating system first supported this system call,
- but I know that SR10.2 supports it. */
-
- extern void proc1_$get_loadav ();
- unsigned long load_ave[3];
-
- proc1_$get_loadav (load_ave);
-
- if (nelem > 0)
- loadavg[elem++] = load_ave[0] / 65536.0;
- if (nelem > 1)
- loadavg[elem++] = load_ave[1] / 65536.0;
- if (nelem > 2)
- loadavg[elem++] = load_ave[2] / 65536.0;
-# endif /* apollo */
-
-# if !defined (LDAV_DONE) && defined (OSF_MIPS)
-# define LDAV_DONE
-
- struct tbl_loadavg load_ave;
- table (TBL_LOADAVG, 0, &load_ave, 1, sizeof (load_ave));
- loadavg[elem++]
- = (load_ave.tl_lscale == 0
- ? load_ave.tl_avenrun.d[0]
- : (load_ave.tl_avenrun.l[0] / (double) load_ave.tl_lscale));
-# endif /* OSF_MIPS */
-
-# if !defined (LDAV_DONE) && (defined (__MSDOS__) || defined (WINDOWS32))
-# define LDAV_DONE
-
- /* A faithful emulation is going to have to be saved for a rainy day. */
- for ( ; elem < nelem; elem++)
- {
- loadavg[elem] = 0.0;
- }
-# endif /* __MSDOS__ || WINDOWS32 */
-
-# if !defined (LDAV_DONE) && defined (OSF_ALPHA)
-# define LDAV_DONE
-
- struct tbl_loadavg load_ave;
- table (TBL_LOADAVG, 0, &load_ave, 1, sizeof (load_ave));
- for (elem = 0; elem < nelem; elem++)
- loadavg[elem]
- = (load_ave.tl_lscale == 0
- ? load_ave.tl_avenrun.d[elem]
- : (load_ave.tl_avenrun.l[elem] / (double) load_ave.tl_lscale));
-# endif /* OSF_ALPHA */
-
-# if !defined (LDAV_DONE) && defined (VMS)
- /* VMS specific code -- read from the Load Ave driver. */
-
- LOAD_AVE_TYPE load_ave[3];
- static int getloadavg_initialized = 0;
-# ifdef eunice
- struct
- {
- int dsc$w_length;
- char *dsc$a_pointer;
- } descriptor;
-# endif
-
- /* Ensure that there is a channel open to the load ave device. */
- if (!getloadavg_initialized)
- {
- /* Attempt to open the channel. */
-# ifdef eunice
- descriptor.dsc$w_length = 18;
- descriptor.dsc$a_pointer = "$$VMS_LOAD_AVERAGE";
-# else
- $DESCRIPTOR (descriptor, "LAV0:");
-# endif
- if (sys$assign (&descriptor, &channel, 0, 0) & 1)
- getloadavg_initialized = 1;
- }
-
- /* Read the load average vector. */
- if (getloadavg_initialized
- && !(sys$qiow (0, channel, IO$_READVBLK, 0, 0, 0,
- load_ave, 12, 0, 0, 0, 0) & 1))
- {
- sys$dassgn (channel);
- getloadavg_initialized = 0;
- }
-
- if (!getloadavg_initialized)
- return -1;
-# endif /* VMS */
-
-# if !defined (LDAV_DONE) && defined(LOAD_AVE_TYPE) && !defined(VMS)
-
- /* UNIX-specific code -- read the average from /dev/kmem. */
-
-# define LDAV_PRIVILEGED /* This code requires special installation. */
-
- LOAD_AVE_TYPE load_ave[3];
-
- /* Get the address of LDAV_SYMBOL. */
- if (offset == 0)
- {
-# ifndef sgi
-# ifndef NLIST_STRUCT
- strcpy (nl[0].n_name, LDAV_SYMBOL);
- strcpy (nl[1].n_name, "");
-# else /* NLIST_STRUCT */
-# ifdef HAVE_STRUCT_NLIST_N_UN_N_NAME
- nl[0].n_un.n_name = LDAV_SYMBOL;
- nl[1].n_un.n_name = 0;
-# else /* not HAVE_STRUCT_NLIST_N_UN_N_NAME */
- nl[0].n_name = LDAV_SYMBOL;
- nl[1].n_name = 0;
-# endif /* not HAVE_STRUCT_NLIST_N_UN_N_NAME */
-# endif /* NLIST_STRUCT */
-
-# ifndef SUNOS_5
- if (
-# if !(defined (_AIX) && !defined (ps2))
- nlist (KERNEL_FILE, nl)
-# else /* _AIX */
- knlist (nl, 1, sizeof (nl[0]))
-# endif
- >= 0)
- /* Omit "&& nl[0].n_type != 0 " -- it breaks on Sun386i. */
- {
-# ifdef FIXUP_KERNEL_SYMBOL_ADDR
- FIXUP_KERNEL_SYMBOL_ADDR (nl);
-# endif
- offset = nl[0].n_value;
- }
-# endif /* !SUNOS_5 */
-# else /* sgi */
- int ldav_off;
-
- ldav_off = sysmp (MP_KERNADDR, MPKA_AVENRUN);
- if (ldav_off != -1)
- offset = (long) ldav_off & 0x7fffffff;
-# endif /* sgi */
- }
-
- /* Make sure we have /dev/kmem open. */
- if (!getloadavg_initialized)
- {
-# ifndef SUNOS_5
- channel = open ("/dev/kmem", 0);
- if (channel >= 0)
- {
- /* Set the channel to close on exec, so it does not
- litter any child's descriptor table. */
-# ifdef F_SETFD
-# ifndef FD_CLOEXEC
-# define FD_CLOEXEC 1
-# endif
- (void) fcntl (channel, F_SETFD, FD_CLOEXEC);
-# endif
- getloadavg_initialized = 1;
- }
-# else /* SUNOS_5 */
- /* We pass 0 for the kernel, corefile, and swapfile names
- to use the currently running kernel. */
- kd = kvm_open (0, 0, 0, O_RDONLY, 0);
- if (kd != 0)
- {
- /* nlist the currently running kernel. */
- kvm_nlist (kd, nl);
- offset = nl[0].n_value;
- getloadavg_initialized = 1;
- }
-# endif /* SUNOS_5 */
- }
-
- /* If we can, get the load average values. */
- if (offset && getloadavg_initialized)
- {
- /* Try to read the load. */
-# ifndef SUNOS_5
- if (lseek (channel, offset, 0) == -1L
- || read (channel, (char *) load_ave, sizeof (load_ave))
- != sizeof (load_ave))
- {
- close (channel);
- getloadavg_initialized = 0;
- }
-# else /* SUNOS_5 */
- if (kvm_read (kd, offset, (char *) load_ave, sizeof (load_ave))
- != sizeof (load_ave))
- {
- kvm_close (kd);
- getloadavg_initialized = 0;
- }
-# endif /* SUNOS_5 */
- }
-
- if (offset == 0 || !getloadavg_initialized)
- return -1;
-# endif /* LOAD_AVE_TYPE and not VMS */
-
-# if !defined (LDAV_DONE) && defined (LOAD_AVE_TYPE) /* Including VMS. */
- if (nelem > 0)
- loadavg[elem++] = LDAV_CVT (load_ave[0]);
- if (nelem > 1)
- loadavg[elem++] = LDAV_CVT (load_ave[1]);
- if (nelem > 2)
- loadavg[elem++] = LDAV_CVT (load_ave[2]);
-
-# define LDAV_DONE
-# endif /* !LDAV_DONE && LOAD_AVE_TYPE */
-
-# ifdef LDAV_DONE
- return elem;
-# else
- /* Set errno to zero to indicate that there was no particular error;
- this function just can't work at all on this system. */
- errno = 0;
- return -1;
-# endif
-}
-
-#endif /* ! HAVE_GETLOADAVG */
-
-#ifdef TEST
-#include "makeint.h"
-
-int
-main (int argc, char **argv)
-{
- int naptime = 0;
-
- if (argc > 1)
- naptime = atoi (argv[1]);
-
- while (1)
- {
- double avg[3];
- int loads;
-
- errno = 0; /* Don't be misled if it doesn't set errno. */
- loads = getloadavg (avg, 3);
- if (loads == -1)
- {
- perror ("Error getting load average");
- exit (1);
- }
- if (loads > 0)
- printf ("1-minute: %f ", avg[0]);
- if (loads > 1)
- printf ("5-minute: %f ", avg[1]);
- if (loads > 2)
- printf ("15-minute: %f ", avg[2]);
- if (loads > 0)
- putchar ('\n');
-
- if (naptime == 0)
- break;
- sleep (naptime);
- }
-
- exit (0);
-}
-#endif /* TEST */