Problem with sources - socketmodule.c

Jonathan Giddy jon at rdt.monash.edu.au
Tue Aug 31 07:47:42 CEST 1999


pointal at lure.u-psud.fr (Laurent POINTAL) writes:

>Looking after the error, it was a problem of the number of arguments
>for gethost_by_name_r (and for gethotstbyaddr_r). 
>The ./configure has correctly tested my headers, found a 5 arguments
>gethost_by_name_r, and defined HAVE_GETHOSTBYNAME_R5_ARG.

>But in the socketmodule.c, the source begin by undefining the
>preprocessor symbols HAVE_GETHOSTBYNAME_* set by ./configure, and set
>them depending on the platform... and for linux it automatically set
>it to HAVE_GETHOSTBYNAME_R6_ARG. Which is false on the Slackware4
>Linux.

>Currently, I have put a #if !defined(linux) / #endif around the
>socketmodule.c code which modify HAVE_GETHOSTBYNAME_* and all works
>well.

>Note:
>Linux 2.2.6
>libc.so.5.4.46
>egcs 2.91.66
>gcc 2.7.2.3
>netdb.h v1.4 1995/08/14

The configure tests are not used because they don't work with non-ANSI 
compilers, which are still the default compilers on some platforms.

This sounds like a libc5 vs. glibc problem, but I can't find any details.
If it is, the solution is to add further tests involving the preprocessor 
defines linux and __GLIBC__, as below.  But maybe someone can confirm my
hypothesis first.

e.g.
#ifdef HAVE_GETHOSTBYNAME_R
#if defined(_AIX) || defined(__osf__)
#define HAVE_GETHOSTBYNAME_R_3_ARG
#elif defined(linux) && defined(__GLIBC__)
#define HAVE_GETHOSTBYNAME_R_6_ARG
#elif defined(__sun__) || defined(__sgi) || defined(linux)
#define HAVE_GETHOSTBYNAME_R_5_ARG
#else
#undef HAVE_GETHOSTBYNAME_R
#endif
#endif





More information about the Python-list mailing list