summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog37
-rw-r--r--Makefile.am4
-rw-r--r--configure.in9
-rw-r--r--doc/make.texi22
-rw-r--r--job.c44
-rw-r--r--main.c13
-rw-r--r--maintMakefile65
-rw-r--r--make.h24
-rw-r--r--misc.c19
-rw-r--r--tests/ChangeLog5
-rw-r--r--tests/scripts/functions/origin11
-rw-r--r--w32/subproc/sub_proc.c3
-rw-r--r--w32/subproc/w32err.c16
13 files changed, 175 insertions, 97 deletions
diff --git a/ChangeLog b/ChangeLog
index 1533989..56c062d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,40 @@
+2004-02-22 Paul D. Smith <psmith@gnu.org>
+
+ * main.c (decode_switches): Require non-empty strings for all our
+ string command-line options. Fixes Debian bug # 164165.
+
+ * configure.in: Check for stdarg.h and varargs.h.
+ * make.h (USE_VARIADIC): Set this if we can use variadic functions
+ for printing messages.
+ * misc.c: Check USE_VARIADIC instead of (obsolete) HAVE_STDVARARGS.
+ (message): Ditto.
+ (error): Ditto.
+ (fatal): Ditto.
+
+ A number of patches for OS/2 support from Andreas Buening
+ <andreas.buening@nexgo.de>:
+
+ * job.c (child_handler) [OS/2]: Allow this on OS/2 but we have to
+ disable the SIGCHLD handler.
+ (reap_children) [OS/2]: Remove special handling of job_rfd.
+ (set_child_handler_action_flags) [OS/2]: Use this function in OS/2.
+ (new_job) [OS/2]: Disable the SIGCHLD handler on OS/2.
+ * main.c (main) [OS/2]: Special handling for paths in OS/2.
+ * configure.in [OS/2]: Force SA_RESTART for OS/2.
+ * Makefile.am (check-regression): Use $(EXEEXT) for Windows-type
+ systems.
+
+2004-02-21 Paul D. Smith <psmith@gnu.org>
+
+ * w32/subproc/sub_proc.c (process_easy) [W32]: Christoph Schulz
+ <mail@kristov.de> reports that if process_begin() fails we don't
+ handle the error condition correctly in all cases.
+ * w32/subproc/w32err.c (map_windows32_error_to_string): Make sure
+ to have a newline on the message.
+
+ * job.c (construct_command_argv_internal): Add "test" to UNIX
+ sh_cmds[]. Fixes Savannah bug # 7606.
+
2004-02-04 Paul D. Smith <psmith@gnu.org>
* job.c (vms_handle_apos) [VMS]: Fix various string handling
diff --git a/Makefile.am b/Makefile.am
index d82a6d3..77ebdf6 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -145,8 +145,8 @@ check-regression:
rm -f tests/$$f; ln -s ../srctests/$$f tests; \
done; fi ;; \
esac; \
- echo "cd tests && $(PERL) ./run_make_tests.pl -make ../make $(MAKETESTFLAGS)"; \
- cd tests && $(PERL) ./run_make_tests.pl -make ../make $(MAKETESTFLAGS); \
+ echo "cd tests && $(PERL) ./run_make_tests.pl -make ../make$(EXEEXT) $(MAKETESTFLAGS)"; \
+ cd tests && $(PERL) ./run_make_tests.pl -make ../make$(EXEEXT) $(MAKETESTFLAGS); \
else \
echo "Can't find a working Perl ($(PERL)); the test suite requires Perl."; \
fi; \
diff --git a/configure.in b/configure.in
index 73d09ee..d815137 100644
--- a/configure.in
+++ b/configure.in
@@ -52,6 +52,9 @@ AC_HEADER_TIME
AC_CHECK_HEADERS(stdlib.h locale.h unistd.h limits.h fcntl.h string.h \
memory.h sys/param.h sys/time.h sys/timeb.h)
+# Determine what kind of variadic function calls we support
+AC_CHECK_HEADERS(stdarg.h varargs.h, break)
+
AM_PROG_CC_C_O
AM_PROG_CC_STDC
AC_C_CONST
@@ -244,6 +247,12 @@ AC_CACHE_CHECK(for SA_RESTART, make_cv_sa_restart, [
[[return SA_RESTART;]])],
[make_cv_sa_restart=yes],
[make_cv_sa_restart=no])])
+
+# enable make_cv_sa_restart for OS/2
+case "$host_os" in
+ os2*) make_cv_sa_restart=yes ;;
+esac
+
if test "$make_cv_sa_restart" != no; then
AC_DEFINE(HAVE_SA_RESTART, 1,
[Define if <signal.h> defines the SA_RESTART constant.])
diff --git a/doc/make.texi b/doc/make.texi
index a81e8ba..7270134 100644
--- a/doc/make.texi
+++ b/doc/make.texi
@@ -1949,9 +1949,8 @@ just the search paths.
The value of the @code{make} variable @code{VPATH} specifies a list of
directories that @code{make} should search. Most often, the
directories are expected to contain prerequisite files that are not in the
-current directory; however, @code{VPATH} specifies a search list that
-@code{make} applies for all files, including files which are targets of
-rules.
+current directory; however, @code{make} uses @code{VPATH} as a search
+list for both prerequisites and targets of rules.
Thus, if a file that is listed as a target or prerequisite does not exist
in the current directory, @code{make} searches the directories listed in
@@ -6470,7 +6469,7 @@ client_LIBS = protocol
all: $(PROGRAMS)
define PROGRAM_template
- $(1): $$($(1)_OBJ) $$($(1)_LIBS:%=-l%)
+ $(1): $$($(1)_OBJS) $$($(1)_LIBS:%=-l%)
ALL_OBJS += $$($(1)_OBJS)
endef
@@ -6600,19 +6599,18 @@ Here the redefinition takes place if @samp{$(origin bletch)} returns either
@cindex backquotes
@cindex shell command, function for
-The @code{shell} function is unlike any other function except the
+The @code{shell} function is unlike any other function other than the
@code{wildcard} function
(@pxref{Wildcard Function, ,The Function @code{wildcard}}) in that it
communicates with the world outside of @code{make}.
The @code{shell} function performs the same function that backquotes
-(@samp{`}) perform in most shells: it does @dfn{command expansion}. This
-means that it takes an argument that is a shell command and returns the
-output of the command. The only processing @code{make} does on the result,
-before substituting it into the surrounding text, is to convert each
-newline or carriage-return / newline pair to a single space. It also
-removes the trailing (carriage-return and) newline, if it's the last
-thing in the result.@refill
+(@samp{`}) perform in most shells: it does @dfn{command expansion}.
+This means that it takes as an argument a shell command and evaluates
+to the output of the command. The only processing @code{make} does on
+the result is to convert each newline (or carriage-return / newline
+pair) to a single space. If there is a trailing (carriage-return
+and) newline it will simply be removed.@refill
The commands run by calls to the @code{shell} function are run when the
function calls are expanded (@pxref{Reading Makefiles, , How
diff --git a/job.c b/job.c
index 1529d29..de5f006 100644
--- a/job.c
+++ b/job.c
@@ -54,7 +54,7 @@ int batch_mode_shell = 0;
#elif defined (__EMX__)
-const char *default_shell = "/bin/sh";
+char *default_shell = "/bin/sh";
int batch_mode_shell = 0;
#elif defined (VMS)
@@ -414,7 +414,6 @@ vms_handle_apos (char *p)
static unsigned int dead_children = 0;
-#ifndef __EMX__ /* Don't use SIGCHLD handler on OS/2. */
RETSIGTYPE
child_handler (int sig)
{
@@ -426,9 +425,15 @@ child_handler (int sig)
job_rfd = -1;
}
+#ifdef __EMX__
+ /* The signal handler must called only once! */
+ signal (SIGCHLD, SIG_DFL);
+#endif
+
+ /* This causes problems if the SIGCHLD interrupts a printf().
DB (DB_JOBS, (_("Got a SIGCHLD; %u unreaped children.\n"), dead_children));
+ */
}
-#endif /* !__EMX__ */
extern int shell_function_pid, shell_function_completed;
@@ -562,18 +567,6 @@ reap_children (int block, int err)
/* If we have started jobs in this second, remove one. */
if (job_counter)
--job_counter;
-
-#ifdef __EMX__
- /* the SIGCHLD handler must not be used on OS/2 because, unlike
- on UNIX systems, it had to call wait() itself. Therefore
- job_rfd has to be closed here. */
- if (job_rfd >= 0)
- {
- close (job_rfd);
- job_rfd = -1;
- }
-#endif
-
}
else
{
@@ -881,10 +874,6 @@ unblock_sigs (void)
#endif
#ifdef MAKE_JOBSERVER
-# ifdef __EMX__
-/* Never install the SIGCHLD handler for EMX!!! */
-# define set_child_handler_action_flags(x)
-# else
/* Set the child handler action flags to FLAGS. */
static void
set_child_handler_action_flags (int flags)
@@ -900,7 +889,6 @@ set_child_handler_action_flags (int flags)
sigaction (SIGCLD, &sa, NULL);
#endif
}
-#endif /* !__EMX__ */
#endif
@@ -1630,6 +1618,10 @@ new_job (struct file *file)
set_child_handler_action_flags (0);
got_token = read (job_rfd, &token, 1);
saved_errno = errno;
+#ifdef __EMX__
+ /* The child handler must be turned off here. */
+ signal (SIGCHLD, SIG_DFL);
+#endif
set_child_handler_action_flags (SA_RESTART);
/* If we got one, we're done here. */
@@ -2750,12 +2742,12 @@ construct_command_argv_internal (char *line, char **restp, char *shell,
char** sh_cmds;
#else /* must be UNIX-ish */
static char sh_chars[] = "#;\"*?[]&|<>(){}$`^~!";
- static char *sh_cmds[] = { "cd", "eval", "exec", "exit", "login",
- "logout", "set", "umask", "wait", "while", "for",
- "case", "if", ":", ".", "break", "continue",
- "export", "read", "readonly", "shift", "times",
- "trap", "switch", 0 };
-#endif /* __MSDOS__ */
+ static char *sh_cmds[] = { ".", ":", "break", "case", "cd", "continue",
+ "eval", "exec", "exit", "export", "for", "if",
+ "login", "logout", "read", "readonly", "set",
+ "shift", "switch", "test", "times", "trap",
+ "umask", "wait", "while", 0 };
+#endif
register int i;
register char *p;
register char *ap;
diff --git a/main.c b/main.c
index 7af539d..96bb430 100644
--- a/main.c
+++ b/main.c
@@ -1158,7 +1158,12 @@ main (int argc, char **argv, char **envp)
program that uses a non-absolute name. */
if (current_directory[0] != '\0'
&& argv[0] != 0
- && (argv[0][0] != '/' && (argv[0][0] == '\0' || argv[0][1] != ':')))
+ && (argv[0][0] != '/' && (argv[0][0] == '\0' || argv[0][1] != ':'))
+#ifdef __EMX__
+ /* do not prepend cwd if argv[0] contains no '/', e.g. "make" */
+ && (strchr (argv[0], '/') != 0 || strchr (argv[0], '\\') != 0)
+# endif
+ )
argv[0] = concat (current_directory, "/", argv[0]);
#else /* !__MSDOS__ */
if (current_directory[0] != '\0'
@@ -2230,6 +2235,12 @@ decode_switches (int argc, char **argv, int env)
if (optarg == 0)
optarg = cs->noarg_value;
+ else if (*optarg == '\0')
+ {
+ error (NILF, _("the `-%c' option requires a non-empty string argument"),
+ cs->c);
+ bad = 1;
+ }
sl = *(struct stringlist **) cs->value_ptr;
if (sl == 0)
diff --git a/maintMakefile b/maintMakefile
index f08c3cc..67f3098 100644
--- a/maintMakefile
+++ b/maintMakefile
@@ -80,20 +80,24 @@ build.sh.in: build.template Makefile
maintFILES = configure aclocal.m4 config.h.in Makefile.in stamp-h.in
CVS-CLEAN-FILES += $(maintFILES) $(TEMPLATES) $(MTEMPLATES) NMakefile \
- missing build.sh.in .dep_segment po-check-?
+ build.sh.in .deps .dep_segment ABOUT-NLS
# This rule tries to clean the tree right down to how it looks when you do a
# virgin CVS checkout.
+# This is potentially dangerous since it removes _ANY FILE_ that is not in
+# CVS. Including files you might mean to add to CVS but haven't yet...
+# I only use this in subdirectories where it's unlikely we have any new
+# files. Stil...
+cvsclean = perl -e '$$k{CVS} = 1; open(E,"< CVS/Entries") || die "CVS/Entries: $$!\n"; while (defined ($$_ = <E>)) { m%^/([^/]*)% or next; $$k{$$1} = 1; } close(E) || die "CVS/Entries: $$!\n"; opendir(D, ".") || die ".: $$!\n"; while (defined ($$_ = readdir(D))) { -f $$_ && ! exists $$k{$$_} && unlink($$_); } closedir(D) || die ".: $$!\n";'
+
.PHONY: cvs-clean
cvs-clean: maintainer-clean
- -rm -f *~
- -rm -f config/*~ config/Makefile.in config/[a-z]*
- -rm -f po/*~ po/Makefile.in.in po/Rules-quot po/[a-z]*
- -rm -f doc/*~ doc/Makefile.in doc/fdl.texi doc/make-stds.texi \
- doc/texinfo.tex
- -rm -f glob/*~ glob/Makefile.in
- -rm -f ABOUT-NLS $(CVS-CLEAN-FILES)
+ -rm -rf *~ $(CVS-CLEAN-FILES)
+ -cd config && $(cvsclean)
+ -cd po && $(cvsclean)
+ -cd doc && $(cvsclean)
+ -cd glob && $(cvsclean)
# ----------------------------------------------------------------------
@@ -142,18 +146,13 @@ po-update:
# The following pseudo table associates a local directory and a URL
# with each of the files that belongs to some other package and is
# regularly updated from the specified URL.
-# $(srcdir)/src/ansi2knr.c
-
-wget_files ?= $(srcdir)/doc/texinfo.tex $(srcdir)/doc/make-stds.texi \
- $(srcdir)/doc/fdl.texi
+wget_files ?= $(srcdir)/doc/make-stds.texi $(srcdir)/doc/fdl.texi
wget-targets = $(patsubst %, get-%, $(wget_files))
ansi2knr.c-url_prefix = ftp://ftp.cs.wisc.edu/ghost/
-texinfo.tex-url_prefix = $(ftp-gnu)/texinfo/
-
standards.texi-url_prefix = $(ftp-gnu)/GNUinfo/
make-stds.texi-url_prefix = $(ftp-gnu)/GNUinfo/
fdl.texi-url_prefix = $(ftp-gnu)/GNUinfo/
@@ -167,32 +166,42 @@ $(wget-targets):
&& $(WGET) $(url) -O $(target).t \
&& $(move_if_change)
-config-prefix = http://savannah.gnu.org/cgi-bin/viewcvs/config
-config-url = $(config-prefix)/$(patsubst get-%,%,$@)?rev=HEAD
+savannah-url = http://savannah.gnu.org/cgi-bin/viewcvs
+viewcvs-suffix = \?rev=HEAD\&content-type=text/plain
+
+config-url = $(savannah-url)/config/config/$(patsubst get-config/%,%,$@)$(viewcvs-suffix)
get-config/config.guess get-config/config.sub:
@echo $(WGET) $(config-url) -O $(target) \
&& $(WGET) $(config-url) -O $(target).t \
&& $(move_if_change)
+gnulib-url = $(savannah-url)/gnulib/gnulib/config/$(patsubst get-config/%,%,$@)$(viewcvs-suffix)
+
+get-config/texinfo.tex:
+ @echo $(WGET) $(gnulib-url) -O $(target) \
+ && $(WGET) $(gnulib-url) -O $(target).t \
+ && $(move_if_change)
+
.PHONY: wget-update
wget-update: $(wget-targets)
# Updating tools via CVS.
-cvs_files ?= depcomp missing
-# config/config.guess config/config.sub
-cvs-targets = $(patsubst %, get-%, $(cvs_files))
+# cvs_files ?= depcomp missing
+# cvs-targets = $(patsubst %, get-%, $(cvs_files))
-automake_repo = :pserver:anoncvs@anoncvs.cygnus.com:/cvs/automake
-.PHONY: $(cvs-targets)
-$(cvs-targets):
- $(CVS) -d $(automake_repo) co -p automake/lib/$(notdir $(target)) \
- >$(target).t \
- && $(move_if_change)
+# automake_repo = :pserver:anoncvs@anoncvs.cygnus.com:/cvs/automake
+# .PHONY: $(cvs-targets)
+# $(cvs-targets):
+# $(CVS) -d $(automake_repo) co -p automake/lib/$(notdir $(target)) \
+# >$(target).t \
+# && $(move_if_change)
+
+# $(cvs-targets)
.PHONY: cvs-update
-cvs-update: $(cvs-targets) get-config/config.guess get-config/config.sub
+cvs-update: get-config/texinfo.tex get-config/config.guess get-config/config.sub
# --------------------- #
@@ -200,9 +209,7 @@ cvs-update: $(cvs-targets) get-config/config.guess get-config/config.sub
# --------------------- #
.PHONY: update
-update: wget-update po-update
-
-# cvs-update
+update: wget-update po-update cvs-update
## --------------- ##
diff --git a/make.h b/make.h
index 3fae1bf..fcd0e75 100644
--- a/make.h
+++ b/make.h
@@ -388,7 +388,29 @@ struct floc
/* Fancy processing for variadic functions in both ANSI and pre-ANSI
compilers. */
-#if defined __STDC__ && __STDC__
+#if HAVE_STDARG_H
+# include <stdarg.h>
+# define VA_START(a, f) va_start(a, f)
+#else
+# if HAVE_VARARGS_H
+# include <varargs.h>
+# define VA_START(a, f) va_start(a)
+# endif
+#endif
+#ifndef VA_START
+ error no variadic api
+#endif
+
+/* We have to have both stdarg.h or varargs.h AND v*printf or doprnt to use
+ variadic versions of these functions. */
+
+#if HAVE_STDARG_H || HAVE_VARARGS_H
+# if HAVE_VPRINTF || HAVE_DOPRNT
+# define USE_VARIADIC 1
+# endif
+#endif
+
+#if __STDC__ && USE_VARIADIC
extern void message (int prefix, const char *fmt, ...)
__attribute__ ((__format__ (__printf__, 2, 3)));
extern void error (const struct floc *flocp, const char *fmt, ...)
diff --git a/misc.c b/misc.c
index 9e5a516..0832042 100644
--- a/misc.c
+++ b/misc.c
@@ -30,9 +30,8 @@ Boston, MA 02111-1307, USA. */
This fancy stuff all came from GNU fileutils, except for the VA_PRINTF and
VA_END macros used here since we have multiple print functions. */
-#if HAVE_VPRINTF || HAVE_DOPRNT
-# define HAVE_STDVARARGS 1
-# if __STDC__
+#if USE_VARIADIC
+# if HAVE_STDARG_H
# include <stdarg.h>
# define VA_START(args, lastarg) va_start(args, lastarg)
# else
@@ -46,7 +45,7 @@ Boston, MA 02111-1307, USA. */
# endif
# define VA_END(args) va_end(args)
#else
-/* # undef HAVE_STDVARARGS */
+/* We can't use any variadic interface! */
# define va_alist a1, a2, a3, a4, a5, a6, a7, a8
# define va_dcl char *a1, *a2, *a3, *a4, *a5, *a6, *a7, *a8;
# define VA_START(args, lastarg)
@@ -206,7 +205,7 @@ concat (const char *s1, const char *s2, const char *s3)
/* Print a message on stdout. */
void
-#if __STDC__ && HAVE_STDVARARGS
+#if USE_VARIADIC
message (int prefix, const char *fmt, ...)
#else
message (prefix, fmt, va_alist)
@@ -215,7 +214,7 @@ message (prefix, fmt, va_alist)
va_dcl
#endif
{
-#if HAVE_STDVARARGS
+#if USE_VARIADIC
va_list args;
#endif
@@ -242,7 +241,7 @@ message (prefix, fmt, va_alist)
/* Print an error message. */
void
-#if __STDC__ && HAVE_STDVARARGS
+#if USE_VARIADIC
error (const struct floc *flocp, const char *fmt, ...)
#else
error (flocp, fmt, va_alist)
@@ -251,7 +250,7 @@ error (flocp, fmt, va_alist)
va_dcl
#endif
{
-#if HAVE_STDVARARGS
+#if USE_VARIADIC
va_list args;
#endif
@@ -275,7 +274,7 @@ error (flocp, fmt, va_alist)
/* Print an error message and exit. */
void
-#if __STDC__ && HAVE_STDVARARGS
+#if USE_VARIADIC
fatal (const struct floc *flocp, const char *fmt, ...)
#else
fatal (flocp, fmt, va_alist)
@@ -284,7 +283,7 @@ fatal (flocp, fmt, va_alist)
va_dcl
#endif
{
-#if HAVE_STDVARARGS
+#if USE_VARIADIC
va_list args;
#endif
diff --git a/tests/ChangeLog b/tests/ChangeLog
index b20f46f..9f31f4e 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,8 @@
+2004-02-21 Paul D. Smith <psmith@gnu.org>
+
+ * scripts/functions/origin: Set our own environment variable
+ rather than relying on $HOME.
+
2004-01-21 Paul D. Smith <psmith@gnu.org>
* scripts/features/conditionals: Test arguments to ifn?def which
diff --git a/tests/scripts/functions/origin b/tests/scripts/functions/origin
index eab2d78..c45a359 100644
--- a/tests/scripts/functions/origin
+++ b/tests/scripts/functions/origin
@@ -15,13 +15,8 @@ defined per the following list:
'override' defined by override in makefile
'automatic' Automatic variable\n";
-# On WIN32 systems, HOME is meaningless. SystemRoot should be defined
-# though. With DJGPP, HOME is not guaranteed to be defined. Use DJDIR
-# instead.
-#
-$homevar = (($port_type eq 'Windows') ? "SystemRoot"
- : (($port_type eq 'DOS') ? "DJDIR"
- : "HOME"));
+# Set an environment variable
+$ENV{MAKETEST} = 1;
open(MAKEFILE,"> $makefile");
@@ -33,7 +28,7 @@ override WHITE := BLACK
all: auto
\t\@echo \$(origin undefined)
\t\@echo \$(origin CC)
-\t\@echo \$(origin $homevar)
+\t\@echo \$(origin MAKETEST)
\t\@echo \$(origin MAKE)
\t\@echo \$(origin foo)
\t\@echo \$(origin CFLAGS)
diff --git a/w32/subproc/sub_proc.c b/w32/subproc/sub_proc.c
index 52f2fa2..bf1e732 100644
--- a/w32/subproc/sub_proc.c
+++ b/w32/subproc/sub_proc.c
@@ -1193,6 +1193,9 @@ process_easy(
if (process_begin(hProcess, argv, envp, argv[0], NULL)) {
fake_exits_pending++;
+ /* process_begin() failed: make a note of that. */
+ if (!((sub_process*) hProcess)->last_err)
+ ((sub_process*) hProcess)->last_err = -1;
((sub_process*) hProcess)->exit_code = process_last_err(hProcess);
/* close up unused handles */
diff --git a/w32/subproc/w32err.c b/w32/subproc/w32err.c
index afe7668..9bfa2c4 100644
--- a/w32/subproc/w32err.c
+++ b/w32/subproc/w32err.c
@@ -6,18 +6,18 @@
*
* Returns: a pointer to a static error
*
- * Notes/Dependencies: I got this from
+ * Notes/Dependencies: I got this from
* comp.os.ms-windows.programmer.win32
*/
-char *
+char *
map_windows32_error_to_string (DWORD ercode) {
/* __declspec (thread) necessary if you will use multiple threads */
__declspec (thread) static char szMessageBuffer[128];
-
- /* Fill message buffer with a default message in
- * case FormatMessage fails
+
+ /* Fill message buffer with a default message in
+ * case FormatMessage fails
*/
- wsprintf (szMessageBuffer, "Error %ld", ercode);
+ wsprintf (szMessageBuffer, "Error %ld\n", ercode);
/*
* Special code for winsock error handling.
@@ -33,7 +33,7 @@ __declspec (thread) static char szMessageBuffer[128];
sizeof(szMessageBuffer),
NULL);
FreeLibrary(hModule);
- }
+ }
} else {
/*
* Default system message handling
@@ -48,4 +48,4 @@ __declspec (thread) static char szMessageBuffer[128];
}
return szMessageBuffer;
}
-
+