5 # Prints prog path to stdout or nothing.
6 local name="$1" result="$2"
7 TLOGN "checking for $name"
8 if ! [ "$result" ]; then
9 result=`acLookFor "$name"`
17 local code="$1" tmpdir rc
18 if test -z "$code"; then
19 AC_FAIL "No code provided to test compile"
21 tmpdir="$(mktemp -d "bup-try-c-compile-XXXXXXX")" || exit $?
22 echo "$code" > "$tmpdir/test.c" || exit $?
23 $AC_CC -Wall -Werror -c -o "$tmpdir/test" "$tmpdir/test.c"
25 rm -r "$tmpdir" || exit $?
36 LOG " You need to have a functional C compiler to build $TARGET"
40 MAKE="$(bup_find_prog make $MAKE)"
41 if test -z "$MAKE"; then
42 MAKE="$(bup_find_prog gmake "$GMAKE")"
45 if test -z "$MAKE"; then
46 AC_FAIL "ERROR: unable to find make"
49 if ! ($MAKE --version | grep "GNU Make"); then
50 AC_FAIL "ERROR: $MAKE is not GNU Make"
53 MAKE_VERSION=`$MAKE --version | grep "GNU Make" | awk '{print $3}'`
54 if [ -z "$MAKE_VERSION" ]; then
55 AC_FAIL "ERROR: $MAKE --version does not return sensible output?"
57 expr "$MAKE_VERSION" '>=' '3.81' || AC_FAIL "ERROR: $MAKE must be >= version 3.81"
60 test -z "$bup_python" && bup_python="$(bup_find_prog python2.7 '')"
61 test -z "$bup_python" && bup_python="$(bup_find_prog python2.6 '')"
62 test -z "$bup_python" && bup_python="$(bup_find_prog python2 '')"
63 test -z "$bup_python" && bup_python="$(bup_find_prog python '')"
64 if test -z "$bup_python"; then
65 AC_FAIL "ERROR: unable to find python"
67 echo "#!/bin/sh" > ../cmd/python-cmd.sh
68 printf "exec %q \"\$@\"" "$bup_python" >> ../cmd/python-cmd.sh
69 chmod u+x ../cmd/python-cmd.sh
70 cd ../cmd && ln -sf python-cmd.sh bup-python
73 if test -z "$(bup_find_prog git '')"; then
74 AC_FAIL "ERROR: unable to find git"
78 AC_CHECK_HEADERS sys/stat.h
79 AC_CHECK_HEADERS sys/types.h
81 # For stat and mincore.
82 AC_CHECK_HEADERS unistd.h
85 AC_CHECK_HEADERS sys/mman.h
87 # For FS_IOC_GETFLAGS and FS_IOC_SETFLAGS.
88 AC_CHECK_HEADERS linux/fs.h
89 AC_CHECK_HEADERS sys/ioctl.h
91 # On GNU/kFreeBSD utimensat is defined in GNU libc, but won't work.
92 if [ -z "$OS_GNU_KFREEBSD" ]; then
93 AC_CHECK_FUNCS utimensat
96 AC_CHECK_FUNCS lutimes
99 AC_CHECK_FUNCS mincore
101 mincore_incore_code="
102 #if 0$ac_defined_HAVE_UNISTD_H
105 #if 0$ac_defined_HAVE_SYS_MMAN_H
106 #include <sys/mman.h>
108 int main(int argc, char **argv)
115 mincore_buf_type_code()
119 #include <sys/mman.h>
120 int main(int argc, char **argv)
124 return mincore(x, 0, buf);
128 if test "$ac_defined_HAVE_MINCORE"; then
129 TLOGN "checking for MINCORE_INCORE"
130 if bup_try_c_code "$mincore_incore_code"; then
131 AC_DEFINE BUP_HAVE_MINCORE_INCORE 1
137 TLOGN "checking mincore buf type"
138 if bup_try_c_code "$(mincore_buf_type_code char)"; then
139 AC_DEFINE BUP_MINCORE_BUF_TYPE 'char'
141 elif bup_try_c_code "$(mincore_buf_type_code 'unsigned char')"; then
142 AC_DEFINE BUP_MINCORE_BUF_TYPE 'unsigned char'
143 TLOG ' (unsigned char)'
145 AC_FAIL "ERROR: unexpected mincore definition; please notify bup-list@googlegroups.com"
150 AC_CHECK_FIELD stat st_atim sys/types.h sys/stat.h unistd.h
151 AC_CHECK_FIELD stat st_mtim sys/types.h sys/stat.h unistd.h
152 AC_CHECK_FIELD stat st_ctim sys/types.h sys/stat.h unistd.h
154 AC_CHECK_FIELD stat st_atimensec sys/types.h sys/stat.h unistd.h
155 AC_CHECK_FIELD stat st_mtimensec sys/types.h sys/stat.h unistd.h
156 AC_CHECK_FIELD stat st_ctimensec sys/types.h sys/stat.h unistd.h
158 AC_CHECK_FIELD tm tm_gmtoff time.h
160 AC_OUTPUT config.vars