]> git.ipfire.org Git - thirdparty/make.git/commitdiff
Commit fix for bug #1418.
authorPaul Smith <psmith@gnu.org>
Tue, 25 Mar 2003 00:15:25 +0000 (00:15 +0000)
committerPaul Smith <psmith@gnu.org>
Tue, 25 Mar 2003 00:15:25 +0000 (00:15 +0000)
Upgrade to require autoconf 2.56.
Fix a pathological performance hit substituting in large values with
lots of words.

ChangeLog
Makefile.am
README.cvs
configure.in
function.c
remake.c
tests/ChangeLog
tests/scripts/options/dash-t

index b99e6f72491c5e06094b9d7eb0bb4f1ba0432dfb..146b332313c6d6b53ea526f39daeeba19d823a50 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
        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.
index f01aeebfcf65fd37b672970760889139a5e6db0b..11eeb73fdd5350e75d966755ecd359a6d01549ed 100644 (file)
@@ -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 \
index ff2d34141ee3fe71839ca6ad596289cd2475abb2..0b416e8a453c1571483790c5f50a188b01aec486 100644 (file)
@@ -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
index befba089c725a1aae89e43e5bf74046bf9a60eb7..38a84ee8ebfd3451bbb966778187ad843102433b 100644 (file)
@@ -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 &&
index 361e3a87d939989da55094959bc1bf1c2bc90f91..08a4d569181bbf94eb68931f21226ab557f57860 100644 (file)
@@ -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;
index e6dac0fd32bc185c8616ece1f3a5688d50ac6fc8..a13a9a436e5e27088c984b20367f19fe6c6082be 100644 (file)
--- 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);
index 39bf62fcfc5b746f8308913326955e999f83e670..88fffb6709de4e66fc5198dd699e8394984e4ba7 100644 (file)
        * 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
index 8192fbf492b1fc189c5c23f5e894cf49bd09006f..ec27d7afbf6696abbf97de5c425dd3fee1528ed1 100644 (file)
@@ -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;