]> git.ipfire.org Git - thirdparty/make.git/commitdiff
Allow jobserver style to be forced to "pipe"
authorPaul Smith <psmith@gnu.org>
Sat, 18 Feb 2023 18:20:00 +0000 (13:20 -0500)
committerPaul Smith <psmith@gnu.org>
Sun, 19 Feb 2023 06:02:16 +0000 (01:02 -0500)
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.

maintMakefile
src/main.c
src/makeint.h
src/posixos.c
tests/run_make_tests.pl

index 2747aad6c70f94a588b2f3ad526822e7937575c0..ae25ee7501f6ce92d27e95f637aaa01d1f34f2cb 100644 (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 \
index 8ad750b84a7164dfbdb62cea70ecfba2b7fdac21..dde0d77dcd67a12d192edb202494a7fca51d5014 100644 (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
index 187974e4628bc7e2825dc4d062923285ab34adac..1e1596d26f94a571fe11ea8133f13f26afb34ab7 100644 (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;
index 0fe0948a0627b5f0531554851ae7e6e3cd872e44..0cc0a585c64fed790256898dae6977967b939c1f 100644 (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
index a5d9b80712951963c285cfeedaba59d96422e38a..012bd66d7213bdbb03b730694f051494e074f327 100644 (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