regex alloca fixes

2005-08-25 Thread Paul Eggert
I noticed that regex invoked alloca with unbounded size.  Rather
than use the allocsa module I thought it better to stick to glibc
style, and define __libc_use_alloca when _LIBC isn't defined.
I installed this (and filed glibc bug 1245):

2005-08-25  Paul Eggert  <[EMAIL PROTECTED]>

* config/srclist.txt: Add glibc bug 1245.

* lib/regexec.c (set_regs): Don't alloca with an unbounded size.

alloca modernization/simplification for regex.
* lib/regex.c: Remove portability cruft for alloca.  This no longer
needs to be at the start of the file, and can be moved into
regex_internal.h and simplified.
* lib/regex_internal.h: Include .
(__libc_use_alloca) [!defined _LIBC]: New macro.
* lib/regexec.c (build_trtable): Remove "#ifdef _LIBC",
since the code now works outside glibc.

--- config/srclist.txt.~1.86.~  2005-08-25 13:39:57.0 -0700
+++ config/srclist.txt  2005-08-25 22:55:59.0 -0700
@@ -105,6 +105,7 @@ $LIBCSRC/stdlib/getsubopt.c lib gpl
 #$LIBCSRC/posix/regcomp.c  lib gpl
 #
 # http://sources.redhat.com/bugzilla/show_bug.cgi?id=1238
+# http://sources.redhat.com/bugzilla/show_bug.cgi?id=1245
 #$LIBCSRC/posix/regex.clib gpl
 #
 # http://sources.redhat.com/bugzilla/show_bug.cgi?id=1201
@@ -128,6 +129,7 @@ $LIBCSRC/stdlib/getsubopt.c lib gpl
 # http://sources.redhat.com/bugzilla/show_bug.cgi?id=1221
 # http://sources.redhat.com/bugzilla/show_bug.cgi?id=1237
 # http://sources.redhat.com/bugzilla/show_bug.cgi?id=1241
+# http://sources.redhat.com/bugzilla/show_bug.cgi?id=1245
 #$LIBCSRC/posix/regex_internal.h   lib gpl
 #
 # http://sources.redhat.com/bugzilla/show_bug.cgi?id=1216
@@ -137,6 +139,7 @@ $LIBCSRC/stdlib/getsubopt.c lib gpl
 # http://sources.redhat.com/bugzilla/show_bug.cgi?id=1231
 # http://sources.redhat.com/bugzilla/show_bug.cgi?id=1237
 # http://sources.redhat.com/bugzilla/show_bug.cgi?id=1241
+# http://sources.redhat.com/bugzilla/show_bug.cgi?id=1245
 #$LIBCSRC/posix/regexec.c  lib gpl
 #
 # c89 changes $LIBCSRC/string/strdup.c lib gpl
--- lib/regex.c 24 Aug 2005 23:43:01 -  1.91
+++ lib/regex.c 26 Aug 2005 05:41:47 -
@@ -21,30 +21,6 @@
 #include "config.h"
 #endif
 
-#ifdef _AIX
-#pragma alloca
-#else
-# ifndef allocax   /* predefined by HP cc +Olibcalls */
-#  ifdef __GNUC__
-#   define alloca(size) __builtin_alloca (size)
-#  else
-#   if HAVE_ALLOCA_H
-#include 
-#   else
-#ifdef __hpux
-void *alloca ();
-#else
-# if !defined __OS2__ && !defined WIN32
-char *alloca ();
-# else
-#  include/* OS/2 defines alloca in here */
-# endif
-#endif
-#   endif
-#  endif
-# endif
-#endif
-
 #ifdef _LIBC
 /* We have to keep the namespace clean.  */
 # define regfree(preg) __regfree (preg)
--- lib/regex_internal.h25 Aug 2005 20:39:57 -  1.4
+++ lib/regex_internal.h26 Aug 2005 05:41:47 -
@@ -431,6 +431,21 @@ static unsigned char re_string_fetch_byt
 #define re_string_skip_bytes(pstr,idx) ((pstr)->cur_idx += (idx))
 #define re_string_set_index(pstr,idx) ((pstr)->cur_idx = (idx))
 
+#include 
+
+#ifndef __LIBC
+# if HAVE_ALLOCA
+/* The OS usually guarantees only one guard page at the bottom of the stack,
+   and a page size can be as small as 4096 bytes.  So we cannot safely
+   allocate anything larger than 4096 bytes.  Also care for the possibility
+   of a few compiler-allocated temporary stack slots.  */
+#  define __libc_use_alloca(n) ((n) < 4032)
+# else
+/* alloca is implemented with malloc, so just use malloc.  */
+#  define __libc_use_alloca(n) 0
+# endif
+#endif
+
 #define re_malloc(t,n) ((t *) malloc ((n) * sizeof (t)))
 #define re_calloc(t,n) ((t *) calloc (n, sizeof (t)))
 #define re_realloc(p,t,n) ((t *) realloc (p, (n) * sizeof (t)))
--- lib/regexec.c   25 Aug 2005 20:39:57 -  1.8
+++ lib/regexec.c   26 Aug 2005 05:41:47 -
@@ -1354,6 +1354,7 @@ set_regs (const regex_t *preg, const re_
   struct re_fail_stack_t *fs;
   struct re_fail_stack_t fs_body = { 0, 2, NULL };
   regmatch_t *prev_idx_match;
+  int prev_idx_match_malloced = 0;
 
 #ifdef DEBUG
   assert (nmatch > 1);
@@ -1372,7 +1373,18 @@ set_regs (const regex_t *preg, const re_
   cur_node = dfa->init_node;
   re_node_set_init_empty (&eps_via_nodes);
 
-  prev_idx_match = (regmatch_t *) alloca (sizeof (regmatch_t) * nmatch);
+  if (__libc_use_alloca (nmatch * sizeof (regmatch_t)))
+prev_idx_match = (regmatch_t *) alloca (nmatch * sizeof (regmatch_t));
+  else
+{
+  prev_idx_match = re_malloc (regmatch_t, nmatch);
+  if (prev_idx_match == NULL)
+   {
+ free_fail_stack_return (fs);
+ return REG_ESPACE;
+   }
+  prev_idx_match_malloced = 1;
+}
   memcpy (prev_idx_match, pmatch, sizeof (regmatch_t) * nmatch);
 
   for (idx = pmatch[0].rm_so; idx <= pmatch[0].rm_eo ;)
@@ -1390,6 +1402,8 @@ set

Re: getpass: use of termios.h problematic

2005-08-25 Thread Simon Josefsson
Paul Eggert <[EMAIL PROTECTED]> writes:

> Simon Josefsson <[EMAIL PROTECTED]> writes:
>
>> Ok to install?
>
> OK, with the following caveats:
>
> * Please put the standard implementation first, and the Windows implementation
>   second.  That'll make it easier to read.

Yup.

> * Please use standard GNU indenting style, e.g.,

I ran indent.

For reference, the patch below is what I installed.

Thanks!

Index: lib/ChangeLog
===
RCS file: /cvsroot/gnulib/gnulib/lib/ChangeLog,v
retrieving revision 1.932
diff -u -p -r1.932 ChangeLog
--- lib/ChangeLog   25 Aug 2005 20:39:57 -  1.932
+++ lib/ChangeLog   25 Aug 2005 21:18:26 -
@@ -1,3 +1,9 @@
+2005-08-24  Simon Josefsson  <[EMAIL PROTECTED]>
+
+   * getpass.c: Add WIN32 implementation.  Conditionalize use of
+   termios.h, tcgetattr, tcsetattr and __fsetlocking.  Remove some
+   GLIBC specific code.
+
 2005-08-25  Paul Eggert  <[EMAIL PROTECTED]>
 
Make regex safe for g++.  This fixes one real bug (an "err"
Index: lib/getpass.c
===
RCS file: /cvsroot/gnulib/gnulib/lib/getpass.c,v
retrieving revision 1.11
diff -u -p -r1.11 getpass.c
--- lib/getpass.c   14 May 2005 06:03:58 -  1.11
+++ lib/getpass.c   25 Aug 2005 21:18:26 -
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992-2001, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1992-2001, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
 
This program is free software; you can redistribute it and/or modify
@@ -19,43 +19,28 @@
 # include 
 #endif
 
-#if !_LIBC
-# include "getpass.h"
-#endif
+#include "getpass.h"
 
-#if _LIBC
-# define HAVE_STDIO_EXT_H 1
-#endif
+#include 
+
+#if !defined WIN32
 
 #include 
 
-#include 
 #if HAVE_STDIO_EXT_H
 # include 
-#else
-# define __fsetlocking(stream, type) /* empty */
 #endif
-#if !_LIBC
-# include "getline.h"
+#if !HAVE___FSETLOCKING
+# define __fsetlocking(stream, type)   /* empty */
 #endif
 
-#include 
-#include 
-
-#if _LIBC
-# include 
+#if HAVE_TERMIOS_H
+# include 
 #endif
 
-#if _LIBC
-# define NOTCANCEL_MODE "c"
-#else
-# define NOTCANCEL_MODE
-#endif
+#include "getline.h"
 
-#if _LIBC
-# define flockfile(s) _IO_flockfile (s)
-# define funlockfile(s) _IO_funlockfile (s)
-#elif USE_UNLOCKED_IO
+#if USE_UNLOCKED_IO
 # include "unlocked-io.h"
 #else
 # if !HAVE_DECL_FFLUSH_UNLOCKED
@@ -80,18 +65,6 @@
 # endif
 #endif
 
-#if _LIBC
-# include 
-#else
-# define __libc_cleanup_push(function, arg) /* empty */
-# define __libc_cleanup_pop(execute) /* empty */
-#endif
-
-#if !_LIBC
-# define __getline getline
-# define __tcgetattr tcgetattr
-#endif
-
 /* It is desirable to use this bit on systems that have it.
The only bit of terminal state we want to twiddle is echoing, which is
done in software; there is no need to change the state of the terminal
@@ -114,7 +87,7 @@ getpass (const char *prompt)
   FILE *tty;
   FILE *in, *out;
   struct termios s, t;
-  bool tty_changed;
+  bool tty_changed = false;
   static char *buf;
   static size_t bufsize;
   ssize_t nread;
@@ -122,7 +95,7 @@ getpass (const char *prompt)
   /* Try to write to and read from the terminal if we can.
  If we can't open the terminal, use stderr and stdin.  */
 
-  tty = fopen ("/dev/tty", "w+" NOTCANCEL_MODE);
+  tty = fopen ("/dev/tty", "w+");
   if (tty == NULL)
 {
   in = stdin;
@@ -136,39 +109,26 @@ getpass (const char *prompt)
   out = in = tty;
 }
 
-  /* Make sure the stream we opened is closed even if the thread is
- canceled.  */
-  __libc_cleanup_push (call_fclose, tty);
-
   flockfile (out);
 
   /* Turn echoing off if it is on now.  */
-
-  if (__tcgetattr (fileno (in), &t) == 0)
+#if HAVE_TCGETATTR
+  if (tcgetattr (fileno (in), &t) == 0)
 {
   /* Save the old one. */
   s = t;
   /* Tricky, tricky. */
-  t.c_lflag &= ~(ECHO|ISIG);
-  tty_changed = (tcsetattr (fileno (in), TCSAFLUSH|TCSASOFT, &t) == 0);
+  t.c_lflag &= ~(ECHO | ISIG);
+  tty_changed = (tcsetattr (fileno (in), TCSAFLUSH | TCSASOFT, &t) == 0);
 }
-  else
-tty_changed = false;
+#endif
 
   /* Write the prompt.  */
-#ifdef USE_IN_LIBIO
-  if (_IO_fwide (out, 0) > 0)
-__fwprintf (out, L"%s", prompt);
-  else
-#endif
-fputs_unlocked (prompt, out);
+  fputs_unlocked (prompt, out);
   fflush_unlocked (out);
 
   /* Read the password.  */
-  nread = __getline (&buf, &bufsize, in);
-
-#if !_LIBC
-  /* As far as is known, glibc doesn't need this no-op fseek.  */
+  nread = getline (&buf, &bufsize, in);
 
   /* According to the C standard, input may not be followed by output
  on the same stream without an intervening call to a file
@@ -180,7 +140,6 @@ getpass (const char *prompt)
  from POSIX version to POSIX version, so play it safe and invoke
  fseek even if in != out.  */
   fseek (out, 0, SEEK_CUR);
-#endif
 
   

Re: gnulib-tool: support for unit test modules

2005-08-25 Thread Simon Josefsson
Bruno Haible <[EMAIL PROTECTED]> writes:

> I'm adding to gnulib-tool the support for unitary tests.

Great!

I routinely build my software on many platforms too, and I can set up
to build a gnulib megatestdir once the tests are sufficiently useful.

I'll try to write tests for my modules, but I know it won't be high
priority...


___
bug-gnulib mailing list
bug-gnulib@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnulib


Re: regex & g++

2005-08-25 Thread Paul Eggert
Sam Steingold <[EMAIL PROTECTED]> writes:

> a superficial code examination shows that these are indeed bugs in
> regex: build_wcs_upper_buffer should be declared to return reg_errcode_t
> and not int.

Thanks for reporting this.  I installed the following patch, which I
hope covers all the C++ problems in the regex module.  I also filed
glibc bug 1241.

2005-08-25  Paul Eggert  <[EMAIL PROTECTED]>

Make regex safe for g++.  This fixes one real bug (an "err"
that should have been "*err").  g++ problem reported by
Sam Steingold.
* config/srclist.txt: Add glibc bug 1241.
* lib/regex_internal.h (re_calloc): New macro, consistent with
re_malloc etc.  All callers of calloc changed to use re_calloc.
* lib/regex_internal.c (build_wcs_upper_buffer): Return reg_errcode_t,
not int.  All callers changed.
* lib/regcomp.c (re_compile_fastmap_iter): Don't use alloca
(mb_cur_max); just use an array of size MB_LEN_MAX.
* lib/regexec.c (push_fail_stack): Use re_realloc, not realloc.
(find_recover_state): Change "err" to "*err"; this fixes what
appears to be a real bug.
(check_arrival_expand_ecl_sub): Be consistent about reg_errcode_t
versus int.

--- config/srclist.txt  25 Aug 2005 05:09:01 -  1.85
+++ config/srclist.txt  25 Aug 2005 20:37:51 -
@@ -101,6 +101,7 @@ $LIBCSRC/stdlib/getsubopt.c lib gpl
 # http://sources.redhat.com/bugzilla/show_bug.cgi?id=1224
 # http://sources.redhat.com/bugzilla/show_bug.cgi?id=1237
 # http://sources.redhat.com/bugzilla/show_bug.cgi?id=1240
+# http://sources.redhat.com/bugzilla/show_bug.cgi?id=1241
 #$LIBCSRC/posix/regcomp.c  lib gpl
 #
 # http://sources.redhat.com/bugzilla/show_bug.cgi?id=1238
@@ -120,11 +121,13 @@ $LIBCSRC/stdlib/getsubopt.c   lib gpl
 # http://sources.redhat.com/bugzilla/show_bug.cgi?id=1226
 # http://sources.redhat.com/bugzilla/show_bug.cgi?id=1231
 # http://sources.redhat.com/bugzilla/show_bug.cgi?id=1237
+# http://sources.redhat.com/bugzilla/show_bug.cgi?id=1241
 #$LIBCSRC/posix/regex_internal.c   lib gpl
 #
 # http://sources.redhat.com/bugzilla/show_bug.cgi?id=1054
 # http://sources.redhat.com/bugzilla/show_bug.cgi?id=1221
 # http://sources.redhat.com/bugzilla/show_bug.cgi?id=1237
+# http://sources.redhat.com/bugzilla/show_bug.cgi?id=1241
 #$LIBCSRC/posix/regex_internal.h   lib gpl
 #
 # http://sources.redhat.com/bugzilla/show_bug.cgi?id=1216
@@ -133,6 +136,7 @@ $LIBCSRC/stdlib/getsubopt.c lib gpl
 # http://sources.redhat.com/bugzilla/show_bug.cgi?id=1227
 # http://sources.redhat.com/bugzilla/show_bug.cgi?id=1231
 # http://sources.redhat.com/bugzilla/show_bug.cgi?id=1237
+# http://sources.redhat.com/bugzilla/show_bug.cgi?id=1241
 #$LIBCSRC/posix/regexec.c  lib gpl
 #
 # c89 changes $LIBCSRC/string/strdup.c lib gpl
--- lib/regex_internal.h24 Aug 2005 23:29:39 -  1.3
+++ lib/regex_internal.h25 Aug 2005 20:21:02 -
@@ -391,7 +391,8 @@ static reg_errcode_t re_string_realloc_b
  internal_function;
 #ifdef RE_ENABLE_I18N
 static void build_wcs_buffer (re_string_t *pstr) internal_function;
-static int build_wcs_upper_buffer (re_string_t *pstr) internal_function;
+static reg_errcode_t build_wcs_upper_buffer (re_string_t *pstr)
+ internal_function;
 #endif /* RE_ENABLE_I18N */
 static void build_upper_buffer (re_string_t *pstr) internal_function;
 static void re_string_translate_buffer (re_string_t *pstr) internal_function;
@@ -431,6 +432,7 @@ static unsigned char re_string_fetch_byt
 #define re_string_set_index(pstr,idx) ((pstr)->cur_idx = (idx))
 
 #define re_malloc(t,n) ((t *) malloc ((n) * sizeof (t)))
+#define re_calloc(t,n) ((t *) calloc (n, sizeof (t)))
 #define re_realloc(p,t,n) ((t *) realloc (p, (n) * sizeof (t)))
 #define re_free(p) free (p)
 
--- lib/regex_internal.c24 Aug 2005 23:29:39 -  1.7
+++ lib/regex_internal.c25 Aug 2005 20:21:02 -
@@ -258,7 +258,7 @@ build_wcs_buffer (re_string_t *pstr)
 /* Build wide character buffer PSTR->WCS like build_wcs_buffer,
but for REG_ICASE.  */
 
-static int
+static reg_errcode_t
 internal_function
 build_wcs_upper_buffer (re_string_t *pstr)
 {
@@ -707,7 +707,7 @@ re_string_reconstruct (re_string_t *pstr
 {
   if (pstr->icase)
{
- int ret = build_wcs_upper_buffer (pstr);
+ reg_errcode_t ret = build_wcs_upper_buffer (pstr);
  if (BE (ret != REG_NOERROR, 0))
return ret;
}
@@ -1504,7 +1504,7 @@ create_ci_newstate (re_dfa_t *dfa, const
   reg_errcode_t err;
   re_dfastate_t *newstate;
 
-  newstate = (re_dfastate_t *) calloc (sizeof (re_dfastate_t), 1);
+  newstate = re_calloc (re_dfastate_t, 1);
   if (BE (newstate == NULL, 0))
 return NULL;
   err = re_node_set_init_copy (&newstate->nodes, nodes);
@@ -1554,7 +1554,7 @@ create_cd_newstate (re_dfa_t *dfa, const
   reg_errcode_t err;
   re_d

Re: regex.m4: skip autodetection if it is not necessary

2005-08-25 Thread Paul Eggert
Stepan Kasal <[EMAIL PROTECTED]> writes:

> 2005-08-25  Stepan Kasal  <[EMAIL PROTECTED]>
>
>   * regex.m4: If --with-included-regex was given, skip the autodetection.

Thanks; I installed that.


___
bug-gnulib mailing list
bug-gnulib@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnulib


Re: update minmax.m4

2005-08-25 Thread Bruno Haible
Stepan Kasal wrote on 2005-06-30:
> I think it's time to re-submit my patch to minmax.m4.
> A new version of the patch is attached to this mail.
>
> Again, it features:
> > - use m4_pushdef/m4_popdef instead of define/undefine
>
> As I explained before, you cannot inadvertently undefine([HEADER]).

OK, I'm taking this.

> > - avoid the obsoleted AC_TRY_COMPILE
>
> Some people run "autoconf -W obsolete", and the macros from gnulib
> shouldn't spoil it.

There are dozens of AC_TRY_COMPILE invocations in gnulib's macros.
Nobody who uses "autoconf -W obsolete" complained about them so far,
and probably noone will until autoconf 3.0 really drops this macro or
emit serious warnings for its use.

I don't see why I should be the first one to engage in AC_TRY_COMPILE's
elimination.

> > - use AS_TR_* instead of raw m4_translit
>
> Do you see any problem with this patch?  All used macros are now
> documented.

Thanks, yes they are documented now. (Hope they won't be withdrawn before
autoconf-2.60 :-).) I applied this as well.

Bruno



___
bug-gnulib mailing list
bug-gnulib@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnulib


Re: Bug Report: sed-4.1.4 misinterprets uClibc's malloc (patch included)

2005-08-25 Thread Paul Eggert
Yuri Vasilevski <[EMAIL PROTECTED]> writes:

> Recent versions of sed expect glibc behavior form malloc, i.e.
> malloc(0) return live pointer. This is not true for uClibc (and many
> other old/classical libc implementations).

Thanks, but I'd rather not go through the glibc regex implementation
looking for other instances of this problem; it will be a maintenance
and reliability hassle.

Instead, let's substitute a malloc that behaves compatibly with GNU
malloc.  I installed this change into gnulib, and I expect when this
patch trickles into sed, then sed will use the gnulib malloc
substitute on uClibc, and that will fix the problem there.

2005-08-25  Paul Eggert  <[EMAIL PROTECTED]>

* modules/regex (Depends-on): Add malloc, since the code
assumes that !malloc(0) means failure.

--- modules/regex   7 Jul 2005 08:08:39 -   1.10
+++ modules/regex   25 Aug 2005 19:43:51 -
@@ -15,6 +15,7 @@ Depends-on:
 alloca
 extensions
 gettext-h
+malloc
 restrict
 
 configure.ac:


___
bug-gnulib mailing list
bug-gnulib@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnulib


Re: getpass: use of termios.h problematic

2005-08-25 Thread Paul Eggert
Simon Josefsson <[EMAIL PROTECTED]> writes:

> Ok to install?

OK, with the following caveats:

* Please put the standard implementation first, and the Windows implementation
  second.  That'll make it easier to read.

* Please use standard GNU indenting style, e.g.,

char *
getpass (const char *prompt)
{
  ...
}


___
bug-gnulib mailing list
bug-gnulib@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnulib


Re: sysexits.h: Define EX_OK

2005-08-25 Thread Paul Eggert
Stepan Kasal <[EMAIL PROTECTED]> writes:

> something like the attached patch (not tested)?

Yes, something like that.

For sanity's sake, I'd use the string "exitcodes" uniformly, though
(e.g., modules/exitcodes, m4/exitcodes.m4, gl_EXITCODES).  And I'd
move the "#include " next to the other system includes, as
it's usually better to put system includes first.

I'd like Bruno's opinion on this before installing it though, as he
was the one who ran into problems with EXIT_SUCCESS and EXIT_FAILURE.


___
bug-gnulib mailing list
bug-gnulib@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnulib


cvs coreutils was broken wrt LARGEFILE support

2005-08-25 Thread Jim Meyering
Today I tried to use `cp' to copy a file larger than 2GB and
was surprised to get a `File too large' error.
Here's the patch I've applied to both coreutils and gnulib:

2005-08-25  Jim Meyering  <[EMAIL PROTECTED]>

* open-safer.c: Include .
Otherwise, we'd lose LARGEFILE support in any file using
e.g. "fcntl--.h"

Index: lib/open-safer.c
===
RCS file: /fetish/cu/lib/open-safer.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -p -u -r1.3 -r1.4
--- lib/open-safer.c3 Jul 2005 06:43:07 -   1.3
+++ lib/open-safer.c25 Aug 2005 16:28:18 -  1.4
@@ -17,6 +17,10 @@
 
 /* Written by Paul Eggert.  */
 
+#if HAVE_CONFIG_H
+# include 
+#endif
+
 #include "fcntl-safer.h"
 
 #include 



___
bug-gnulib mailing list
bug-gnulib@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnulib


Re: gettimeofday() for Win32

2005-08-25 Thread Jim Meyering
Paul Eggert <[EMAIL PROTECTED]> wrote:
> I suspect that he'll say it's OK with him as long as it's no real work
> for him.

That's accurate :)


___
bug-gnulib mailing list
bug-gnulib@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnulib


Re: [bug-gnulib] synced mktime.c and strtol.c from intprops.h

2005-08-25 Thread Stepan Kasal
Hello,

On Thu, Aug 25, 2005 at 09:21:00AM -0700, Paul Eggert wrote:
> > What would be wrong with the following patch?
> 
> Synchronization with glibc.  mktime.c is shared with the GNU C
> Library, and glibc doesn't have intprops.h.

thanks for explanation.  I'm dropping the patch.

> I suppose that we could migrate intprops.h into glibc, but that would

Yes, that might take some effort...

Stepan


___
bug-gnulib mailing list
bug-gnulib@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnulib


Re: [bug-gnulib] gettimeofday() for Win32

2005-08-25 Thread Paul Eggert
Bruno Haible <[EMAIL PROTECTED]> writes:

> What's the right way to fill the struct timezone?

Don't fill it in at all.  Don't even look at the pointer to it.  POSIX
says portable applications must always pass NULL, but I wouldn't even
rely on that.

>> I have two questions: Would you consider integrating such changes into
>> the existing module at all?
>
> Jim?

I suspect that he'll say it's OK with him as long as it's no real work
for him.


___
bug-gnulib mailing list
bug-gnulib@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnulib


Re: [bug-gnulib] synced mktime.c and strtol.c from intprops.h

2005-08-25 Thread Paul Eggert
Stepan Kasal <[EMAIL PROTECTED]> writes:

> What would be wrong with the following patch?

Synchronization with glibc.  mktime.c is shared with the GNU C
Library, and glibc doesn't have intprops.h.

I suppose that we could migrate intprops.h into glibc, but that would
be a bigger project and we're having enough trouble as it is keeping
them in sync.


___
bug-gnulib mailing list
bug-gnulib@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnulib


Re: error: possibly undefined macro: AC_CHECK_HEADERS_ONCE

2005-08-25 Thread Stepan Kasal
Hello,

On Thu, Aug 25, 2005 at 05:06:55PM +0200, Bruno Haible wrote:
>  AC_INIT(regexp, 1.0, clisp-list)
> +AC_GNU_SOURCE
>  AC_CONFIG_SRCDIR(regexp.lisp)

> That might be a little too early,  [...]
> I would put it after the determination of CC and CPP, but
> before all AC_CHECK_HEADER and AC_CHECK_FUNC tests:
>...
>  AC_PROG_CC
>  AC_PROG_CPP
>  AC_AIX
> +AC_GNU_SOURCE
>  AC_HEADER_STDC

yes, this is probably a good idea.  The gnulib manual also says that gl_EARLY
should be called right after AC_PROG_CC.

But as far as the artificial configure.ac is concerned, I think calling
AC_GNU_SOURCE right after AC_INIT doesn't make it worse, so it can be
left the way I did it.

> [...] because AC_GNU_SOURCE emits a definition into the config header,
> but before AC_CONFIG_HEADERS it doesn't know the file name...

No, AC_CONFIG_HEADERS has nothing to do with this.  During the run of
./configure, the AC_DEFINES are collected.  At the end of the day,
AC_OUTPUT engraves them all into all config headers.

>From the perspective of Autoconf and ./configure, config headers can
be declared anywhere (between AC_INIT and AC_OUTPUT, of course).

>From the perspective of autoheader, the name of the first of the declared
config headers is important.  But autoheader doesn't care about AC_DEFINEs,
and it has nothing to do with ./configure execution.

All these facts should be deducable from the Autoconf manual.  I have
recently fixed some of this in CVS; if the CVS version of manual doesn't
describe the situation clearly, suggestions are welcome.

Have a nice day,
Stepan


___
bug-gnulib mailing list
bug-gnulib@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnulib


Re: [bug-gnulib] gettimeofday() for Win32

2005-08-25 Thread Martin Lambers
On Thu, 25. Aug 2005, 15:32:00 +0200, Bruno Haible wrote:
> > If so, how can this be done?
> 
> It can be done by merging your .m4 file with Jim's one, and put a big
> #if inside lib/gettimeofday.c. 

OK, I had no better idea than defining GETTIMEOFDAY_USE_REPLACEMENTS if
the replacement functions should be used, and let the big #if test that.
Besides introducing another constat, this has the disadvantage that
rpl_tzset is compiled even when it is not activated by the tzset module.
There's probably a better way to do it.

> But first, can you please bring your proposed code up to gnulib
> standards?

Done.

> And compare the code with GNU clisp's gettimeofday emulations. (I wrote
> that code => no copyright problems when porting it to gnulib.)

I used your code, with one exception:

> What's the right way to fill the struct timezone?

Newer descriptions of the gettimeofday function replaced 'struct
timezone * tzp' with 'void * tzp' and state that "If tzp is not a null
pointer, the behavior is unspecified." See
http://www.opengroup.org/onlinepubs/009695399/functions/gettimeofday.html
The code below therefore simply ignores the tzp argument.

I also added a test module, using the test code from Jim Meyering's
tests in gettimeofday.m4.

Thanks for your comments,
Martin


diff -uNr gnulib/lib/gettimeofday.c gnulib-gettimeofday-work/lib/gettimeofday.c
--- gnulib/lib/gettimeofday.c   2005-05-14 08:03:58.0 +0200
+++ gnulib-gettimeofday-work/lib/gettimeofday.c 2005-08-25 17:01:47.0 
+0200
@@ -1,8 +1,9 @@
-/* Work around the bug in some systems whereby gettimeofday clobbers the
+/* Provide gettimeofday for systems that don't have it, or 
+   work around the bug in some systems whereby gettimeofday clobbers the
static buffer that localtime uses for it's return value.  The gettimeofday
function from Mac OS X 10.0.4, i.e. Darwin 1.3.7 has this problem.
The tzset replacement is necessary for at least Solaris 2.5, 2.5.1, and 2.6.
-   Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
 
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -31,19 +32,35 @@
 
 #include 
 
-#if TIME_WITH_SYS_TIME
-# include 
-# include 
-#else
-# if HAVE_SYS_TIME_H
-#  include 
-# else
-#  include 
-# endif
+#include 
+
+#ifdef _WIN32
+#include 
 #endif
 
-#include 
+#include "gettimeofday.h"
+
+#ifndef HAVE_GETTIMEOFDAY
+int 
+gettimeofday (struct timeval *tp, void *tzp)
+{
+  if (tp != NULL)
+{
+#ifdef _WIN32
+  struct _timeb timebuf;
+  _ftime (&timebuf);
+  tp->tv_sec = timebuf.time;
+  tp->tv_usec = (long)(timebuf.millitm) * (100/1000);
+#else
+  tp->tv_sec = time (NULL);
+  tp->tv_usec = 0;
+#endif
+}
+  return 0;
+}
+#endif /* HAVE_GETTIMEOFDAY */
 
+#ifdef GETTIMEOFDAY_USE_REPLACEMENTS
 static struct tm *localtime_buffer_addr;
 
 /* This is a wrapper for localtime.  It is used only on systems for which
@@ -119,3 +136,4 @@
   tzset ();
   *localtime_buffer_addr = save;
 }
+#endif /* GETTIMEOFDAY_USE_REPLACEMENTS */
diff -uNr gnulib/lib/gettimeofday.h gnulib-gettimeofday-work/lib/gettimeofday.h
--- gnulib/lib/gettimeofday.h   1970-01-01 01:00:00.0 +0100
+++ gnulib-gettimeofday-work/lib/gettimeofday.h 2005-08-25 17:28:06.908471216 
+0200
@@ -0,0 +1,50 @@
+/* Provide gettimeofday for systems that don't have it, or 
+   work around the bug in some systems whereby gettimeofday clobbers the
+   static buffer that localtime uses for it's return value.  The gettimeofday
+   function from Mac OS X 10.0.4, i.e. Darwin 1.3.7 has this problem.
+   The tzset replacement is necessary for at least Solaris 2.5, 2.5.1, and 2.6.
+   Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+
+#ifndef GETTIMEOFDAY_H
+#define GETTIMEOFDAY_H
+
+#include 
+
+#if TIME_WITH_SYS_TIME
+# include 
+# include 
+#else
+# if HAVE_SYS_TIME_H
+#  include 
+# else
+#  include 
+# endif
+#endif
+
+#ifndef HAVE_STRUCT_TIMEVAL
+struct timeval
+{
+  time_t tv_sec;
+  suseconds_t tv_usec;
+};
+#endif
+
+#ifndef HAVE_GETTIMEOFDAY
+int gettimeofday (struct timeval *tp, void *tzp);
+#endif
+
+#endif /* GET

Re: Non-standard types in public header files

2005-08-25 Thread Stepan Kasal
Hello,

On Sat, Aug 13, 2005 at 07:30:21PM -0500, Albert Chin wrote:
> Look at how glib solves a similar problem. Of course, they define
> their own types but they install a platform-specific .h file in
> $prefix/lib/include (glibconfig.h). This is similar to the
> gnutls-config.h suggested by Stepan Kasal.
> 
> AC_CONFIG_COMMANDS([gnutlsconfig.h],
> [
>   outfile=gnutlsconfig.h
>   cat >$outfile <<_EOF_
> #ifndef __GNUTLSCONFIG_H__
> #define __GNUTLSCONFIG_H__
> 
> _EOF_
> 
>   if test x$HAVE_SSIZE_T = xyes; then
> echo '#define GTLS_SSIZE_T ssize_t' >>$outfile
>   else
> echo '#define GTLS_SSIZE_T long' >>$outfile
>   fi
> 
>   echo '#endif /* __GNUTLSCONFIG_H__ */' >>$outfile
> ])

yes, this is similar, but not pure enough, I think.

I think that gnutlsconfig.h should contain only information bits about
the system, with comments similar to what you see in config.h.
So it would #define GNUTLS_HAVE_SSIZE_T or not.

Currently, glib's configure.in contains:

outfile=glibconfig.h-tmp
if test x$glib_limits_h = xyes; then
  echo '#include ' >> $outfile
fi
if test x$glib_float_h = xyes; then
  echo '#include ' >> $outfile
fi
if test x$glib_values_h = xyes; then
  echo '#include ' >> $outfile
fi
(glib_values_h is set to yes only if limits.h or float.h is missing).

Instead, it should define GLIB_HAVE_LIMITS_H, GLIB_HAVE_FLOAT_H and
GLIB_HAVE_VALUES_H to 1, if the headers are available.
Another file, say gnutls-features.h, would

#include 

and then:

#if GLIB_HAVE_LIMITS_H
# include 
#elif GLIB_HAVE_VALUES_H
# include 
#endif

#if GLIB_HAVE_FLOAT_H
# include 
#elif GLIB_HAVE_VALUES_H
# include 
#endif

Simon said that public header should work with any of the compilers on the
host.  While we cannot fully achieve this, this setup can help.
If the description in gnutlconfig.h happens to be inacurate, the user can
supply it's own copy, editing some of the bits.  (It might even work! ;-)

This rationale is similar to why we have config.h.in; in rare cases, users
can use it as a form to fill...

Another reason is that the constant gnutls-features.h header shows all the
possible alternatives, and gnutlsconfig.h selects which should be executed.

With glib, I cannot see the other alternatives, unless I look into
configure.in.  (Which is not installed, of course.)

A few days ago I consulted glibconfig.h for the definition of
G_GINT64_CONSTANT.  I saw only one definition, so I assumed it's the only
one.  Perhaps I have compromised the portability of the package I was
working on, because of that false assumption.

Hope this essay will help you to make the right decision.  ;-)

Happy hacking,
Stepan Kasal


___
bug-gnulib mailing list
bug-gnulib@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnulib


Re: error: possibly undefined macro: AC_CHECK_HEADERS_ONCE

2005-08-25 Thread Stepan Kasal
Hello,

On Thu, Aug 25, 2005 at 09:36:12AM -0400, Sam Steingold wrote:
> But I do not have lib/regex.c!
> I have regex.c in the current directory!
> Is it OK?

yes, it is.

Stepan


___
bug-gnulib mailing list
bug-gnulib@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnulib


Re: [bug-gnulib] Re: error: possibly undefined macro: AC_CHECK_HEADERS_ONCE

2005-08-25 Thread Bruno Haible
Sam Steingold wrote:
> But I do not have lib/regex.c!
> I have regex.c in the current directory!
> Is it OK?

Yes, it is OK since clisp is not using automake. Only in projects with a
Makefile.am it is a problem if you don't put the AC_LIBSOURCEd files into
lib/.

Bruno



___
bug-gnulib mailing list
bug-gnulib@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnulib


Re: [bug-gnulib] Re: error: possibly undefined macro: AC_CHECK_HEADERS_ONCE

2005-08-25 Thread Bruno Haible
Stepan Kasal wrote:
> There was one remaining problem: AC_GNU_SOURCE has to be called early in
> configure.ac.
> ...
@@ -4,6 +4,7 @@
 
 AC_PREREQ(2.57)
 AC_INIT(regexp, 1.0, clisp-list)
+AC_GNU_SOURCE
 AC_CONFIG_SRCDIR(regexp.lisp)
 AC_CONFIG_AUX_DIR(../../src/build-aux)
 AC_CONFIG_HEADERS(config.h)

That might be a little too early, because AC_GNU_SOURCE emits a definition
into the config header, but before AC_CONFIG_HEADERS it doesn't know the
file name... I would put it after the determination of CC and CPP, but
before all AC_CHECK_HEADER and AC_CHECK_FUNC tests:

 AC_PREREQ(2.57)
 AC_INIT(regexp, 1.0, clisp-list)
 AC_CONFIG_SRCDIR(regexp.lisp)
 AC_CONFIG_AUX_DIR(../../src/build-aux)
 AC_CONFIG_HEADERS(config.h)
 
 AC_MSG_NOTICE([* Regexp (Checks)])
 AC_PROG_CC
 AC_PROG_CPP
 AC_AIX
+AC_GNU_SOURCE
 AC_HEADER_STDC
 AC_CHECK_HEADERS(string.h sys/types.h)


Bruno



___
bug-gnulib mailing list
bug-gnulib@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnulib


Re: [bug-gnulib] synced mktime.c and strtol.c from intprops.h

2005-08-25 Thread Stepan Kasal
Hello,
  regarding this old patch:

On Mon, Mar 14, 2005 at 04:46:10PM -0800, Paul Eggert wrote:
> When I updated intprops.h I forgot to make similar modifications to
> mktime.c and strtol.c.  I installed this patch to fix that.
> 
> 2005-03-14  Paul Eggert  <[EMAIL PROTECTED]>
> 
>   * mktime.c (TYPE_TWOS_COMPLEMENT, TYPE_ONES_COMPLEMENT,
>   TYPE_SIGNED_MAGNITUDE, TYPE_MINIMUM, TYPE_MAXIMUM): Sync from
>   intprops.h.
>   * strtol.c: Likewise.

Why it is not possible to #include intprops.h?

What would be wrong with the following patch?

Stepan
2005-08-25  Stepan Kasal  <[EMAIL PROTECTED]>

* modules/mktime, modules/strtol: Add lib/intprops.h.
* modules/xstrtol: Fix a typo in a comment.

2005-08-25  Stepan Kasal  <[EMAIL PROTECTED]>

* mktime.c, strtol.c: Include intprops.h instead of defining the
same macros.

Index: lib/mktime.c
===
RCS file: /cvsroot/gnulib/gnulib/lib/mktime.c,v
retrieving revision 1.52
diff -u -r1.52 mktime.c
--- lib/mktime.c23 Jun 2005 07:14:09 -  1.52
+++ lib/mktime.c25 Aug 2005 14:28:49 -
@@ -62,38 +62,7 @@
? (a) >> (b)\
: (a) / (1 << (b)) - ((a) % (1 << (b)) < 0))
 
-/* The extra casts in the following macros work around compiler bugs,
-   e.g., in Cray C 5.0.3.0.  */
-
-/* True if the arithmetic type T is an integer type.  bool counts as
-   an integer.  */
-#define TYPE_IS_INTEGER(t) ((t) 1.5 == 1)
-
-/* True if negative values of the signed integer type T use two's
-   complement, ones' complement, or signed magnitude representation,
-   respectively.  Much GNU code assumes two's complement, but some
-   people like to be portable to all possible C hosts.  */
-#define TYPE_TWOS_COMPLEMENT(t) ((t) ~ (t) 0 == (t) -1)
-#define TYPE_ONES_COMPLEMENT(t) ((t) ~ (t) 0 == 0)
-#define TYPE_SIGNED_MAGNITUDE(t) ((t) ~ (t) 0 < (t) -1)
-
-/* True if the arithmetic type T is signed.  */
-#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
-
-/* The maximum and minimum values for the integer type T.  These
-   macros have undefined behavior if T is signed and has padding bits.
-   If this is a problem for you, please let us know how to fix it for
-   your host.  */
-#define TYPE_MINIMUM(t) \
-  ((t) (! TYPE_SIGNED (t) \
-   ? (t) 0 \
-   : TYPE_SIGNED_MAGNITUDE (t) \
-   ? ~ (t) 0 \
-   : ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1)))
-#define TYPE_MAXIMUM(t) \
-  ((t) (! TYPE_SIGNED (t) \
-   ? (t) -1 \
-   : ~ (~ (t) 0 << (sizeof (t) * CHAR_BIT - 1
+#include "intprops.h"
 
 #ifndef TIME_T_MIN
 # define TIME_T_MIN TYPE_MINIMUM (time_t)
Index: lib/strtol.c
===
RCS file: /cvsroot/gnulib/gnulib/lib/strtol.c,v
retrieving revision 1.23
diff -u -r1.23 strtol.c
--- lib/strtol.c14 May 2005 06:03:58 -  1.23
+++ lib/strtol.c25 Aug 2005 14:28:49 -
@@ -124,34 +124,7 @@
 # define STRTOL_LONG_MAX LONG_LONG_MAX
 # define STRTOL_ULONG_MAX ULONG_LONG_MAX
 
-/* The extra casts in the following macros work around compiler bugs,
-   e.g., in Cray C 5.0.3.0.  */
-
-/* True if negative values of the signed integer type T use two's
-   complement, ones' complement, or signed magnitude representation,
-   respectively.  Much GNU code assumes two's complement, but some
-   people like to be portable to all possible C hosts.  */
-# define TYPE_TWOS_COMPLEMENT(t) ((t) ~ (t) 0 == (t) -1)
-# define TYPE_ONES_COMPLEMENT(t) ((t) ~ (t) 0 == 0)
-# define TYPE_SIGNED_MAGNITUDE(t) ((t) ~ (t) 0 < (t) -1)
-
-/* True if the arithmetic type T is signed.  */
-# define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
-
-/* The maximum and minimum values for the integer type T.  These
-   macros have undefined behavior if T is signed and has padding bits.
-   If this is a problem for you, please let us know how to fix it for
-   your host.  */
-# define TYPE_MINIMUM(t) \
-   ((t) (! TYPE_SIGNED (t) \
-? (t) 0 \
-: TYPE_SIGNED_MAGNITUDE (t) \
-? ~ (t) 0 \
-: ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1)))
-# define TYPE_MAXIMUM(t) \
-   ((t) (! TYPE_SIGNED (t) \
-? (t) -1 \
-: ~ (~ (t) 0 << (sizeof (t) * CHAR_BIT - 1
+# include "intprops.h"
 
 # ifndef ULONG_LONG_MAX
 #  define ULONG_LONG_MAX TYPE_MAXIMUM (unsigned long long)
Index: modules/mktime
===
RCS file: /cvsroot/gnulib/gnulib/modules/mktime,v
retrieving revision 1.5
diff -u -r1.5 mktime
--- modules/mktime  22 Sep 2004 15:11:04 -  1.5
+++ modules/mktime  25 Aug 2005 14:28:49 -
@@ -2,6 +2,7 @@
 mktime() function: convert broken-down time to linear time.
 
 Files:
+lib/intprops.h
 lib/mktime.c
 m4/mktime.m4
 
Index: modules/strtol
===
RCS file: /cvsroot/gnulib/gnulib/modules/strtol,v
retrieving revision 1.4
diff -u -r1.4 strtol
--- modul

Re: error: possibly undefined macro: AC_CHECK_HEADERS_ONCE

2005-08-25 Thread Sam Steingold
> * Stepan Kasal <[EMAIL PROTECTED]> [2005-08-25 11:06:00 +0200]:
>
> On Wed, Aug 24, 2005 at 10:30:44PM -0400, Sam Steingold wrote:
>> gnulib CVS head does not contain gl_INCLUDED_REGEX.
>
> (gl_REGEX): Don't bother checking whether lib/regex.c exists;
> assume that it does.
>
> The first change means you have to call gl_REGEX instead.

But I do not have lib/regex.c!
I have regex.c in the current directory!
Is it OK?

-- 
Sam Steingold (http://www.podval.org/~sds) running w2k
 
  
Your mouse has moved - WinNT has to be restarted for this to take effect.



___
bug-gnulib mailing list
bug-gnulib@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnulib


Re: gnulib-tool: update --version output

2005-08-25 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

According to Bruno Haible on 8/25/2005 6:13 AM:
> An update of the --version output.
> 
> !   echo "Copyright (C) 2002-2005 Free Software Foundation, Inc.

Don't the coding standards state that the --version output need only be
the most recent year, and that prior years are only stored in the source
files?

- --
Life is short - so eat dessert first!

Eric Blake [EMAIL PROTECTED]
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDDcV684KuGfSFAYARArYaAKCawKdiquuKIzAg9b0xRTk9du2IhACeMY4p
vIiLlzH76HlbfY4vJtaYo74=
=rqwr
-END PGP SIGNATURE-


___
bug-gnulib mailing list
bug-gnulib@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnulib


Re: [bug-gnulib] gettimeofday() for Win32

2005-08-25 Thread Bruno Haible
Hi,

Martin Lambers wrote:
> I'd like to provide a gettimeofday() function for systems that do not
> have it (at least Win32).
>
> I already wrote a module that works, see below. But this module
> overwrites the existing gettimeofday module. I do not know how to
> integrate the changes into the existing module because of the autoconf
> and M4 magic that is involved.
>
> I have two questions: Would you consider integrating such changes into
> the existing module at all?

Jim?

> If so, how can this be done?

It can be done by merging your .m4 file with Jim's one, and put a big
#if inside lib/gettimeofday.c. But first, can you please bring your
proposed code up to gnulib standards?

  - Indentation by 2 characters, not by 4.
  - A space before the opening parenthesis in function/macro calls.
  - Use #ifdef _WIN32, not #ifdef WIN32.

And compare the code with GNU clisp's gettimeofday emulations. (I wrote
that code => no copyright problems when porting it to gnulib.)

/* an emulation of gettimeofday(3). */
int
gettimeofday (struct timeval * tp, struct timezone * tzp)
{
  if (tp != NULL || tzp != NULL)
{
  struct timeb timebuf;
  ftime (&timebuf);
  if (tp != NULL)
{
  tp->tv_sec = timebuf.time;
  tp->tv_usec = (long)(timebuf.millitm) * (100/1000);
}
  if (tzp != NULL)
{
  tzp->tz_minuteswest = timebuf.timezone;
  tzp->tz_dsttime = 0;  /* ?? */
}
}
  return 0;
}

What's the right way to fill the struct timezone?

Bruno



___
bug-gnulib mailing list
bug-gnulib@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnulib


Re: [bug-gnulib] Re: error: possibly undefined macro: AC_CHECK_HEADERS_ONCE

2005-08-25 Thread Bruno Haible
Sam Steingold wrote:
> gnulib CVS head does not contain gl_INCLUDED_REGEX.

Paul removed this macro; you need to call gl_REGEX without arguments, now.

Bruno



___
bug-gnulib mailing list
bug-gnulib@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnulib


gnulib-tool: support for unit test modules

2005-08-25 Thread Bruno Haible
Hi all,

C code generally doesn't work unless it's tested.

Simon added a test for the 'getpass' module yesterday, but no "make check"
actually runs it. So it resembles dead code. Let's change that!

Nelson Beebe has a zoo of different platforms, and now and then he reports
portability problems about a package that uses gnulib. But we have no
guarantee that all of gnulib actually works on all his platforms.
Let's change that!

I'm adding to gnulib-tool the support for unitary tests. It is activated
when you pass the option --with-tests. Then, the package created by
--create-testdir or --create-megatestdir has a "make check" that will
actually run the available tests.

When you contribute new tests, the test sources go under tests/.
They are accompanied with a metainformation file modules/-tests.
The template for this file is:

  Files:
  [Here you list all test files. m4 files are also possible.]

  Depends-on:
  [The test module may depend on other modules than the particular library
  module. It may even depend on other test modules.]

  configure.ac:
  [Some autoconf tests for use by the test.]

  Makefile.am:
  [Snippet of rules for tests/Makefile.am.]

Everyone, please contribute a test for your modules! Then at some point,
we can actually create a megatestdir and have people like Nelson Beebe
perform a complete portability test on gnulib.

Bruno


Support for unit test modules.
* modules/README: Mention tests modules.
* modules/TEMPLATE-TESTS: New file.
* gnulib-tool: New options --extract-tests-module, --with-tests and
--tests-base (unused for the moment).
(testsbase, inctests): New variables.
(func_all_modules): Exclude TEMPLATE-TESTS and *-tests.
(func_verify_module): Exclude TEMPLATE-TESTS.
(func_verify_nontests_module, func_verify_tests_module): New functions.
(func_get_dependencies): Add implicit dependency for tests modules.
(func_get_tests_module): New function.
(func_modules_transitive_closure): When --with-tests was specified,
include the unit tests as well, unless explicitly avoided.
(func_emit_lib_Makefile_am): Ignore the tests modules here.
(func_emit_tests_Makefile_am): New function.
(func_create_testdir): When --with-tests was specified, emit a
tests/ directory.
* MODULES.html.sh (Future developments): Update.

*** modules/README.bak  2004-10-11 13:28:34.0 +0200
--- modules/README  2005-08-25 00:54:40.0 +0200
***
*** 1,9 
! This directory contains metainformation about the gnulib modules, one file
! per module. These files are used by gnulib-tool.
  
  All the files in this directory are distributed under the following copyright:
  
!   Copyright (C) 2002-2004 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
in any medium, are permitted without royalty provided the copyright
notice and this notice are preserved.
--- 1,15 
! This directory contains metainformation about the gnulib modules, one or two
! files per module. These files are used by gnulib-tool.
! 
! For every module,
!   - the file  is the metainformation about the library code of the
! module,
!   - the file -tests is the metainformation about the unit test of
! the module (optional but recommended).
  
  All the files in this directory are distributed under the following copyright:
  
!   Copyright (C) 2002-2005 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
in any medium, are permitted without royalty provided the copyright
notice and this notice are preserved.
*** gnulib-tool.bak 2005-08-25 02:14:54.0 +0200
--- gnulib-tool 2005-08-25 03:59:41.0 +0200
***
*** 56,61 
--- 56,62 
 gnulib-tool --extract-include-directive module
 gnulib-tool --extract-license module
 gnulib-tool --extract-maintainer module
+gnulib-tool --extract-tests-module module
  
  Operation modes:
--listprint the available module names
***
*** 76,81 
--- 77,83 
--extract-licensereport the license terms of the source 
files
 under lib/
--extract-maintainer report the maintainer(s) inside gnulib
+   --extract-tests-module   report the unit test module, if it exists
  
  Options:
--dir=DIRECTORY   specify the target directory
***
*** 88,95 
--- 90,101 
  placed (default \"lib\"), for --import.
--m4-base=DIRECTORY   Directory relative --dir where *.m4 macros are
  placed (default \"m4\"), for --import.
+   --tests-base=DIRECTORY
+ Directory relative --dir where unit tests are
+ placed (default \"tes

Re: sysexits.h: Define EX_OK

2005-08-25 Thread Stepan Kasal
Hello,

On Wed, Aug 24, 2005 at 10:20:08PM -0700, Paul Eggert wrote:
>  Let's please just define [EX_OK] to 0; [...]
> 
> I also like Simon's suggestion of defining EXIT_SUCCESS and
> EXIT_FAILURE in config.h, [...]

something like the attached patch (not tested)?

Stepan
diff -urpN gnulib/lib/.cppi-disable gnulib.new/lib/.cppi-disable
--- gnulib/lib/.cppi-disable2005-08-25 14:51:21.0 +0200
+++ gnulib.new/lib/.cppi-disable2005-08-25 14:52:42.0 +0200
@@ -1,7 +1,6 @@
 alloca_.h
 allocsa.h
 error.h
-exit.h
 fnmatch_.h
 fts.c
 fts_.h
diff -urpN gnulib/lib/argmatch.c gnulib.new/lib/argmatch.c
--- gnulib/lib/argmatch.c   2005-08-25 14:51:21.0 +0200
+++ gnulib.new/lib/argmatch.c   2005-08-25 14:52:42.0 +0200
@@ -36,7 +36,7 @@
 #define _(msgid) gettext (msgid)
 
 #include "error.h"
-#include "exit.h"
+#include 
 #include "quotearg.h"
 #include "quote.h"
 
diff -urpN gnulib/lib/copy-file.c gnulib.new/lib/copy-file.c
--- gnulib/lib/copy-file.c  2005-08-25 14:51:21.0 +0200
+++ gnulib.new/lib/copy-file.c  2005-08-25 14:52:42.0 +0200
@@ -45,7 +45,7 @@
 #include "safe-read.h"
 #include "full-write.h"
 #include "binary-io.h"
-#include "exit.h"
+#include 
 #include "gettext.h"
 
 #define _(str) gettext (str)
diff -urpN gnulib/lib/execute.c gnulib.new/lib/execute.c
--- gnulib/lib/execute.c2005-08-25 14:51:21.0 +0200
+++ gnulib.new/lib/execute.c2005-08-25 14:52:42.0 +0200
@@ -35,7 +35,7 @@
 #endif
 
 #include "error.h"
-#include "exit.h"
+#include 
 #include "fatal-signal.h"
 #include "wait-process.h"
 #include "gettext.h"
diff -urpN gnulib/lib/exit.h gnulib.new/lib/exit.h
--- gnulib/lib/exit.h   2005-08-25 14:51:33.0 +0200
+++ gnulib.new/lib/exit.h   1970-01-01 01:00:00.0 +0100
@@ -1,32 +0,0 @@
-/* exit() function.
-   Copyright (C) 1995, 2001 Free Software Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
-
-#ifndef _EXIT_H
-#define _EXIT_H
-
-/* Get exit() declaration.  */
-#include 
-
-/* Some systems do not define EXIT_*, even with STDC_HEADERS.  */
-#ifndef EXIT_SUCCESS
-# define EXIT_SUCCESS 0
-#endif
-#ifndef EXIT_FAILURE
-# define EXIT_FAILURE 1
-#endif
-
-#endif /* _EXIT_H */
diff -urpN gnulib/lib/exitfail.c gnulib.new/lib/exitfail.c
--- gnulib/lib/exitfail.c   2005-08-25 14:51:21.0 +0200
+++ gnulib.new/lib/exitfail.c   2005-08-25 14:52:42.0 +0200
@@ -22,6 +22,6 @@
 #endif
 
 #include "exitfail.h"
-#include "exit.h"
+#include 
 
 int volatile exit_failure = EXIT_FAILURE;
diff -urpN gnulib/lib/pagealign_alloc.c gnulib.new/lib/pagealign_alloc.c
--- gnulib/lib/pagealign_alloc.c2005-08-25 14:51:21.0 +0200
+++ gnulib.new/lib/pagealign_alloc.c2005-08-25 14:52:42.0 +0200
@@ -39,7 +39,7 @@
 #endif
 
 #include "error.h"
-#include "exit.h"
+#include 
 #include "getpagesize.h"
 #include "xalloc.h"
 #include "gettext.h"
diff -urpN gnulib/lib/pipe.c gnulib.new/lib/pipe.c
--- gnulib/lib/pipe.c   2005-08-25 14:51:21.0 +0200
+++ gnulib.new/lib/pipe.c   2005-08-25 14:52:42.0 +0200
@@ -34,7 +34,7 @@
 #endif
 
 #include "error.h"
-#include "exit.h"
+#include 
 #include "fatal-signal.h"
 #include "wait-process.h"
 #include "gettext.h"
diff -urpN gnulib/lib/sysexit_.h gnulib.new/lib/sysexit_.h
--- gnulib/lib/sysexit_.h   2005-08-25 14:51:21.0 +0200
+++ gnulib.new/lib/sysexit_.h   2005-08-25 14:52:42.0 +0200
@@ -1,5 +1,5 @@
 /* exit() exit codes for some BSD system programs.
-   Copyright (C) 2003 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2005 Free Software Foundation, Inc.
 
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -20,6 +20,7 @@
 #ifndef _SYSEXITS_H
 #define _SYSEXITS_H
 
+#define EX_OK 0
 #define EX_USAGE 64
 #define EX_DATAERR 65
 #define EX_NOINPUT 66
diff -urpN gnulib/lib/wait-process.c gnulib.new/lib/wait-process.c
--- gnulib/lib/wait-process.c   2005-08-25 14:51:21.0 +0200
+++ gnulib.new/lib/wait-process.c   2005-08-25 14:52:42.0 +0200
@@ -91,7 +91,7 @@
 #endif
 
 #include "error.h"
-#include "exit.h"
+#include 
 #include "fatal-signal.h"
 #include "xalloc.h"
 #include "gettext.h"
diff -urpN gnulib/lib/xsetenv.c gnuli

Re: getpass: use of termios.h problematic

2005-08-25 Thread Simon Josefsson
Paul Eggert <[EMAIL PROTECTED]> writes:

> Simon Josefsson <[EMAIL PROTECTED]> writes:
>
>> The resulting code would look awful, and I think it would be weird to
>> have plenty of non-glibc specific hacks inside glibc.  But keeping
>> things in sync is a good idea, and I can work toward that goal for
>> this module if you want.
>
> If it's too much work, don't bother; perhaps we can come up with a
> better approach later.

I think it is too much work now.  I'm happy with my proposed patch,
and since we aren't in sync now it doesn't make things much worse
anyway.

Ok to install?

Thanks,
Simon


___
bug-gnulib mailing list
bug-gnulib@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnulib


gnulib-tool: generalize --aux-dir

2005-08-25 Thread Bruno Haible
This patch makes --aux-dir work for the other modes than --import.

* gnulib-tool: Add support for the --aux-dir option to
--create-testdir, --create-megatestdir, --test, --megatest.
(func_create_testdir, func_create_megatestdir): Optionally emit a
AC_CONFIG_AUX_DIR directive.
(create-testdir, create-megatestdir, test, megatest): Provide a
default value for $auxdir.

*** gnulib-tool.bak 2005-08-25 01:22:21.0 +0200
--- gnulib-tool 2005-08-25 01:37:21.0 +0200
***
*** 89,96 
--m4-base=DIRECTORY   Directory relative --dir where *.m4 macros are
  placed (default \"m4\"), for --import.
--aux-dir=DIRECTORY   Directory relative --dir where auxiliary build
! tools are placed (default \"build-aux\"),
! for --import.
--avoid=MODULEAvoid including the given MODULE. Useful if you
  have code that provides equivalent functionality.
  This option can be repeated.
--- 89,95 
--m4-base=DIRECTORY   Directory relative --dir where *.m4 macros are
  placed (default \"m4\"), for --import.
--aux-dir=DIRECTORY   Directory relative --dir where auxiliary build
! tools are placed (default \"build-aux\").
--avoid=MODULEAvoid including the given MODULE. Useful if you
  have code that provides equivalent functionality.
  This option can be repeated.
***
*** 591,596 
--- 590,596 
  # - libname library name
  # - sourcebase  directory relative to destdir where to place source code
  # - m4base  directory relative to destdir where to place *.m4 macros
+ # - auxdir  directory relative to destdir where to place build aux 
files
  # - avoidlist   list of modules to avoid, from --avoid
  # - lgpltrue if library's license shall be LGPL, blank otherwise
  # - libtool true if libtool will be used, blank otherwise
***
*** 752,757 
--- 752,759 
  }
  
  # func_create_testdir testdir modules
+ # Input:
+ # - auxdir  directory relative to destdir where to place build aux 
files
  func_create_testdir ()
  {
testdir="$1"
***
*** 832,837 
--- 834,842 
# Create configure.ac.
(echo "# Process this file with autoconf to produce a configure script."
 echo "AC_INIT([dummy], [0])"
+if test "$auxdir" != "."; then
+  echo "AC_CONFIG_AUX_DIR([$auxdir])"
+fi
 echo "AM_INIT_AUTOMAKE"
 echo
 echo "AM_CONFIG_HEADER([config.h])"
***
*** 883,888 
--- 888,895 
  }
  
  # func_create_megatestdir megatestdir allmodules
+ # Input:
+ # - auxdir  directory relative to destdir where to place build aux 
files
  func_create_megatestdir ()
  {
megatestdir="$1"
***
*** 914,919 
--- 921,929 
# Create configure.ac.
(echo "# Process this file with autoconf to produce a configure script."
 echo "AC_INIT([dummy], [0])"
+if test "$auxdir" != "."; then
+  echo "AC_CONFIG_AUX_DIR([$auxdir])"
+fi
 echo "AM_INIT_AUTOMAKE"
 echo
 echo "AC_PROG_MAKE_SET"
***
*** 1028,1033 
--- 1038,1044 
  mkdir "$destdir"
  test -d "$destdir" \
|| func_fatal_error "could not create destination directory"
+ test -n "$auxdir" || auxdir="build-aux"
  func_create_testdir "$destdir" "$*"
  ;;
  
***
*** 1036,1047 
--- 1047,1060 
func_fatal_error "please specify --dir option"
  fi
  mkdir "$destdir" || func_fatal_error "could not create destination 
directory"
+ test -n "$auxdir" || auxdir="build-aux"
  func_create_megatestdir "$destdir" "$*"
  ;;
  
test )
  test -n "$destdir" || destdir=testdir$$
  mkdir "$destdir" || func_fatal_error "could not create destination 
directory"
+ test -n "$auxdir" || auxdir="build-aux"
  func_create_testdir "$destdir" "$*"
  cd "$destdir"
mkdir build
***
*** 1064,1069 
--- 1077,1083 
megatest )
  test -n "$destdir" || destdir=testdir$$
  mkdir "$destdir" || func_fatal_error "could not create destination 
directory"
+ test -n "$auxdir" || auxdir="build-aux"
  func_create_megatestdir "$destdir" "$*"
  cd "$destdir"
mkdir build



___
bug-gnulib mailing list
bug-gnulib@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnulib


gnulib-tool: update --version output

2005-08-25 Thread Bruno Haible
An update of the --version output.


* gnulib-tool (func_version): Update.

*** gnulib-tool.bak 2005-08-25 02:05:40.0 +0200
--- gnulib-tool 2005-08-25 02:14:54.0 +0200
***
*** 108,117 
  func_version ()
  {
echo "$progname (GNU $package) $version"
!   echo "Copyright (C) 2002 Free Software Foundation, Inc.
  This is free software; see the source for copying conditions.  There is NO
  warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
!   echo "Written by" "Bruno Haible"
  }
  
  # func_fatal_error message
--- 108,117 
  func_version ()
  {
echo "$progname (GNU $package) $version"
!   echo "Copyright (C) 2002-2005 Free Software Foundation, Inc.
  This is free software; see the source for copying conditions.  There is NO
  warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
!   echo "Written by" "Bruno Haible" "and" "Simon Josefsson"
  }
  
  # func_fatal_error message



___
bug-gnulib mailing list
bug-gnulib@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnulib


gnulib-tool: small output tweak

2005-08-25 Thread Bruno Haible
Alexandre Duret-Lutz recommends that all autoconf macro invocations should
quote their arguments. This patch does it in gnulib-tool.

* gnulib-tool (func_import, func_create_testdir,
func_create_megatestdir): Quote all autoconf macro arguments.

*** gnulib-tool.bak 2005-08-16 13:12:02.0 +0200
--- gnulib-tool 2005-08-25 00:56:16.0 +0200
***
*** 711,735 
echo 'changequote(,)dnl'
echo 'LTALLOCA=`echo "$ALLOCA" | sed '"'"'s/\.[^.]* /.lo 
/g;s/\.[^.]*$/.lo/'"'"'`'
echo 'changequote([, ])dnl'
!   echo 'AC_SUBST(LTALLOCA)'
  fi
fi
  done
  echo "])"
  echo
! echo "dnl Usage: gl_MODULES(module1 module2 ...)"
  echo "AC_DEFUN([gl_MODULES], [])"
  echo
! echo "dnl Usage: gl_AVOID(module1 module2 ...)"
  echo "AC_DEFUN([gl_AVOID], [])"
  echo
! echo "dnl Usage: gl_SOURCE_BASE(DIR)"
  echo "AC_DEFUN([gl_SOURCE_BASE], [])"
  echo
! echo "dnl Usage: gl_M4_BASE(DIR)"
  echo "AC_DEFUN([gl_M4_BASE], [])"
  echo
! echo "dnl Usage: gl_LIB(LIBNAME)"
  echo "AC_DEFUN([gl_LIB], [])"
  echo
  echo "dnl Usage: gl_LGPL"
--- 712,736 
echo 'changequote(,)dnl'
echo 'LTALLOCA=`echo "$ALLOCA" | sed '"'"'s/\.[^.]* /.lo 
/g;s/\.[^.]*$/.lo/'"'"'`'
echo 'changequote([, ])dnl'
!   echo 'AC_SUBST([LTALLOCA])'
  fi
fi
  done
  echo "])"
  echo
! echo "dnl Usage: gl_MODULES([module1 module2 ...])"
  echo "AC_DEFUN([gl_MODULES], [])"
  echo
! echo "dnl Usage: gl_AVOID([module1 module2 ...])"
  echo "AC_DEFUN([gl_AVOID], [])"
  echo
! echo "dnl Usage: gl_SOURCE_BASE([DIR])"
  echo "AC_DEFUN([gl_SOURCE_BASE], [])"
  echo
! echo "dnl Usage: gl_M4_BASE([DIR])"
  echo "AC_DEFUN([gl_M4_BASE], [])"
  echo
! echo "dnl Usage: gl_LIB([LIBNAME])"
  echo "AC_DEFUN([gl_LIB], [])"
  echo
  echo "dnl Usage: gl_LGPL"
***
*** 830,839 
  
# Create configure.ac.
(echo "# Process this file with autoconf to produce a configure script."
!echo "AC_INIT(dummy,0)"
 echo "AM_INIT_AUTOMAKE"
 echo
!echo "AM_CONFIG_HEADER(config.h)"
 echo
 echo "AC_PROG_CC"
 echo "AC_PROG_INSTALL"
--- 830,839 
  
# Create configure.ac.
(echo "# Process this file with autoconf to produce a configure script."
!echo "AC_INIT([dummy], [0])"
 echo "AM_INIT_AUTOMAKE"
 echo
!echo "AM_CONFIG_HEADER([config.h])"
 echo
 echo "AC_PROG_CC"
 echo "AC_PROG_INSTALL"
***
*** 912,918 
  
# Create configure.ac.
(echo "# Process this file with autoconf to produce a configure script."
!echo "AC_INIT(dummy,0)"
 echo "AM_INIT_AUTOMAKE"
 echo
 echo "AC_PROG_MAKE_SET"
--- 912,918 
  
# Create configure.ac.
(echo "# Process this file with autoconf to produce a configure script."
!echo "AC_INIT([dummy], [0])"
 echo "AM_INIT_AUTOMAKE"
 echo
 echo "AC_PROG_MAKE_SET"



___
bug-gnulib mailing list
bug-gnulib@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnulib


regex.m4: skip autodetection if it is not necessary

2005-08-25 Thread Stepan Kasal
Hello,
  would you accept this patch?

Stepan Kasal
2005-08-25  Stepan Kasal  <[EMAIL PROTECTED]>

* regex.m4: If --with-included-regex was given, skip the autodetection.

Index: m4/regex.m4
===
RCS file: /cvsroot/gnulib/gnulib/m4/regex.m4,v
retrieving revision 1.43
diff -u -r1.43 regex.m4
--- m4/regex.m4 24 Aug 2005 23:29:39 -  1.43
+++ m4/regex.m4 25 Aug 2005 12:04:40 -
@@ -1,4 +1,4 @@
-#serial 27
+#serial 28
 
 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005 Free
 # Software Foundation, Inc.
@@ -10,27 +10,33 @@
 dnl Initially derived from code in GNU grep.
 dnl Mostly written by Jim Meyering.
 
+AC_PREREQ([2.50])
+
 AC_DEFUN([gl_REGEX],
 [
   AC_LIBSOURCES(
 [regcomp.c, regex.c, regex.h,
  regex_internal.c, regex_internal.h, regexec.c])
 
-  dnl Even packages that don't use regex.c can use this macro.
-  dnl Of course, for them it doesn't do anything.
-
-  # Assume we'll default to using the included regex.c.
-  ac_use_included_regex=yes
-
-  # However, if the system regex support is good enough that it passes the
-  # the following run test, then default to *not* using the included regex.c.
-  # If cross compiling, assume the test would fail and use the included
-  # regex.c.  The first failing regular expression is from `Spencer ere
-  # test #75' in grep-2.3.
-  AC_CACHE_CHECK([for working re_compile_pattern],
-[gl_cv_func_working_re_compile_pattern],
-[AC_RUN_IFELSE(
-   [AC_LANG_PROGRAM(
+  AC_ARG_WITH([included-regex],
+[AC_HELP_STRING([--without-included-regex],
+   [don't compile regex; this is the default on
+systems with recent-enough versions of the GNU C
+Library (use with caution on other systems)])])
+
+  case $with_included_regex in
+  yes|no) ac_use_included_regex=$with_included_regex
+   ;;
+  '')
+# If the system regex support is good enough that it passes the the
+# following run test, then default to *not* using the included regex.c.
+# If cross compiling, assume the test would fail and use the included
+# regex.c.  The first failing regular expression is from `Spencer ere
+# test #75' in grep-2.3.
+AC_CACHE_CHECK([for working re_compile_pattern],
+  [gl_cv_func_re_compile_pattern_broken],
+  [AC_RUN_IFELSE(
+   [AC_LANG_PROGRAM(
  [AC_INCLUDES_DEFAULT
   #include ],
  [[static struct re_pattern_buffer regex;
@@ -92,21 +98,17 @@
  exit (1);
 
exit (0);]])],
-   [gl_cv_func_working_re_compile_pattern=yes],
-   [gl_cv_func_working_re_compile_pattern=no],
+   [gl_cv_func_re_compile_pattern_broken=no],
+   [gl_cv_func_re_compile_pattern_broken=yes],
dnl When crosscompiling, assume it is broken.
-   [gl_cv_func_working_re_compile_pattern=no])])
-  if test $gl_cv_func_working_re_compile_pattern = yes; then
-ac_use_included_regex=no
-  fi
+   [gl_cv_func_re_compile_pattern_broken=yes])])
+ac_use_included_regex=$gl_cv_func_re_compile_pattern_broken
+;;
+  *) AC_MSG_ERROR([Invalid value for --with-included-regex: 
$with_included_regex])
+;;
+  esac
 
-  AC_ARG_WITH([included-regex],
-[  --without-included-regex don't compile regex; this is the default on
-   systems with recent-enough versions of the GNU C
-   Library (use with caution on other systems)],
-[gl_with_regex=$withval],
-[gl_with_regex=$ac_use_included_regex])
-  if test "X$gl_with_regex" = Xyes; then
+  if test $ac_use_included_regex = yes; then
 AC_LIBOBJ([regex])
 gl_PREREQ_REGEX
   fi
___
bug-gnulib mailing list
bug-gnulib@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnulib


gnulib-tool: fix autoreconf invocation

2005-08-25 Thread Bruno Haible
Currently, a megatestdir will, during the first "./configure; make",
rebuild config.h, requiring autoconf and automake in the PATH. This fixes it.


* gnulib-tool (func_create_megatestdir): Call autoreconf without the
option --force, because --force causes the aclocal.m4 of each
subdirectory to be newer than the corresponding config.h.in.

*** gnulib-tool.bak 2005-08-25 01:37:21.0 +0200
--- gnulib-tool 2005-08-25 02:05:40.0 +0200
***
*** 934,941 
  
# Create autogenerated files.
(cd "$megatestdir"
!echo "executing ${AUTORECONF} --force --install"
!${AUTORECONF} --force --install
)
  }
  
--- 934,941 
  
# Create autogenerated files.
(cd "$megatestdir"
!echo "executing ${AUTORECONF} --install"
!${AUTORECONF} --install
)
  }
  



___
bug-gnulib mailing list
bug-gnulib@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnulib


gnulib-tool: change default --aux-dir

2005-08-25 Thread Bruno Haible
The default --aux-dir of "." clutters up the top-level directory.
Now that have agreed on a reasonable name for this directory, gnulib-tool
does not need to do this any more. I'm changing the default --aux-dir
to "build-aux".

Note: This is an INCOMPATIBLE change. You need to add an option
--aux-dir=. if you want to keep the previous behaviour.


* gnulib-tool (import): Change --aux-dir default to "build-aux".

*** gnulib-tool.bak 2005-08-25 00:56:16.0 +0200
--- gnulib-tool 2005-08-25 01:10:57.0 +0200
***
*** 89,95 
--m4-base=DIRECTORY   Directory relative --dir where *.m4 macros are
  placed (default \"m4\"), for --import.
--aux-dir=DIRECTORY   Directory relative --dir where auxiliary build
! tools are placed (default \".\"), for --import.
--avoid=MODULEAvoid including the given MODULE. Useful if you
  have code that provides equivalent functionality.
  This option can be repeated.
--- 89,96 
--m4-base=DIRECTORY   Directory relative --dir where *.m4 macros are
  placed (default \"m4\"), for --import.
--aux-dir=DIRECTORY   Directory relative --dir where auxiliary build
! tools are placed (default \"build-aux\"),
! for --import.
--avoid=MODULEAvoid including the given MODULE. Useful if you
  have code that provides equivalent functionality.
  This option can be repeated.
***
*** 997,1003 
  
  # Set up auxiliary directory.
  test -z "$auxdir" && auxdir="$ac_auxdir"
! test -z "$auxdir" && auxdir="."
  test -d "$destdir/$auxdir" \
|| (test -z "$dry_run" && mkdir "$destdir/$auxdir") \
|| func_fatal_error "aux directory $destdir/$auxdir doesn't exist"
--- 998,1004 
  
  # Set up auxiliary directory.
  test -z "$auxdir" && auxdir="$ac_auxdir"
! test -z "$auxdir" && auxdir="build-aux"
  test -d "$destdir/$auxdir" \
|| (test -z "$dry_run" && mkdir "$destdir/$auxdir") \
|| func_fatal_error "aux directory $destdir/$auxdir doesn't exist"



___
bug-gnulib mailing list
bug-gnulib@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnulib


gnulib-tool: small tweak

2005-08-25 Thread Bruno Haible
This change is to use { ... } syntax instead of ( ... ) where possible.
( ... ) causes a subshell to be fork()ed, { ... } doesn't.


* gnulib-tool (import): Use compound statement instead of subshell
where possible.

*** gnulib-tool.bak 2005-08-25 00:56:16.0 +0200
--- gnulib-tool 2005-08-25 01:22:21.0 +0200
***
*** 985,1005 
  test -z "$sourcebase" && sourcebase="$ac_sourcebase"
  test -z "$sourcebase" && sourcebase="lib"
  test -d "$destdir/$sourcebase" \
!   || (test -z "$dry_run" && mkdir "$destdir/$sourcebase") \
|| func_fatal_error "source base $destdir/$sourcebase doesn't exist"
  
  # Set up m4 base.
  test -z "$m4base" && m4base="$ac_m4base"
  test -z "$m4base" && m4base="m4"
  test -d "$destdir/$m4base" \
!   || (test -z "$dry_run" && mkdir "$destdir/$m4base") \
|| func_fatal_error "m4 base $destdir/$m4base doesn't exist"
  
  # Set up auxiliary directory.
  test -z "$auxdir" && auxdir="$ac_auxdir"
  test -z "$auxdir" && auxdir="build-aux"
  test -d "$destdir/$auxdir" \
!   || (test -z "$dry_run" && mkdir "$destdir/$auxdir") \
|| func_fatal_error "aux directory $destdir/$auxdir doesn't exist"
  
  # Using libtool?
--- 986,1006 
  test -z "$sourcebase" && sourcebase="$ac_sourcebase"
  test -z "$sourcebase" && sourcebase="lib"
  test -d "$destdir/$sourcebase" \
!   || { test -z "$dry_run" && mkdir "$destdir/$sourcebase"; } \
|| func_fatal_error "source base $destdir/$sourcebase doesn't exist"
  
  # Set up m4 base.
  test -z "$m4base" && m4base="$ac_m4base"
  test -z "$m4base" && m4base="m4"
  test -d "$destdir/$m4base" \
!   || { test -z "$dry_run" && mkdir "$destdir/$m4base"; } \
|| func_fatal_error "m4 base $destdir/$m4base doesn't exist"
  
  # Set up auxiliary directory.
  test -z "$auxdir" && auxdir="$ac_auxdir"
  test -z "$auxdir" && auxdir="build-aux"
  test -d "$destdir/$auxdir" \
!   || { test -z "$dry_run" && mkdir "$destdir/$auxdir"; } \
|| func_fatal_error "aux directory $destdir/$auxdir doesn't exist"
  
  # Using libtool?



___
bug-gnulib mailing list
bug-gnulib@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnulib


Re: error: possibly undefined macro: AC_CHECK_HEADERS_ONCE

2005-08-25 Thread Stepan Kasal
Hello,

On Thu, Aug 25, 2005 at 11:06:00AM +0200, Stepan Kasal wrote:
> Indeed, when I   cp ../gnulib/m4/regex.m4 src/m4/
> and apply the patch attached below, then
> 
>   make -f Makefile.devel check-configures

I forgot to attach the patch, sorry.
Please find it attached to this mail.

Stepan Kasal
Index: Makefile.devel
===
RCS file: /cvsroot/clisp/clisp/Makefile.devel,v
retrieving revision 1.136
diff -u -r1.136 Makefile.devel
--- Makefile.devel  4 Aug 2005 22:21:30 -   1.136
+++ Makefile.devel  25 Aug 2005 10:12:30 -
@@ -137,10 +137,13 @@
 src/autoconf/aclocal.m4 : $(wildcard src/m4/*.m4) \
$(addsuffix .in,$(CLISP_CONFIGURES))
egrep '(AC_INIT|AC_PREREQ)' src/configure.in > configure.ac
-   cat $(addsuffix .in,$(CLISP_CONFIGURES)) | egrep -v 
'(AC_INIT|AC_CONFIG_HEADER|AC_OUTPUT|AC_CONFIG_FILE.*(Makefile|link\.sh)|_CANONICAL_|AC_PREREQ)'
 >> configure.ac
+   echo AC_GNU_SOURCE >> configure.ac
+   cat $(addsuffix .in,$(CLISP_CONFIGURES)) | \
+ egrep -v -e 
'AC_(INIT|PREREQ|CANONICAL_|GNU_SOURCE|CONFIG_HEADER|OUTPUT)' \
+   -e 'AC_CONFIG_FILE.*(Makefile|link\.sh)' >> configure.ac
echo AC_OUTPUT >> configure.ac
aclocal -I `pwd`/src/m4 --output=src/autoconf/aclocal.m4
-   $(RM) configure.ac
+   #$(RM) configure.ac
 
 AUTOCONF_FILES = src/autoconf/aclocal.m4
 AUTOCONF = autoconf
Index: modules/regexp/configure.in
===
RCS file: /cvsroot/clisp/clisp/modules/regexp/configure.in,v
retrieving revision 1.15
diff -u -r1.15 configure.in
--- modules/regexp/configure.in 4 Aug 2005 22:10:53 -   1.15
+++ modules/regexp/configure.in 25 Aug 2005 10:12:30 -
@@ -4,6 +4,7 @@
 
 AC_PREREQ(2.57)
 AC_INIT(regexp, 1.0, clisp-list)
+AC_GNU_SOURCE
 AC_CONFIG_SRCDIR(regexp.lisp)
 AC_CONFIG_AUX_DIR(../../src/build-aux)
 AC_CONFIG_HEADERS(config.h)
@@ -16,7 +17,7 @@
 AM_GNU_GETTEXT([external])
 gl_C_RESTRICT
 gl_FUNC_ALLOCA
-gl_INCLUDED_REGEX([regex.c])
+gl_REGEX
 
 # can we use the system-wide regex implementation?
 if test "$ac_use_included_regex" = no -a "$cl_cv_regexp" = yes; then
___
bug-gnulib mailing list
bug-gnulib@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnulib


Re: error: possibly undefined macro: AC_CHECK_HEADERS_ONCE

2005-08-25 Thread Stepan Kasal
Hello,

On Wed, Aug 24, 2005 at 10:30:44PM -0400, Sam Steingold wrote:
> gnulib CVS head does not contain gl_INCLUDED_REGEX.

Indeed:

revision 1.42
date: 2005/08/23 18:48:31;  author: eggert;  state: Exp;  lines: +95 -109
* regex.m4 (gl_INCLUDED_REGEX): Remove; no longer used.
All contents moved to gl_REGEX.
(gl_REGEX): Don't bother checking whether lib/regex.c exists;
assume that it does.

The first change means you have to call gl_REGEX instead.

The second change fixes your problem (see subj. line).

> the easiest way to reproduce the problem is
> $ cvs -d:pserver:[EMAIL PROTECTED]:/cvsroot/clisp login
> $ cvs -z3 -d:pserver:[EMAIL PROTECTED]:/cvsroot/clisp co -P clisp
> $ cd clisp
> $ make -f Makefile.devel check-configures

Thanks for this hint.  It sounds trivial for you, but it helped me a lot.

Indeed, when I   cp ../gnulib/m4/regex.m4 src/m4/
and apply the patch attached below, then

make -f Makefile.devel check-configures

There was one remaining problem: AC_GNU_SOURCE has to be called early in
configure.ac.  For projects which use gnulib-tool, macro gl_EARLY takes
care of this; but you have to take care of it yourself.

Have a nice day,
Stepan Kasal


___
bug-gnulib mailing list
bug-gnulib@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnulib