void-packages/srcpkgs/tmux/patches/reallocarray.patch

50 lines
1.5 KiB
Diff

Index: tmux-3.3a/configure.ac
===================================================================
--- tmux-3.3a.orig/configure.ac
+++ tmux-3.3a/configure.ac
@@ -173,41 +173,12 @@ AC_REPLACE_FUNCS([ \
strlcpy \
strndup \
strsep \
+ strtonum \
+ reallocarray \
+ recallocarray \
])
AC_FUNC_STRNLEN
-# Check if strtonum works.
-AC_MSG_CHECKING([for working strtonum])
-AC_RUN_IFELSE([AC_LANG_PROGRAM(
- [#include <stdlib.h>],
- [return (strtonum("0", 0, 1, NULL) == 0 ? 0 : 1);]
- )],
- [AC_DEFINE(HAVE_STRTONUM) AC_MSG_RESULT(yes)],
- [AC_LIBOBJ(strtonum) AC_MSG_RESULT(no)],
- [AC_LIBOBJ(strtonum) AC_MSG_RESULT(no)]
-)
-
-# Clang sanitizers wrap reallocarray even if it isn't available on the target
-# system. When compiled it always returns NULL and crashes the program. To
-# detect this we need a more complicated test.
-AC_MSG_CHECKING([for working reallocarray])
-AC_RUN_IFELSE([AC_LANG_PROGRAM(
- [#include <stdlib.h>],
- [return (reallocarray(NULL, 1, 1) == NULL);]
- )],
- AC_MSG_RESULT(yes),
- [AC_LIBOBJ(reallocarray) AC_MSG_RESULT([no])],
- [AC_LIBOBJ(reallocarray) AC_MSG_RESULT([no])]
-)
-AC_MSG_CHECKING([for working recallocarray])
-AC_RUN_IFELSE([AC_LANG_PROGRAM(
- [#include <stdlib.h>],
- [return (recallocarray(NULL, 1, 1, 1) == NULL);]
- )],
- AC_MSG_RESULT(yes),
- [AC_LIBOBJ(recallocarray) AC_MSG_RESULT([no])],
- [AC_LIBOBJ(recallocarray) AC_MSG_RESULT([no])]
-)
# Look for clock_gettime. Must come before event_init.
AC_SEARCH_LIBS(clock_gettime, rt)