summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOBATA Akio <obache@wizdas.com>2020-08-17 16:07:14 +0900
committerSlávek Banko <slavek.banko@axis.cz>2021-02-03 22:38:39 +0100
commit3242ddae6c6233ba633bdbfcc1677dbd2630d57d (patch)
tree607e522a7b64505763a9ea1c46c8b412cc934079
parentbdf8756ae1185c869a2f29bc8e6bf3fb138ed289 (diff)
downloadtdelibs-3242ddae6c6233ba633bdbfcc1677dbd2630d57d.tar.gz
tdelibs-3242ddae6c6233ba633bdbfcc1677dbd2630d57d.zip
Add `getservbyname_r` prototype detection to CMake
OpenBSD's prototype is differ than glibc's one, but it is declared. Signed-off-by: OBATA Akio <obache@wizdas.com> (cherry picked from commit 6886dd7e96d475b64ac3c41a96a759c7d5fa2be9)
-rw-r--r--CMakeLists.txt1
-rw-r--r--config.h.cmake2
-rw-r--r--kdecore/network/kresolver_p.h2
3 files changed, 2 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index bdc89d9b9..c3a305458 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -378,6 +378,7 @@ check_function_exists( getpeername HAVE_GETPEERNAME )
check_function_exists( getprotobyname_r HAVE_GETPROTOBYNAME_R )
check_function_exists( getpt HAVE_GETPT )
check_function_exists( getservbyname_r HAVE_GETSERVBYNAME_R )
+check_symbol_exists( getservbyname_r "netdb.h" HAVE_DECL_GETSERVBYNAME_R )
check_function_exists( getservbyport_r HAVE_GETSERVBYPORT_R )
check_function_exists( getsockname HAVE_GETSOCKNAME )
check_function_exists( getsockopt HAVE_GETSOCKOPT )
diff --git a/config.h.cmake b/config.h.cmake
index 0d03e89ad..169d07538 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -156,7 +156,7 @@
#cmakedefine HAVE_CUPS_1_6 1
/* Define to 1 if you have the declaration of `getservbyname_r', and to 0 if you don't. */
-#undef HAVE_DECL_GETSERVBYNAME_R
+#cmakedefine01 HAVE_DECL_GETSERVBYNAME_R
/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'. */
#cmakedefine HAVE_DIRENT_H 1
diff --git a/kdecore/network/kresolver_p.h b/kdecore/network/kresolver_p.h
index 9cc139458..7f74c6fe6 100644
--- a/kdecore/network/kresolver_p.h
+++ b/kdecore/network/kresolver_p.h
@@ -48,7 +48,6 @@ extern TQMutex getXXbyYYmutex;
#endif
/* some systems have the functions, but don't declare them */
-#ifndef __OpenBSD__
#if defined(HAVE_GETSERVBYNAME_R) && !HAVE_DECL_GETSERVBYNAME_R
extern "C" {
struct servent;
@@ -70,7 +69,6 @@ extern "C" {
struct protoent** result);
}
#endif
-#endif
/* decide whether res_init is thread-safe or not */
#if defined(__GLIBC__)