Zoltán Füzesi schrieb: > Building git in msys environment fails: > ... > LINK git.exe > builtin-grep.o: In function `wait_all': > D:\devel\msysgit\git/builtin-grep.c:260: undefined reference to > `pthread_cond_broadcast' Use this. I'll try to find a better solution over the weekend. diff --git a/Makefile b/Makefile index c591d70..bbee373 100644 --- a/Makefile +++ b/Makefile @@ -183,6 +183,9 @@ all:: # Define THREADED_DELTA_SEARCH if you have pthreads and wish to exploit # parallel delta searching when packing objects. # +# Define THREADED_GREP if you have pthreads and wish to exploit a +# parallelized grep. +# # Define INTERNAL_QSORT to use Git's implementation of qsort(), which # is a simplified version of the merge sort used in glibc. This is # recommended if Git triggers O(n^2) behavior in your platform's qsort(). @@ -723,11 +726,13 @@ ifeq ($(uname_S),Linux) NO_STRLCPY = YesPlease NO_MKSTEMPS = YesPlease THREADED_DELTA_SEARCH = YesPlease + THREADED_GREP = YesPlease endif ifeq ($(uname_S),GNU/kFreeBSD) NO_STRLCPY = YesPlease NO_MKSTEMPS = YesPlease THREADED_DELTA_SEARCH = YesPlease + THREADED_GREP = YesPlease endif ifeq ($(uname_S),UnixWare) CC = cc @@ -782,6 +787,7 @@ ifeq ($(uname_S),Darwin) endif NO_MEMMEM = YesPlease THREADED_DELTA_SEARCH = YesPlease + THREADED_GREP = YesPlease USE_ST_TIMESPEC = YesPlease endif ifeq ($(uname_S),SunOS) @@ -795,6 +801,7 @@ ifeq ($(uname_S),SunOS) NO_MKSTEMPS = YesPlease NO_REGEX = YesPlease THREADED_DELTA_SEARCH = YesPlease + THREADED_GREP = YesPlease ifeq ($(uname_R),5.7) NEEDS_RESOLV = YesPlease NO_IPV6 = YesPlease @@ -851,6 +858,7 @@ ifeq ($(uname_S),FreeBSD) DIR_HAS_BSD_GROUP_SEMANTICS = YesPlease USE_ST_TIMESPEC = YesPlease THREADED_DELTA_SEARCH = YesPlease + THREADED_GREP = YesPlease ifeq ($(shell expr "$(uname_R)" : '4\.'),2) PTHREAD_LIBS = -pthread NO_UINTMAX_T = YesPlease @@ -865,6 +873,7 @@ ifeq ($(uname_S),OpenBSD) BASIC_CFLAGS += -I/usr/local/include BASIC_LDFLAGS += -L/usr/local/lib THREADED_DELTA_SEARCH = YesPlease + THREADED_GREP = YesPlease endif ifeq ($(uname_S),NetBSD) ifeq ($(shell expr "$(uname_R)" : '[01]\.'),2) @@ -873,6 +882,7 @@ ifeq ($(uname_S),NetBSD) BASIC_CFLAGS += -I/usr/pkg/include BASIC_LDFLAGS += -L/usr/pkg/lib $(CC_LD_DYNPATH)/usr/pkg/lib THREADED_DELTA_SEARCH = YesPlease + THREADED_GREP = YesPlease USE_ST_TIMESPEC = YesPlease NO_MKSTEMPS = YesPlease endif @@ -889,6 +899,7 @@ ifeq ($(uname_S),AIX) BASIC_CFLAGS += -D_LARGE_FILES ifneq ($(shell expr "$(uname_V)" : '[1234]'),1) THREADED_DELTA_SEARCH = YesPlease + THREADED_GREP = YesPlease else NO_PTHREADS = YesPlease endif @@ -916,6 +927,7 @@ ifeq ($(uname_S),IRIX) SHELL_PATH = /usr/gnu/bin/bash NEEDS_LIBGEN = YesPlease THREADED_DELTA_SEARCH = YesPlease + THREADED_GREP = YesPlease endif ifeq ($(uname_S),IRIX64) NO_SETENV=YesPlease @@ -935,6 +947,7 @@ ifeq ($(uname_S),IRIX64) SHELL_PATH=/usr/gnu/bin/bash NEEDS_LIBGEN = YesPlease THREADED_DELTA_SEARCH = YesPlease + THREADED_GREP = YesPlease endif ifeq ($(uname_S),HP-UX) NO_IPV6=YesPlease @@ -1334,6 +1347,7 @@ endif ifdef NO_PTHREADS THREADED_DELTA_SEARCH = + THREADED_GREP = BASIC_CFLAGS += -DNO_PTHREADS else EXTLIBS += $(PTHREAD_LIBS) @@ -1341,6 +1355,11 @@ endif ifdef THREADED_DELTA_SEARCH BASIC_CFLAGS += -DTHREADED_DELTA_SEARCH +endif +ifdef THREADED_GREP + BASIC_CFLAGS += -DTHREADED_GREP +endif +ifneq (,$(THREADED_GREP)$(THREADED_DELTA_SEARCH)) LIB_OBJS += thread-utils.o endif ifdef DIR_HAS_BSD_GROUP_SEMANTICS diff --git a/builtin-grep.c b/builtin-grep.c index 9bd467c..911d0da 100644 --- a/builtin-grep.c +++ b/builtin-grep.c @@ -16,7 +16,7 @@ #include "quote.h" #include "dir.h" -#ifndef NO_PTHREADS +#ifdef THREADED_GREP #include "thread-utils.h" #include <pthread.h> #endif @@ -28,7 +28,7 @@ static char const * const grep_usage[] = { static int use_threads = 1; -#ifndef NO_PTHREADS +#ifdef THREADED_GREP #define THREADS 8 static pthread_t threads[THREADS]; @@ -274,7 +274,7 @@ static int wait_all(void) return hit; } -#else /* !NO_PTHREADS */ +#else /* THREADED_GREP */ #define read_sha1_lock() #define read_sha1_unlock() @@ -439,7 +439,7 @@ static int grep_sha1(struct grep_opt *opt, const unsigned char *sha1, name = strbuf_detach(&pathbuf, NULL); -#ifndef NO_PTHREADS +#ifdef THREADED_GREP if (use_threads) { grep_sha1_async(opt, name, sha1); return 0; @@ -501,7 +501,7 @@ static int grep_file(struct grep_opt *opt, const char *filename) strbuf_addstr(&buf, filename); name = strbuf_detach(&buf, NULL); -#ifndef NO_PTHREADS +#ifdef THREADED_GREP if (use_threads) { grep_file_async(opt, name, filename); return 0; @@ -902,7 +902,7 @@ int cmd_grep(int argc, const char **argv, const char *prefix) if ((opt.regflags != REG_NEWLINE) && opt.fixed) die("cannot mix --fixed-strings and regexp"); -#ifndef NO_PTHREADS +#ifdef THREADED_GREP if (online_cpus() == 1 || !grep_threads_ok(&opt)) use_threads = 0; -- 1.7.0.rc0.1096.g3300c.dirty -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html