summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGustavo Sverzut Barbieri <barbieri@profusion.mobi>2017-01-26 15:35:35 -0200
committerGustavo Sverzut Barbieri <barbieri@profusion.mobi>2017-01-26 15:53:14 -0200
commit85a095f0a88ef803e1eb98664b83116e2614c4ce (patch)
treefa8ee37c671dc1b041d7c9bec5c4ba992b8b5574
parent4ed139a49cedf3f6e85d6f631a56bb7e4e416cc6 (diff)
cmake: fix strlcpy() detection and usage.
Linux usually ship with strlcpy(), but it's inside bsd/string.h and needs -lbsd. On BSD it's inside string.h and libc.
-rw-r--r--cmake/config/common.cmake8
-rw-r--r--src/lib/eina/CMakeLists.txt4
-rw-r--r--src/lib/eina/eina_str.c4
3 files changed, 15 insertions, 1 deletions
diff --git a/cmake/config/common.cmake b/cmake/config/common.cmake
index 2e31bf4dd9..be69a892fd 100644
--- a/cmake/config/common.cmake
+++ b/cmake/config/common.cmake
@@ -36,6 +36,7 @@ EFL_OPTION(ENABLE_VALGRIND "Enable valgrind support" "${SUGGEST_VALGRIND}" DEPEN
36 36
37HEADER_CHECK(alloca.h) 37HEADER_CHECK(alloca.h)
38HEADER_CHECK(asm/hwcap.h) 38HEADER_CHECK(asm/hwcap.h)
39HEADER_CHECK(bsd/string.h)
39HEADER_CHECK(dirent.h) 40HEADER_CHECK(dirent.h)
40HEADER_CHECK(execinfo.h) 41HEADER_CHECK(execinfo.h)
41HEADER_CHECK(mcheck.h) 42HEADER_CHECK(mcheck.h)
@@ -80,7 +81,12 @@ FUNC_CHECK(shm_open INCLUDE_FILES sys/mman.h sys/stat.h fcntl.h LIBRARIES rt)
80FUNC_CHECK(siglongjmp INCLUDE_FILES setjmp.h) 81FUNC_CHECK(siglongjmp INCLUDE_FILES setjmp.h)
81FUNC_CHECK(splice INCLUDE_FILES fcntl.h DEFINITIONS "-D_GNU_SOURCE=1") 82FUNC_CHECK(splice INCLUDE_FILES fcntl.h DEFINITIONS "-D_GNU_SOURCE=1")
82FUNC_CHECK(strerror_r INCLUDE_FILES string.h) 83FUNC_CHECK(strerror_r INCLUDE_FILES string.h)
83FUNC_CHECK(strlcpy INCLUDE_FILES bsd/string.h) 84
85if(HAVE_BSD_STRING_H)
86 FUNC_CHECK(strlcpy INCLUDE_FILES bsd/string.h LIBRARIES bsd)
87else()
88 FUNC_CHECK(strlcpy INCLUDE_FILES string.h)
89endif()
84 90
85TYPE_CHECK(siginfo_t INCLUDE_FILES signal.h) 91TYPE_CHECK(siginfo_t INCLUDE_FILES signal.h)
86 92
diff --git a/src/lib/eina/CMakeLists.txt b/src/lib/eina/CMakeLists.txt
index bd23e782e8..4c5ee50faa 100644
--- a/src/lib/eina/CMakeLists.txt
+++ b/src/lib/eina/CMakeLists.txt
@@ -22,6 +22,10 @@ set(LIBRARIES
22 rt 22 rt
23) 23)
24 24
25if(HAVE_BSD_STRING_H)
26 list(APPEND LIBRARIES bsd)
27endif()
28
25set(PUBLIC_HEADERS 29set(PUBLIC_HEADERS
26 Eina.h 30 Eina.h
27 eina_accessor.h 31 eina_accessor.h
diff --git a/src/lib/eina/eina_str.c b/src/lib/eina/eina_str.c
index dcf93c3ca4..b9f0c034ff 100644
--- a/src/lib/eina/eina_str.c
+++ b/src/lib/eina/eina_str.c
@@ -28,6 +28,10 @@
28#include <limits.h> 28#include <limits.h>
29#include <ctype.h> 29#include <ctype.h>
30 30
31#ifdef HAVE_BSD_STRING_H
32# include <bsd/string.h>
33#endif
34
31#ifdef HAVE_ICONV 35#ifdef HAVE_ICONV
32# include <errno.h> 36# include <errno.h>
33# include <iconv.h> 37# include <iconv.h>