>Most of these troubles should go away if you use the 'compile' and 'ar-lib'
>auxiliary scripts, as described in section 2 of
>These instructions were tested with GNU gperf and a couple of other GNU
>packages. They should be applicable to GNU gzip as well.
This is great information. It would be nice to ship a README.windows together with the gzip sources.
Grosso modo I'm building in the way described, but put my files into Visual Studio project.
Based on what I found today: the changes at low-level stdio in the FILE struct are now complable (I did not have yet a chance to let pass gzip our own internal tests, will do so later today or tomorrow).
But still some things are incorrect:
- frexp.c is not needed, as Visual Studio already provides frexp() function via system libraries.
- memchr.c is not needed, as Visual Studio already provides memchr() function via system libraries.
- gzip.c/h, util.c: the strlwr() function conflicts with Visual Studio one. Added HAVE_STRLWR define in config.h and omit implementation + prototype.
- lseek.c: need to include winsock2.h before including windows.h
- utimens.c: need to include sys/times.c on Windows to get struct utimbuf + need to define HAVE_STRUCT_UTIMBUF in config.h +
- unzip.c: added xalloc.h to have consistent prototype for xalloc-die() (and removed this prototype from gzip.h). See also #9 which probably explains why a prototype exists in two places? Anyhow, util.c already included xalloc.h.
- config.h (stored in clearcase as config_win32.h): added typedefs for uid_t and gid_t.
- tailor.h/utimes.c: HAVE_SYS_UTIME_H is defined, but not used. Should this not become part of configure and add HAVE_SYS_UTIME_H define in config.h + adjust code in utimens.c?
- util.c/xalloc-die.c: both contain a xalloc_die() function. I guess this is intentionally?
For t#1, #2, #3, #5, #7, #8: I lack the knowledge to adjust configure in such way that correct defines in config.h are generated. Also the source code need to be adjusted (rely on system headers instead of own prototypes if there is a working 'system'
counterpart. I added myself HAVE_STRLWR in config.h.
The #4 is IMO a bug. It is required to include winsock2.h before including windows.h for recent Visual Studio versions.
The same applies to #6: the prototype for xalloc_die () exists in gzip.h and xalloc.h, but differs (regarding _Neturn attribute and ATTRIBUTE_NORETURN suffix. IMO unzip.c should include xalloc.h and gzip.h should not contain a prototype for xalloc().
Regarding #8: I added a few lines in utimens.c:37:
# include <utime.h>
# include <sys/utime.h>
On Windows/Visual Studio sys/utime.h defines struct utimebuf (so HAVE_STRUCT_UTIMBUF need to be defines as well in config.h). But it would be nice if configure detects this.
>It is in this step 'c' that the 'compile' auxiliary script becomes useful.
Finaly I've a gzip.exe using native Visual Stduio libraries. And at least it starts J:
Copyright (C) 2016 Free Software Foundation, Inc.
Copyright (C) 1993 Jean-loup Gailly.
This is free software. You may redistribute copies of it under the terms of
There is NO WARRANTY, to the extent permitted by law.
Written by Jean-loup Gailly.
So thanks all for your help.