Merge branch 'km/gettext-n'
authorJunio C Hamano <gitster@pobox.com>
Wed, 11 Feb 2015 21:42:00 +0000 (13:42 -0800)
committerJunio C Hamano <gitster@pobox.com>
Wed, 11 Feb 2015 21:42:00 +0000 (13:42 -0800)
* km/gettext-n:
gettext.h: add parentheses around N_ expansion if supported

1  2 
Makefile
git-compat-util.h
diff --combined Makefile
index c44eb3a8511c1d179113c241245f4a0ba8dc2787,be740010ead9c08152e89d82ef4f4f1defee7aca..e8ce649ca1e2fb536e7de366205666388d8cfdf7
+++ b/Makefile
@@@ -191,10 -191,6 +191,10 @@@ all:
  # Define NO_TRUSTABLE_FILEMODE if your filesystem may claim to support
  # the executable mode bit, but doesn't really do so.
  #
 +# Define NEEDS_MODE_TRANSLATION if your OS strays from the typical file type
 +# bits in mode values (e.g. z/OS defines I_SFMT to 0xFF000000 as opposed to the
 +# usual 0xF000).
 +#
  # Define NO_IPV6 if you lack IPv6 support and getaddrinfo().
  #
  # Define NO_UNIX_SOCKETS if your system does not offer unix sockets.
  #
  # Define HAVE_CLOCK_GETTIME if your platform has clock_gettime in librt.
  #
 +# Define HAVE_CLOCK_MONOTONIC if your platform has CLOCK_MONOTONIC in librt.
 +#
 +# 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.
  
  GIT-VERSION-FILE: FORCE
        @$(SHELL_PATH) ./GIT-VERSION-GEN
@@@ -955,6 -955,14 +964,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)
@@@ -1004,9 -1012,6 +1021,9 @@@ ifdef HAVE_ALLOCA_
        BASIC_CFLAGS += -DHAVE_ALLOCA_H
  endif
  
 +IMAP_SEND_BUILDDEPS =
 +IMAP_SEND_LDFLAGS = $(OPENSSL_LINK) $(OPENSSL_LIBSSL) $(LIB_4_CRYPTO)
 +
  ifdef NO_CURL
        BASIC_CFLAGS += -DNO_CURL
        REMOTE_CURL_PRIMARY =
                        PROGRAM_OBJS += http-push.o
                endif
        endif
 +      curl_check := $(shell (echo 072200; curl-config --vernum) 2>/dev/null | sort -r | sed -ne 2p)
 +      ifeq "$(curl_check)" "072200"
 +              USE_CURL_FOR_IMAP_SEND = YesPlease
 +      endif
 +      ifdef USE_CURL_FOR_IMAP_SEND
 +              BASIC_CFLAGS += -DUSE_CURL_FOR_IMAP_SEND
 +              IMAP_SEND_BUILDDEPS = http.o
 +              IMAP_SEND_LDFLAGS += $(CURL_LIBCURL)
 +      endif
        ifndef NO_EXPAT
                ifdef EXPATDIR
                        BASIC_CFLAGS += -I$(EXPATDIR)/include
@@@ -1080,9 -1076,6 +1097,9 @@@ ifndef NO_OPENSS
        ifdef NEEDS_CRYPTO_WITH_SSL
                OPENSSL_LIBSSL += -lcrypto
        endif
 +      ifdef NO_HMAC_CTX_CLEANUP
 +              BASIC_CFLAGS += -DNO_HMAC_CTX_CLEANUP
 +      endif
  else
        BASIC_CFLAGS += -DNO_OPENSSL
        BLK_SHA1 = 1
@@@ -1254,10 -1247,6 +1271,10 @@@ endi
  ifdef NO_TRUSTABLE_FILEMODE
        BASIC_CFLAGS += -DNO_TRUSTABLE_FILEMODE
  endif
 +ifdef NEEDS_MODE_TRANSLATION
 +      COMPAT_CFLAGS += -DNEEDS_MODE_TRANSLATION
 +      COMPAT_OBJS += compat/stat.o
 +endif
  ifdef NO_IPV6
        BASIC_CFLAGS += -DNO_IPV6
  endif
@@@ -1410,10 -1399,6 +1427,10 @@@ ifdef HAVE_CLOCK_GETTIM
        EXTLIBS += -lrt
  endif
  
 +ifdef HAVE_CLOCK_MONOTONIC
 +      BASIC_CFLAGS += -DHAVE_CLOCK_MONOTONIC
 +endif
 +
  ifeq ($(TCLTK_PATH),)
  NO_TCLTK = NoThanks
  endif
@@@ -1912,7 -1897,7 +1929,7 @@@ gettext.sp gettext.s gettext.o: GIT-PRE
  gettext.sp gettext.s gettext.o: EXTRA_CPPFLAGS = \
        -DGIT_LOCALE_PATH='"$(localedir_SQ)"'
  
 -http-push.sp http.sp http-walker.sp remote-curl.sp: SPARSE_FLAGS += \
 +http-push.sp http.sp http-walker.sp remote-curl.sp imap-send.sp: SPARSE_FLAGS += \
        -DCURL_DISABLE_TYPECHECK
  
  ifdef NO_EXPAT
@@@ -1933,9 -1918,9 +1950,9 @@@ endi
  git-%$X: %.o GIT-LDFLAGS $(GITLIBS)
        $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
  
 -git-imap-send$X: imap-send.o GIT-LDFLAGS $(GITLIBS)
 +git-imap-send$X: imap-send.o $(IMAP_SEND_BUILDDEPS) GIT-LDFLAGS $(GITLIBS)
        $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
 -              $(LIBS) $(OPENSSL_LINK) $(OPENSSL_LIBSSL) $(LIB_4_CRYPTO)
 +              $(LIBS) $(IMAP_SEND_LDFLAGS)
  
  git-http-fetch$X: http.o http-walker.o http-fetch.o GIT-LDFLAGS $(GITLIBS)
        $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
diff --combined git-compat-util.h
index 553fc017623be771878778c84aca08a4684f6902,572664371d0b0d9870449b889c9575559fc5139d..68c07af9d465ce92d78b11d347ae0396299a1855
@@@ -75,8 -75,7 +75,8 @@@
  # endif
  #elif !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__USLC__) && \
        !defined(_M_UNIX) && !defined(__sgi) && !defined(__DragonFly__) && \
 -      !defined(__TANDEM) && !defined(__QNX__) && !defined(__MirBSD__)
 +      !defined(__TANDEM) && !defined(__QNX__) && !defined(__MirBSD__) && \
 +      !defined(__CYGWIN__)
  #define _XOPEN_SOURCE 600 /* glibc2 and AIX 5.3L need 500, OpenBSD needs 600 for S_ISLNK() */
  #define _XOPEN_SOURCE_EXTENDED 1 /* AIX 5.3L needs this */
  #endif
@@@ -212,15 -211,8 +212,15 @@@ extern char *gitbasename(char *)
  #endif
  
  #ifndef NO_OPENSSL
 +#define __AVAILABILITY_MACROS_USES_AVAILABILITY 0
 +#define MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_10_6
  #include <openssl/ssl.h>
  #include <openssl/err.h>
 +#undef MAC_OS_X_VERSION_MIN_REQUIRED
 +#undef __AVAILABILITY_MACROS_USES_AVAILABILITY
 +#ifdef NO_HMAC_CTX_CLEANUP
 +#define HMAC_CTX_cleanup HMAC_cleanup
 +#endif
  #endif
  
  /* On most systems <netdb.h> would have given us this, but
@@@ -482,40 -474,6 +482,40 @@@ extern int git_munmap(void *start, size
  #define on_disk_bytes(st) ((st).st_blocks * 512)
  #endif
  
 +#ifdef NEEDS_MODE_TRANSLATION
 +#undef S_IFMT
 +#undef S_IFREG
 +#undef S_IFDIR
 +#undef S_IFLNK
 +#undef S_IFBLK
 +#undef S_IFCHR
 +#undef S_IFIFO
 +#undef S_IFSOCK
 +#define S_IFMT   0170000
 +#define S_IFREG  0100000
 +#define S_IFDIR  0040000
 +#define S_IFLNK  0120000
 +#define S_IFBLK  0060000
 +#define S_IFCHR  0020000
 +#define S_IFIFO  0010000
 +#define S_IFSOCK 0140000
 +#ifdef stat
 +#undef stat
 +#endif
 +#define stat(path, buf) git_stat(path, buf)
 +extern int git_stat(const char *, struct stat *);
 +#ifdef fstat
 +#undef fstat
 +#endif
 +#define fstat(fd, buf) git_fstat(fd, buf)
 +extern int git_fstat(int, struct stat *);
 +#ifdef lstat
 +#undef lstat
 +#endif
 +#define lstat(path, buf) git_lstat(path, buf)
 +extern int git_lstat(const char *, struct stat *);
 +#endif
 +
  #define DEFAULT_PACKED_GIT_LIMIT \
        ((1024L * 1024L) * (sizeof(void*) >= 8 ? 8192 : 256))
  
@@@ -678,11 -636,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)
@@@ -875,4 -828,8 +875,8 @@@ 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
  #endif