ai_flags in BSD/OS

Russ Allbery rra at stanford.edu
Sat Jan 31 16:47:20 UTC 2009


Julien ÉLIE <julien at trigofacile.com> writes:

>> If that flag is defined but doesn't work on BSD/OS, we may need to
>> probe in configure for whether it actually works.
>
> How can we do that?  Is something like what Apache did fine?
>    http://mail-archives.apache.org/mod_mbox/apr-commits/200309.mbox/%3C20030929113159.95912.qmail@minotaur.apache.org%3E

Yup, that looks great.

Their probe source is a little #ifdef-crazy.  The rest of INN assumes that
all of the headers being included exist, so you can just include them
unconditionally in the probe.  I would use INN_FUNC_GETADDRINFO_ADDRCONFIG
for the name of the macro, HAVE_GETADDRINFO_ADDRCONFIG for the define, and
separate the source into a separate define.  See, for instance,
m4/inet-ntoa.m4 for a similar sort of probe.  (Although feel free to use
INN's indentation style for the source snippet.)

Then, in include/portable/socket.h, you can do something like:

    /* AI_ADDRCONFIG results in an error from getaddrinfo on BSD/OS and
       possibly other platforms.  If configure determined it didn't work,
       pretend it doesn't exist. */
    #if !defined(HAVE_GETADDRINFO_ADDRCONFIG) && defined(AI_ADDRCONFIG)
    # undef AI_ADDRCONFIG
    #endif

before the code that defines it to 0 if it doesn't exist.

-- 
Russ Allbery (rra at stanford.edu)             <http://www.eyrie.org/~eagle/>

    Please send questions to the list rather than mailing me directly.
     <http://www.eyrie.org/~eagle/faqs/questions.html> explains why.



More information about the inn-workers mailing list