strtoll() not available on HP-UX

2005-08-11 Thread Albert Chin
None of the following platforms have strtoll():
  HP-UX 10.20, 11.00, 11.11

There is a replacement strtoll() in gnulib but it's licensed under the
GPL. Would importing it conflict with wget license which contains the
OpenSSL exception?

-- 
albert chin ([EMAIL PROTECTED])


Re: strtoll() not available on HP-UX

2005-08-11 Thread Albert Chin
On Thu, Aug 11, 2005 at 01:27:28PM -0500, Steven M. Schweda wrote:
>I haven't used HP-UX for a while, so I may be wasting your time, but
> I thought that 11.x was 64-bit-only.  If so, does strtoll() actually
> differ from strtol()?  (How big is your "long int"?)

11.x is 32-bit _and_ 64-bit. 10.20 is 32-bit only.

sizeof(int) == 4
sizeof(long) == 4
sizeof(long long) == 8

>My VMS C RTL help says, "The strtoll and strtoq functions are
> identical."  Do you have a strtoq()?

HP-UX doesn't have this function.

-- 
albert chin ([EMAIL PROTECTED])


Re: strtoll() not available on HP-UX

2005-08-11 Thread Albert Chin
On Thu, Aug 11, 2005 at 10:17:18PM +0200, Hrvoje Niksic wrote:
> Albert Chin <[EMAIL PROTECTED]> writes:
> 
> > None of the following platforms have strtoll():
> >   HP-UX 10.20, 11.00, 11.11
> 
> Do those platforms have 64-bit off_t, i.e. large file support?  If so,
> do they have another strtoll-like function, such as strtoq?

All have large file support.

I don't know of any replacement to strtoll() on these platforms.

> > There is a replacement strtoll() in gnulib but it's licensed under
> > the GPL. Would importing it conflict with wget license which
> > contains the OpenSSL exception?
> 
> As both are assigned to the FSF, I don't think there would be a
> conflict.  But Wget already contains a (currently Windows-specific)
> strtoll implementation which can be moved to cmpt.c.

I was incorrect about the license. strtoll() in gnulib is under the
LGPL so it's ok to import. We did this with a locally-patched 1.10 and
it builds fine. Haven't run it yet.

-- 
albert chin ([EMAIL PROTECTED])


Re: strtoll() not available on HP-UX

2005-08-11 Thread Albert Chin
On Thu, Aug 11, 2005 at 03:24:53PM -0500, Albert Chin wrote:
> On Thu, Aug 11, 2005 at 10:17:18PM +0200, Hrvoje Niksic wrote:
> > Albert Chin <[EMAIL PROTECTED]> writes:
> > 
> > > None of the following platforms have strtoll():
> > >   HP-UX 10.20, 11.00, 11.11
> > 
> > Do those platforms have 64-bit off_t, i.e. large file support?  If so,
> > do they have another strtoll-like function, such as strtoq?
> 
> All have large file support.
> 
> I don't know of any replacement to strtoll() on these platforms.

Actually, all of the above seem to have strtoimax():
  http://www.opengroup.org/onlinepubs/009695399/functions/strtoimax.html
which is defined as the following in :
  #define strtoimax(__a, __b, __c) __strtoll(__a, __b, __c)

-- 
albert chin ([EMAIL PROTECTED])


Re: strtoll() not available on HP-UX

2005-08-11 Thread Albert Chin
On Thu, Aug 11, 2005 at 11:17:25PM +0200, Hrvoje Niksic wrote:
> OK, in presence of LFS, Wget will use either strtoll, strtoimax, or
> its own strtoll implementation if none are available.

I looked at your configure.in change and it won't work. strtoimax is a
macro on HP-UX. So, AC_CHECK_LIB won't work. I'll work up a patch for
you.

-- 
albert chin ([EMAIL PROTECTED])


Re: strtoll() not available on HP-UX

2005-08-12 Thread Albert Chin
On Fri, Aug 12, 2005 at 12:59:59PM +0200, Hrvoje Niksic wrote:
> Albert Chin <[EMAIL PROTECTED]> writes:
> 
> > On Thu, Aug 11, 2005 at 11:17:25PM +0200, Hrvoje Niksic wrote:
> >> OK, in presence of LFS, Wget will use either strtoll, strtoimax, or
> >> its own strtoll implementation if none are available.
> >
> > I looked at your configure.in change and it won't work. strtoimax is a
> > macro on HP-UX.
> 
> It will work, but suboptimally -- it will use a homegrown strtoll
> implementation when it could be using libc's strtoimax.  Maybe this is
> acceptable on systems that defy standards by defining a standard
> function only as a macro[1].
> 
> [1]
> Both C and POSIX require standard functions to also be defined as
> functions, even if those that are normally invoked as macros of the
> same name.  The 2004 edition of POSIX explicitly speaks of strtoimax
> and friends as "functions".  See http://tinyurl.com/8atx3 and point #2
> of http://tinyurl.com/c4ndu/.

HP-UX 10.20, 11.00, and 11.11 r1 predate 2004.

We have something working now. I'll send a patch in a bit.

-- 
albert chin ([EMAIL PROTECTED])


Re: strtoll() not available on HP-UX

2005-08-25 Thread Albert Chin
On Fri, Aug 12, 2005 at 06:00:13PM +0200, Hrvoje Niksic wrote:
> Albert Chin <[EMAIL PROTECTED]> writes:
> 
> > We have something working now. I'll send a patch in a bit.
> 
> Thanks.

Better late than never :)
Patch below against trunk.

The src/wget.h changes are cosmetic and can be ignored if you want.

-- 
albert chin ([EMAIL PROTECTED])

-- snip snip
Index: configure.in
===
--- configure.in(revision 2063)
+++ configure.in(working copy)
@@ -205,8 +205,21 @@
 AC_FUNC_MMAP
 AC_FUNC_FSEEKO
 AC_CHECK_FUNCS(strptime timegm snprintf vsnprintf vasprintf drand48)
-AC_CHECK_FUNCS(strtoll strtoimax usleep ftello sigblock sigsetjmp)
+AC_CHECK_FUNCS(usleep ftello sigblock sigsetjmp)
 
+AC_CHECK_FUNCS(strtoll, , [
+  dnl The following taken from gnulib:
+  dnl   Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+  AC_MSG_CHECKING([whether  defines strtoimax as a macro])
+  AC_EGREP_CPP([inttypes_h_defines_strtoimax], [#include 
+#ifdef strtoimax
+ inttypes_h_defines_strtoimax
+#endif], [
+AC_MSG_RESULT(yes)
+AC_DEFINE(HAVE_STRTOIMAX, 1,
+  [Define to 1 if you have the `strtoimax'.])], [
+AC_MSG_RESULT(no)])])
+
 dnl We expect to have these functions on Unix-like systems configure
 dnl runs on.  The defines are provided to get them in config.h.in so
 dnl Wget can still be ported to non-Unix systems (such as Windows)
Index: src/wget.h
===
--- src/wget.h  (revision 2063)
+++ src/wget.h  (working copy)
@@ -134,12 +134,14 @@
 #  define WGINT_MAX LLONG_MAX
 #  ifdef HAVE_STRTOLL
 #   define str_to_wgint strtoll
-#  elif defined HAVE_STRTOIMAX /* HPUX 11.0 has strtoimax, but no strtoll */
-#   define str_to_wgint strtoimax
 #  else
-#   define str_to_wgint strtoll
-#   define NEED_STRTOLL
-#   define strtoll_type long long
+#   ifdef HAVE_STRTOIMAX /* HPUX 11.0.0 has strtoimax, but not strtoll */
+#define str_to_wgint strtoimax
+#   else
+#define str_to_wgint strtoll
+#define NEED_STRTOLL
+#define strtoll_type long long
+#   endif
 #  endif
 # endif
 #endif /* not WINDOWS */
Index: src/cmpt.c
===
--- src/cmpt.c  (revision 2063)
+++ src/cmpt.c  (working copy)
@@ -1270,12 +1270,13 @@
 #ifdef NEED_STRTOLL
 /* strtoll is required by C99 and used by Wget only on systems with
LFS.  Unfortunately, some systems have LFS, but no strtoll or
-   equivalent.  These include HPUX 11.0 and Windows.
+   equivalent (e.g. Windows).
 
-   We use #ifdef NEED_STRTOLL instead of #ifndef HAVE_STRTOLL because
-   of the systems which have a suitable replacement (e.g. _strtoi64 on
-   Windows), on which Wget's str_to_wgint is instructed to use that
-   instead.  */
+   We use #ifdef NEED_STRTOLL instead of:
+ #if !defined(HAVE_STRTOLL) && !defined(HAVE_STRTOIMAX)
+   because of systems which have a suitable replacement (e.g.
+   _strtoi64 on Windows) or where strtol() is sufficent, on which Wget's
+   str_to_wgint is instructed to use that instead.  */
 
 static inline int
 char_value (char c, int base)


Honor --datadir

2005-08-25 Thread Albert Chin
$(datadir) is not always $(prefix)/share. So, honor $(datadir).

Patch against head.

-- 
albert chin ([EMAIL PROTECTED])

-- snip snip
Index: src/Makefile.in
===
--- src/Makefile.in (revision 2063)
+++ src/Makefile.in (working copy)
@@ -41,7 +41,8 @@
 exec_prefix  = @exec_prefix@
 bindir   = @bindir@
 sysconfdir   = @sysconfdir@
-localedir= $(prefix)/share/locale
+datadir  = @datadir@
+localedir= $(datadir)/locale
 
 DESTDIR  =