]> arthur.barton.de Git - bup.git/blob - config/configure
Write the system ARG_MAX to an autogenerated config.py at configure time.
[bup.git] / config / configure
1 #!/bin/sh
2
3 bup_find_prog()
4 {
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"`
10     fi
11     TLOG " ($result)"
12     echo "$result"
13 }
14
15 TARGET=bup
16
17 . ./configure.inc
18
19 AC_INIT $TARGET
20
21 if ! AC_PROG_CC; then
22     LOG " You need to have a functional C compiler to build $TARGET"
23     exit 1
24 fi
25
26 MAKE="$(bup_find_prog make $MAKE)"
27 if test -z "$MAKE"; then
28     MAKE="$(bup_find_prog gmake "$GMAKE")"
29 fi
30
31 if test -z "$MAKE"; then
32     AC_FAIL "ERROR: unable to find make"
33 fi
34
35 if ! ($MAKE --version | grep "GNU Make"); then
36     AC_FAIL "ERROR: $MAKE is not GNU Make"
37 fi
38
39 MAKE_VERSION=`$MAKE --version | grep "GNU Make" | awk '{print $3}'`
40 if [ -z "$MAKE_VERSION" ]; then
41     AC_FAIL "ERROR: $MAKE --version does not return sensible output?"
42 fi
43 expr "$MAKE_VERSION" '>=' '3.81' || AC_FAIL "ERROR: $MAKE must be >= version 3.81"
44
45 if test -z "$(bup_find_prog python '')"; then
46     AC_FAIL "ERROR: unable to find python"
47 fi
48
49 if test -z "$(bup_find_prog git '')"; then
50     AC_FAIL "ERROR: unable to find git"
51 fi
52
53 # For stat.
54 AC_CHECK_HEADERS sys/stat.h
55 AC_CHECK_HEADERS sys/types.h
56 AC_CHECK_HEADERS unistd.h
57
58 # For FS_IOC_GETFLAGS and FS_IOC_SETFLAGS.
59 AC_CHECK_HEADERS linux/fs.h
60 AC_CHECK_HEADERS sys/ioctl.h
61
62 # On GNU/kFreeBSD utimensat is defined in GNU libc, but won't work.
63 if [ -z "$OS_GNU_KFREEBSD" ]; then
64     AC_CHECK_FUNCS utimensat
65 fi
66 AC_CHECK_FUNCS utimes
67 AC_CHECK_FUNCS lutimes
68
69 AC_CHECK_FIELD stat st_atim sys/types.h sys/stat.h unistd.h
70 AC_CHECK_FIELD stat st_mtim sys/types.h sys/stat.h unistd.h
71 AC_CHECK_FIELD stat st_ctim sys/types.h sys/stat.h unistd.h
72
73 AC_CHECK_FIELD stat st_atimensec sys/types.h sys/stat.h unistd.h
74 AC_CHECK_FIELD stat st_mtimensec sys/types.h sys/stat.h unistd.h
75 AC_CHECK_FIELD stat st_ctimensec sys/types.h sys/stat.h unistd.h
76
77 cat > ../lib/bup/config.py <<EOF
78 # Automatically generated file.  Edit config/configure instead of this file.
79 EOF
80
81 LOGN 'checking for ARG_MAX'
82 val_arg_max="$(getconf ARG_MAX)"
83 if test $? -ne 0; then
84     AC_FAIL "ERROR: getconf ARG_MAX failed."
85 else
86     if ! echo "$val_arg_max" | grep -qE '^[0-9]+$'; then
87         AC_FAIL "ERROR: ARG_MAX does not appear to be an integer: $val_arg_max"
88     fi
89     if ! echo "arg_max = $val_arg_max" >> ../lib/bup/config.py; then
90         AC_FAIL "ERROR: could not write to config.py."
91     fi
92     LOG " ($val_arg_max)"
93 fi
94
95 AC_OUTPUT config.vars