From 686084d6e0a33b4a91cd1ea3a572016c14efeb7e Mon Sep 17 00:00:00 2001
From: Yorhel <git@yorhel.nl>
Date: Fri, 7 May 2010 14:17:03 +0200
Subject: [PATCH] Added compll to the compilation environment and allow linking
 to zlib

---
 .gitmodules     |  3 +++
 compll          |  1 +
 configure.in    | 24 ++++++++++++++++++++++++
 src/Makefile.am |  5 ++++-
 src/compll.c    |  1 +
 src/compll.h    |  1 +
 6 files changed, 34 insertions(+), 1 deletion(-)
 create mode 100644 .gitmodules
 create mode 160000 compll
 create mode 120000 src/compll.c
 create mode 120000 src/compll.h

diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..85c75f4
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "compll"]
+	path = compll
+	url = git://g.blicky.net/compll.git/
diff --git a/compll b/compll
new file mode 160000
index 0000000..f089f64
--- /dev/null
+++ b/compll
@@ -0,0 +1 @@
+Subproject commit f089f64220c1a41532853c5e4ee17daa8f40b2ff
diff --git a/configure.in b/configure.in
index c4ee13e..d350e0d 100644
--- a/configure.in
+++ b/configure.in
@@ -18,6 +18,8 @@ AC_CHECK_HEADERS(
 AC_TYPE_OFF_T
 AC_SYS_LARGEFILE
 AC_STRUCT_ST_BLOCKS
+AC_CHECK_TYPE([unsigned long long], [],
+              [AC_MSG_ERROR([your compiler does not have an unsigned long long type.])])
 
 # Check for library functions.
 AC_CHECK_FUNCS(
@@ -47,6 +49,28 @@ AC_CHECK_LIB([$ncurses],
 
 
 
+# compll configuration (only zlib is supported currently)
+compll=no
+AC_ARG_WITH([compll],
+            AC_HELP_STRING([--with-compll=zlib], [use zlib for in-memory compression (experimental)]),
+            [compll=$withval])
+if test "x$compll" != "xno"; then
+  AC_CHECK_LIB([z],
+               [zlibVersion],
+               [AC_CHECK_HEADER([zlib.h], [LIBS="$LIBS -lz"; compll=zlib],
+                                [if test "x$compll" = "xauto"; then compll=no
+                                 else AC_MSG_ERROR([--with-compll is given, but zlib.h could not be found]); fi])
+               ],
+               [if test "x$compll" = "xauto"; then compll=no
+                else AC_MSG_ERROR([--with-compll is given, but no zlib library could not be found]); fi])
+fi
+if test "x$compll" = "xno"; then
+  AC_DEFINE([COMPLL_NOLIB], [1], [don't use compll])
+fi
+AM_CONDITIONAL([COMPLL], [test "x$compll" != "xno"])
+
+
+
 AC_OUTPUT([Makefile src/Makefile doc/Makefile])
 
 echo ""
diff --git a/src/Makefile.am b/src/Makefile.am
index 3047a5e..698d5eb 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,5 +1,8 @@
 bin_PROGRAMS = ncdu
 
 ncdu_SOURCES = browser.c calc.c delete.c dirlist.c exclude.c help.c main.c path.c util.c
+if COMPLL
+ncdu_SOURCES += compll.c
+endif
 
-noinst_HEADERS = browser.h calc.h delete.h dirlist.h exclude.h global.h help.h path.h util.h
+noinst_HEADERS = browser.h compll.h calc.h delete.h dirlist.h exclude.h global.h help.h path.h util.h
diff --git a/src/compll.c b/src/compll.c
new file mode 120000
index 0000000..60ae193
--- /dev/null
+++ b/src/compll.c
@@ -0,0 +1 @@
+../compll/compll.c
\ No newline at end of file
diff --git a/src/compll.h b/src/compll.h
new file mode 120000
index 0000000..0425579
--- /dev/null
+++ b/src/compll.h
@@ -0,0 +1 @@
+../compll/compll.h
\ No newline at end of file
-- 
GitLab