summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2003-03-25 00:15:25 +0000
committerPaul Smith <psmith@gnu.org>2003-03-25 00:15:25 +0000
commit955899ef770fc289febe3f186e4533e09baa7076 (patch)
tree4f3b49e3a7c2acba5cb614fdcf118814db022843
parent4068c5e4a3eb0f47ec3cb4ee4fad5dd2edb9de6f (diff)
downloadgunmake-955899ef770fc289febe3f186e4533e09baa7076.tar.gz
Commit fix for bug #1418.
Upgrade to require autoconf 2.56. Fix a pathological performance hit substituting in large values with lots of words.
-rw-r--r--ChangeLog14
-rw-r--r--Makefile.am1
-rw-r--r--README.cvs48
-rw-r--r--configure.in90
-rw-r--r--function.c19
-rw-r--r--remake.c3
-rw-r--r--tests/ChangeLog5
-rw-r--r--tests/scripts/options/dash-t20
8 files changed, 110 insertions, 90 deletions
diff --git a/ChangeLog b/ChangeLog
index b99e6f7..146b332 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -103,6 +103,20 @@
invocation's arguments that aren't used by this one, so that this
invocation doesn't "inherit" them accidentally.
+2002-12-05 Paul D. Smith <psmith@gnu.org>
+
+ * function.c (subst_expand): Valery Khamenia reported a
+ pathological performance hit when doing substitutions on very
+ large values with lots of words: turns out we were invoking
+ strlen() a ridiculous number of times. Instead of having each
+ call to sindex() call strlen() again, keep track of how much of
+ the text we've seen and pass the length to sindex().
+
+2002-11-19 Paul D. Smith <psmith@gnu.org>
+
+ * README.cvs, configure.in: Upgrade to require autoconf 2.56.
+
+
2002-11-16 Paul D. Smith <psmith@gnu.org>
* NMakefile.template (OBJS): Add hash.c object file.
diff --git a/Makefile.am b/Makefile.am
index f01aeeb..11eeb73 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -13,6 +13,7 @@ else
remote = remote-stub.c
endif
+
make_SOURCES = ar.c arscan.c commands.c default.c dir.c expand.c file.c \
function.c getopt.c getopt1.c implicit.c job.c main.c \
misc.c read.c remake.c $(remote) rule.c signame.c \
diff --git a/README.cvs b/README.cvs
index ff2d341..0b416e8 100644
--- a/README.cvs
+++ b/README.cvs
@@ -23,7 +23,7 @@ There is no password; just hit the ENTER key if you are asked for one.
Building From CVS
-----------------
-To build GNU make from CVS, you will need Autoconf 2.54 (or better),
+To build GNU make from CVS, you will need Autoconf 2.56 (or better),
Automake 1.7.1 (or better), and Gettext 0.11.5 (or better), and any
tools that those utilities require (GNU m4, Perl, etc.). You will also
need a copy of wget.
@@ -32,48 +32,18 @@ After checking out the code, you will need to perform these steps to get
to the point where you can run "make".
- 1) $ autopoint
+ 1) $ autoreconf -i -s
- This will instantiate various m4 macros files, etc. in the config
- and po directories.
+ This rebuilds all the things that need rebuilding, installing
+ missing files as symbolic links.
- 2) $ aclocal -I config
-
- Generate the proper aclocal.m4 file.
-
-
- 3) $ autoheader
-
- Generate a "config.h.in" file from the contents of configure.in,
- etc.
-
-
- 4) $ automake --add-missing
-
- Add (symlink) missing files into the distribution, and generate
- Makefile.in's from Makefile.am's.
-
- You will see these perhaps unexpected messages (among others which
- you should be expecting :)); just ignore them--I know what I'm doing
- :).
-
- Makefile.am: required file `./README' not found
- configure.in:xxx: required file `./build.sh.in' not found
- Makefile.am:xxx: automatically discovered file `getloadavg.c' should not be explicitly mentioned
-
-
- 5) $ autoconf
-
- Generate a "configure" script from configure.in and acinclude.m4.
-
-
- 6) $ ./configure
+ 2) $ ./configure
Generate a Makefile
- 7) $ make update
+ 3) $ make update
Use wget to retrieve various other files that GNU make relies on,
but does not keep in its own source tree.
@@ -129,11 +99,7 @@ This list is eminently suitable for a quick swipe o' the mouse and a
swift click o' mouse-2 into an xterm. Go for it!
-autopoint
-aclocal -I config
-autoheader
-automake --add-missing
-autoconf
+autoreconf -i -s
./configure
make update
make
diff --git a/configure.in b/configure.in
index befba08..38a84ee 100644
--- a/configure.in
+++ b/configure.in
@@ -1,8 +1,8 @@
# Process this file with autoconf to produce a configure script.
-AC_INIT(GNU make,3.81a1,bug-make@gnu.org)
+AC_INIT([GNU make],[3.81a1],[bug-make@gnu.org])
-AC_PREREQ(2.54)
+AC_PREREQ(2.56)
AC_REVISION([[$Id$]])
@@ -66,7 +66,8 @@ AC_TYPE_PID_T
AC_CHECK_TYPE(uintmax_t,,[
uintmax_t="unsigned long"
AC_CHECK_TYPE(unsigned long long,[uintmax_t="unsigned long long"])
- AC_DEFINE_UNQUOTED(uintmax_t,$uintmax_t,[Define uintmax_t if not defined in <stdint.h> or <inttypes.h>.])])
+ AC_DEFINE_UNQUOTED(uintmax_t,$uintmax_t,
+ [Define uintmax_t if not defined in <stdint.h> or <inttypes.h>.])])
# Find out whether our struct stat returns nanosecond resolution timestamps.
@@ -75,12 +76,13 @@ AC_MSG_CHECKING([whether to use high resolution file timestamps])
AC_CACHE_VAL(make_cv_file_timestamp_hi_res, [
make_cv_file_timestamp_hi_res=no
if test "$ac_cv_struct_st_mtim_nsec" != no; then
- AC_TRY_COMPILE([
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
# if HAVE_INTTYPES_H
# include <inttypes.h>
-# endif],
- [char a[0x7fffffff < (uintmax_t) -1 >> 30 ? 1 : -1];],
- make_cv_file_timestamp_hi_res=yes)
+# endif]],
+ [[char a[0x7fffffff < (uintmax_t)-1 >> 30 ? 1 : -1];]])],
+ [make_cv_file_timestamp_hi_res=yes],
+ [])
fi])
AC_MSG_RESULT($make_cv_file_timestamp_hi_res)
if test "$make_cv_file_timestamp_hi_res" = yes; then
@@ -107,16 +109,16 @@ fi
# one.
AC_CACHE_CHECK([for standard gettimeofday], ac_cv_func_gettimeofday,
[ac_cv_func_gettimeofday=no
- AC_TRY_RUN([#include <sys/time.h>
- int main ()
- {
- struct timeval t; t.tv_sec = -1; t.tv_usec = -1;
- exit (gettimeofday (&t, 0) != 0
- || t.tv_sec < 0 || t.tv_usec < 0);
- }],
- ac_cv_func_gettimeofday=yes,
- ac_cv_func_gettimeofday=no,
- ac_cv_func_gettimeofday="no (cross-compiling)")])
+ AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <sys/time.h>
+ int main ()
+ {
+ struct timeval t; t.tv_sec = -1; t.tv_usec = -1;
+ exit (gettimeofday (&t, 0) != 0
+ || t.tv_sec < 0 || t.tv_usec < 0);
+ }]])],
+ [ac_cv_func_gettimeofday=yes],
+ [ac_cv_func_gettimeofday=no],
+ [ac_cv_func_gettimeofday="no (cross-compiling)"])])
if test "$ac_cv_func_gettimeofday" = yes; then
AC_DEFINE(HAVE_GETTIMEOFDAY, 1,
[Define if you have a standard gettimeofday function])
@@ -133,7 +135,7 @@ make_FUNC_SETVBUF_REVERSED
AC_FUNC_STRCOLL
AC_FUNC_ALLOCA
-AC_FUNC_VFORK
+AC_FUNC_FORK([])
AC_FUNC_VPRINTF
AC_FUNC_CLOSEDIR_VOID
@@ -143,52 +145,56 @@ AC_FUNC_GETLOADAVG
# doesn't. So, we will.
if test "$ac_cv_header_nlist_h" = yes; then
- AC_TRY_COMPILE([#include <nlist.h>],
- [struct nlist nl;
- nl.n_name = "string";
- return 0;],
- make_cv_nlist_struct=yes,
- make_cv_nlist_struct=no)
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <nlist.h>]],
+ [[struct nlist nl;
+ nl.n_name = "string";
+ return 0;]])],
+ [make_cv_nlist_struct=yes],
+ [make_cv_nlist_struct=no])
if test "$make_cv_nlist_struct" = yes; then
AC_DEFINE(NLIST_STRUCT, 1,
[Define if struct nlist.n_name is a pointer rather than an array.])
fi
fi
-AC_DECL_SYS_SIGLIST
+AC_CHECK_DECLS([sys_siglist])
+
# Check out the wait reality.
AC_CHECK_HEADERS(sys/wait.h)
AC_CHECK_FUNCS(waitpid wait3)
AC_MSG_CHECKING(for union wait)
AC_CACHE_VAL(make_cv_union_wait, [dnl
-AC_TRY_LINK([#include <sys/types.h>
-#include <sys/wait.h>],
- [union wait status; int pid; pid = wait (&status);
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
+#include <sys/wait.h>]],
+ [[union wait status; int pid; pid = wait (&status);
#ifdef WEXITSTATUS
/* Some POSIXoid systems have both the new-style macros and the old
union wait type, and they do not work together. If union wait
conflicts with WEXITSTATUS et al, we don't want to use it at all. */
-if (WEXITSTATUS (status) != 0) pid = -1;
+ if (WEXITSTATUS (status) != 0) pid = -1;
#ifdef WTERMSIG
-/* If we have WEXITSTATUS and WTERMSIG, just use them on ints. */
--- blow chunks here --
+ /* If we have WEXITSTATUS and WTERMSIG, just use them on ints. */
+ -- blow chunks here --
#endif
#endif
#ifdef HAVE_WAITPID
-/* Make sure union wait works with waitpid. */
-pid = waitpid (-1, &status, 0);
+ /* Make sure union wait works with waitpid. */
+ pid = waitpid (-1, &status, 0);
#endif
-],
- [make_cv_union_wait=yes], [make_cv_union_wait=no])])
+ ]])],
+ [make_cv_union_wait=yes],
+ [make_cv_union_wait=no])])
if test "$make_cv_union_wait" = yes; then
- AC_DEFINE(HAVE_UNION_WAIT, 1, [Define this if you have the \`union wait' type in <sys/wait.h>.])
+ AC_DEFINE(HAVE_UNION_WAIT, 1,
+ [Define this if you have the \`union wait' type in <sys/wait.h>.])
fi
AC_MSG_RESULT($make_cv_union_wait)
# See if the user wants to use pmake's "customs" distributed build capability
+AC_SUBST(REMOTE) REMOTE=stub
use_customs=false
AC_ARG_WITH(customs,
AC_HELP_STRING([--with-customs=DIR],
@@ -204,6 +210,7 @@ AC_ARG_WITH(customs,
CF_NETLIBS
AC_CHECK_HEADER(customs.h,
[use_customs=true
+ REMOTE=cstms
LIBS="$LIBS -lcustoms" LDFLAGS="$make_ldflags"],
[with_customs=no
CPPFLAGS="$make_cppflags" make_badcust=yes])
@@ -226,10 +233,10 @@ case "$ac_cv_func_waitpid/$ac_cv_func_wait3" in
esac
AC_CACHE_CHECK(for SA_RESTART, make_cv_sa_restart, [
- AC_TRY_COMPILE([#include <signal.h>],
- [return SA_RESTART;],
- make_cv_sa_restart=yes,
- make_cv_sa_restart=no)])
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <signal.h>]],
+ [[return SA_RESTART;]])],
+ [make_cv_sa_restart=yes],
+ [make_cv_sa_restart=no])])
if test "$make_cv_sa_restart" != no; then
AC_DEFINE(HAVE_SA_RESTART, 1,
[Define if <signal.h> defines the SA_RESTART constant.])
@@ -249,7 +256,8 @@ if test -f /usr/sccs/get; then
else
make_cv_path_sccs_get=get
fi])
-AC_DEFINE_UNQUOTED(SCCS_GET, ["$make_cv_path_sccs_get"], [Define to the name of the SCCS 'get' command.])
+AC_DEFINE_UNQUOTED(SCCS_GET, ["$make_cv_path_sccs_get"],
+ [Define to the name of the SCCS 'get' command.])
ac_clean_files="$ac_clean_files s.conftest conftoast" # Remove these later.
if ( /usr/sccs/admin -n s.conftest || admin -n s.conftest ) >/dev/null 2>&1 &&
diff --git a/function.c b/function.c
index 361e3a8..08a4d56 100644
--- a/function.c
+++ b/function.c
@@ -80,13 +80,14 @@ subst_expand (char *o, char *text, char *subst, char *replace,
unsigned int slen, unsigned int rlen,
int by_word, int suffix_only)
{
- register char *t = text;
- register char *p;
+ char *t = text;
+ unsigned int tlen = strlen (text);
+ char *p;
if (slen == 0 && !by_word && !suffix_only)
{
/* The first occurrence of "" in any string is its end. */
- o = variable_buffer_output (o, t, strlen (t));
+ o = variable_buffer_output (o, t, tlen);
if (rlen > 0)
o = variable_buffer_output (o, replace, rlen);
return o;
@@ -100,11 +101,11 @@ subst_expand (char *o, char *text, char *subst, char *replace,
p = end_of_token (next_token (t));
else
{
- p = sindex (t, 0, subst, slen);
+ p = sindex (t, tlen, subst, slen);
if (p == 0)
{
/* No more matches. Output everything left on the end. */
- o = variable_buffer_output (o, t, strlen (t));
+ o = variable_buffer_output (o, t, tlen);
return o;
}
}
@@ -127,8 +128,12 @@ subst_expand (char *o, char *text, char *subst, char *replace,
/* Output the replacement string. */
o = variable_buffer_output (o, replace, rlen);
- /* Advance T past the string to be replaced. */
- t = p + slen;
+ /* Advance T past the string to be replaced; adjust tlen. */
+ {
+ char *nt = p + slen;
+ tlen -= nt - t;
+ t = nt;
+ }
} while (*t != '\0');
return o;
diff --git a/remake.c b/remake.c
index e6dac0f..a13a9a4 100644
--- a/remake.c
+++ b/remake.c
@@ -748,7 +748,8 @@ notice_finished_file (struct file *file)
have_nonrecursing:
if (file->phony)
file->update_status = 0;
- else
+ /* According to POSIX, -t doesn't affect targets with no cmds. */
+ else if (file->cmds != 0)
{
/* Should set file's modification date and do nothing else. */
file->update_status = touch_file (file);
diff --git a/tests/ChangeLog b/tests/ChangeLog
index 39bf62f..88fffb6 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -20,6 +20,11 @@
* scripts/functions/eval: Test using $(eval ...) inside
conditionals (Bug #1516).
+2002-10-14 Paul D. Smith <psmith@gnu.org>
+
+ * scripts/options/dash-t: Add a test for handling -t on targets
+ with no commands (Bug #1418).
+
2002-10-13 Paul D. Smith <psmith@gnu.org>
* scripts/features/targetvars: Add a test for exporting
diff --git a/tests/scripts/options/dash-t b/tests/scripts/options/dash-t
index 8192fbf..ec27d7a 100644
--- a/tests/scripts/options/dash-t
+++ b/tests/scripts/options/dash-t
@@ -35,4 +35,24 @@ $answer = "touch interm-a\ntouch final-a\ntouch interm-b\ntouch final-b\n";
unlink('orig1-a', 'orig2-a', 'interm-a', 'final-a');
unlink('orig1-b', 'orig2-b', 'interm-b', 'final-b');
+# TEST 1
+# -t should not touch files with no commands.
+
+$makefile2 = &get_tmpfile;
+
+open(MAKEFILE, "> $makefile2");
+print MAKEFILE <<'EOMAKE';
+
+PHOOEY: xxx
+xxx: ; @:
+
+EOMAKE
+close(MAKEFILE);
+
+&run_make_with_options($makefile2, "-t", &get_logfile);
+$answer = "touch xxx\n";
+&compare_output($answer, &get_logfile(1));
+
+unlink('xxx');
+
1;