Fix detection of lstat64 for Apple Silicon systems. Based on
https://git.kernel.org/pub/scm/utils/dash/dash.git/commit/?id=6f6d1f2da03468c0e131fdcbdcfa9771ffca2614
--- configure.orig	2012-04-23 06:24:12.000000000 -0500
+++ configure	2022-04-11 06:04:25.000000000 -0500
@@ -23123,18 +23123,32 @@
 
 fi
 
-for ac_func in fchdir lstat64
+for ac_func in fchdir
 do :
-  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
-if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
+  ac_fn_c_check_func "$LINENO" "fchdir" "ac_cv_func_fchdir"
+if test "x$ac_cv_func_fchdir" = x""yes; then :
   cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define HAVE_FCHDIR 1
 _ACEOF
 
 fi
 done
 
+ac_fn_c_check_decl "$LINENO" "lstat64" "ac_cv_have_decl_lstat64" "$ac_includes_default"
+if test "x$ac_cv_have_decl_lstat64" = x""yes; then :
+  for ac_func in lstat64
+do :
+  ac_fn_c_check_func "$LINENO" "lstat64" "ac_cv_func_lstat64"
+if test "x$ac_cv_func_lstat64" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LSTAT64 1
+_ACEOF
+
+fi
+done
+
+fi
+
 # c89: AC_FUNC_VPRINTF
 # c89: AC_CHECK_FUNCS([strchr strrchr setlocale])
 # gnulib: AC_FUNC_LSTAT