autoconf: modernize and modularize

Use my modular m4 library used for other things as well; update
autoconf macros to 2.71 standard.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
This commit is contained in:
H. Peter Anvin 2024-06-10 18:24:53 -07:00
parent 33051a296c
commit fefaa2cc5c
35 changed files with 680 additions and 461 deletions

View file

@ -3,10 +3,10 @@
SUB = lib common tftp tftpd
%.build: MCONFIG aconfig.h version.h
%.build: config/MCONFIG config/config.h version.h
$(MAKE) -C $(patsubst %.build, %, $@)
%.install: MCONFIG aconfig.h version.h
%.install: config/MCONFIG config/config.h version.h
$(MAKE) -C $(patsubst %.install, %, $@) install
%.clean:
@ -15,12 +15,12 @@ SUB = lib common tftp tftpd
%.distclean:
$(MAKE) -C $(patsubst %.distclean, %, $@) distclean
all: MCONFIG $(patsubst %, %.build, $(SUB))
all: config/MCONFIG $(patsubst %, %.build, $(SUB))
tftp.build: lib.build common.build
tftpd.build: lib.build common.build
install: MCONFIG $(patsubst %, %.install, $(SUB))
install: config/MCONFIG $(patsubst %, %.install, $(SUB))
clean: localclean $(patsubst %, %.clean, $(SUB))
@ -30,46 +30,37 @@ localclean:
distclean: localdistclean $(patsubst %, %.distclean, $(SUB))
localdistclean: localclean
rm -f MCONFIG config.status config.log aconfig.h *~ \#*
rm -f config/config/MCONFIG config.status config.log config/config.h *~ \#*
rm -rf *.cache
find . -type f \( -name \*.orig -o -name \*.rej \) | xargs rm -f
spotless: distclean
rm -f configure aconfig.h.in tftp.spec
rm -f configure config/config.h.in tftp.spec
autoconf: configure aconfig.h.in
autoconf: configure config/config.h.in
config: MCONFIG aconfig.h
config: config/MCONFIG config/config.h
release:
$(MAKE) autoconf
$(MAKE) tftp.spec
$(MAKE) distclean
MCONFIG: configure MCONFIG.in aconfig.h.in
config/MCONFIG: configure config/MCONFIG.in config/config.h.in
if test -x config.status; then \
./config.status --recheck && ./config.status ; \
else \
./configure ; \
fi
aconfig.h: MCONFIG
config/config.h: config/MCONFIG
: Generated by side effect
# Adding "configure" to the dependencies serializes this with running
# autoconf, because there are apparently race conditions between
# autoconf and autoheader. And worse than that, even when autoconf
# cleanly returns first, autoheader will truncate the timestamp of
# aconfig.h.in to second resolution, so on a filesystem with subsecond
# resolution it can appear older than configure (which isn't truncated).
# So make it an order-only prerequisite to avoid looping regenerating it.
aconfig.h.in: configure.ac aclocal.m4 | configure
rm -f aconfig.h.in aconfig.h
autoheader
configure: configure.ac
sh autogen.sh
configure: configure.ac aclocal.m4
rm -rf MCONFIG configure config.log aconfig.h *.cache
autoconf
config/config.h.in: configure
: Generated by side effect
version.h: version
echo \#define VERSION \"tftp-hpa `cat version`\" > version.h