#!/bin/sh
+bup_find_prog()
+{
+ # Prints prog path to stdout or nothing.
+ local name="$1" result="$2"
+ TLOGN "checking for $name"
+ if ! [ "$result" ]; then
+ result=`acLookFor "$name"`
+ fi
+ TLOG " ($result)"
+ echo "$result"
+}
+
TARGET=bup
. ./configure.inc
exit 1
fi
-TLOGN "checking the GNU make"
-MAKE=`acLookFor make`
-if [ -z "$MAKE" ]; then
- AC_FAIL " Cannot find make";
+MAKE="$(bup_find_prog make $MAKE)"
+if test -z "$MAKE"; then
+ MAKE="$(bup_find_prog gmake "$GMAKE")"
+fi
+
+if test -z "$MAKE"; then
+ AC_FAIL "ERROR: unable to find make"
fi
-MAKE_GNU=`$MAKE --version | grep "GNU Make"`
-if [ -z "$MAKE_GNU" ]; then
- AC_FAIL " $MAKE is not GNU Make"
+if ! ($MAKE --version | grep "GNU Make"); then
+ AC_FAIL "ERROR: $MAKE is not GNU Make"
fi
MAKE_VERSION=`$MAKE --version | grep "GNU Make" | awk '{print $3}'`
if [ -z "$MAKE_VERSION" ]; then
- AC_FAIL " $MAKE --version does not return sensible output?"
+ AC_FAIL "ERROR: $MAKE --version does not return sensible output?"
fi
-expr "$MAKE_VERSION" '>=' '3.81' || AC_FAIL "$MAKE must be >= version 3.81"
-TLOG " ok"
+expr "$MAKE_VERSION" '>=' '3.81' || AC_FAIL "ERROR: $MAKE must be >= version 3.81"
-TLOGN "checking the python"
-PYTHON=`acLookFor python`
-if [ -z "$PYTHON" ]; then
- AC_FAIL " Cannot find python";
+if test -z "$(bup_find_prog python '')"; then
+ AC_FAIL "ERROR: unable to find python"
fi
-TLOG " - you have some python program - ok"
-TLOGN "checking the git"
-GIT=`acLookFor git`
-if [ -z "$GIT" ]; then
- AC_FAIL " Cannot find git";
+if test -z "$(bup_find_prog git '')"; then
+ AC_FAIL "ERROR: unable to find git"
fi
-TLOG " - you have some git program - ok"
+# For stat.
+AC_CHECK_HEADERS sys/stat.h
+AC_CHECK_HEADERS sys/types.h
+AC_CHECK_HEADERS unistd.h
+
+# For FS_IOC_GETFLAGS and FS_IOC_SETFLAGS.
+AC_CHECK_HEADERS linux/fs.h
+AC_CHECK_HEADERS sys/ioctl.h
+
+# On GNU/kFreeBSD utimensat is defined in GNU libc, but won't work.
+if [ -z "$OS_GNU_KFREEBSD" ]; then
+ AC_CHECK_FUNCS utimensat
+fi
+AC_CHECK_FUNCS utimes
+AC_CHECK_FUNCS lutimes
-# assuming the above checks pass, get the path of everything
-MF_PATH_INCLUDE GMAKE make gmake
-MF_PATH_INCLUDE GIT git
-MF_PATH_INCLUDE TAR tar gtar
-MF_PATH_INCLUDE PYTHON python
+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
-AC_CHECK_HEADERS sys/stat.h
-AC_CHECK_FUNCS utimensat
-AC_CHECK_FUNCS utime
+AC_CHECK_FIELD stat st_atimensec sys/types.h sys/stat.h unistd.h
+AC_CHECK_FIELD stat st_mtimensec sys/types.h sys/stat.h unistd.h
+AC_CHECK_FIELD stat st_ctimensec sys/types.h sys/stat.h unistd.h
AC_OUTPUT config.vars