aboutsummaryrefslogtreecommitdiffstats
path: root/configure.ac
diff options
context:
space:
mode:
authorDavid Michael <fedora.dm0@gmail.com>2014-12-03 21:24:17 -0500
committerJunio C Hamano <gitster@pobox.com>2014-12-04 11:58:36 -0800
commitd543d9c0f44a89f30ec1670f16c698b5da801476 (patch)
treea4b23afa1f7297104e9a56ff13c78f467d668eb9 /configure.ac
parent7fa1365c54c28b3cd9375539f381b54061a1880d (diff)
downloadgit-d543d9c0f44a89f30ec1670f16c698b5da801476.tar.gz
compat: convert modes to use portable file type values
This adds simple wrapper functions around calls to stat(), fstat(), and lstat() that translate the operating system's native file type bits to those used by most operating systems. It also rewrites the S_IF* macros to the common values, so all file type processing is performed using the translated modes. This makes projects portable across operating systems that use different file type definitions. Only the file type bits may be affected by these compatibility functions; the file permission bits are assumed to be 07777 and are passed through unchanged. Signed-off-by: David Michael <fedora.dm0@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac23
1 files changed, 23 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 4b1ae7c3c9..f75609e743 100644
--- a/configure.ac
+++ b/configure.ac
@@ -865,6 +865,29 @@ else
SNPRINTF_RETURNS_BOGUS=
fi
GIT_CONF_SUBST([SNPRINTF_RETURNS_BOGUS])
+#
+# Define NEEDS_MODE_TRANSLATION if your OS strays from the typical file type
+# bits in mode values.
+AC_CACHE_CHECK([whether the platform uses typical file type bits],
+ [ac_cv_sane_mode_bits], [
+AC_EGREP_CPP(yippeeyeswehaveit,
+ AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
+[#if S_IFMT == 0170000 && \
+ S_IFREG == 0100000 && S_IFDIR == 0040000 && S_IFLNK == 0120000 && \
+ S_IFBLK == 0060000 && S_IFCHR == 0020000 && \
+ S_IFIFO == 0010000 && S_IFSOCK == 0140000
+yippeeyeswehaveit
+#endif
+]),
+ [ac_cv_sane_mode_bits=yes],
+ [ac_cv_sane_mode_bits=no])
+])
+if test $ac_cv_sane_mode_bits = yes; then
+ NEEDS_MODE_TRANSLATION=
+else
+ NEEDS_MODE_TRANSLATION=UnfortunatelyYes
+fi
+GIT_CONF_SUBST([NEEDS_MODE_TRANSLATION])
## Checks for library functions.