diff auto/unix @ 8349:05e0988a6898 quic

Merged with the default branch.
author Sergey Kandaurov <pluknet@nginx.com>
date Wed, 10 Mar 2021 15:39:01 +0300
parents c43a2e8fdf7e
children e2e9e0fae747
line wrap: on
line diff
--- a/auto/unix
+++ b/auto/unix
@@ -727,19 +727,35 @@ ngx_feature_test="char buf[1]; struct io
 . auto/feature
 
 
-ngx_feature="sys_nerr"
-ngx_feature_name="NGX_SYS_NERR"
-ngx_feature_run=value
-ngx_feature_incs='#include <errno.h>
-                  #include <stdio.h>'
+# strerrordesc_np(), introduced in glibc 2.32
+
+ngx_feature="strerrordesc_np()"
+ngx_feature_name="NGX_HAVE_STRERRORDESC_NP"
+ngx_feature_run=no
+ngx_feature_incs='#include <string.h>'
 ngx_feature_path=
 ngx_feature_libs=
-ngx_feature_test='printf("%d", sys_nerr);'
+ngx_feature_test="char *p; p = strerrordesc_np(0);
+                  if (p == NULL) return 1"
 . auto/feature
 
 
 if [ $ngx_found = no ]; then
 
+    ngx_feature="sys_nerr"
+    ngx_feature_name="NGX_SYS_NERR"
+    ngx_feature_run=value
+    ngx_feature_incs='#include <errno.h>
+                      #include <stdio.h>'
+    ngx_feature_path=
+    ngx_feature_libs=
+    ngx_feature_test='printf("%d", sys_nerr);'
+    . auto/feature
+fi
+
+
+if [ $ngx_found = no ]; then
+
     # Cygiwn defines _sys_nerr
     ngx_feature="_sys_nerr"
     ngx_feature_name="NGX_SYS_NERR"
@@ -753,34 +769,6 @@ if [ $ngx_found = no ]; then
 fi
 
 
-if [ $ngx_found = no ]; then
-
-    # Solaris has no sys_nerr
-    ngx_feature='maximum errno'
-    ngx_feature_name=NGX_SYS_NERR
-    ngx_feature_run=value
-    ngx_feature_incs='#include <errno.h>
-                      #include <string.h>
-                      #include <stdio.h>'
-    ngx_feature_path=
-    ngx_feature_libs=
-    ngx_feature_test='int  n;
-                      char *p;
-                      for (n = 1; n < 1000; n++) {
-                          errno = 0;
-                          p = strerror(n);
-                          if (errno == EINVAL
-                              || p == NULL
-                              || strncmp(p, "Unknown error", 13) == 0)
-                          {
-                              break;
-                          }
-                      }
-                      printf("%d", n);'
-    . auto/feature
-fi
-
-
 ngx_feature="localtime_r()"
 ngx_feature_name="NGX_HAVE_LOCALTIME_R"
 ngx_feature_run=no