Joe Orton wrote:
Ah, OK, the stdcall/cdecl thing.  I'm not sure how best to handle this.
Does *every* function which the configure script checks for on MinGW use
the __stdcall calling convention, or only some?  If only some, would it
be possible to use some global toggle which switches what NE_SEARCH_LIBS
will check for?

e.g.

NE_MINGW_STDCALL NE_SEARCH_LIBS(socket, ...)
NE_MINGW_CDECL
NE_SEARCH_LIBS(somethingelse, ...)

would that make sense?  Then NE_SEARCH_LIBS could just use some global
variable to prefix the function in the AC_LINK_IFELSEs.  And this could
all be conditional on `uname -s` being whatever MinGW defines at some
point.  Does that sound workable?

It's only the Windows API functions that use stdcall. What do you think about checking `uname -s` and library name? I've attached a new patch demonstrating what I mean.

-Matthias
Index: macros/neon.m4
===================================================================
--- macros/neon.m4      (revision 1066)
+++ macros/neon.m4      (working copy)
@@ -357,12 +357,19 @@
 ne_sl_save_LIBS=$LIBS
 ne_cv_libsfor_$1="not found"
 for lib in $2; do
+    # The w32api libraries link using the stdcall calling convention.
+    if (test `uname -s | grep ^MINGW`) && (test "$lib" = "ws2_32"); then
+        code="__stdcall $1();"
+    else
+        code="$1();"
+    fi
+
     LIBS="$ne_sl_save_LIBS -l$lib $NEON_LIBS"
-    AC_LINK_IFELSE([AC_LANG_PROGRAM([], [[$1();]])],
+    AC_LINK_IFELSE([AC_LANG_PROGRAM([], [$code])],
                    [ne_cv_libsfor_$1="-l$lib"; break])
     m4_if($3, [], [], dnl If $3 is specified, then...
               [LIBS="$ne_sl_save_LIBS -l$lib $3 $NEON_LIBS"
-               AC_LINK_IFELSE([AC_LANG_PROGRAM([], [[$1();]])], 
+               AC_LINK_IFELSE([AC_LANG_PROGRAM([], [$code])], 
                               [ne_cv_libsfor_$1="-l$lib $3"; break])])
 done
 LIBS=$ne_sl_save_LIBS])])
@@ -636,7 +643,7 @@
    # Checks for non-getaddrinfo() based resolver interfaces.
    # QNX has gethostbyname in -lsocket. BeOS only has it in -lbind.
    # CygWin/Winsock2 has it in -lws2_32, allegedly.
-   NE_SEARCH_LIBS(gethostbyname, socket nsl bind)
+   NE_SEARCH_LIBS(gethostbyname, socket nsl bind ws2_32)
    NE_SEARCH_LIBS(hstrerror, resolv,,[:])
    NE_CHECK_FUNCS(hstrerror)
    # Older Unixes don't declare h_errno.
_______________________________________________
neon mailing list
[email protected]
http://mailman.webdav.org/mailman/listinfo/neon

Reply via email to