* Some configure fixes.

This commit is contained in:
Paul Smith 1999-07-24 04:55:08 +00:00
parent 4e7ee4fc01
commit a9166bb7bc
3 changed files with 140 additions and 141 deletions

View File

@ -3,7 +3,7 @@ AC_REVISION([$Id$])
AC_PREREQ(2.13)dnl dnl Minimum Autoconf version required. AC_PREREQ(2.13)dnl dnl Minimum Autoconf version required.
AC_INIT(vpath.c)dnl dnl A distinctive file to look for in srcdir. 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) AM_CONFIG_HEADER(config.h)
dnl Regular configure stuff dnl Regular configure stuff
@ -57,8 +57,8 @@ AC_CHECK_LIB(posix4, clock_gettime)
AC_CHECK_FUNCS(memmove strdup psignal mktemp pstat_getdynamic \ AC_CHECK_FUNCS(memmove strdup psignal mktemp pstat_getdynamic \
clock_gettime dup2 getcwd sigsetmask sigaction getgroups \ clock_gettime dup2 getcwd sigsetmask sigaction getgroups \
setlinebuf seteuid setegid setreuid setregid \ setlinebuf seteuid setegid setreuid setregid pipe \
strerror strsignal pipe) strerror strsignal)
AC_CHECK_SYMBOL(sys_siglist) AC_CHECK_SYMBOL(sys_siglist)
AC_FUNC_ALLOCA AC_FUNC_ALLOCA
AC_FUNC_VFORK AC_FUNC_VFORK
@ -212,12 +212,14 @@ if test -r $srcdir/maintMakefile; then
fi fi
AC_SUBST_FILE(MAINT_MAKEFILE) 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) 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 case "$make_badcust" in
yes) echo yes) echo
echo "WARNING: --with-customs specified but no customs.h could be found;" echo "WARNING: --with-customs specified but no customs.h could be found;"

259
job.c
View File

@ -542,153 +542,150 @@ reap_children (block, err)
break; break;
if (c == 0) if (c == 0)
{ /* An unknown child died.
/* An unknown child died. Ignore it; it was inherited from our invoker. */
Ignore it; it was inherited from our invoker. */ continue;
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 else
{ {
if (debug_flag) if (child_failed)
printf ("Reaping %s child 0x%08lx PID %ld token %c%s\n", {
child_failed ? "losing" : "winning", /* The commands failed, but we don't care. */
(unsigned long int) c, (long) c->pid, c->job_token, child_error (c->file->name,
c->remote ? " (remote)" : ""); exit_code, exit_sig, coredump, 1);
child_failed = 0;
}
if (c->sh_batch_file) { /* If there are more commands to run, try to start them. */
if (debug_flag) if (job_next_command (c))
printf("Cleaning up temp batch file %s\n", c->sh_batch_file); {
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 */ if (c->file->update_status != 0)
remove(c->sh_batch_file); /* 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 */ /* When we get here, all the commands for C->file are finished
free(c->sh_batch_file); (or aborted) and C->file->update_status contains 0 or 2. But
c->sh_batch_file = NULL; 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 (! handling_fatal_signal)
if (c->good_stdin) /* Notice if the target of the commands has been changed.
good_stdin_used = 0; 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) if (debug_flag)
{ printf ("Removing child 0x%08lx PID %ld token %c%s from chain.\n",
/* The commands failed. Write an error message, (unsigned long int) c, (long) c->pid, c->job_token,
delete non-precious targets, and abort. */ c->remote ? " (remote)" : "");
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 there are more commands to run, try to start them. */ /* Block fatal signals while frobnicating the list, so that
if (job_next_command (c)) children and job_slots_used are always consistent. Otherwise
{ a fatal signal arriving after the child is off the chain and
if (handling_fatal_signal) before job_slots_used is decremented would believe a child was
{ live and call reap_children again. */
/* Never start new commands while we are dying. block_sigs ();
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;
}
if (c->file->update_status != 0) /* If this job has a token out, return it. */
/* We failed to start the commands. */ free_job_token(c);
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;
}
/* When we get here, all the commands for C->file are finished /* There is now another slot open. */
(or aborted) and C->file->update_status contains 0 or 2. But if (job_slots_used > 0)
C->file->command_state is still cs_running if all the commands --job_slots_used;
ran; notice_finish_file looks for cs_running to tell it that
it's interesting to check the file's modtime again now. */
if (! handling_fatal_signal) /* Remove the child from the chain and free it. */
/* Notice if the target of the commands has been changed. if (lastc == 0)
This also propagates its values for command_state and children = c->next;
update_status to its also_make files. */ else
notice_finished_file (c->file); lastc->next = c->next;
if (! handling_fatal_signal) /* Don't bother if about to die. */
free_child (c);
if (debug_flag) unblock_sigs ();
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)" : "");
/* Block fatal signals while frobnicating the list, so that /* If the job failed, and the -k flag was not given, die,
children and job_slots_used are always consistent. Otherwise unless we are already in the process of dying. */
a fatal signal arriving after the child is off the chain and if (!err && child_failed && !keep_going_flag &&
before job_slots_used is decremented would believe a child was /* fatal_error_signal will die with the right signal. */
live and call reap_children again. */ !handling_fatal_signal)
block_sigs (); die (2);
/* 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);
}
/* Only block for one child. */ /* Only block for one child. */
block = 0; block = 0;
} }
return; return;
} }

View File

@ -11,10 +11,10 @@ globhdr := $(wildcard glob/*.h)
TEMPLATES = README README.DOS config.ami configh.dos config.h.W32 config.h-vms TEMPLATES = README README.DOS config.ami configh.dos config.h.W32 config.h-vms
MTEMPLATES = Makefile.DOS SMakefile MTEMPLATES = Makefile.DOS SMakefile
# We need this to ensure that README is created on time to avoid errors # We need this to ensure that README and build.sh.in are created on time to
# by automake. # avoid errors by automake.
# #
Makefile.in: README #Makefile.in: README build.sh.in
# General rule for turning a .template into a regular file. # General rule for turning a .template into a regular file.
# #