ai_flags in BSD/OS
Julien ÉLIE
julien at trigofacile.com
Sat Jan 31 19:08:56 UTC 2009
Hi,
> 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:
Thanks, Russ, for your detailed information.
It works pretty well.
It looks as though my autoconf 2.61 were broken:
struct addrinfo hints, *ai;
is not understood, contrary to:
struct addrinfo hints;
struct addrinfo *ai;
The first one gives:
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <netdb.h>
#include <sys/types.h>
#include <sys/socket.h>
#if STDC_HEADERS || HAVE_STRING_H
# include <string.h>
#endif
int
main(int argc, char **argv) {
struct addrinfo hints
_ACEOF
rm -f conftest$ac_exeext
if { (ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_link") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && { ac_try='./conftest$ac_exeext'
{ (case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
*ai;
memset(&hints, 0, sizeof(hints));
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
hints.ai_flags = AI_ADDRCONFIG;
return getaddrinfo("localhost", NULL, &hints, &ai) != 0;
}
Very weird...
--
Julien ÉLIE
« L'homme a imaginé le cercle avant de savoir que la terre était ronde.
Ça prouve quand même une certaine faculté d'invention. » (Jacques Sternberg)
More information about the inn-workers
mailing list