Autoconf test and demo for gethostname_r
Purpose This is a small demonstration of an autoconf test package to determine the
right way to call gethostbyname_r under different oses.
Add the ac_c_gethostbyname_r.m4 test to your autoconf's aclocal directory
(probably in /usr/local/share/aclocal
get acx_pthread.m4 from http://www.gnu.org/software/ac-archive/ and put
it in your autoconf's aclocal dir
add to acconfig.h the following lines
add gethostname.c to your project
add gethostname.h to your project
use the gethostname_re api instead of gethostbyname_r. Follow the example
in test.c, note that you should initialize the variable as shown there, and do
clean up after the final gethostname call as shown.
Perhaps in the future this little package should have the rest of the
nonstandaized network _r calls with appropiate autoconf tests and interfaces,
feel free to send on any thoughts on that.
Known to work under at least
Solaris, OSF/1 and Linux
Caolan McNamara (2000) <firstname.lastname@example.org>