]> arthur.barton.de Git - bup.git/commitdiff
Write the system ARG_MAX to an autogenerated config.py at configure time.
authorRob Browning <rlb@defaultvalue.org>
Thu, 8 May 2014 18:44:11 +0000 (13:44 -0500)
committerRob Browning <rlb@defaultvalue.org>
Thu, 8 May 2014 18:48:39 +0000 (13:48 -0500)
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
.gitignore
Makefile
config/configure
lib/bup/t/tconfig.py [new file with mode: 0644]

index b5a261e84bb975740fd1b0b99e02a544bfed6475..25184bf0bae0c8cadd1a148b30a95d79956f4d5a 100644 (file)
@@ -1,6 +1,7 @@
 /bup
 /cmd/bup-*
 /lib/bup/_version.py
+/lib/bup/config.py
 randomgen
 memtest
 *.o
index d8b19b55c8d00dfb3be3a94a77a8e3f38798e54a..599835f08dff168732ff8371c49fb07bfec7badb 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -174,7 +174,7 @@ clean: Documentation/clean config/clean
                .*~ *~ */*~ lib/*/*~ lib/*/*/*~ \
                *.pyc */*.pyc lib/*/*.pyc lib/*/*/*.pyc \
                bup bup-* cmd/bup-* lib/bup/_version.py randomgen memtest \
-               testfs.img lib/bup/t/testfs.img
+               testfs.img lib/bup/t/testfs.img lib/bup/config.py
        if test -e t/mnt; then t/cleanup-mounts-under t/mnt; fi
        if test -e t/mnt; then rm -r t/mnt; fi
        if test -e t/tmp; then t/cleanup-mounts-under t/tmp; fi
index d6156d25b565fd77f4301ae5f02d1280e4fb0ff5..e5f70dc10f6fbacf12ab4d6568a7bc5581c6e2ba 100755 (executable)
@@ -74,4 +74,22 @@ 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
 
+cat > ../lib/bup/config.py <<EOF
+# Automatically generated file.  Edit config/configure instead of this file.
+EOF
+
+LOGN 'checking for ARG_MAX'
+val_arg_max="$(getconf ARG_MAX)"
+if test $? -ne 0; then
+    AC_FAIL "ERROR: getconf ARG_MAX failed."
+else
+    if ! echo "$val_arg_max" | grep -qE '^[0-9]+$'; then
+        AC_FAIL "ERROR: ARG_MAX does not appear to be an integer: $val_arg_max"
+    fi
+    if ! echo "arg_max = $val_arg_max" >> ../lib/bup/config.py; then
+        AC_FAIL "ERROR: could not write to config.py."
+    fi
+    LOG " ($val_arg_max)"
+fi
+
 AC_OUTPUT config.vars
diff --git a/lib/bup/t/tconfig.py b/lib/bup/t/tconfig.py
new file mode 100644 (file)
index 0000000..1b5fbda
--- /dev/null
@@ -0,0 +1,8 @@
+from helpers import readpipe
+from wvtest import *
+import config
+
+
+@wvtest
+def test_arg_max():
+    WVPASSEQ(int(readpipe(['getconf', 'ARG_MAX'])), config.arg_max)