summaryrefslogtreecommitdiff
path: root/debian/patches/cherry-pick-4c89849c-50641-use-int-main-in-test-C-codes-in-configure.patch
diff options
context:
space:
mode:
authorMichael Prokop <mika@debian.org>2024-08-14 12:38:21 +0200
committerMichael Prokop <mika@debian.org>2024-08-14 12:38:51 +0200
commit11fc6875ec127d03aca4e185eab7116e7af89e80 (patch)
treef1b4185be64600cc1fa69ca5c8d37153c13ad398 /debian/patches/cherry-pick-4c89849c-50641-use-int-main-in-test-C-codes-in-configure.patch
parent13f8dc0aa3eba19c8437937ecfd976e2aa5c6107 (diff)
downloadzsh-11fc6875ec127d03aca4e185eab7116e7af89e80.tar.gz
zsh-11fc6875ec127d03aca4e185eab7116e7af89e80.zip
Cherry-pick upstream changes to fix ftbfs with GCC-14
Apply cherry-pick-4c89849c-50641-use-int-main-in-test-C-codes-in-configure.patch (commit 4c89849c98172c951a9def3690e8647dae76308f upstream) and cherry-pick-ab4d62eb-52383-Avoid-incompatible-pointer-types-in-terminfo-global.patch (commit ab4d62eb975a4c4c51dd35822665050e2ddc6918 upstream) to fix ftbfs with GCC-14. Relevant patches were identified by Simon McVittie, who looked at Arch Linux's patchset - thanks to Christian Hesse, one of Arch's zsh maintainers. Thanks: Simon McVittie <smcv@debian.org> Closes: #1075708
Diffstat (limited to 'debian/patches/cherry-pick-4c89849c-50641-use-int-main-in-test-C-codes-in-configure.patch')
-rw-r--r--debian/patches/cherry-pick-4c89849c-50641-use-int-main-in-test-C-codes-in-configure.patch546
1 files changed, 546 insertions, 0 deletions
diff --git a/debian/patches/cherry-pick-4c89849c-50641-use-int-main-in-test-C-codes-in-configure.patch b/debian/patches/cherry-pick-4c89849c-50641-use-int-main-in-test-C-codes-in-configure.patch
new file mode 100644
index 000000000..35619cd1a
--- /dev/null
+++ b/debian/patches/cherry-pick-4c89849c-50641-use-int-main-in-test-C-codes-in-configure.patch
@@ -0,0 +1,546 @@
+From: Nicholas Vinson <nvinson234@gmail.com>
+Date: Wed, 21 Sep 2022 09:22:11 +0900
+Subject: 50641: use 'int main()' in test C-codes in configure
+
+Origin: upstream, commit:ab4d62eb975a4c4c51dd35822665050e2ddc6918
+Bug-Debian: https://bugs.debian.org/1075708
+---
+ aczsh.m4 | 64 ++++++++++++++++++++---------------------
+ configure.ac | 94 ++++++++++++++++++++++++++----------------------------------
+ 2 files changed, 72 insertions(+), 86 deletions(-)
+
+diff --git a/aczsh.m4 b/aczsh.m4
+index d2a47ba..27cc260 100644
+--- a/aczsh.m4
++++ b/aczsh.m4
+@@ -44,6 +44,7 @@ AC_DEFUN(zsh_64_BIT_TYPE,
+ #include <sys/types.h>
+ #endif
+
++int
+ main()
+ {
+ $1 foo = 0;
+@@ -118,7 +119,6 @@ AC_TRY_COMMAND($DLLD -o conftest1.$DL_EXT $LDFLAGS $DLLDFLAGS conftest1.o $LIBS
+ AC_TRY_COMMAND($CC -c $CFLAGS $CPPFLAGS $DLCFLAGS conftest2.c 1>&AS_MESSAGE_LOG_FD) &&
+ AC_TRY_COMMAND($DLLD -o conftest2.$DL_EXT $LDFLAGS $DLLDFLAGS conftest2.o $LIBS 1>&AS_MESSAGE_LOG_FD); then
+ AC_RUN_IFELSE([AC_LANG_SOURCE([[
+-#include <stdlib.h>
+ #ifdef HPUX10DYNAMIC
+ #include <dl.h>
+ #define RTLD_LAZY BIND_DEFERRED
+@@ -146,29 +146,30 @@ char *zsh_gl_sym_addr ;
+ #define RTLD_GLOBAL 0
+ #endif
+
++int
+ main()
+ {
+ void *handle1, *handle2;
+ void *(*zsh_getaddr1)(), *(*zsh_getaddr2)();
+ void *sym1, *sym2;
+ handle1 = dlopen("./conftest1.$DL_EXT", RTLD_LAZY | RTLD_GLOBAL);
+- if(!handle1) exit(1);
++ if(!handle1) return(1);
+ handle2 = dlopen("./conftest2.$DL_EXT", RTLD_LAZY | RTLD_GLOBAL);
+- if(!handle2) exit(1);
++ if(!handle2) return(1);
+ zsh_getaddr1 = (void *(*)()) dlsym(handle1, "${us}zsh_getaddr1");
+ zsh_getaddr2 = (void *(*)()) dlsym(handle2, "${us}zsh_getaddr2");
+ sym1 = zsh_getaddr1();
+ sym2 = zsh_getaddr2();
+- if(!sym1 || !sym2) exit(1);
+- if(sym1 != sym2) exit(1);
++ if(!sym1 || !sym2) return(1);
++ if(sym1 != sym2) return(1);
+ dlclose(handle1);
+ handle1 = dlopen("./conftest1.$DL_EXT", RTLD_LAZY | RTLD_GLOBAL);
+- if(!handle1) exit(1);
++ if(!handle1) return(1);
+ zsh_getaddr1 = (void *(*)()) dlsym(handle1, "${us}zsh_getaddr1");
+ sym1 = zsh_getaddr1();
+- if(!sym1) exit(1);
+- if(sym1 != sym2) exit(1);
+- exit(0);
++ if(!sym1) return(1);
++ if(sym1 != sym2) return(1);
++ return(0);
+ }
+ ]])],[zsh_cv_shared_$1=yes],
+ [zsh_cv_shared_$1=no],
+@@ -200,7 +201,6 @@ AC_TRY_COMMAND($DLLD -o conftest1.$DL_EXT $LDFLAGS $DLLDFLAGS conftest1.o $LIBS
+ AC_TRY_COMMAND($CC -c $CFLAGS $CPPFLAGS $DLCFLAGS conftest2.c 1>&AS_MESSAGE_LOG_FD) &&
+ AC_TRY_COMMAND($DLLD -o conftest2.$DL_EXT $LDFLAGS $DLLDFLAGS conftest2.o $LIBS 1>&AS_MESSAGE_LOG_FD); then
+ AC_RUN_IFELSE([AC_LANG_SOURCE([[
+-#include <stdlib.h>
+ #ifdef HPUX10DYNAMIC
+ #include <dl.h>
+ #define RTLD_LAZY BIND_DEFERRED
+@@ -228,19 +228,19 @@ char *zsh_gl_sym_addr ;
+ #define RTLD_GLOBAL 0
+ #endif
+
+-
++int
+ main()
+ {
+ void *handle1, *handle2;
+ int (*fred1)(), (*fred2)();
+ handle1 = dlopen("./conftest1.$DL_EXT", RTLD_LAZY | RTLD_GLOBAL);
+- if(!handle1) exit(1);
++ if(!handle1) return(1);
+ handle2 = dlopen("./conftest2.$DL_EXT", RTLD_LAZY | RTLD_GLOBAL);
+- if(!handle2) exit(1);
++ if(!handle2) return(1);
+ fred1 = (int (*)()) dlsym(handle1, "${us}fred");
+ fred2 = (int (*)()) dlsym(handle2, "${us}fred");
+- if(!fred1 || !fred2) exit(1);
+- exit((*fred1)() != 42 || (*fred2)() != 69);
++ if(!fred1 || !fred2) return(1);
++ return((*fred1)() != 42 || (*fred2)() != 69);
+ }
+ ]])],[zsh_cv_sys_dynamic_clash_ok=yes],
+ [zsh_cv_sys_dynamic_clash_ok=no],
+@@ -276,7 +276,6 @@ AC_TRY_COMMAND($DLLD -o conftest1.$DL_EXT $LDFLAGS $DLLDFLAGS conftest1.o $LIBS
+ AC_TRY_COMMAND($CC -c $CFLAGS $CPPFLAGS $DLCFLAGS conftest2.c 1>&AS_MESSAGE_LOG_FD) &&
+ AC_TRY_COMMAND($DLLD -o conftest2.$DL_EXT $LDFLAGS $DLLDFLAGS conftest2.o $LIBS 1>&AS_MESSAGE_LOG_FD); then
+ AC_RUN_IFELSE([AC_LANG_SOURCE([[
+-#include <stdlib.h>
+ #ifdef HPUX10DYNAMIC
+ #include <dl.h>
+ #define RTLD_LAZY BIND_DEFERRED
+@@ -304,17 +303,18 @@ char *zsh_gl_sym_addr ;
+ #define RTLD_GLOBAL 0
+ #endif
+
++int
+ main()
+ {
+ void *handle;
+ int (*barneysym)();
+ handle = dlopen("./conftest1.$DL_EXT", RTLD_LAZY | RTLD_GLOBAL);
+- if(!handle) exit(1);
++ if(!handle) return(1);
+ handle = dlopen("./conftest2.$DL_EXT", RTLD_LAZY | RTLD_GLOBAL);
+- if(!handle) exit(1);
++ if(!handle) return(1);
+ barneysym = (int (*)()) dlsym(handle, "${us}barney");
+- if(!barneysym) exit(1);
+- exit((*barneysym)() != 69);
++ if(!barneysym) return(1);
++ return((*barneysym)() != 69);
+ }
+ ]])],[zsh_cv_sys_dynamic_rtld_global=yes],
+ [zsh_cv_sys_dynamic_rtld_global=no],
+@@ -346,7 +346,6 @@ AC_TRY_COMMAND($DLLD -o conftest1.$DL_EXT $LDFLAGS $DLLDFLAGS conftest1.o $LIBS
+ save_ldflags=$LDFLAGS
+ LDFLAGS="$LDFLAGS $EXTRA_LDFLAGS"
+ AC_RUN_IFELSE([AC_LANG_SOURCE([[
+-#include <stdlib.h>
+ #ifdef HPUX10DYNAMIC
+ #include <dl.h>
+ #define RTLD_LAZY BIND_DEFERRED
+@@ -374,15 +373,16 @@ char *zsh_gl_sym_addr ;
+ #define RTLD_GLOBAL 0
+ #endif
+
++int
+ main()
+ {
+ void *handle;
+ int (*barneysym)();
+ handle = dlopen("./conftest1.$DL_EXT", RTLD_LAZY | RTLD_GLOBAL);
+- if(!handle) exit(1);
++ if(!handle) return(1);
+ barneysym = (int (*)()) dlsym(handle, "${us}barney");
+- if(!barneysym) exit(1);
+- exit((*barneysym)() != 69);
++ if(!barneysym) return(1);
++ return((*barneysym)() != 69);
+ }
+
+ int fred () { return 42; }
+@@ -420,7 +420,6 @@ elif
+ save_ldflags=$LDFLAGS
+ LDFLAGS="$LDFLAGS $EXTRA_LDFLAGS -s"
+ AC_RUN_IFELSE([AC_LANG_SOURCE([[
+-#include <stdlib.h>
+ #ifdef HPUX10DYNAMIC
+ #include <dl.h>
+ #define RTLD_LAZY BIND_DEFERRED
+@@ -448,15 +447,16 @@ char *zsh_gl_sym_addr ;
+ #define RTLD_GLOBAL 0
+ #endif
+
++int
+ main()
+ {
+ void *handle;
+ int (*barneysym)();
+ handle = dlopen("./conftest1.$DL_EXT", RTLD_LAZY | RTLD_GLOBAL);
+- if(!handle) exit(1);
++ if(!handle) return(1);
+ barneysym = (int (*)()) dlsym(handle, "${us}barney");
+- if(!barneysym) exit(1);
+- exit((*barneysym)() != 69);
++ if(!barneysym) return(1);
++ return((*barneysym)() != 69);
+ }
+
+ int fred () { return 42; }
+@@ -488,7 +488,6 @@ echo 'int fred () { return 42; }' > conftest1.c
+ if AC_TRY_COMMAND($CC -c $CFLAGS $CPPFLAGS $DLCFLAGS conftest1.c 1>&AS_MESSAGE_LOG_FD) &&
+ AC_TRY_COMMAND($DLLD -o conftest1.$DL_EXT $LDFLAGS $DLLDFLAGS -s conftest1.o $LIBS 1>&AS_MESSAGE_LOG_FD); then
+ AC_RUN_IFELSE([AC_LANG_SOURCE([[
+-#include <stdlib.h>
+ #ifdef HPUX10DYNAMIC
+ #include <dl.h>
+ #define RTLD_LAZY BIND_DEFERRED
+@@ -516,15 +515,16 @@ char *zsh_gl_sym_addr ;
+ #define RTLD_GLOBAL 0
+ #endif
+
++int
+ main()
+ {
+ void *handle;
+ int (*fredsym)();
+ handle = dlopen("./conftest1.$DL_EXT", RTLD_LAZY | RTLD_GLOBAL);
+- if(!handle) exit(1);
++ if(!handle) return(1);
+ fredsym = (int (*)()) dlsym(handle, "${us}fred");
+- if(!fredsym) exit(1);
+- exit((*fredsym)() != 42);
++ if(!fredsym) return(1);
++ return((*fredsym)() != 42);
+ }
+ ]])],[zsh_cv_sys_dynamic_strip_lib=yes],
+ [zsh_cv_sys_dynamic_strip_lib=no],
+diff --git a/configure.ac b/configure.ac
+index 928b467..5534f42 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -596,7 +596,7 @@ fi
+ dnl Checking if compiler correctly cast signed to unsigned.
+ AC_CACHE_CHECK(if signed to unsigned casting is broken,
+ zsh_cv_c_broken_signed_to_unsigned_casting,
+-[AC_RUN_IFELSE([AC_LANG_SOURCE([[main(){return((int)(unsigned char)((char) -1) == 255);}]])],[zsh_cv_c_broken_signed_to_unsigned_casting=yes],[zsh_cv_c_broken_signed_to_unsigned_casting=no],[zsh_cv_c_broken_signed_to_unsigned_casting=no])])
++[AC_RUN_IFELSE([AC_LANG_SOURCE([[int main(){return((int)(unsigned char)((char) -1) == 255);}]])],[zsh_cv_c_broken_signed_to_unsigned_casting=yes],[zsh_cv_c_broken_signed_to_unsigned_casting=no],[zsh_cv_c_broken_signed_to_unsigned_casting=no])])
+ AH_TEMPLATE([BROKEN_SIGNED_TO_UNSIGNED_CASTING],
+ [Define to 1 if compiler incorrectly cast signed to unsigned.])
+ if test x$zsh_cv_c_broken_signed_to_unsigned_casting = xyes; then
+@@ -1052,7 +1052,7 @@ else
+ [AC_RUN_IFELSE([AC_LANG_SOURCE([[
+ #include <sys/types.h>
+
+-main() { return sizeof(off_t) < 8; }
++int main() { return sizeof(off_t) < 8; }
+ ]])],[zsh_cv_off_t_is_64_bit=yes],[zsh_cv_off_t_is_64_bit=no],[zsh_cv_off_t_is_64_bit=no])])
+ if test x$zsh_cv_off_t_is_64_bit = xyes; then
+ AC_DEFINE(OFF_T_IS_64_BIT)
+@@ -1062,7 +1062,7 @@ main() { return sizeof(off_t) < 8; }
+ [AC_RUN_IFELSE([AC_LANG_SOURCE([[
+ #include <sys/types.h>
+
+-main() { return sizeof(ino_t) < 8; }
++int main() { return sizeof(ino_t) < 8; }
+ ]])],[zsh_cv_ino_t_is_64_bit=yes],[zsh_cv_ino_t_is_64_bit=no],[zsh_cv_ino_t_is_64_bit=no])])
+ if test x$zsh_cv_ino_t_is_64_bit = xyes; then
+ AC_DEFINE(INO_T_IS_64_BIT)
+@@ -1374,7 +1374,7 @@ zsh_cv_func_realpath_accepts_null,
+ #include <stdlib.h>
+ #include <limits.h>
+ ],[
+-exit(!realpath("/", (char*)0));
++return(!realpath("/", (char*)0));
+ ])],
+ [zsh_cv_func_realpath_accepts_null=yes],
+ [zsh_cv_func_realpath_accepts_null=no],
+@@ -1403,10 +1403,9 @@ AC_CACHE_CHECK(if tgetent accepts NULL,
+ zsh_cv_func_tgetent_accepts_null,
+ [AC_RUN_IFELSE([AC_LANG_SOURCE([[
+ #include <fcntl.h>
+-#include <stdlib.h>
+ int tgetent(char *, char *);
+ char *tgetstr(char *, char **);
+-main()
++int main()
+ {
+ char buf[4096];
+ int r1 = tgetent(buf, "vt100");
+@@ -1417,7 +1416,7 @@ main()
+ tgetstr("cl", &u);
+ creat("conftest.tgetent", 0640);
+ }
+- exit((r1 != r2) || r2 == -1);
++ return((r1 != r2) || r2 == -1);
+ }
+ ]])],[if test -f conftest.tgetent; then
+ zsh_cv_func_tgetent_accepts_null=yes
+@@ -1431,10 +1430,9 @@ AC_CACHE_CHECK(if tgetent returns 0 on success,
+ zsh_cv_func_tgetent_zero_success,
+ [AC_RUN_IFELSE([AC_LANG_SOURCE([[
+ #include <fcntl.h>
+-#include <stdlib.h>
+ int tgetent(char *, char*);
+ char *tgetstr(char *, char **);
+-main()
++int main()
+ {
+ char buf[4096];
+ int r1 = tgetent(buf, "!@#$%^&*");
+@@ -1445,7 +1443,7 @@ main()
+ tgetstr("cl", &u);
+ creat("conftest.tgetent0", 0640);
+ }
+- exit(r1 == r2);
++ return(r1 == r2);
+ }
+ ]])],[if test -f conftest.tgetent0; then
+ zsh_cv_func_tgetent_zero_success=yes
+@@ -1871,8 +1869,7 @@ zsh_cv_rlim_t_is_longer,
+ #include <sys/time.h>
+ #endif
+ #include <sys/resource.h>
+-#include <stdlib.h>
+-main(){struct rlimit r;exit(sizeof(r.rlim_cur) <= sizeof(long));}]])],[zsh_cv_rlim_t_is_longer=yes],[zsh_cv_rlim_t_is_longer=no],[zsh_cv_rlim_t_is_longer=yes])])
++int main(){struct rlimit r;return(sizeof(r.rlim_cur) <= sizeof(long));}]])],[zsh_cv_rlim_t_is_longer=yes],[zsh_cv_rlim_t_is_longer=no],[zsh_cv_rlim_t_is_longer=yes])])
+ if test x$zsh_cv_rlim_t_is_longer = xyes; then
+ AC_CACHE_CHECK(if rlim_t is a quad,
+ zsh_cv_rlim_t_is_quad_t,
+@@ -1882,13 +1879,12 @@ if test x$zsh_cv_rlim_t_is_longer = xyes; then
+ #endif
+ #include <stdio.h>
+ #include <sys/resource.h>
+-#include <stdlib.h>
+-main() {
++int main() {
+ struct rlimit r;
+ char buf[20];
+ r.rlim_cur = 0;
+ sprintf(buf, "%qd", r.rlim_cur);
+- exit(strcmp(buf, "0"));
++ return(strcmp(buf, "0"));
+ }]])],[zsh_cv_rlim_t_is_quad_t=yes],[zsh_cv_rlim_t_is_quad_t=no],[zsh_cv_rlim_t_is_quad_t=no])])
+ if test x$zsh_cv_rlim_t_is_quad_t = xyes; then
+ AC_DEFINE(RLIM_T_IS_QUAD_T)
+@@ -1905,8 +1901,7 @@ else
+ #include <sys/time.h>
+ #endif
+ #include <sys/resource.h>
+-#include <stdlib.h>
+- main(){struct rlimit r;r.rlim_cur=-1;exit(r.rlim_cur<0);}]])],[zsh_cv_type_rlim_t_is_unsigned=yes],[zsh_cv_type_rlim_t_is_unsigned=no],[zsh_cv_type_rlim_t_is_unsigned=no])])
++ int main(){struct rlimit r;r.rlim_cur=-1;return(r.rlim_cur<0);}]])],[zsh_cv_type_rlim_t_is_unsigned=yes],[zsh_cv_type_rlim_t_is_unsigned=no],[zsh_cv_type_rlim_t_is_unsigned=no])])
+ if test x$zsh_cv_type_rlim_t_is_unsigned = xyes; then
+ AC_DEFINE(RLIM_T_IS_UNSIGNED)
+ DEFAULT_RLIM_T="unsigned $DEFAULT_RLIM_T"
+@@ -2185,9 +2180,8 @@ zsh_cv_sys_fifo,
+ #include <fcntl.h>
+ #include <signal.h>
+ #include <unistd.h>
+-#include <stdlib.h>
+ #include <sys/stat.h>
+-main()
++int main()
+ {
+ char c;
+ int fd;
+@@ -2198,18 +2192,18 @@ main()
+ #else
+ if(mknod("/tmp/fifo$$", 0010600, 0) < 0)
+ #endif
+- exit(1);
++ return(1);
+ pid = fork();
+ if(pid < 0)
+- exit(1);
++ return(1);
+ if(pid) {
+ fd = open("/tmp/fifo$$", O_RDONLY);
+- exit(fd < 0 || read(fd, &c, 1) != 1 || c != 'x');
++ return(fd < 0 || read(fd, &c, 1) != 1 || c != 'x');
+ }
+ fd = open("/tmp/fifo$$", O_WRONLY);
+ ret = (fd < 0 || write(fd, "x", 1) < 1);
+ unlink("/tmp/fifo$$");
+- exit(ret);
++ return(ret);
+ }
+ ]])],[zsh_cv_sys_fifo=yes],[zsh_cv_sys_fifo=no],[zsh_cv_sys_fifo=yes])
+ ])
+@@ -2287,8 +2281,7 @@ zsh_cv_sys_link,
+ [AC_RUN_IFELSE([AC_LANG_SOURCE([[
+ #include <unistd.h>
+ #include <fcntl.h>
+-#include <stdlib.h>
+-main()
++int main()
+ {
+ int ret;
+ char *tmpfile, *newfile;
+@@ -2297,11 +2290,11 @@ main()
+ unlink(tmpfile);
+ unlink(newfile);
+ if(creat(tmpfile, 0644) < 0)
+- exit(1);
++ return(1);
+ ret = link(tmpfile, newfile);
+ unlink(tmpfile);
+ unlink(newfile);
+- exit(ret<0);
++ return(ret<0);
+ }
+ ]])],[zsh_cv_sys_link=yes],[zsh_cv_sys_link=no],[zsh_cv_sys_link=yes])])
+ AH_TEMPLATE([HAVE_LINK],
+@@ -2320,12 +2313,11 @@ zsh_cv_sys_killesrch,
+ #include <unistd.h>
+ #include <signal.h>
+ #include <errno.h>
+-#include <stdlib.h>
+-main()
++int main()
+ {
+ int pid = (getpid() + 10000) & 0xffffff;
+ while (pid && (kill(pid, 0) == 0 || errno != ESRCH)) pid >>= 1;
+- exit(errno!=ESRCH);
++ return(errno!=ESRCH);
+ }
+ ]])],[zsh_cv_sys_killesrch=yes],[zsh_cv_sys_killesrch=no],[zsh_cv_sys_killesrch=yes])])
+ AH_TEMPLATE([BROKEN_KILL_ESRCH],
+@@ -2346,12 +2338,11 @@ if test x$signals_style = xPOSIX_SIGNALS; then
+ [AC_RUN_IFELSE([AC_LANG_SOURCE([[
+ #include <signal.h>
+ #include <unistd.h>
+-#include <stdlib.h>
+ int child=0;
+ void handler(sig)
+ int sig;
+ {if(sig==SIGCHLD) child=1;}
+-main() {
++int main() {
+ struct sigaction act;
+ sigset_t set;
+ int pid, ret;
+@@ -2366,7 +2357,7 @@ main() {
+ if(pid>0) {
+ sigemptyset(&set);
+ ret=sigsuspend(&set);
+- exit(child==0);
++ return(child==0);
+ }
+ }
+ ]])],[zsh_cv_sys_sigsuspend=yes],[zsh_cv_sys_sigsuspend=no],[zsh_cv_sys_sigsuspend=yes])])
+@@ -2398,15 +2389,14 @@ case "x$zsh_working_tcsetpgrp" in
+ #include <sys/types.h>
+ #include <unistd.h>
+ #include <fcntl.h>
+-#include <stdlib.h>
+-main() {
++int main() {
+ int fd;
+ int ret;
+ fd=open("/dev/tty", O_RDWR);
+- if (fd < 0) exit(2);
++ if (fd < 0) return(2);
+ ret=tcsetpgrp(fd, tcgetpgrp(fd));
+- if (ret < 0) exit(1);
+- exit(0);
++ if (ret < 0) return(1);
++ return(0);
+ }
+ ]])],[zsh_cv_sys_tcsetpgrp=yes],[
+ case $? in
+@@ -2446,7 +2436,7 @@ if test x$ac_cv_func_getpwnam = xyes; then
+ #include <string.h>
+ #include <stdlib.h>
+ #include <unistd.h>
+-main() {
++int main() {
+ struct passwd *pw1, *pw2;
+ char buf[1024], name[1024];
+ sprintf(buf, "%d:%d", getpid(), rand());
+@@ -2454,7 +2444,7 @@ main() {
+ if (pw1) strcpy(name, pw1->pw_name);
+ sprintf(buf, "%d:%d", rand(), getpid());
+ pw2=getpwnam(buf);
+- exit(pw1!=0 && pw2!=0 && !strcmp(name, pw2->pw_name));
++ return(pw1!=0 && pw2!=0 && !strcmp(name, pw2->pw_name));
+ }
+ ]])],[zsh_cv_sys_getpwnam_faked=no],[zsh_cv_sys_getpwnam_faked=yes],[zsh_cv_sys_getpwnam_faked=no])])
+ if test x$zsh_cv_sys_getpwnam_faked = xyes; then
+@@ -2773,20 +2763,17 @@ elif test "x$dynamic" = xyes; then
+ zsh_cv_sys_elf,
+ [AC_RUN_IFELSE([AC_LANG_SOURCE([[/* Test for whether ELF binaries are produced */
+ #include <fcntl.h>
+-#include <stdlib.h>
+ #include <unistd.h>
+-main(argc, argv)
+-int argc;
+-char *argv[];
++int main(int argc, char *argv[])
+ {
+ char b[4];
+ int i = open(argv[0],O_RDONLY);
+ if(i == -1)
+- exit(1); /* fail */
++ return(1); /* fail */
+ if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
+- exit(0); /* succeed (yes, it's ELF) */
++ return(0); /* succeed (yes, it's ELF) */
+ else
+- exit(1); /* fail */
++ return(1); /* fail */
+ }]])],[zsh_cv_sys_elf=yes],[zsh_cv_sys_elf=no],[zsh_cv_sys_elf=yes])])
+
+ # We use [0-9]* in case statements, so need to change quoting
+@@ -2922,13 +2909,12 @@ LDFLAGS="$old_LDFLAGS")
+ AC_CACHE_CHECK(if your dlsym() needs a leading underscore,
+ zsh_cv_func_dlsym_needs_underscore,
+ [echo failed >conftestval && cat >conftest.c <<EOM
+-fred () { }
++void fred () { }
+ EOM
+ AC_TRY_COMMAND($CC -c $CFLAGS $CPPFLAGS $DLCFLAGS conftest.c 1>&AS_MESSAGE_LOG_FD) &&
+ AC_TRY_COMMAND($DLLD $LDFLAGS $DLLDFLAGS -o conftest.$DL_EXT conftest.o 1>&AS_MESSAGE_LOG_FD) &&
+ AC_RUN_IFELSE([AC_LANG_SOURCE([[
+ #include <stdio.h>
+-#include <stdlib.h>
+ #ifdef HPUX10DYNAMIC
+ #include <dl.h>
+ #define RTLD_LAZY BIND_DEFERRED
+@@ -2955,16 +2941,16 @@ char *zsh_gl_sym_addr ;
+
+ extern int fred() ;
+
+-main()
++int main()
+ {
+ void * handle ;
+ void * symbol ;
+ FILE *f=fopen("conftestval", "w");
+- if (!f) exit(1);
++ if (!f) return(1);
+ handle = dlopen("./conftest.$DL_EXT", RTLD_LAZY) ;
+ if (handle == NULL) {
+ fprintf (f, "dlopen failed") ;
+- exit(1);
++ return(1);
+ }
+ symbol = dlsym(handle, "fred") ;
+ if (symbol == NULL) {
+@@ -2972,13 +2958,13 @@ main()
+ symbol = dlsym(handle, "_fred") ;
+ if (symbol == NULL) {
+ fprintf (f, "dlsym failed") ;
+- exit(1);
++ return(1);
+ }
+ fprintf (f, "yes") ;
+ }
+ else
+ fprintf (f, "no") ;
+- exit(0);
++ return(0);
+ }]])],[zsh_cv_func_dlsym_needs_underscore=`cat conftestval`],[zsh_cv_func_dlsym_needs_underscore=failed
+ dynamic=no],[zsh_cv_func_dlsym_needs_underscore=no])])
+ if test "x$zsh_cv_func_dlsym_needs_underscore" = xyes; then