On Tue, Aug 09, 2016 at 04:10:07PM +0200, Corinna Vinschen wrote:
Hi Urs,
On Aug 9 13:35, Urs Janßen wrote:
I've made snapshots of the upcomming 2.4.0 release (planned for August 23rd), please give them a try and report (or even fix) any issues:
<ftp://ftp.tin.org/pub/news/clients/tin/v2.3/snapshots/tin-2.4.0.tar.xz> <ftp://ftp.tin.org/pub/news/clients/tin/v2.3/snapshots/tin-2.4.0.tar.bz2> <ftp://ftp.tin.org/pub/news/clients/tin/v2.3/snapshots/tin-2.4.0.tar.gz>
I encountered two build problems in the tin configury.
I was trying to build the snapshot on Cygwin and noticed lots of warnings in terms of the strcasecmp function being undeclared.
okay...
To explain why I only noticed now, lately newlib and Cygwin had a major revamp of the header files to align the feature macro handling closer to the standards and ultimately to glibc as far as GNU extensions are concerned.
as a rule, I don't use changes that only work on "new" systems.
When building on Cygwin, the tin configury sets -D_XOPEN_SOURCE=600. However, tin.h contains this:
#ifndef __QNX__ # ifdef HAVE_STRING_H # include <string.h> # else # ifdef HAVE_STRINGS_H # include <strings.h> # endif /* HAVE_STRINGS_H */ # endif /* HAVE_STRING_H */ #else # ifdef HAVE_STRING_H # include <string.h> # endif /* HAVE_STRING_H */ # ifdef HAVE_STRINGS_H # include <strings.h> # endif /* HAVE_STRINGS_H */ #endif /* !__QNX__ */
So on non-__QNX__ systems, prefer to include string.h and only if that's not available, include strings.h.
AFAICS this is incorrect. POSIX-1.2008 requires to include strings.h to get strcasecmp/strncasecmp.
It might be now, but when I added it, there were (possibly still are...) systems which would have conflicting definitions.
Per the glibc man page the declarations are in string.h only on BSD systems or in BSD compatiblity mode. You won't notice this on Linux,
My Debian 7 manual page only shows strings.h The header files have the prototypes in both (but not ifdef'd to match your description).
because on Linux the aclocal.m4 function CF_XOPEN_SOURCE will set the compatibility mode to -D_GNU_SOURCE, rather than -D_XOPEN_SOURCE=600.
that's what works for Linux.
I think the right thing to do is to change tin.h to always include string.h and strings.h when they are available, i. e.:
It's worth a try, to see what breaks :-)
The second problem I encountered is a missing declaration of vasprintf. The reason here is that configure checks for the existence of vasprintf, but then the tin headers don't define _GNU_SOURCE before using vasprintf, even though vasprintf is a GNU extension.
_GNU_SOURCE should be defined in the makefile (not in the headers). Defining that sort of thing in the header files has never worked reliably.
I think the right thing to do here is to define _GNU_SOURCE as soon as HAVE_VASPRINTF is defined. E. g:
nope. If it's not defined by CF_XOPEN_SOURCE and/or CF_GNU_SOURCE, it's probably incorrect.
A Cygwin-specific workaround for both problems would be to change CF_XOPEN_SOURCE to use the same mechanism to set _GNU_SOURCE as on Linux etc, and to regenerate configure:
==================================================================== --- aclocal.m4.ORIG 2016-08-09 15:35:17.983772427 +0200 +++ aclocal.m4 2016-08-09 16:06:06.794538386 +0200 @@ -5599,7 +5599,7 @@ case $host_os in (aix[[4-7]]*) cf_xopen_source="-D_ALL_SOURCE" ;; -(cygwin|msys) +(msys) cf_XOPEN_SOURCE=600 ;; (darwin[[0-8]].*) @@ -5627,7 +5627,7 @@ case $host_os in cf_xopen_source="-D_SGI_SOURCE" cf_XOPEN_SOURCE= ;; -(linux*|gnu*|mint*|k*bsd*-gnu) +(linux*|gnu*|mint*|k*bsd*-gnu|cygwin) CF_GNU_SOURCE
again - something to try :-) -- Thomas E. Dickey <dickey@invisible-island.net> http://invisible-island.net ftp://invisible-island.net