]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Replace platform ISC_PLATFORM_NEEDSTRLCPY and ISC_PLATFORM_NEEDSTRLCAT with AC_CHECK_...
authorOndřej Surý <ondrej@sury.org>
Tue, 4 Sep 2018 19:10:02 +0000 (21:10 +0200)
committerOndřej Surý <ondrej@sury.org>
Fri, 7 Sep 2018 10:17:30 +0000 (12:17 +0200)
config.h.in
configure
configure.in
lib/isc/include/isc/platform.h.in
lib/isc/include/isc/string.h
lib/isc/string.c
lib/isc/win32/include/isc/platform.h.in

index 83a1e8a99e4b34d47fd30d2815f1cf1c20457eec..5ccb35efc5bc7074195a7a7812468adbeb1518c5 100644 (file)
 /* 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
 
index 8d44145be12fee0bb06b5a4bdaac21b861e60fd5..2ac9d6efb4d0a587c393eb4ed519cdeba5dc386e 100755 (executable)
--- a/configure
+++ b/configure
@@ -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
 
 
 
index 5de4a1e3004ee5869570693688770f73c4c13e25..1b80783f4670a24268f0bc5f4161a7c819049495 100644 (file)
@@ -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,
index ee6b87adb6df62de7d6298e3cb0666e696726401..ee1845bd25ba3e0ea0c8d7b4c344cc7e5e20c901 100644 (file)
  */
 @ISC_PLATFORM_HAVEDEVPOLL@
 
-/*
- *** Printing.
- ***/
-
-/*
- * If the system needs strlcat(), ISC_PLATFORM_NEEDSTRLCAT will be defined.
- */
-@ISC_PLATFORM_NEEDSTRLCAT@
-
 /***
  *** Miscellaneous.
  ***/
index 52c959e340f1ba9404d3bb30529551fa99ba29e3..309b1277a6c76f33865c506993d6c5a649c1519e 100644 (file)
 
 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
index 46e5303166d67d277cfe725aa58bd5ab68dd818b..096793da7724269a638ded3eb7b693ba325b4011 100644 (file)
@@ -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) {
index c01aad276495878e88e043e00eaed88cb0a5cc13..1e0a0354dc061513ad924c40739c4eada8499aef 100644 (file)
@@ -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.
  */