about summary refs log tree commit diff
path: root/aczsh.m4
diff options
context:
space:
mode:
authorRin Okuyama <rokuyama.rk@gmail.com>2020-03-22 10:04:19 +0900
committerDaniel Shahaf <d.s@daniel.shahaf.name>2020-03-22 23:22:38 +0000
commitaa93901db2ce33724cc2bbeeaaae0c1e53bd02b3 (patch)
tree980d31b6b322359fda11afaec5e4ea4e00e185ab /aczsh.m4
parent508b47c750ea4709e38ccad73a41e17ff4efe770 (diff)
downloadzsh-aa93901db2ce33724cc2bbeeaaae0c1e53bd02b3.tar.gz
zsh-aa93901db2ce33724cc2bbeeaaae0c1e53bd02b3.tar.xz
zsh-aa93901db2ce33724cc2bbeeaaae0c1e53bd02b3.zip
github #51: Fix configure for cross build.
In order to detect equivalence b/w various rlimit values, use compile
tests instead of run tests. This enables configure script to run in
cross-build environment without any side effects.

From NetBSD/pkgsrc:
http://cvsweb.netbsd.org/bsdweb.cgi/pkgsrc/shells/zsh/patches/
Diffstat (limited to 'aczsh.m4')
-rw-r--r--aczsh.m419
1 files changed, 19 insertions, 0 deletions
diff --git a/aczsh.m4 b/aczsh.m4
index 0219ae2fb..b7177de5b 100644
--- a/aczsh.m4
+++ b/aczsh.m4
@@ -688,3 +688,22 @@ if test $zsh_cv_have_$1 = yes; then
   AC_DEFINE(HAVE_$1)
 fi])
 
+dnl Check whether rlmit $1, e.g. AS, is the same as rlmit $3, e.g. VMEM.
+dnl $2 is lowercase $1, $4 is lowercase $3.
+AC_DEFUN(zsh_LIMITS_EQUAL,
+[AH_TEMPLATE([RLIMIT_]$1[_IS_]$3,
+[Define to 1 if RLIMIT_]$1[ and RLIMIT_]$3[ both exist and are equal.])
+AC_CACHE_CHECK([if RLIMIT_]$1[ and RLIMIT_]$3[ are the same],
+zsh_cv_rlimit_$2_is_$4,
+[AC_TRY_COMPILE([
+#include <sys/types.h>
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#include <sys/resource.h>],
+[static char x[(RLIMIT_$1 == RLIMIT_$3)? 1 : -1]],
+  zsh_cv_rlimit_$2_is_$4=yes,
+  zsh_cv_rlimit_$2_is_$4=no)])
+if test x$zsh_cv_rlimit_$2_is_$4 = xyes; then
+  AC_DEFINE(RLIMIT_$1_IS_$3)
+fi])