diff options
Diffstat (limited to 'patches/nginx-1.16.1/0005-auto-unix-make-sys_nerr-guessing-cross-friendly.patch')
-rw-r--r-- | patches/nginx-1.16.1/0005-auto-unix-make-sys_nerr-guessing-cross-friendly.patch | 134 |
1 files changed, 134 insertions, 0 deletions
diff --git a/patches/nginx-1.16.1/0005-auto-unix-make-sys_nerr-guessing-cross-friendly.patch b/patches/nginx-1.16.1/0005-auto-unix-make-sys_nerr-guessing-cross-friendly.patch new file mode 100644 index 000000000..8a98f197f --- /dev/null +++ b/patches/nginx-1.16.1/0005-auto-unix-make-sys_nerr-guessing-cross-friendly.patch @@ -0,0 +1,134 @@ +From: Samuel Martin <s.martin49@gmail.com> +Date: Sun, 1 Jun 2014 16:05:04 +0200 +Subject: [PATCH] auto/unix: make sys_nerr guessing cross-friendly + +This patch replaces the default sys_nerr runtest with a test done at +buildtime. + +The idea behind this buildtime test is finding the value of the ERR_MAX +macro if defined, or the EHWPOISON (which is currently the last errno) +otherwise. + +Signed-off-by: Samuel Martin <s.martin49@gmail.com> + +Refresh for 1.8.0. + +Signed-off-by: Danomi Manchego <danomimanchego123@gmail.com> +--- + auto/os/sys_nerr | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + auto/unix | 10 ++++++++ + 2 files changed, 88 insertions(+) + create mode 100644 auto/os/sys_nerr + +diff --git a/auto/os/sys_nerr b/auto/os/sys_nerr +new file mode 100644 +index 000000000000..8970f5f6ec73 +--- /dev/null ++++ b/auto/os/sys_nerr +@@ -0,0 +1,78 @@ ++ ++# Copyright (C) Samuel Martin <s.martin49@gmail.com> ++ ++ ++echo $ngx_n "checking for sys_nerr value...$ngx_c" ++ ++# sys_nerr guessing is done using a (very) poor (but working) ++# heuristics, by checking for the value of ERR_MAX if defined, or ++# EHWPOISON otherwise. ++ ++cat << END >> $NGX_AUTOCONF_ERR ++ ++---------------------------------------- ++checking for sys_nerr value ++ ++END ++ ++ngx_sys_nerr= ++ ++cat << _EOF > $NGX_AUTOTEST.c ++ ++#include <stdio.h> ++#include <errno.h> ++ ++static char sys_nerr_test[ERR_MAX]; ++int main(void) ++{ ++ return 0; ++} ++ ++_EOF ++ ++if $CC $CC_TEST_FLAGS $CC_AUX_FLAGS \ ++ $NGX_AUTOTEST.c -o $NGX_AUTOTEST \ ++ $NGX_LD_OPT $ngx_feature_libs >/dev/null 2>&1 ; then ++ _ngx_max_err_macro=ERR_MAX ++else ++ # the +2 has been empirically found! ++ _ngx_max_err_macro="EHWPOISON + 2" ++fi ++ ++cat << _EOF > $NGX_AUTOTEST.c ++ ++#include <stdio.h> ++#include <errno.h> ++ ++static char sys_nerr_test[(TEST_ERR_MAX == $_ngx_max_err_macro) ? 1 : -1]; ++int main(void) ++{ ++ return 0; ++} ++ ++_EOF ++ ++ ++ngx_sys_nerr=`for i in $(seq 0 2000) ; do \ ++ $CC $CC_TEST_FLAGS $CC_AUX_FLAGS \ ++ -DTEST_ERR_MAX="$i" \ ++ $NGX_AUTOTEST.c -o $NGX_AUTOTEST \ ++ $NGX_LD_OPT $ngx_feature_libs >/dev/null 2>&1 || continue ;\ ++ echo $i ; break ; done` ++ ++rm -rf $NGX_AUTOTEST* ++ ++if test -z $ngx_sys_nerr ; then ++ ngx_size=0 ++ ngx_sys_nerr=0 ++fi ++ ++cat << END >> $NGX_AUTO_CONFIG_H ++ ++#ifndef $ngx_feature_name ++#define $ngx_feature_name $ngx_sys_nerr ++#endif ++ ++END ++ ++echo " $ngx_sys_nerr" +diff --git a/auto/unix b/auto/unix +index 3da005375cf5..a67ee3e2939c 100644 +--- a/auto/unix ++++ b/auto/unix +@@ -736,6 +736,10 @@ ngx_feature_incs='#include <errno.h> + #include <stdio.h>' + ngx_feature_path= + ngx_feature_libs= ++ ++if false ; then ++# Disabled because only valid for native build. ++ + ngx_feature_test='printf("%d", sys_nerr);' + . auto/feature + +@@ -784,6 +788,12 @@ if [ $ngx_found = no ]; then + . auto/feature + fi + ++else ++ # Cross-compilation support ++ . auto/os/sys_nerr ++ ++fi ++ + + ngx_feature="localtime_r()" + ngx_feature_name="NGX_HAVE_LOCALTIME_R" |