diff --git a/configure.ac b/configure.ac index f54093b0..61f24633 100644 --- a/configure.ac +++ b/configure.ac @@ -417,8 +417,9 @@ AC_FUNC_VPRINTF AC_CHECK_FUNCS([ \ getpass gettimeofday getline memset mkdir \ strdup strerror memset_s explicit_bzero \ - strlcpy strlcat strnlen sigaction + strnlen sigaction ]) +AC_CHECK_DECLS([strlcpy, strlcat], [], [], [[#include ]]) AC_CHECK_SIZEOF(void *) if test "${ac_cv_sizeof_void_p}" = 8; then LIBRARY_BITNESS="64" diff --git a/src/common/compat_strlcat.c b/src/common/compat_strlcat.c index af373f11..fa51cd29 100644 --- a/src/common/compat_strlcat.c +++ b/src/common/compat_strlcat.c @@ -31,7 +31,7 @@ #include "config.h" #endif -#ifndef HAVE_STRLCAT +#if !defined(HAVE_DECL_STRLCAT) || !HAVE_DECL_STRLCAT #include #include diff --git a/src/common/compat_strlcat.h b/src/common/compat_strlcat.h index f0284aca..9debdfad 100644 --- a/src/common/compat_strlcat.h +++ b/src/common/compat_strlcat.h @@ -10,9 +10,11 @@ #include "config.h" #endif -#ifndef HAVE_STRLCAT +#if !defined(HAVE_DECL_STRLCAT) || !HAVE_DECL_STRLCAT #include size_t strlcat(char *dst, const char *src, size_t siz); +#else +#include #endif #endif diff --git a/src/common/compat_strlcpy.c b/src/common/compat_strlcpy.c index 88f3a5fb..c8505707 100644 --- a/src/common/compat_strlcpy.c +++ b/src/common/compat_strlcpy.c @@ -20,7 +20,7 @@ #include "config.h" #endif -#ifndef HAVE_STRLCPY /* empty file if strlcpy is available */ +#if !defined(HAVE_DECL_STRLCPY) || !HAVE_DECL_STRLCPY #include #include diff --git a/src/common/compat_strlcpy.h b/src/common/compat_strlcpy.h index 5a6067fb..9da1604e 100644 --- a/src/common/compat_strlcpy.h +++ b/src/common/compat_strlcpy.h @@ -38,9 +38,11 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "config.h" #endif -#ifndef HAVE_STRLCPY +#if !defined(HAVE_DECL_STRLCPY) || !HAVE_DECL_STRLCPY #include size_t strlcpy(char *dst, const char *src, size_t siz); +#else +#include #endif #endif