From 89b69bf1e26dcf09bd2c6620b8f14782e2c84941 Mon Sep 17 00:00:00 2001 From: psmith Date: Tue, 15 Nov 2011 21:12:53 +0000 Subject: [PATCH] Enable jobserver on W32 when using configure. Some W32 cleanups: see Savannah bug #34830 Forgot to modify the config.h.W32.template file for jobserver support. --- ChangeLog | 11 +++++++++++ config.h.W32.template | 2 +- configure.in | 21 ++++++++++++--------- job.c | 8 +++++--- main.c | 7 ++++--- w32/include/sub_proc.h | 6 +++--- w32/subproc/sub_proc.c | 2 +- 7 files changed, 37 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index d765363..0a4c07d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2011-11-15 Paul Smith + + * main.c (main): Use %ld when printing DWORD values. + * job.c (new_job): Ditto. + * w32/include/sub_proc.h: Use const. + * w32/subproc/sub_proc.c (open_jobserver_semaphore): Use const. + Fixes Savannah bug #34830. Patches suggested by Ozkan Sezer. + + * configure.in (MAKE_JOBSERVER): Enable jobserver on W32 systems. + * config.h.W32.template (MAKE_JOBSERVER): Ditto. + 2011-11-14 Paul Smith * read.c (eval): parse_file_seq() might shorten the string due to diff --git a/config.h.W32.template b/config.h.W32.template index 9b4138e..03a4316 100644 --- a/config.h.W32.template +++ b/config.h.W32.template @@ -332,7 +332,7 @@ this program. If not, see . */ #define MAKE_HOST "Windows32" /* Define this to enable job server support in GNU make. */ -/* #undef MAKE_JOBSERVER */ +#define MAKE_JOBSERVER 1 /* Define to 1 if your `struct nlist' has an `n_un' member. Obsolete, depend on `HAVE_STRUCT_NLIST_N_UN_N_NAME */ diff --git a/configure.in b/configure.in index 640816d..1797587 100644 --- a/configure.in +++ b/configure.in @@ -20,7 +20,7 @@ AC_INIT([GNU make],[3.82.90],[bug-make@gnu.org]) AC_PREREQ(2.59) -AC_REVISION([[$Id: configure.in,v 1.157 2010/08/29 23:05:27 psmith Exp $]]) +AC_REVISION([[$Id: configure.in,v 1.158 2011/11/15 21:12:54 psmith Exp $]]) # Autoconf setup AC_CONFIG_AUX_DIR(config) @@ -301,18 +301,21 @@ if test "$make_cv_sa_restart" != no; then [Define to 1 if defines the SA_RESTART constant.]) fi -# enable make_cv_sa_restart for OS/2 so that the jobserver will be enabled, -# but do it after HAVE_SA_RESTART has been defined. -case "$host_os" in - os2*) make_cv_sa_restart=yes ;; +# Only allow jobserver on systems that support it +case "/$ac_cv_func_pipe/$ac_cv_func_sigaction/$make_cv_sa_restart/$has_wait_nohang/" in + */no/*) make_cv_job_server=no ;; esac -case "$ac_cv_func_pipe/$ac_cv_func_sigaction/$make_cv_sa_restart/$has_wait_nohang/$make_cv_job_server" in - yes/yes/yes/yes/yes) - AC_DEFINE(MAKE_JOBSERVER, 1, - [Define to 1 to enable job server support in GNU make.]);; +# Also supported on OS2 and W32 +case "$host_os" in + os2*|mingw32) make_cv_sa_restart=yes ;; esac +if test "$make_cv_job_server" != no; then + AC_DEFINE(MAKE_JOBSERVER, 1, + [Define to 1 to enable job server support in GNU make.]) +fi + # if we have both lstat() and readlink() then we can support symlink # timechecks. case "$ac_cv_func_lstat/$ac_cv_func_readlink" in diff --git a/job.c b/job.c index f359520..c5fe0bf 100644 --- a/job.c +++ b/job.c @@ -946,7 +946,7 @@ free_child (struct child *child) if (! release_jobserver_semaphore()) { DWORD err = GetLastError(); - fatal (NILF,_("release jobserver semaphore: (Error %d: %s)"), + fatal (NILF, _("release jobserver semaphore: (Error %ld: %s)"), err, map_windows32_error_to_string(err)); } @@ -1775,9 +1775,11 @@ new_job (struct file *file) #endif while (1) { - char token; int got_token; +#ifndef WINDOWS32 + char token; int saved_errno; +#endif DB (DB_JOBS, ("Need a job token; we %shave children\n", children ? "" : "don't ")); @@ -1842,7 +1844,7 @@ new_job (struct file *file) if (got_token < 0) { DWORD err = GetLastError(); - fatal (NILF,_("semaphore or child process wait: (Error %d: %s)"), + fatal (NILF, _("semaphore or child process wait: (Error %ld: %s)"), err, map_windows32_error_to_string(err)); } #else diff --git a/main.c b/main.c index 16957d4..86a89ad 100644 --- a/main.c +++ b/main.c @@ -36,6 +36,7 @@ this program. If not, see . */ # include # include "pathstuff.h" # include "sub_proc.h" +# include "w32err.h" #endif #ifdef __EMX__ # include @@ -988,7 +989,7 @@ main (int argc, char **argv, char **envp) fatal_signal_mask = 0; #define ADD_SIG(sig) fatal_signal_mask |= sigmask (sig) #else -#define ADD_SIG(sig) (void)sig /* Needed to avoid warnings in MSVC. */ +#define ADD_SIG(sig) (void)sig #endif #endif @@ -1728,7 +1729,7 @@ main (int argc, char **argv, char **envp) if (! open_jobserver_semaphore(cp)) { DWORD err = GetLastError(); - fatal (NILF,_("internal error: unable to open jobserver semaphore `%s': (Error %d: %s)"), + fatal (NILF, _("internal error: unable to open jobserver semaphore `%s': (Error %ld: %s)"), cp, err, map_windows32_error_to_string(err)); } DB (DB_JOBS, (_("Jobserver client (semaphore %s)\n"), cp)); @@ -1804,7 +1805,7 @@ main (int argc, char **argv, char **envp) if (! create_jobserver_semaphore(job_slots - 1)) { DWORD err = GetLastError(); - fatal (NILF,_("creating jobserver semaphore: (Error %d: %s)"), + fatal (NILF, _("creating jobserver semaphore: (Error %ld: %s)"), err, map_windows32_error_to_string(err)); } #else diff --git a/w32/include/sub_proc.h b/w32/include/sub_proc.h index b6b5695..f0a9b68 100644 --- a/w32/include/sub_proc.h +++ b/w32/include/sub_proc.h @@ -21,11 +21,11 @@ this program. If not, see . */ /* * Component Name: * - * $Date: 2011/11/14 00:42:50 $ + * $Date: 2011/11/15 21:12:54 $ * * $Source: /sources/make/make/w32/include/sub_proc.h,v $ * - * $Id: sub_proc.h,v 1.13 2011/11/14 00:42:50 psmith Exp $ + * $Id: sub_proc.h,v 1.14 2011/11/15 21:12:54 psmith Exp $ */ #define EXTERN_DECL(entry, args) extern entry args @@ -58,7 +58,7 @@ EXTERN_DECL(int process_errcnt, (HANDLE proc)); EXTERN_DECL(void process_pipes, (HANDLE proc, int pipes[3])); /* jobserver routines */ -EXTERN_DECL(int open_jobserver_semaphore, (char* name)); +EXTERN_DECL(int open_jobserver_semaphore, (const char* name)); EXTERN_DECL(int create_jobserver_semaphore, (int tokens)); EXTERN_DECL(void free_jobserver_semaphore, (VOID_DECL)); EXTERN_DECL(int acquire_jobserver_semaphore, (VOID_DECL)); diff --git a/w32/subproc/sub_proc.c b/w32/subproc/sub_proc.c index 64185b3..b4dddbe 100644 --- a/w32/subproc/sub_proc.c +++ b/w32/subproc/sub_proc.c @@ -63,7 +63,7 @@ static char jobserver_semaphore_name[MAX_PATH + 1]; static HANDLE jobserver_semaphore = NULL; /* Open existing jobserver semaphore */ -int open_jobserver_semaphore(char* name) +int open_jobserver_semaphore(const char* name) { jobserver_semaphore = OpenSemaphore( SEMAPHORE_ALL_ACCESS, // Semaphore access setting -- 2.11.4.GIT