summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5413812)
raw | patch | inline | side by side (parent: 5413812)
author | Junio C Hamano <gitster@pobox.com> | |
Sat, 15 Nov 2008 12:08:14 +0000 (04:08 -0800) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 2 Dec 2008 23:29:12 +0000 (15:29 -0800) |
This introduces make variable NO_PTHREADS for platforms that lack the
support for pthreads library or people who do not want to use it for
whatever reason. When defined, it makes the multi-threaded index
preloading into a no-op, and also disables threaded delta searching by
pack-objects.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Mike Ralphson <mike@abacus.co.uk>
Tested-by: Johannes Sixt <j6t@kdbg.org> (AIX 4.3.x)
Signed-off-by: Junio C Hamano <gitster@pobox.com>
support for pthreads library or people who do not want to use it for
whatever reason. When defined, it makes the multi-threaded index
preloading into a no-op, and also disables threaded delta searching by
pack-objects.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Mike Ralphson <mike@abacus.co.uk>
Tested-by: Johannes Sixt <j6t@kdbg.org> (AIX 4.3.x)
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Makefile | patch | blob | history | |
config.mak.in | patch | blob | history | |
configure.ac | patch | blob | history | |
preload-index.c | patch | blob | history |
diff --git a/Makefile b/Makefile
index 649cfb819f6fc3f0164bac8d3c8b11aee6f0827f..9577d6fc734de9912c4099758f2f68b2ae86c57b 100644 (file)
--- a/Makefile
+++ b/Makefile
#
# Define NO_MMAP if you want to avoid mmap.
#
+# Define NO_PTHREADS if you do not have or do not want to use Pthreads.
+#
# Define NO_PREAD if you have a problem with pread() system call (e.g.
# cygwin.dll before v1.5.22).
#
uname_O := $(shell sh -c 'uname -o 2>/dev/null || echo not')
uname_R := $(shell sh -c 'uname -r 2>/dev/null || echo not')
uname_P := $(shell sh -c 'uname -p 2>/dev/null || echo not')
+uname_V := $(shell sh -c 'uname -v 2>/dev/null || echo not')
# CFLAGS and LDFLAGS are for the users to override from the command line.
INTERNAL_QSORT = UnfortunatelyYes
NEEDS_LIBICONV=YesPlease
BASIC_CFLAGS += -D_LARGE_FILES
+ ifneq ($(shell expr "$(uname_V)" : '[1234]'),1)
+ THREADED_DELTA_SEARCH = YesPlease
+ else
+ NO_PTHREADS = YesPlease
+ endif
endif
ifeq ($(uname_S),GNU)
# GNU/Hurd
NO_STRCASESTR = YesPlease
NO_STRLCPY = YesPlease
NO_MEMMEM = YesPlease
+ NO_PTHREADS = YesPlease
NEEDS_LIBICONV = YesPlease
OLD_ICONV = YesPlease
NO_C99_FORMAT = YesPlease
COMPAT_OBJS += compat/qsort.o
endif
+ifdef NO_PTHREADS
+ THREADED_DELTA_SEARCH =
+ BASIC_CFLAGS += -DNO_PTHREADS
+else
+ EXTLIBS += $(PTHREAD_LIBS)
+endif
+
ifdef THREADED_DELTA_SEARCH
BASIC_CFLAGS += -DTHREADED_DELTA_SEARCH
- EXTLIBS += $(PTHREAD_LIBS)
LIB_OBJS += thread-utils.o
endif
ifdef DIR_HAS_BSD_GROUP_SEMANTICS
diff --git a/config.mak.in b/config.mak.in
index ea7705c1edb6040a900159077a60e129e03a5de1..14dfb21fa59efb7482ea0727845c8198cc996271 100644 (file)
--- a/config.mak.in
+++ b/config.mak.in
NO_DEFLATE_BOUND=@NO_DEFLATE_BOUND@
FREAD_READS_DIRECTORIES=@FREAD_READS_DIRECTORIES@
SNPRINTF_RETURNS_BOGUS=@SNPRINTF_RETURNS_BOGUS@
+NO_PTHREADS=@NO_PTHREADS@
PTHREAD_LIBS=@PTHREAD_LIBS@
diff --git a/configure.ac b/configure.ac
index 42567420e0b6ab01bc0a905b61c3fd7939f800f9..8821b5080af2eb3ec8cabd3ae40ee20e10c80f2e 100644 (file)
--- a/configure.ac
+++ b/configure.ac
# Define NO_SYMLINK_HEAD if you never want .git/HEAD to be a symbolic link.
# Enable it on Windows. By default, symrefs are still used.
#
+# Define NO_PTHREADS if we do not have pthreads
+#
# Define PTHREAD_LIBS to the linker flag used for Pthread support.
AC_LANG_CONFTEST([AC_LANG_PROGRAM(
[[#include <pthread.h>]],
${CC} -lpthread conftest.c -o conftest.o > /dev/null 2>&1
if test $? -eq 0;then
PTHREAD_LIBS="-lpthread"
+ else
+ NO_PTHREADS=UnfortunatelyYes
fi
fi
AC_SUBST(PTHREAD_LIBS)
+AC_SUBST(NO_PTHREADS)
## Site configuration (override autodetection)
## --with-PACKAGE[=ARG] and --without-PACKAGE
diff --git a/preload-index.c b/preload-index.c
index a6855837a4b85e475d556527335d89c8b0e3a02c..88edc5f8a9d5384e19426e6adb40e08b34d3adf2 100644 (file)
--- a/preload-index.c
+++ b/preload-index.c
* Copyright (C) 2008 Linus Torvalds
*/
#include "cache.h"
+
+#ifdef NO_PTHREADS
+static void preload_index(struct index_state *index, const char **pathspec)
+{
+ ; /* nothing */
+}
+#else
+
#include <pthread.h>
/*
die("unable to join threaded lstat");
}
}
+#endif
int read_index_preload(struct index_state *index, const char **pathspec)
{