still looking for getaddrinfo - Mailing list pgsql-hackers
From | Andrew Dunstan |
---|---|
Subject | still looking for getaddrinfo |
Date | |
Msg-id | 4303DD02.1000704@dunslane.net Whole thread Raw |
List | pgsql-hackers |
[redirecting to -hackers in the hope of more eyes ;-) ] (goal - to use native ip6 support in Windows) First, after the change Tom committed earlier, I added a test for ws2_32.dll to the win32 port section of config.in: AC_CHECK_LIB(ws2_32, main) That worked fine. The I added this line to src/port/win32/sys/socket.h: #include <ws2tcpip.h> This brought me to the getaddrinfo test. config.in has this: # system's version of getaddrinfo(), if any, may be used only if we found # a definition for struct addrinfo; see notes in src/include/getaddrinfo.h if test x"$ac_cv_type_struct_addrinfo" = xyes ; then AC_REPLACE_FUNCS([getaddrinfo]) else AC_LIBOBJ(getaddrinfo) fi Which generates the code below with the failure show. As Petr Jelinek showed me, If we remove the declaration "char getaddrinfo();" and instead do "#include <netinet/in.h>" the test succeeds, as we want it to. My question is, for the autoconf gurus, how do we write an autoconf test that does this right? Do we need a custom test? cheers andrew -------- Original Message -------- Subject: [pgsql-hackers-win32] looking for getaddrinfo Date: Wed, 17 Aug 2005 17:35:17 -0400 From: Andrew Dunstan <andrew@dunslane.net> To: pgsql-hackers-win32 <pgsql-hackers-win32@postgresql.org> I'm having trouble with a configure test for getaddrinfo on Windows. The relevant part of config.log is as below. Any help would be appreciated. According to http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock/winsock/getaddrinfo_2.asp ws2_32.dll is what I should need, and is what I am using. thanks andrew configure:14625: checking for getaddrinfo configure:14682: gcc -o conftest.exe -O2 -Wall -Wmissing-prototypes -Wpointer-arith -fno-strict-aliasing -I./src/include/port/win32 -DEXEC_BACKEND -Wl,--allow-multiple-definitionconftest.c -lz -lws2_32 -lwsock32 -lm >&5 C:/DOCUME~1/pgrunner/LOCALS~1/Temp/ccGQbaaa.o(.text+0x1a):conftest.c: undefined reference to `getaddrinfo' C:/DOCUME~1/pgrunner/LOCALS~1/Temp/ccGQbaaa.o(.data+0x0):conftest.c: undefined reference to `getaddrinfo' configure:14688: $? = 1 configure: failed program was: | /* confdefs.h. */ | | #define PACKAGE_NAME "PostgreSQL" | #define PACKAGE_TARNAME "postgresql" | #define PACKAGE_VERSION "8.1devel" | #define PACKAGE_STRING "PostgreSQL 8.1devel" | #define PACKAGE_BUGREPORT "pgsql-bugs@postgresql.org" | #define PG_VERSION "8.1devel" | #define DEF_PGPORT 5432 | #define DEF_PGPORT_STR "5432" | #define PG_VERSION_STR "PostgreSQL 8.1devel on i686-pc-mingw32, compiled by GCC gcc.exe (GCC) 3.2.3 (mingw special 20030504-1)" | #define PG_KRB_SRVNAM "postgres" | #define HAVE_LIBM 1 | #define HAVE_LIBWSOCK32 1 | #define HAVE_LIBWS2_32 1 | #define HAVE_LIBZ 1 | #define HAVE_SPINLOCKS 1 | #define STDC_HEADERS 1 | #define HAVE_SYS_TYPES_H 1 | #define HAVE_SYS_STAT_H 1 | #define HAVE_STDLIB_H 1 | #define HAVE_STRING_H 1 | #define HAVE_MEMORY_H 1 | #define HAVE_STRINGS_H 1 | #define HAVE_INTTYPES_H 1 | #define HAVE_STDINT_H 1 | #define HAVE_UNISTD_H 1 | #define HAVE_GETOPT_H 1 | #define HAVE_PWD_H 1 | #define HAVE_SYS_SOCKET_H 1 | #define HAVE_SYS_TIME_H 1 | #define HAVE_UTIME_H 1 | #define HAVE_WCHAR_H 1 | #define HAVE_WCTYPE_H 1 | #define HAVE_NETINET_IN_H 1 | #define HAVE_STRINGIZE 1 | #define HAVE_FUNCNAME__FUNC 1 | #define HAVE_STRUCT_SOCKADDR_STORAGE 1 | #define HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY 1 | #define HAVE_STRUCT_ADDRINFO 1 | #define HAVE_STRUCT_OPTION 1 | #define HAVE_INT_TIMEZONE | #define ACCEPT_TYPE_RETURN unsigned int PASCAL | #define ACCEPT_TYPE_ARG1 unsigned int | #define ACCEPT_TYPE_ARG2 struct sockaddr * | #define ACCEPT_TYPE_ARG3 int | #define HAVE_CBRT 1 | #define HAVE_FCVT 1 | #define HAVE_MEMMOVE 1 | #define HAVE_TOWLOWER 1 | #define HAVE_UTIME 1 | #define HAVE_WCSTOMBS 1 | #define HAVE_DECL_FDATASYNC 0 | #define HAVE_IPV6 1 | #define HAVE_SNPRINTF 1 | #define HAVE_VSNPRINTF 1 | #define HAVE_DECL_SNPRINTF 1 | #define HAVE_DECL_VSNPRINTF 1 | #define HAVE_ISINF 1 | #define HAVE_GETOPT 1 | #define HAVE_RINT 1 | #define HAVE_STRDUP 1 | #define HAVE_STRERROR 1 | #define HAVE_STRTOL 1 | #define HAVE_STRTOUL 1 | /* end confdefs.h. */ | /* Define getaddrinfo to an innocuous variant, in case <limits.h> declares getaddrinfo. | For example, HP-UX 11i <limits.h> declares gettimeofday. */ | #define getaddrinfo innocuous_getaddrinfo | | /* System header to define __stub macros and hopefully few prototypes, | which can conflict with char getaddrinfo (); below. | Prefer <limits.h> to <assert.h> if __STDC__ is defined, since | <limits.h> exists even on freestanding compilers. */ | | #ifdef __STDC__ | # include <limits.h> | #else | # include <assert.h> | #endif | | #undef getaddrinfo | | /* Override any gcc2 internal prototype to avoid an error. */ | #ifdef __cplusplus | extern "C" | { | #endif | /* We use char because int might match the return type of a gcc2 | builtin and then its argument prototype would still apply. */ | char getaddrinfo (); | /* The GNU C library defines this for functions which it implements | to always fail with ENOSYS. Some functions are actually named | something starting with __ and the normal name is an alias. */ | #if defined (__stub_getaddrinfo) || defined (__stub___getaddrinfo) | choke me | #else | char (*f) () = getaddrinfo; | #endif | #ifdef __cplusplus | } | #endif | | int | main () | { | return f != getaddrinfo; | ; | return 0; | } configure:14713: result: no
pgsql-hackers by date: