(Not sure which list is relevant, so I'm cross-posting to both mingw-users and autoconf lists)

Hello lists,

when I'm cross compiling from linux x86_64 to 32-bit MinGW autoconf refuses to detect getaddrinfo and define HAVE_GETADDRINFO. I've limited the case to the following behaviour:

The "getaddrinfo-link.c" attached file is a simplification of what AC_REPLACE_FUNCS(getaddrinfo) tries to compile and link. It fails to find the symbol because gcc most probably doesn't use proper calling conventions (stdcall). This is demonstrated by the build success of the second attached program. So:

$ i686-w64-mingw32-gcc     -o getaddrinfo-link getaddrinfo-link.c    -lws2_32
/tmp/cctQtw3q.o:getaddrinfo-link.c:(.text+0xc): undefined reference to 
`_getaddrinfo'
collect2: ld returned 1 exit status
$ i686-w64-mingw32-gcc     -o getaddrinfo-link getaddrinfo-link-2.c    -lws2_32
$

In the second case ("getaddrinfo-link-2.c") compilation is successful because the symbol linked is "_getaddrinfo@16" which actually exists in ws2_32 (verified it with nm). Here is the version of my toolchain:

$ i686-w64-mingw32-gcc --version
i686-w64-mingw32-gcc (GCC) 4.6.3

Any idea what's the proper way to use AC_REPLACE_FUNCS in this case?


Thanks in advance,
Dimitris
int __attribute__((__stdcall__)) getaddrinfo(int,int,int,int);

int
main ()
{
return getaddrinfo (0,0,0,0);
  ;
  return 0;
}
int getaddrinfo ();

int
main ()
{
return getaddrinfo ();
  ;
  return 0;
}
_______________________________________________
Autoconf mailing list
Autoconf@gnu.org
https://lists.gnu.org/mailman/listinfo/autoconf

Reply via email to