replace getservbyname_r ifdef hacks with configure check

this should make it work automatically on any new platform without
having to add yet another ifdef hack.
should fix issues with android (#265).
additionally the code for the systems lacking GNU-compatible getservbyname_r()
is now guarded with a mutex, which prevents possible races, therefore
resolving the ancient "TODO" item.
This commit is contained in:
rofl0r
2018-12-02 13:48:43 +00:00
parent 2213afb6f0
commit 49bf4ba772
2 changed files with 15 additions and 9 deletions

3
configure vendored
View File

@ -149,6 +149,9 @@ issolaris() {
$solaris_detected
}
check_compile 'whether we have GNU-style getservbyname_r()' "-DHAVE_GNU_GETSERVBYNAME_R" \
'#define _GNU_SOURCE\n#include <netdb.h>\nint main() {\nstruct servent *se = 0;struct servent se_buf;char buf[1024];\ngetservbyname_r("foo", (void*) 0, &se_buf, buf, sizeof(buf), &se);\nreturn 0;}'
check_define __APPLE__ && {
mac_detected=true
check_define __x86_64__ && mac_64=true