+
+builtin_mul_overflow_code="
+#include <stddef.h>
+int main(int argc, char **argv)
+{
+ size_t n = 0, size = 0, total;
+ __builtin_mul_overflow(n, size, &total);
+ return 0;
+}
+"
+
+TLOGN "checking for __builtin_mul_overflow"
+if bup_try_c_code "$builtin_mul_overflow_code"; then
+ AC_DEFINE BUP_HAVE_BUILTIN_MUL_OVERFLOW 1
+ TLOG ' (found)'
+else
+ TLOG ' (not found)'
+fi
+
+
+AC_CHECK_FUNCS mincore
+
+mincore_incore_code="
+#if 0$ac_defined_HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if 0$ac_defined_HAVE_SYS_MMAN_H
+#include <sys/mman.h>
+#endif
+int main(int argc, char **argv)
+{
+ if (MINCORE_INCORE)
+ return 0;
+}
+"
+
+mincore_buf_type_code()
+{
+ local vec_type="$1"
+ echo "
+#include <sys/mman.h>
+int main(int argc, char **argv)
+{
+ void *x = 0;
+ $vec_type *buf = 0;
+ return mincore(x, 0, buf);
+}" || exit $?
+}
+
+if test "$ac_defined_HAVE_MINCORE"; then
+ TLOGN "checking for MINCORE_INCORE"
+ if bup_try_c_code "$mincore_incore_code"; then
+ AC_DEFINE BUP_HAVE_MINCORE_INCORE 1
+ TLOG ' (found)'
+ else
+ TLOG ' (not found)'
+ fi
+
+ TLOGN "checking mincore buf type"
+ if bup_try_c_code "$(mincore_buf_type_code char)"; then
+ AC_DEFINE BUP_MINCORE_BUF_TYPE 'char'
+ TLOG ' (char)'
+ elif bup_try_c_code "$(mincore_buf_type_code 'unsigned char')"; then
+ AC_DEFINE BUP_MINCORE_BUF_TYPE 'unsigned char'
+ TLOG ' (unsigned char)'
+ else
+ AC_FAIL "ERROR: unexpected mincore definition; please notify bup-list@googlegroups.com"
+ fi
+fi
+
+