Bug 625

Summary: configure fails to detect getaddrinfo() on Tru64 v5.1
Product: Sudo Reporter: Daniel Richard G. <skunk>
Component: ConfigureAssignee: Todd C. Miller <Todd.Miller>
Status: RESOLVED FIXED    
Severity: normal    
Priority: low    
Version: 1.8.7   
Hardware: Alpha   
OS: Tru64 UNIX   

Description Daniel Richard G. 2013-11-19 20:57:14 MST
Tru64 v5.1 has getaddrinfo(), but not in the form most systems have it. From /usr/include/netdb.h:

    #if defined (_SOCKADDR_LEN) || defined (_XOPEN_SOURCE_EXTENDED)
    #define getaddrinfo ngetaddrinfo
    #else
    #define getaddrinfo ogetaddrinfo
    #endif

The configure script only looks for the library symbol, so it doesn't find the function (Sudo hg tip here):

    checking for getaddrinfo... no
    checking for getaddrinfo in -lsocket... no
    checking for getaddrinfo in -linet... no
    checking for getaddrinfo in -lsocket -lnsl... no

It thus enables building compat/getaddrinfo.c, which fails due to conflicting definitions:

libtool: compile:  cc -c -I../../include -I.. -I../.. -D__STDC_WANT_LIB_EXT1__=1 -std1 -warnprotos -readonly_strings -fast -O4 ../../compat/getaddrinfo.c  -DPIC -o .libs/getaddrinfo.o
[several warnings about redefined cpp symbols]
cc: Error: ../../compat/getaddrinfo.h, line 36: In this declaration, the struct "addrinfo" is redefined. (redefstruct)
struct addrinfo {
^
cc: Error: ../../compat/getaddrinfo.h, line 72: In this declaration, the type of "gai_strerror" is not compatible with the type of a previous declaration of "gai_strerror" at line number 293 in file /usr/include/netdb.h. (notcompat)
const char *gai_strerror(int ecode);
------------^
[...]


If I manually edit config.h so that HAVE_GETADDRINFO is #defined, then the build succeeds.

It would probably make sense to check for getaddrinfo() using AC_LINK_IFELSE() instead of AC_CHECK_FUNCS(), but the concomitant usage of SUDO_CHECK_LIB() makes the solution less than straightforward.
Comment 1 Todd C. Miller 2013-11-20 12:05:47 MST
I've checked in a dedicated check for getaddrifo() that should address this.
Comment 2 Daniel Richard G. 2013-11-20 14:49:44 MST
And it does, sure enough. Sudo now builds (and tests) cleanly on Tru64 v5.1. Thank you for the fix!