Skip to main content.
home | support | download

Back to List Archive

Re: Suggestion for small correction in swish-e

From: krasnal <krasnal(at)>
Date: Mon May 23 2005 - 12:38:44 GMT
I've seen that 2.4.4 is coming up so I've decided to take a look at this.

On Fri, 13 May 2005 09:57:38 -0700 (PDT), David L Norris wrote
> Cygwin may be defining _WIN32 when it is emulating a UNIX 
> environment. If you can disable the _WIN32 definition then Swish-e 
> should work fine. If you cannot disable the _WIN32 definition then 
> the #ifdef _WIN32 lines in Swish-e may need to be changed to 
> something like:  #if defined(_WIN32) && !defined(__CYGWIN__)

I'm not sure about undefining _WIN32.  I think it is still win 32
environment but more "unix/posix" like.  Unfortunately I don't have enough
knowledge of cygwin to tell what is the best way :).  The other problem is
that I don't know how to turn it off in an elegant way :))).  Probably
adding -mno-win32 to CFLAGS should help since in 
../gcc-lib/i686-pc-cygwin/3.3.3/specs there's something like:

%(cpp_cpu) %{posix:-D_POSIX_SOURCE}   %{mno-win32:%{mno-cygwin: %emno-cygwin
and mno-win32
 are not compatible}}   %{mno-cygwin:-D__MSVCRT__ -D__MINGW32__
}  %{!mno-cygwin:-D__CYGWIN32__ -D__CYGWIN__ %{!ansi:-Dunix} -D__unix__
-D__unix }  %{mwin
32|mno-cygwin:-DWIN32 -D_WIN32 -D__WIN32 -D__WIN32__ %{!ansi:-DWINNT}} 
-win32|mno-cygwin:-idirafter ../include/w32api%s -idirafter

I can't find the description of this in the info files.  But doing this
gives me the following:

make[2]: Entering directory `/home/aao014/tmp/swish-e-2.4.3/src'
if /bin/bash ../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I. 
-Dlibexecdir=\"/usr/local/lib/swish-e\" -DPATH_SEPARATOR=\":\"  
-I/usr/include/libxml2 -Ireplace  -Wall -mno-win32 -MT search.lo -MD -MP -MF
".deps/search.Tpo" \
  -c -o search.lo `test -f 'search.c' || echo './'`search.c; \
then mv -f ".deps/search.Tpo" ".deps/search.Plo"; \
else rm -f ".deps/search.Tpo"; exit 1; \
 gcc -DHAVE_CONFIG_H -I. -I. -I. -Dlibexecdir=\"/usr/local/lib/swish-e\"
-DPATH_SEPARATOR=\":\" -I/usr/include/libxml2 -Ireplace -Wall -mno-win32 -MT
search.lo -MD -MP -MF .deps/search.Tpo -c search.c  -DPIC -o .libs/search.o
In file included from search.c:111:
swish.h:90:21: windows.h: No such file or directory
make[2]: *** [search.lo] Error 1
make[2]: Leaving directory `/home/aao014/tmp/swish-e-2.4.3/src'
make[1]: *** [check-recursive] Error 1
make[1]: Leaving directory `/home/aao014/tmp/swish-e-2.4.3/src'
make: *** [check-recursive] Error 1

I don't know why HAVE_WINDOWS_H is defined in the result of running
configure - the error comes from search.h lines:

#include <windows.h>

while configure with the -mno-win32 gives me:

checking windows.h usability... no
checking windows.h presence... yes
configure: WARNING: windows.h: present but cannot be compiled
configure: WARNING: windows.h:     check for missing prerequisite headers?
configure: WARNING: windows.h: see the Autoconf documentation
configure: WARNING: windows.h:     section "Present But Cannot Be Compiled"
configure: WARNING: windows.h: proceeding with the preprocessor's result
configure: WARNING: windows.h: in the future, the compiler will take precedence
configure: WARNING:     ## ------------------------------------------ ##
configure: WARNING:     ## Report this to the AC_PACKAGE_NAME lists.  ##
configure: WARNING:     ## ------------------------------------------ ##
checking for windows.h... yes

IMHO if the windows.h is not usable we should not define HAVE_WINDOWS_H (see
also PS note)

> If that works then I can probably make the change before 2.4.4.  It will
> be a while before I can test it myself.

For sure the attached patch works FOR ME :), at least it passes 'make check' 
and does not show the problematic behaviour.  Do not apply it blindly :)),
although I modified only some #if.. _WIN32 directives I'm not sure whether
all of them are needed/correct (e.g. it looks like geteuid are defined but
I don't know what is their semantics, symlinks are emulated by the cygwin
and I don't know if this kind of support is enough for swish-e - I had no
problems with this so far).

Best regards

BTW. I've just checked that the defaults are
aao014@aao014-01 ~/tmp
$ cat test.c
#ifdef _WIN32
"Aqq na muniu"
aao014@aao014-01 ~/tmp
$ gcc -E test.c
# 1 "test.c"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "test.c"
aao014@aao014-01 ~/tmp
$ gcc -E -mwin32 test.c
# 1 "test.c"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "test.c"

"Aqq na muniu"

so I need to tell explicitely to preprocessor that I wan't _WIN32 to be 
defined.  I don't understand autoconf/automake enough to try to figure out
why it is defined during swish-e build.
    ____   _  ___ 
   /  | \_/ |/ _ \   Andrzej Marek Ostruszka 
  / _ |     | (_) |       MPSC (Cracow)
 /_/ L|_|V|_|\___/  (GnuPG key ID: 0x3D9C498A)

Due to deletion of content types excluded from this list by policy,
this multipart message was reduced to a single part, and from there
to a plain text message.
Received on Mon May 23 05:38:59 2005