I downloaded the CVS version of wget today and tried to build it under the latest (1.15-14) Cygwin. I hit two compilation problems, both in src/ptimer.c.
1. The first problem is with the test for _POSIX_MONOTONIC_CLOCK on line 186. That line is: #if _POSIX_MONOTONIC_CLOCK >= 0 /* -1 means not supported */ Under Cygwin, _POSIX_MONOTONIC_CLOCK is not defined, so cpp uses a default value of 0 in the test. This causes the test to succeed, and ptimer.c tries to compile "sysconf(_SC_MONOTONIC_CLOCK)" which fails. A fix (but possibly not the most portable fix) for this is to change the test: #if defined(_POSIX_MONOTONIC_CLOCK) && (_POSIX_MONOTONIC_CLOCK >= 0) 2. The second problem is a little more annoying. Under Cygwin, clock_getres() is properly defined in time.h, but there is no librt.a to resolve the reference. A possible workaround is to a) add a test for clock_getres to aclocal.m4, and b) wrap the code in ptimer.c that calls clock_getres() in a #if HAVE_CLOCK_GETRES conditional. I have attached a patch implementing these two fixes, if anyone is interested. With these two problems resolved, the CVS version of wget is running great under Cygwin. In a day or two, I should know if the >2G file support is working as well... Thanks! KM
diff -ur wget.orig/aclocal.m4 wget/aclocal.m4 --- wget.orig/aclocal.m4 2005-04-08 01:41:08.000000000 +0200 +++ wget/aclocal.m4 2005-04-08 16:14:40.078125000 +0200 @@ -85,6 +85,9 @@ AC_CHECK_FUNCS(clock_gettime, [], [ AC_CHECK_LIB(rt, clock_gettime) ]) + AC_CHECK_FUNCS(clock_getres, [], [ + AC_CHECK_LIB(rt, clock_getres) + ]) ]) dnl Check whether we need to link with -lnsl and -lsocket, as is the diff -ur wget.orig/src/ptimer.c wget/src/ptimer.c --- wget.orig/src/ptimer.c 2005-04-08 14:09:02.046875000 +0200 +++ wget/src/ptimer.c 2005-04-08 15:10:27.250000000 +0200 @@ -183,13 +183,14 @@ { struct timespec res; -#if _POSIX_MONOTONIC_CLOCK >= 0 /* -1 means not supported */ +#if defined(_POSIX_MONOTONIC_CLOCK) && (_POSIX_MONOTONIC_CLOCK >= 0) /* -1 means not supported */ if (sysconf (_SC_MONOTONIC_CLOCK) > 0) posix_clock_id = CLOCK_MONOTONIC; else #endif posix_clock_id = CLOCK_REALTIME; +#if HAVE_CLOCK_GETRES if (clock_getres (posix_clock_id, &res) < 0) { logprintf (LOG_NOTQUIET, _("Cannot read clock resolution: %s\n"), @@ -198,6 +199,10 @@ res.tv_sec = 0; res.tv_nsec = 1000000; } +#else + res.tv_sec = 0; + res.tv_nsec = 1000000; +#endif posix_resolution = res.tv_sec * 1000.0 + res.tv_nsec / 1000000.0; /* Guard against clock_getres reporting 0 resolution; after all, it