Bug 625 - configure fails to detect getaddrinfo() on Tru64 v5.1
configure fails to detect getaddrinfo() on Tru64 v5.1
Status: RESOLVED FIXED
Product: Sudo
Classification: Unclassified
Component: Configure
1.8.7
Alpha Tru64 UNIX
: low normal
Assigned To: Todd C. Miller
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-11-19 20:57 MST by Daniel Richard G.
Modified: 2013-11-20 14:49 MST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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!