From: Junio C Hamano Date: Fri, 20 Mar 2015 20:11:49 +0000 (-0700) Subject: Merge branch 'km/bsd-sysctl' X-Git-Tag: v2.4.0-rc0~34 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/551fc7aec1a7efe868a59fbeea14582b41923f4d?ds=inline;hp=-c Merge branch 'km/bsd-sysctl' We now detect number of CPUs on older BSD-derived systems. * km/bsd-sysctl: thread-utils.c: detect CPU count on older BSD-like systems configure: support HAVE_BSD_SYSCTL option --- 551fc7aec1a7efe868a59fbeea14582b41923f4d diff --combined Makefile index 44f1dd10ff,fdac1b9803..5f3987fe3b --- a/Makefile +++ b/Makefile @@@ -349,14 -349,7 +349,16 @@@ all: # Define NO_HMAC_CTX_CLEANUP if your OpenSSL is version 0.9.6b or earlier to # cleanup the HMAC context with the older HMAC_cleanup function. # +# Define USE_PARENS_AROUND_GETTEXT_N to "yes" if your compiler happily +# compiles the following initialization: +# +# static const char s[] = ("FOO"); +# +# and define it to "no" if you need to remove the parentheses () around the +# constant. The default is "auto", which means to use parentheses if your +# compiler is detected to support it. ++# + # Define HAVE_BSD_SYSCTL if your platform has a BSD-compatible sysctl function. GIT-VERSION-FILE: FORCE @$(SHELL_PATH) ./GIT-VERSION-GEN @@@ -964,14 -957,6 +966,14 @@@ ifneq (,$(SOCKLEN_T) BASIC_CFLAGS += -Dsocklen_t=$(SOCKLEN_T) endif +ifeq (yes,$(USE_PARENS_AROUND_GETTEXT_N)) + BASIC_CFLAGS += -DUSE_PARENS_AROUND_GETTEXT_N=1 +else +ifeq (no,$(USE_PARENS_AROUND_GETTEXT_N)) + BASIC_CFLAGS += -DUSE_PARENS_AROUND_GETTEXT_N=0 +endif +endif + ifeq ($(uname_S),Darwin) ifndef NO_FINK ifeq ($(shell test -d /sw/lib && echo y),y) @@@ -1052,13 -1037,13 +1054,13 @@@ els REMOTE_CURL_NAMES = $(REMOTE_CURL_PRIMARY) $(REMOTE_CURL_ALIASES) PROGRAM_OBJS += http-fetch.o PROGRAMS += $(REMOTE_CURL_NAMES) - curl_check := $(shell (echo 070908; curl-config --vernum) 2>/dev/null | sort -r | sed -ne 2p) + curl_check := $(shell (echo 070908; curl-config --vernum | sed -e '/^70[BC]/s/^/0/') 2>/dev/null | sort -r | sed -ne 2p) ifeq "$(curl_check)" "070908" ifndef NO_EXPAT PROGRAM_OBJS += http-push.o endif endif - curl_check := $(shell (echo 072200; curl-config --vernum) 2>/dev/null | sort -r | sed -ne 2p) + curl_check := $(shell (echo 072200; curl-config --vernum | sed -e '/^70[BC]/s/^/0/') 2>/dev/null | sort -r | sed -ne 2p) ifeq "$(curl_check)" "072200" USE_CURL_FOR_IMAP_SEND = YesPlease endif @@@ -1431,6 -1416,10 +1433,10 @@@ ifdef HAVE_CLOCK_MONOTONI BASIC_CFLAGS += -DHAVE_CLOCK_MONOTONIC endif + ifdef HAVE_BSD_SYSCTL + BASIC_CFLAGS += -DHAVE_BSD_SYSCTL + endif + ifeq ($(TCLTK_PATH),) NO_TCLTK = NoThanks endif diff --combined git-compat-util.h index fbfd10dadc,4ead8c8fdd..bc8fc8cf85 --- a/git-compat-util.h +++ b/git-compat-util.h @@@ -127,6 -127,9 +127,9 @@@ #else #include #endif + #ifdef HAVE_BSD_SYSCTL + #include + #endif #if defined(__MINGW32__) /* pull in Windows compatibility stuff */ @@@ -164,10 -167,16 +167,10 @@@ typedef long intptr_t; typedef unsigned long uintptr_t; #endif -#if defined(__CYGWIN__) -#undef _XOPEN_SOURCE -#include -#define _XOPEN_SOURCE 600 -#else #undef _ALL_SOURCE /* AIX 5.3L defines a struct list with _ALL_SOURCE. */ #include #define _ALL_SOURCE 1 #endif -#endif /* used on Mac OS X */ #ifdef PRECOMPOSE_UNICODE @@@ -206,15 -215,12 +209,15 @@@ extern char *gitbasename(char *) #endif #ifndef NO_OPENSSL +#ifdef __APPLE__ #define __AVAILABILITY_MACROS_USES_AVAILABILITY 0 -#define MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_10_6 +#include +#undef DEPRECATED_ATTRIBUTE +#define DEPRECATED_ATTRIBUTE +#undef __AVAILABILITY_MACROS_USES_AVAILABILITY +#endif #include #include -#undef MAC_OS_X_VERSION_MIN_REQUIRED -#undef __AVAILABILITY_MACROS_USES_AVAILABILITY #ifdef NO_HMAC_CTX_CLEANUP #define HMAC_CTX_cleanup HMAC_cleanup #endif @@@ -675,11 -681,6 +678,11 @@@ extern char *xgetcwd(void) #define REALLOC_ARRAY(x, alloc) (x) = xrealloc((x), (alloc) * sizeof(*(x))) +static inline char *xstrdup_or_null(const char *str) +{ + return str ? xstrdup(str) : NULL; +} + static inline size_t xsize_t(off_t len) { if (len > (size_t) len) @@@ -688,7 -689,7 +691,7 @@@ } /* in ctype.c, for kwset users */ -extern const char tolower_trans_tbl[256]; +extern const unsigned char tolower_trans_tbl[256]; /* Sane ctype - no locale, and works with signed chars */ #undef isascii @@@ -872,12 -873,4 +875,12 @@@ struct tm *git_gmtime_r(const time_t * #define gmtime_r git_gmtime_r #endif +#if !defined(USE_PARENS_AROUND_GETTEXT_N) && defined(__GNUC__) +#define USE_PARENS_AROUND_GETTEXT_N 1 +#endif + +#ifndef SHELL_PATH +# define SHELL_PATH "/bin/sh" +#endif + #endif