to optimize for size. You need to add -Os or equivalent
flag(s) to CFLAGS manually.
+ --enable-assume-ram=SIZE
+ On the most common operating systems, XZ Utils is able to
+ detect the amount of physical memory on the system. This
+ information is used to set the default memory usage limit.
+
+ On some systems, there is no code to detect the amount of
+ RAM though. Using --enable-assume-ram one can set how much
+ memory to assume on these systems. SIZE is given as MiB.
+ The default is 32 MiB, which is probably too low for most
+ systems, but it is enough to allow decompressing .xz files
+ created with the default settings.
+
+ Feel free to send patches to add support for detecting
+ the amount of RAM on the operating system you use. See
+ src/common/tuklib_physmem.c for details.
+
--disable-threads
Disable threading support. This makes some things
thread-unsafe, meaning that if multithreaded application
# We use the actual result a little later.
+#########################
+# Assumed amount of RAM #
+#########################
+
+# We use 32 MiB as default, because it should be small enough for most
+# cases and allows decompressing files compressed with the default settings.
+# Probably it is too small for most systems, but it's safer to guess too low.
+AC_MSG_CHECKING([how much RAM to assume if the real amount is unknown])
+AC_ARG_ENABLE([assume-ram], AC_HELP_STRING([--enable-assume-ram=SIZE],
+ [If and only if the real amount of RAM cannot be determined,
+ assume SIZE MiB. The default is 32 MiB. This affects the
+ default memory usage limit.]),
+ [], [enable_assume_ram=32])
+assume_ram_check=`echo "$enable_assume_ram" | tr -d 0123456789`
+if test -z "$enable_assume_ram" || test -n "$assume_ram_check"; then
+ AC_MSG_RESULT([])
+ AC_MSG_ERROR([--enable-assume-ram accepts only an integer argument])
+fi
+AC_MSG_RESULT([$enable_assume_ram MiB])
+AC_DEFINE_UNQUOTED([ASSUME_RAM], [$enable_assume_ram],
+ [How many MiB of RAM to assume if the real amount cannot
+ be determined.])
+
+
############################################
# xz/xzdec/lzmadec linkage against liblzma #
############################################
uint64_t mem = tuklib_physmem();
- // If we cannot determine the amount of RAM, assume 32 MiB. Maybe
- // even that is too much on some systems. But on most systems it's
- // far too little, and can be annoying.
+ // If we cannot determine the amount of RAM, use the assumption
+ // defined by the configure script.
if (mem == 0)
- mem = UINT64_C(32) * 1024 * 1024;
+ mem = (uint64_t)(ASSUME_RAM) * 1024 * 1024;
memlimit = percentage * mem / 100;
return;
{
uint64_t mem = tuklib_physmem();
- // If we cannot determine the amount of RAM, assume 32 MiB.
+ // If we cannot determine the amount of RAM, use the assumption
+ // set by the configure script.
if (mem == 0)
- mem = UINT64_C(32) * 1024 * 1024;
+ mem = (uint64_t)(ASSUME_RAM) * 1024 * 1024;
memlimit = percentage * mem / 100;
return;