Commit 47f18c7d authored by Ondřej Surý's avatar Ondřej Surý

Replace platform ISC_PLATFORM_NEEDSTRLCPY and ISC_PLATFORM_NEEDSTRLCAT with AC_CHECK_FUNCS call

parent 4014bc42
......@@ -404,6 +404,12 @@
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the `strlcat' function. */
#undef HAVE_STRLCAT
/* Define to 1 if you have the `strlcpy' function. */
#undef HAVE_STRLCPY
/* Define to 1 if you have the <sys/capability.h> header file. */
#undef HAVE_SYS_CAPABILITY_H
......
......@@ -716,8 +716,6 @@ DST_EXTRA_SRCS
DST_EXTRA_OBJS
USE_ISC_SPNEGO
READLINE_LIB
ISC_PLATFORM_NEEDSTRLCAT
ISC_PLATFORM_NEEDSTRLCPY
ISC_PLATFORM_HAVETFO
BIND9_CO_RULE
LIBTOOL_MODE_UNINSTALL
......@@ -17608,22 +17606,17 @@ esac
#
# Check for some other useful functions that are not ever-present.
#
ac_fn_c_check_func "$LINENO" "strlcpy" "ac_cv_func_strlcpy"
if test "x$ac_cv_func_strlcpy" = xyes; then :
ISC_PLATFORM_NEEDSTRLCPY="#undef ISC_PLATFORM_NEEDSTRLCPY"
else
ISC_PLATFORM_NEEDSTRLCPY="#define ISC_PLATFORM_NEEDSTRLCPY 1"
fi
for ac_func in strlcpy strlcat
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF
ac_fn_c_check_func "$LINENO" "strlcat" "ac_cv_func_strlcat"
if test "x$ac_cv_func_strlcat" = xyes; then :
ISC_PLATFORM_NEEDSTRLCAT="#undef ISC_PLATFORM_NEEDSTRLCAT"
else
ISC_PLATFORM_NEEDSTRLCAT="#define ISC_PLATFORM_NEEDSTRLCAT 1"
fi
done
......
......@@ -1895,15 +1895,7 @@ AC_SUBST(ISC_PLATFORM_HAVETFO)
#
# Check for some other useful functions that are not ever-present.
#
AC_CHECK_FUNC(strlcpy,
[ISC_PLATFORM_NEEDSTRLCPY="#undef ISC_PLATFORM_NEEDSTRLCPY"],
[ISC_PLATFORM_NEEDSTRLCPY="#define ISC_PLATFORM_NEEDSTRLCPY 1"])
AC_SUBST(ISC_PLATFORM_NEEDSTRLCPY)
AC_CHECK_FUNC(strlcat,
[ISC_PLATFORM_NEEDSTRLCAT="#undef ISC_PLATFORM_NEEDSTRLCAT"],
[ISC_PLATFORM_NEEDSTRLCAT="#define ISC_PLATFORM_NEEDSTRLCAT 1"])
AC_SUBST(ISC_PLATFORM_NEEDSTRLCAT)
AC_CHECK_FUNCS([strlcpy strlcat])
AC_SUBST(READLINE_LIB)
AC_ARG_WITH(readline,
......
......@@ -62,15 +62,6 @@
*/
@ISC_PLATFORM_HAVEDEVPOLL@
/*
*** Printing.
***/
/*
* If the system needs strlcat(), ISC_PLATFORM_NEEDSTRLCAT will be defined.
*/
@ISC_PLATFORM_NEEDSTRLCAT@
/***
*** Miscellaneous.
***/
......
......@@ -20,18 +20,14 @@
ISC_LANG_BEGINDECLS
#if !defined(HAVE_STRLCPY)
size_t
isc_string_strlcpy(char *dst, const char *src, size_t size);
#ifdef ISC_PLATFORM_NEEDSTRLCPY
#define strlcpy isc_string_strlcpy
#endif
strlcpy(char *dst, const char *src, size_t size);
#endif /* !defined(HAVE_STRLCPY) */
#if !defined(HAVE_STRLCAT)
size_t
isc_string_strlcat(char *dst, const char *src, size_t size);
#ifdef ISC_PLATFORM_NEEDSTRLCAT
#define strlcat isc_string_strlcat
strlcat(char *dst, const char *src, size_t size);
#endif
int
......
......@@ -49,8 +49,9 @@
#include "isc/string.h" // IWYU pragma: keep
#if !defined(HAVE_STRLCPY)
size_t
isc_string_strlcpy(char *dst, const char *src, size_t size)
strlcpy(char *dst, const char *src, size_t size)
{
char *d = dst;
const char *s = src;
......@@ -76,9 +77,11 @@ isc_string_strlcpy(char *dst, const char *src, size_t size)
return(s - src - 1); /* count does not include NUL */
}
#endif /* !defined(HAVE_STRLCPY) */
#if !defined(HAVE_STRLCAT)
size_t
isc_string_strlcat(char *dst, const char *src, size_t size)
strlcat(char *dst, const char *src, size_t size)
{
char *d = dst;
const char *s = src;
......@@ -106,6 +109,7 @@ isc_string_strlcat(char *dst, const char *src, size_t size)
return(dlen + (s - src)); /* count does not include NUL */
}
#endif /* !defined(HAVE_STRLCAT) */
int
isc_string_strerror_r(int errnum, char *buf, size_t buflen) {
......
......@@ -46,9 +46,6 @@
#undef MSG_TRUNC
#define ISC_PLATFORM_NEEDSTRLCPY
#define ISC_PLATFORM_NEEDSTRLCAT
/*
* Used to control how extern data is linked; needed for Win32 platforms.
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment