summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOBATA Akio <obache@wizdas.com>2019-04-20 16:46:15 +0900
committerSlávek Banko <slavek.banko@axis.cz>2019-04-21 15:35:21 +0200
commitd2f98f542298c3af4627fd3e4dbec467d011409b (patch)
treedb781064b0708de15fcba42e6aa675ca2230dd74
parent1a69923c0ab462a50578e1e00554efeab58b95a5 (diff)
downloadtdenetwork-d2f98f542298c3af4627fd3e4dbec467d011409b.tar.gz
tdenetwork-d2f98f542298c3af4627fd3e4dbec467d011409b.zip
Change to check `strerror` and `fdopen` with CMake
It is hard to update list of "available" platforms. Signed-off-by: OBATA Akio <obache@wizdas.com> (cherry picked from commit 7537d9ef7d526052ca051d93692b290b5fb64d88)
-rw-r--r--config.h.cmake3
-rw-r--r--ktalkd/ConfigureChecks.cmake3
-rw-r--r--ktalkd/mail.local/mail.local.c7
3 files changed, 11 insertions, 2 deletions
diff --git a/config.h.cmake b/config.h.cmake
index 3bed93bc..df1f6404 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -52,6 +52,9 @@
#cmakedefine HAVE_UTMP_H 1
#cmakedefine HAVE_UTMPX_H 1
#cmakedefine HAVE_VSNPRINTF 1
+#cmakedefine HAVE_STRERROR 1
+#cmakedefine HAVE_STRERROR_PROTO 1
+#cmakedefine HAVE_FDOPEN_PROTO 1
#cmakedefine SCANDIR_NEEDS_CONST 1
// only for Linux
diff --git a/ktalkd/ConfigureChecks.cmake b/ktalkd/ConfigureChecks.cmake
index 923854b0..d10b5ea4 100644
--- a/ktalkd/ConfigureChecks.cmake
+++ b/ktalkd/ConfigureChecks.cmake
@@ -17,6 +17,9 @@ check_include_file( utmp.h HAVE_UTMP_H )
check_include_file( utmpx.h HAVE_UTMPX_H )
check_function_exists( vsnprintf HAVE_VSNPRINTF )
+check_function_exists( strerror HAVE_STRERROR )
+check_symbol_exists( strerror "string.h" HAVE_STRERROR_PROTO )
+check_symbol_exists( fdopen "stdio.h" HAVE_FDOPEN_PROTO )
if( ${CMAKE_SYSTEM_NAME} STREQUAL "Linux" )
set( PROC_FIND_USER 1 CACHE INTERNAL "" FORCE )
diff --git a/ktalkd/mail.local/mail.local.c b/ktalkd/mail.local/mail.local.c
index 9c90d272..c88351dd 100644
--- a/ktalkd/mail.local/mail.local.c
+++ b/ktalkd/mail.local/mail.local.c
@@ -232,8 +232,11 @@ static char copyright[] =
# define _BSD_VA_LIST_ va_list
#endif
-#if !defined(BSD4_4) && !defined(linux) && !defined(_UNIXWARE)
+#ifndef HAVE_STRERROR_PROTO
extern char *strerror __P((int));
+#endif
+
+#ifndef HAVE_FDOPEN_PROTO
extern FILE *fdopen __P((int, const char *));
#endif
@@ -831,7 +834,7 @@ e_to_sys(num)
}
}
-#if !defined(BSD4_4) && !defined(__osf__) && !defined(__GLIBC__)
+#ifndef HAVE_STRERROR
char *
strerror(eno)