[PATCH] Fix compilation on OS X.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On OS X libc headers don't define `environ', and since ec535cc2 removed
the redundant declaration this code no longer builds on OS X.
---
 Makefile          | 5 +++++
 config.mak.uname  | 1 +
 git-compat-util.h | 4 ++++
 3 files changed, 10 insertions(+)

diff --git a/Makefile b/Makefile
index 0600eb4..774db18 100644
--- a/Makefile
+++ b/Makefile
@@ -98,6 +98,8 @@ all::
 #
 # Define NO_UNSETENV if you don't have unsetenv in the C library.
 #
+# Define NO_EXT_ENVIRON if your C library doesn't define `environ'.
+#
 # Define NO_MKDTEMP if you don't have mkdtemp in the C library.
 #
 # Define MKDIR_WO_TRAILING_SLASH if your mkdir() can't deal with trailing slash.
@@ -1307,6 +1309,9 @@ ifdef NO_UNSETENV
 	COMPAT_CFLAGS += -DNO_UNSETENV
 	COMPAT_OBJS += compat/unsetenv.o
 endif
+ifdef NO_EXT_ENVIRON
+	COMPAT_CFLAGS += -DNO_EXT_ENVIRON
+endif
 ifdef NO_SYS_SELECT_H
 	BASIC_CFLAGS += -DNO_SYS_SELECT_H
 endif
diff --git a/config.mak.uname b/config.mak.uname
index 7ac541e..ebcfbfd 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -93,6 +93,7 @@ ifeq ($(uname_S),Darwin)
 		NO_STRLCPY = YesPlease
 	endif
 	NO_MEMMEM = YesPlease
+        NO_EXT_ENVIRON = UnfortunatelyYes
 	USE_ST_TIMESPEC = YesPlease
 	HAVE_DEV_TTY = YesPlease
 	NEEDS_CLIPPED_WRITE = YesPlease
diff --git a/git-compat-util.h b/git-compat-util.h
index ff193f4..3bac4e9 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -408,6 +408,10 @@ extern ssize_t git_pread(int fd, void *buf, size_t count, off_t offset);
  */
 extern ssize_t read_in_full(int fd, void *buf, size_t count);
 
+#ifdef NO_EXT_ENVIRON
+extern char **environ;
+#endif
+
 #ifdef NO_SETENV
 #define setenv gitsetenv
 extern int gitsetenv(const char *, const char *, int);
-- 
1.8.2.1.539.g4196a96

--
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




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]