Subject: util.c of diffutils 3.5 fails to build on Windows

From: Kees Dekker <[email-masked]>
Date: Thu, 9 Feb 2017 15:00:34 +0000

Hi,

Contrary to diffutils 3.3, src/util.c got an additional piece of code, that is quite UNIX centric. I've the following build errors when building util.c with Visual Studio's cl.exe:

-          SIGSTOP, SIGTSTP, SIGALRM, SIGHUP, SIGPIPE, SIGQUIT not defined. Windows has a very limited set of signaling, see: https://msdn.microsoft.com/en-us/library/xdkz3x12.aspx

-          The pseudo signals SIGKILL, SIGSTOP are not defined, similar to lib/sigaction.c.

-          There is already special msvc code for signal handling, but is not used here.

-          Even if the code compiles, the pr_program is UNIX centric too (PR_PROGRAM = /usr/bin/pr). I think the stuff behind paginate is solely UNIX. Can you add this behind platform specific ifdefs (#ifndef _WIN32)?

Even with using http://git.savannah.gnu.org/gitweb/?p=gperf.git;a=blob_plain;f=README.windows (step 2, native build for visual studio, using the ar-lib and compile helper scripts) (and making some minor fixes, see also https://debbugs.gnu.org/cgi/bugreport.cgi?bug=25663) util.c did not compile.

The errors are:

util.c(227): error C2065: 'SIGSTOP': undeclared identifier
util.c(248): error C2065: 'SIGTSTP': undeclared identifier
util.c(251): error C2065: 'SIGALRM': undeclared identifier
util.c(251): error C2065: 'SIGHUP': undeclared identifier
util.c(251): error C2065: 'SIGPIPE': undeclared identifier
util.c(251): error C2065: 'SIGQUIT': undeclared identifier
util.c(301): error C2065: 'SIGTSTP': undeclared identifier
util.c(246): error C2099: initializer is not a constant
util.c(565): warning C4116: unnamed type definition in parentheses
util.c(896): warning C4047: '=': 'FILE *' differs in levels of indirection from 'int'
make[1]: *** [Makefile:1418: util.obj] Error 2
make[1]: Leaving directory '/cygdrive/d/temp/kees/downloads/diffutils-3.5/src'
make: *** [Makefile:1277: all] Error 2

I'm willing to try to make a fix, but I first like to hear your thoughts....
My idea is to remove references to the 'pr' tool on Windows/Visual Studio, as it is not available.

Regards,
Kees