Allow jobserver style to be forced to "pipe"

Some systems that support mkfifo() don't support the usage that GNU
make wants.  Provide a way to force using "pipe" jobserver mode even
when mkfifo() is available.

* src/makeint.h (MK_OS_HURD): Define if we're on Hurd.
(JOBSERVER_USE_FIFO): Define if we have mkfifo() and we're NOT on
Hurd.
* src/main.c (main): Test JOBSERVER_USE_FIFO not HAVE_MKFIFO.
* src/posixos.c (jobserver_setup): Ditto.
* maintMakefile: Create a config check test for forcing "pipe" mode.
* tests/run_make_tests.pl: Show discovered FEATURES in verbose mode.
This commit is contained in:
Paul Smith 2023-02-18 13:20:00 -05:00
parent ffa28f3914
commit c85f68c4e9
5 changed files with 18 additions and 3 deletions

View file

@ -274,6 +274,7 @@ CFGCHECK_MAKEFLAGS = # CFLAGS='$(AM_CFLAGS)'
checkcfg.strict-c90: CFGCHECK_CONFIGFLAGS = CFLAGS='-std=c90 -pedantic'
checkcfg.strict-c90: CFGCHECK_MAKEFLAGS =
checkcfg.job-pipe: CFGCHECK_CONFIGFLAGS = CPPFLAGS=-DJOBSERVER_USE_FIFO=0
checkcfg.no-jobserver:CFGCHECK_CONFIGFLAGS = --disable-job-server
checkcfg.no-load: CFGCHECK_CONFIGFLAGS = --disable-load
checkcfg.no-guile: CFGCHECK_CONFIGFLAGS = --without-guile
@ -289,6 +290,7 @@ checkcfg.no-archives: CFGCHECK_CONFIGFLAGS = CPPFLAGS=-DNO_ARCHIVES
CONFIG_CHECKS := \
checkcfg.strict-c90 \
checkcfg.job-pipe \
checkcfg.no-jobserver \
checkcfg.no-load \
checkcfg.no-guile \

View file

@ -234,6 +234,7 @@ static const int inf_jobs = 0;
char *jobserver_auth = NULL;
/* Style for the jobserver. */
static char *jobserver_style = NULL;
/* Shuffle mode for goals and prerequisites. */
@ -1447,7 +1448,7 @@ main (int argc, char **argv, char **envp)
#endif
#ifdef MAKE_JOBSERVER
" jobserver"
# ifdef HAVE_MKFIFO
# if JOBSERVER_USE_FIFO
" jobserver-fifo"
# endif
#endif

View file

@ -83,6 +83,9 @@ extern int errno;
#endif
/* Define macros specifying which OS we are building for. */
#if __gnu_hurd__
# define MK_OS_HURD 1
#endif
#if defined(__MVS__)
# define MK_OS_ZOS 1
#endif
@ -742,6 +745,14 @@ extern char cmd_prefix;
extern unsigned int no_intermediates;
#if HAVE_MKFIFO
# if !defined(JOBSERVER_USE_FIFO) && !MK_OS_HURD
/* It seems that mkfifo() is not working correctly, or at least not the way
GNU make wants it to work, on GNU/Hurd so don't use it there. */
# define JOBSERVER_USE_FIFO 1
# endif
#endif
#define JOBSERVER_AUTH_OPT "jobserver-auth"
extern char *jobserver_auth;

View file

@ -147,8 +147,8 @@ jobserver_setup (int slots, const char *style)
{
int r;
#if HAVE_MKFIFO
if (style == NULL || strcmp (style, "fifo") == 0)
#if JOBSERVER_USE_FIFO
if (!style || strcmp (style, "fifo") == 0)
{
/* Unfortunately glibc warns about uses of mktemp even though we aren't
using it in dangerous way here. So avoid this by generating our own

View file

@ -671,6 +671,7 @@ sub set_more_defaults
create_file('features.mk', 'all:;$(info $(.FEATURES))');
%FEATURES = map { $_ => 1 } split /\s+/, `$make_path -sf features.mk`;
print "$make_path FEATURES: @{[%FEATURES]}\n" if $verbose;
unlink('features.mk');
# Find the default values for different built-in variables