From 1f4eb93b1fc98d806e9f955d7639fb79db851abb Mon Sep 17 00:00:00 2001 From: psmith Date: Fri, 5 Sep 1997 21:01:49 +0000 Subject: [PATCH] Changes for GNU make 3.75.93. --- ChangeLog | 32 ++++++++++++++++++++- Makefile.DOS.template | 4 +-- Makefile.am | 2 +- configure.in | 6 ++-- getopt.c | 2 +- job.c | 80 ++++++++++++++++++++++++++++++++++++++++++--------- 6 files changed, 104 insertions(+), 22 deletions(-) diff --git a/ChangeLog b/ChangeLog index 314074a..eaf8c0b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,9 +1,39 @@ +Fri Aug 29 02:01:27 1997 Paul D. Smith + + * Version 3.75.93. + +Thu Aug 28 19:39:06 1997 Rob Tulloh + + * job.c (exec_command): [WINDOWS32] If exec_command() is invoked + from main() to re-exec make, the call to execvp() would + incorrectly return control to parent shell before the exec'ed + command could run to completion. I believe this is a feature of + the way that execvp() is implemented on top of WIN32 APIs. To + alleviate the problem, use the supplied process launch function in + the sub_proc library and suspend the parent process until the + child process has run. When the child exits, exit the parent make + with the exit code of the child make. + +Thu Aug 28 17:04:47 1997 Paul D. Smith + + * Makefile.DOS.template (distdir): Fix a line that got wrapped in + email. + + * Makefile.am (loadavg): Give the necessary cmdline options when + linking loadavg. + + * configure.in: Check for pstat_getdynamic for getloadvg on HP. + + * job.c (start_job_command): [VMS,_AMIGA] Don't perform empty + command optimization on these systems; it doesn't make sense. + Wed Aug 27 17:09:32 1997 Paul D. Smith * Version 3.75.92 Tue Aug 26 11:59:15 1997 Paul D. Smith - * main.c (print_version): Add 97 to copyright years. + + * main.c (print_version): Add '97 to copyright years. * read.c (do_define): Check the length of the array before looking at a particular offset. diff --git a/Makefile.DOS.template b/Makefile.DOS.template index e2f8135..4c6a9db 100644 --- a/Makefile.DOS.template +++ b/Makefile.DOS.template @@ -296,9 +296,7 @@ distdir: $(DISTFILES) rm -rf $(distdir) mkdir $(distdir) -chmod 777 $(distdir) - @for file in $(DISTFILES); do d=$(srcdir); test -f $(distdir)/$$file || ln $$d/$$file $(distdir)/$$file 2> /dev/null || cp -p $$d/$$file $(distdir)/$$file; done - for subdir in $(SUBDIRS); do test -d $(distdir)/$$subdir || mkdir $(distdir)/$$subdir || exit 1; chmod 777 $(distdir)/$$subdir; (cd $$subdir && $(MAKE) top_distdir=../$(top_distdir)/$$subdir distdir=../$(distdir)/$$subdir distdir) || exit -1; done + @for file in $(DISTFILES); do d=$(srcdir); test -f $(distdir)/$$file || ln $$d/$$file $(distdir)/$$file 2> /dev/null || cp -p $$d/$$file $(distdir)/$$file; done; for subdir in $(SUBDIRS); do test -d $(distdir)/$$subdir || mkdir $(distdir)/$$subdir || exit 1; chmod 777 $(distdir)/$$subdir; (cd $$subdir && $(MAKE) top_distdir=../$(top_distdir)/$$subdir distdir=../$(distdir)/$$subdir distdir) || exit 1; done $(MAKE) top_distdir="$(top_distdir)" distdir="$(distdir)" dist-info $(MAKE) top_distdir="$(top_distdir)" distdir="$(distdir)" dist-hook alloca.o alloca.lo: alloca.c config.h diff --git a/Makefile.am b/Makefile.am index 3a8451e..58bdc95 100644 --- a/Makefile.am +++ b/Makefile.am @@ -48,7 +48,7 @@ check-local: check-loadavg check-regression # loadavg: loadavg.c config.h @rm -f loadavg - $(LINK) -DTEST $(make_LDFLAGS) loadavg.c $(LIBS) + $(LINK) -I. -I$(srcdir) -DHAVE_CONFIG_H -DTEST $(make_LDFLAGS) loadavg.c $(LIBS) # We copy getloadavg.c into a different file rather than compiling it # directly because some compilers clobber getloadavg.o in the process. loadavg.c: getloadavg.c diff --git a/configure.in b/configure.in index b98d3cf..4484310 100644 --- a/configure.in +++ b/configure.in @@ -1,9 +1,9 @@ dnl Process this file with autoconf to produce a configure script. -AC_REVISION([$Id: configure.in,v 1.56 1997/08/27 20:31:08 psmith Exp $]) +AC_REVISION([$Id: configure.in,v 1.57 1997/09/05 21:01:55 psmith Exp $]) AC_PREREQ(2.12)dnl dnl Minimum Autoconf version required. AC_INIT(vpath.c)dnl dnl A distinctive file to look for in srcdir. -AM_INIT_AUTOMAKE(make, 3.75.92) +AM_INIT_AUTOMAKE(make, 3.75.93) AM_CONFIG_HEADER(config.h) AC_CONFIG_SUBDIRS(glob) @@ -45,7 +45,7 @@ changequote([,])dnl fi AC_MSG_RESULT($ac_cv_check_symbol_$1)])dnl -AC_CHECK_FUNCS(memmove psignal mktemp \ +AC_CHECK_FUNCS(memmove psignal mktemp pstat_getdynamic \ dup2 getcwd sigsetmask getgroups setlinebuf \ seteuid setegid setreuid setregid strerror strsignal) AC_CHECK_SYMBOL(sys_siglist) diff --git a/getopt.c b/getopt.c index c6b1345..7b56b57 100644 --- a/getopt.c +++ b/getopt.c @@ -79,7 +79,7 @@ USA. */ #endif #endif -#if defined (_WINDOWS32) && !defined (__CYGWIN32__) +#if defined (WINDOWS32) && !defined (__CYGWIN32__) /* It's not Unix, really. See? Capital letters. */ #include #define getpid() GetCurrentProcessId() diff --git a/job.c b/job.c index 09b9469..2227bef 100644 --- a/job.c +++ b/job.c @@ -787,6 +787,7 @@ start_job_command (child) /* Optimize an empty command. People use this for timestamp rules, and forking a useless shell all the time leads to inefficiency. */ +#if !defined(VMS) && !defined(_AMIGA) if ( #ifdef __MSDOS__ unixy_shell /* the test is complicated and we already did it */ @@ -800,6 +801,7 @@ start_job_command (child) set_command_state (child->file, cs_running); goto next_command; } +#endif /* !VMS && !_AMIGA */ /* Tell update_goal_chain that a command has been started on behalf of this target. It is important that this happens here and not in @@ -827,9 +829,7 @@ start_job_command (child) fflush (stderr); #ifndef VMS -#ifndef WINDOWS32 -#ifndef _AMIGA -#ifndef __MSDOS__ +#if !defined(WINDOWS32) && !defined(_AMIGA) && !defined(__MSDOS__) /* Set up a bad standard input that reads from a broken pipe. */ @@ -857,9 +857,7 @@ start_job_command (child) } } -#endif /* !AMIGA */ -#endif /* !WINDOWS32 */ -#endif /* !__MSDOS__ */ +#endif /* !WINDOWS32 && !_AMIGA && !__MSDOS__ */ /* Decide whether to give this child the `good' standard input (one that points to the terminal or whatever), or the `bad' one @@ -869,7 +867,7 @@ start_job_command (child) if (child->good_stdin) good_stdin_used = 1; -#endif /* Not VMS */ +#endif /* !VMS */ child->deleted = 0; @@ -1602,11 +1600,66 @@ exec_command (argv, envp) char **argv, **envp; { #ifdef VMS - /* Run the program. */ - execve (argv[0], argv, envp); - perror_with_name ("execve: ", argv[0]); - _exit (EXIT_FAILURE); + /* Run the program. */ + execve (argv[0], argv, envp); + perror_with_name ("execve: ", argv[0]); + _exit (EXIT_FAILURE); #else +#ifdef WINDOWS32 + HANDLE hPID; + HANDLE hWaitPID; + int err = 0; + int exit_code = EXIT_FAILURE; + + /* make sure CreateProcess() has Path it needs */ + sync_Path_environment(); + + /* launch command */ + hPID = process_easy(argv, envp); + + /* make sure launch ok */ + if (hPID == INVALID_HANDLE_VALUE) + { + int i; + fprintf(stderr, + "process_easy() failed failed to launch process (e=%d)\n", + process_last_err(hPID)); + for (i = 0; argv[i]; i++) + fprintf(stderr, "%s ", argv[i]); + fprintf(stderr, "\nCounted %d args in failed launch\n", i); + exit(EXIT_FAILURE); + } + + /* wait and reap last child */ + while (hWaitPID = process_wait_for_any()) + { + /* was an error found on this process? */ + err = process_last_err(hWaitPID); + + /* get exit data */ + exit_code = process_exit_code(hWaitPID); + + if (err) + fprintf(stderr, "make (e=%d, rc=%d): %s", + err, exit_code, map_windows32_error_to_string(err)); + + /* cleanup process */ + process_cleanup(hWaitPID); + + /* expect to find only last pid, warn about other pids reaped */ + if (hWaitPID == hPID) + break; + else + fprintf(stderr, + "make reaped child pid %d, still waiting for pid %d\n", + hWaitPID, hPID); + } + + /* return child's exit code as our exit code */ + exit(exit_code); + +#else /* !WINDOWS32 */ + /* Be the user, permanently. */ child_access (); @@ -1658,18 +1711,19 @@ exec_command (argv, envp) } _exit (127); +#endif /* !WINDOWS32 */ #endif /* !VMS */ } #else /* On Amiga */ void exec_command (argv) char **argv; { - MyExecute (argv); + MyExecute (argv); } void clean_tmp (void) { - DeleteFile (amiga_bname); + DeleteFile (amiga_bname); } #endif /* On Amiga */ -- 2.11.4.GIT