From a9166bb7bc8a7798aa75c0077288885e48c37252 Mon Sep 17 00:00:00 2001 From: Paul Smith Date: Sat, 24 Jul 1999 04:55:08 +0000 Subject: [PATCH] * Some configure fixes. --- configure.in | 16 ++-- job.c | 259 +++++++++++++++++++++++++------------------------- maintMakefile | 6 +- 3 files changed, 140 insertions(+), 141 deletions(-) diff --git a/configure.in b/configure.in index f2fb61b6..096df541 100644 --- a/configure.in +++ b/configure.in @@ -3,7 +3,7 @@ AC_REVISION([$Id$]) AC_PREREQ(2.13)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.77.90) +AM_INIT_AUTOMAKE(make, 3.77.91) AM_CONFIG_HEADER(config.h) dnl Regular configure stuff @@ -57,8 +57,8 @@ AC_CHECK_LIB(posix4, clock_gettime) AC_CHECK_FUNCS(memmove strdup psignal mktemp pstat_getdynamic \ clock_gettime dup2 getcwd sigsetmask sigaction getgroups \ - setlinebuf seteuid setegid setreuid setregid \ - strerror strsignal pipe) + setlinebuf seteuid setegid setreuid setregid pipe \ + strerror strsignal) AC_CHECK_SYMBOL(sys_siglist) AC_FUNC_ALLOCA AC_FUNC_VFORK @@ -212,12 +212,14 @@ if test -r $srcdir/maintMakefile; then fi AC_SUBST_FILE(MAINT_MAKEFILE) -dnl build.sh is also an AC_OUTPUT, but we can't specify it here because -dnl it's built from build.template and autoconf will crap out. So, we -dnl build it in the makefiles themselves. - AC_OUTPUT(build.sh Makefile glob/Makefile) +dnl If we don't yet have build.sh.in, build.sh is a bogus 0-length file +dnl so remove it. + +test -f build.sh.in || rm -f build.sh + + case "$make_badcust" in yes) echo echo "WARNING: --with-customs specified but no customs.h could be found;" diff --git a/job.c b/job.c index ed8f64ba..2695beaf 100644 --- a/job.c +++ b/job.c @@ -542,153 +542,150 @@ reap_children (block, err) break; if (c == 0) - { - /* An unknown child died. - Ignore it; it was inherited from our invoker. */ - continue; - } + /* An unknown child died. + Ignore it; it was inherited from our invoker. */ + continue; + + if (debug_flag) + printf ("Reaping %s child 0x%08lx PID %ld token %c%s\n", + child_failed ? "losing" : "winning", + (unsigned long int) c, (long) c->pid, c->job_token, + c->remote ? " (remote)" : ""); + + if (c->sh_batch_file) { + if (debug_flag) + printf ("Cleaning up temp batch file %s\n", c->sh_batch_file); + + /* just try and remove, don't care if this fails */ + remove (c->sh_batch_file); + + /* all done with memory */ + free (c->sh_batch_file); + c->sh_batch_file = NULL; + } + + /* If this child had the good stdin, say it is now free. */ + if (c->good_stdin) + good_stdin_used = 0; + + if (child_failed && !c->noerror && !ignore_errors_flag) + { + /* The commands failed. Write an error message, + delete non-precious targets, and abort. */ + static int delete_on_error = -1; + child_error (c->file->name, exit_code, exit_sig, coredump, 0); + c->file->update_status = 2; + if (delete_on_error == -1) + { + struct file *f = lookup_file (".DELETE_ON_ERROR"); + delete_on_error = f != 0 && f->is_target; + } + if (exit_sig != 0 || delete_on_error) + delete_child_targets (c); + } else - { - if (debug_flag) - printf ("Reaping %s child 0x%08lx PID %ld token %c%s\n", - child_failed ? "losing" : "winning", - (unsigned long int) c, (long) c->pid, c->job_token, - c->remote ? " (remote)" : ""); + { + if (child_failed) + { + /* The commands failed, but we don't care. */ + child_error (c->file->name, + exit_code, exit_sig, coredump, 1); + child_failed = 0; + } - if (c->sh_batch_file) { - if (debug_flag) - printf("Cleaning up temp batch file %s\n", c->sh_batch_file); + /* If there are more commands to run, try to start them. */ + if (job_next_command (c)) + { + if (handling_fatal_signal) + { + /* Never start new commands while we are dying. + Since there are more commands that wanted to be run, + the target was not completely remade. So we treat + this as if a command had failed. */ + c->file->update_status = 2; + } + else + { + /* Check again whether to start remotely. + Whether or not we want to changes over time. + Also, start_remote_job may need state set up + by start_remote_job_p. */ + c->remote = start_remote_job_p (0); + start_job_command (c); + /* Fatal signals are left blocked in case we were + about to put that child on the chain. But it is + already there, so it is safe for a fatal signal to + arrive now; it will clean up this child's targets. */ + unblock_sigs (); + if (c->file->command_state == cs_running) + /* We successfully started the new command. + Loop to reap more children. */ + continue; + } - /* just try and remove, don't care if this fails */ - remove(c->sh_batch_file); + if (c->file->update_status != 0) + /* We failed to start the commands. */ + delete_child_targets (c); + } + else + /* There are no more commands. We got through them all + without an unignored error. Now the target has been + successfully updated. */ + c->file->update_status = 0; + } - /* all done with memory */ - free(c->sh_batch_file); - c->sh_batch_file = NULL; - } + /* When we get here, all the commands for C->file are finished + (or aborted) and C->file->update_status contains 0 or 2. But + C->file->command_state is still cs_running if all the commands + ran; notice_finish_file looks for cs_running to tell it that + it's interesting to check the file's modtime again now. */ - /* If this child had the good stdin, say it is now free. */ - if (c->good_stdin) - good_stdin_used = 0; + if (! handling_fatal_signal) + /* Notice if the target of the commands has been changed. + This also propagates its values for command_state and + update_status to its also_make files. */ + notice_finished_file (c->file); - if (child_failed && !c->noerror && !ignore_errors_flag) - { - /* The commands failed. Write an error message, - delete non-precious targets, and abort. */ - static int delete_on_error = -1; - child_error (c->file->name, exit_code, exit_sig, coredump, 0); - c->file->update_status = 2; - if (delete_on_error == -1) - { - struct file *f = lookup_file (".DELETE_ON_ERROR"); - delete_on_error = f != 0 && f->is_target; - } - if (exit_sig != 0 || delete_on_error) - delete_child_targets (c); - } - else - { - if (child_failed) - { - /* The commands failed, but we don't care. */ - child_error (c->file->name, - exit_code, exit_sig, coredump, 1); - child_failed = 0; - } + if (debug_flag) + printf ("Removing child 0x%08lx PID %ld token %c%s from chain.\n", + (unsigned long int) c, (long) c->pid, c->job_token, + c->remote ? " (remote)" : ""); - /* If there are more commands to run, try to start them. */ - if (job_next_command (c)) - { - if (handling_fatal_signal) - { - /* Never start new commands while we are dying. - Since there are more commands that wanted to be run, - the target was not completely remade. So we treat - this as if a command had failed. */ - c->file->update_status = 2; - } - else - { - /* Check again whether to start remotely. - Whether or not we want to changes over time. - Also, start_remote_job may need state set up - by start_remote_job_p. */ - c->remote = start_remote_job_p (0); - start_job_command (c); - /* Fatal signals are left blocked in case we were - about to put that child on the chain. But it is - already there, so it is safe for a fatal signal to - arrive now; it will clean up this child's targets. */ - unblock_sigs (); - if (c->file->command_state == cs_running) - /* We successfully started the new command. - Loop to reap more children. */ - continue; - } + /* Block fatal signals while frobnicating the list, so that + children and job_slots_used are always consistent. Otherwise + a fatal signal arriving after the child is off the chain and + before job_slots_used is decremented would believe a child was + live and call reap_children again. */ + block_sigs (); - if (c->file->update_status != 0) - /* We failed to start the commands. */ - delete_child_targets (c); - } - else - /* There are no more commands. We got through them all - without an unignored error. Now the target has been - successfully updated. */ - c->file->update_status = 0; - } + /* If this job has a token out, return it. */ + free_job_token(c); - /* When we get here, all the commands for C->file are finished - (or aborted) and C->file->update_status contains 0 or 2. But - C->file->command_state is still cs_running if all the commands - ran; notice_finish_file looks for cs_running to tell it that - it's interesting to check the file's modtime again now. */ + /* There is now another slot open. */ + if (job_slots_used > 0) + --job_slots_used; - if (! handling_fatal_signal) - /* Notice if the target of the commands has been changed. - This also propagates its values for command_state and - update_status to its also_make files. */ - notice_finished_file (c->file); + /* Remove the child from the chain and free it. */ + if (lastc == 0) + children = c->next; + else + lastc->next = c->next; + if (! handling_fatal_signal) /* Don't bother if about to die. */ + free_child (c); - if (debug_flag) - printf ("Removing child 0x%08lx PID %ld token %c%s from chain.\n", - (unsigned long int) c, (long) c->pid, c->job_token, - c->remote ? " (remote)" : ""); + unblock_sigs (); - /* Block fatal signals while frobnicating the list, so that - children and job_slots_used are always consistent. Otherwise - a fatal signal arriving after the child is off the chain and - before job_slots_used is decremented would believe a child was - live and call reap_children again. */ - block_sigs (); - - /* If this job has a token out, return it. */ - free_job_token(c); - - /* There is now another slot open. */ - if (job_slots_used > 0) - --job_slots_used; - - /* Remove the child from the chain and free it. */ - if (lastc == 0) - children = c->next; - else - lastc->next = c->next; - if (! handling_fatal_signal) /* Don't bother if about to die. */ - free_child (c); - - unblock_sigs (); - - /* If the job failed, and the -k flag was not given, die, - unless we are already in the process of dying. */ - if (!err && child_failed && !keep_going_flag && - /* fatal_error_signal will die with the right signal. */ - !handling_fatal_signal) - die (2); - } + /* If the job failed, and the -k flag was not given, die, + unless we are already in the process of dying. */ + if (!err && child_failed && !keep_going_flag && + /* fatal_error_signal will die with the right signal. */ + !handling_fatal_signal) + die (2); /* Only block for one child. */ block = 0; } + return; } diff --git a/maintMakefile b/maintMakefile index 939e19f5..50fc396a 100644 --- a/maintMakefile +++ b/maintMakefile @@ -11,10 +11,10 @@ globhdr := $(wildcard glob/*.h) TEMPLATES = README README.DOS config.ami configh.dos config.h.W32 config.h-vms MTEMPLATES = Makefile.DOS SMakefile -# We need this to ensure that README is created on time to avoid errors -# by automake. +# We need this to ensure that README and build.sh.in are created on time to +# avoid errors by automake. # -Makefile.in: README +#Makefile.in: README build.sh.in # General rule for turning a .template into a regular file. #