X-Git-Url: https://arthur.barton.de/gitweb/?a=blobdiff_plain;f=config%2Fconfigure;h=f250d1a32a486fccaaa2d975e6011c40216e32d6;hb=6178db0ca9a784fa9961d2de5b29090c3c4c3e03;hp=89da205674262c93ecd8b1b3746f3695bf6190b5;hpb=e6ee5c9bbee41e7a3b1891e252de89571d0ee717;p=bup.git diff --git a/config/configure b/config/configure index 89da205..f250d1a 100755 --- a/config/configure +++ b/config/configure @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash bup_find_prog() { @@ -12,6 +12,20 @@ bup_find_prog() echo "$result" } +bup_try_c_code() +{ + local code="$1" tmpdir rc + if test -z "$code"; then + AC_FAIL "No code provided to test compile" + fi + tmpdir="$(mktemp -d "bup-try-c-compile-XXXXXXX")" || exit $? + echo "$code" > "$tmpdir/test.c" || exit $? + $AC_CC -Wall -Werror -c -o "$tmpdir/test" "$tmpdir/test.c" + rc=$? + rm -r "$tmpdir" || exit $? + return $rc +} + TARGET=bup . ./configure.inc @@ -53,8 +67,13 @@ fi # For stat. AC_CHECK_HEADERS sys/stat.h AC_CHECK_HEADERS sys/types.h + +# For stat and mincore. AC_CHECK_HEADERS unistd.h +# For mincore. +AC_CHECK_HEADERS sys/mman.h + # For FS_IOC_GETFLAGS and FS_IOC_SETFLAGS. AC_CHECK_HEADERS linux/fs.h AC_CHECK_HEADERS sys/ioctl.h @@ -65,8 +84,59 @@ if [ -z "$OS_GNU_KFREEBSD" ]; then fi AC_CHECK_FUNCS utimes AC_CHECK_FUNCS lutimes + + AC_CHECK_FUNCS mincore +mincore_incore_code=" +#if 0$ac_defined_HAVE_UNISTD_H +#include +#endif +#if 0$ac_defined_HAVE_SYS_MMAN_H +#include +#endif +int main(int argc, char **argv) +{ + if (MINCORE_INCORE) + return 0; +} +" + +mincore_buf_type_code() +{ + local vec_type="$1" + echo " +#include +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 + + AC_CHECK_FIELD stat st_atim sys/types.h sys/stat.h unistd.h AC_CHECK_FIELD stat st_mtim sys/types.h sys/stat.h unistd.h AC_CHECK_FIELD stat st_ctim sys/types.h sys/stat.h unistd.h