+2013-08-13 Nicolas François <nicolas.francois@centraliens.net>
+
+ * configure.in: Check if sizeof uid_t and gid_t is larger than 32
+ bit to support subordinate IDs.
+
2013-08-13 Nicolas François <nicolas.francois@centraliens.net>
* lib/subordinateio.c: Avoid dead branches.
[AC_HELP_STRING([--enable-subordinate-ids],
[support subordinate ids @<:@default=yes@:>@])],
[enable_subids="${enableval}"],
- [enable_subids="yes"]
+ [enable_subids="maybe"]
)
AC_ARG_WITH(audit,
fi
AM_CONDITIONAL(ENABLE_REGENERATE_MAN, test "x$enable_man" != "xno")
-if test "$enable_subids" = "yes"; then
+if test "$enable_subids" != "no"; then
dnl
dnl FIXME: check if 32 bit UIDs/GIDs are supported by libc
dnl
- AC_DEFINE(ENABLE_SUBIDS, 1, [Define to support the subordinate IDs.])
- enable_subids="yes"
+ AC_RUN_IFELSE([AC_LANG_SOURCE([
+#include <sys/types.h>
+int main(void) {
+ uid_t u;
+ gid_t g;
+ return (sizeof u < 4) || (sizeof g < 4);
+}
+ ])], [id32bit="yes"], [id32bit="no"])
+
+ if test "x$id32bit" = "xyes"; then
+ AC_DEFINE(ENABLE_SUBIDS, 1, [Define to support the subordinate IDs.])
+ enable_subids="yes"
+ else
+ if test "x$enable_subids" = "xyes"; then
+ AC_MSG_ERROR([Cannot enable support the subordinate IDs on systems where gid_t or uid_t has less than 32 bits])
+ fi
+ enable_subids="no"
+ fi
fi
AM_CONDITIONAL(ENABLE_SUBIDS, test "x$enable_subids" != "xno")