From 02232adfd8bdc692bbe408ead7332ebfe416e83d Mon Sep 17 00:00:00 2001 From: Jeff King Date: Tue, 16 Jun 2009 15:07:40 -0400 Subject: [PATCH 1/3] Makefile: refactor regex compat support There was no tweakable knob to use the regex compat code; it was embedded in the mingw build. Since other platforms may want to use it, let's factor it out in the usual way for build configuration knobs. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- Makefile | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 41ab8e9e0..0cb21da6d 100644 --- a/Makefile +++ b/Makefile @@ -194,6 +194,8 @@ all:: # # Define USE_NED_ALLOCATOR if you want to replace the platforms default # memory allocators with the nedmalloc allocator written by Niall Douglas. +# +# Define NO_REGEX if you have no or inferior regex support in your C library. GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE @$(SHELL_PATH) ./GIT-VERSION-GEN @@ -884,9 +886,10 @@ ifneq (,$(findstring MINGW,$(uname_S))) USE_NED_ALLOCATOR = YesPlease UNRELIABLE_FSTAT = UnfortunatelyYes OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo - COMPAT_CFLAGS += -D__USE_MINGW_ACCESS -DNOGDI -Icompat -Icompat/regex -Icompat/fnmatch + NO_REGEX = YesPlease + COMPAT_CFLAGS += -D__USE_MINGW_ACCESS -DNOGDI -Icompat -Icompat/fnmatch COMPAT_CFLAGS += -DSTRIP_EXTENSION=\".exe\" - COMPAT_OBJS += compat/mingw.o compat/fnmatch/fnmatch.o compat/regex/regex.o compat/winansi.o + COMPAT_OBJS += compat/mingw.o compat/fnmatch/fnmatch.o compat/winansi.o EXTLIBS += -lws2_32 X = .exe ifneq (,$(wildcard ../THIS_IS_MSYSGIT)) @@ -1200,6 +1203,10 @@ endif ifdef UNRELIABLE_FSTAT BASIC_CFLAGS += -DUNRELIABLE_FSTAT endif +ifdef NO_REGEX + COMPAT_CFLAGS += -Icompat/regex + COMPAT_OBJS += compat/regex/regex.o +endif ifdef USE_NED_ALLOCATOR COMPAT_CFLAGS += -DUSE_NED_ALLOCATOR -DOVERRIDE_STRDUP -DNDEBUG -DREPLACE_SYSTEM_ALLOCATOR -Icompat/nedmalloc From ee78cac22b3e5e3f93898361b87a38b488c5592e Mon Sep 17 00:00:00 2001 From: Jeff King Date: Tue, 16 Jun 2009 15:08:21 -0400 Subject: [PATCH 2/3] Makefile: use compat regex on Solaris The system regex is either slow or buggy for complex patterns, like the built-in xfuncname pattern for java files. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 0cb21da6d..3bd0c08f4 100644 --- a/Makefile +++ b/Makefile @@ -725,6 +725,7 @@ ifeq ($(uname_S),SunOS) NO_MEMMEM = YesPlease NO_MKDTEMP = YesPlease NO_MKSTEMPS = YesPlease + NO_REGEX = YesPlease ifeq ($(uname_R),5.7) NEEDS_RESOLV = YesPlease NO_IPV6 = YesPlease From 1d7b1af42028c321aeca18ab1c719b21089108bf Mon Sep 17 00:00:00 2001 From: Brandon Casey Date: Fri, 19 Jun 2009 10:10:39 -0500 Subject: [PATCH 3/3] Makefile: Solaris needs HAVE_ALLOCA_H for alloca() There is special handling in compat/regex/regex.c for the GNU compiler to define alloca to __builtin_alloca, but the native compiler must include alloca.h which happens when HAVE_ALLOCA_H is defined. Signed-off-by: Brandon Casey Signed-off-by: Junio C Hamano --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 3bd0c08f4..bbc26e8bd 100644 --- a/Makefile +++ b/Makefile @@ -753,7 +753,7 @@ ifeq ($(uname_S),SunOS) endif INSTALL = /usr/ucb/install TAR = gtar - BASIC_CFLAGS += -D__EXTENSIONS__ -D__sun__ + BASIC_CFLAGS += -D__EXTENSIONS__ -D__sun__ -DHAVE_ALLOCA_H endif ifeq ($(uname_O),Cygwin) NO_D_TYPE_IN_DIRENT = YesPlease