]> git.ipfire.org Git - thirdparty/git.git/blame - config.mak.uname
The sixth batch
[thirdparty/git.git] / config.mak.uname
CommitLineData
e1b6dbb5
JK
1# Platform specific Makefile tweaks based on uname detection
2
dce7d295
JH
3# Define NO_SAFESEH if you need MSVC/Visual Studio to ignore the lack of
4# Microsoft's Safe Exception Handling in libraries (such as zlib).
5# Typically required for VS2013+/32-bit compilation on Vista+ versions.
6
e1b6dbb5
JK
7uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
8uname_M := $(shell sh -c 'uname -m 2>/dev/null || echo not')
9uname_O := $(shell sh -c 'uname -o 2>/dev/null || echo not')
10uname_R := $(shell sh -c 'uname -r 2>/dev/null || echo not')
e1b6dbb5
JK
11uname_V := $(shell sh -c 'uname -v 2>/dev/null || echo not')
12
ebd2e4a1
CMAB
13ifneq ($(findstring MINGW,$(uname_S)),)
14 uname_S := MINGW
15endif
16
e1b6dbb5
JK
17ifdef MSVC
18 # avoid the MingW and Cygwin configuration sections
19 uname_S := Windows
20 uname_O := Windows
dce7d295
JH
21
22 # Generate and include makefile variables that point to the
23 # currently installed set of MSVC command line tools.
24compat/vcbuild/MSVC-DEFS-GEN: compat/vcbuild/find_vs_env.bat
25 @"$<" | tr '\\' / >"$@"
26include compat/vcbuild/MSVC-DEFS-GEN
27
28 # See if vcpkg and the vcpkg-build versions of the third-party
29 # libraries that we use are installed. We include the result
30 # to get $(vcpkg_*) variables defined for the Makefile.
976aaedc 31ifeq (,$(SKIP_VCPKG))
dce7d295
JH
32compat/vcbuild/VCPKG-DEFS: compat/vcbuild/vcpkg_install.bat
33 @"$<"
34include compat/vcbuild/VCPKG-DEFS
e1b6dbb5 35endif
976aaedc 36endif
e1b6dbb5
JK
37
38# We choose to avoid "if .. else if .. else .. endif endif"
39# because maintaining the nesting to match is a pain. If
40# we had "elif" things would have been much nicer...
41
e1b6dbb5
JK
42ifeq ($(uname_S),OSF1)
43 # Need this for u_short definitions et al
44 BASIC_CFLAGS += -D_OSF_SOURCE
45 SOCKLEN_T = int
46 NO_STRTOULL = YesPlease
47 NO_NSEC = YesPlease
48endif
49ifeq ($(uname_S),Linux)
61f76a36 50 HAVE_ALLOCA_H = YesPlease
26a8b236 51 # override in config.mak if you have glibc >= 2.38
e1b6dbb5 52 NO_STRLCPY = YesPlease
cdda67de 53 CSPRNG_METHOD = getrandom
e1b6dbb5
JK
54 HAVE_PATHS_H = YesPlease
55 LIBC_CONTAINS_LIBINTL = YesPlease
56 HAVE_DEV_TTY = YesPlease
148d6771 57 HAVE_CLOCK_GETTIME = YesPlease
a6c3c638 58 HAVE_CLOCK_MONOTONIC = YesPlease
abf38abe 59 HAVE_SYNC_FILE_RANGE = YesPlease
0cc30e0e 60 HAVE_GETDELIM = YesPlease
e2d90fd1 61 FREAD_READS_DIRECTORIES = UnfortunatelyYes
50dec7c5 62 HAVE_SYSINFO = YesPlease
226c0ddd 63 PROCFS_EXECUTABLE_PATH = /proc/self/exe
2f732bf1
ES
64 HAVE_PLATFORM_PROCINFO = YesPlease
65 COMPAT_OBJS += compat/linux/procinfo.o
ffb9f298 66 # centos7/rhel7 provides gcc 4.8.5 and zlib 1.2.7.
728b9ac0 67 ifneq ($(findstring .el7.,$(uname_R)),)
ffb9f298 68 BASIC_CFLAGS += -std=c99
728b9ac0 69 endif
8427b7e7 70 LINK_FUZZ_PROGRAMS = YesPlease
e1b6dbb5
JK
71endif
72ifeq ($(uname_S),GNU/kFreeBSD)
61f76a36 73 HAVE_ALLOCA_H = YesPlease
e1b6dbb5 74 NO_STRLCPY = YesPlease
e1b6dbb5
JK
75 HAVE_PATHS_H = YesPlease
76 DIR_HAS_BSD_GROUP_SEMANTICS = YesPlease
77 LIBC_CONTAINS_LIBINTL = YesPlease
e2d90fd1 78 FREAD_READS_DIRECTORIES = UnfortunatelyYes
e1b6dbb5
JK
79endif
80ifeq ($(uname_S),UnixWare)
81 CC = cc
82 NEEDS_SOCKET = YesPlease
83 NEEDS_NSL = YesPlease
84 NEEDS_SSL_WITH_CRYPTO = YesPlease
85 NEEDS_LIBICONV = YesPlease
86 SHELL_PATH = /usr/local/bin/bash
87 NO_IPV6 = YesPlease
88 NO_HSTRERROR = YesPlease
e1b6dbb5
JK
89 BASIC_CFLAGS += -Kthread
90 BASIC_CFLAGS += -I/usr/local/include
91 BASIC_LDFLAGS += -L/usr/local/lib
92 INSTALL = ginstall
93 TAR = gtar
94 NO_STRCASESTR = YesPlease
95 NO_MEMMEM = YesPlease
96endif
97ifeq ($(uname_S),SCO_SV)
728b9ac0 98 ifeq ($(uname_R),3.2)
e1b6dbb5 99 CFLAGS = -O2
728b9ac0
TB
100 endif
101 ifeq ($(uname_R),5)
e1b6dbb5
JK
102 CC = cc
103 BASIC_CFLAGS += -Kthread
728b9ac0 104 endif
e1b6dbb5
JK
105 NEEDS_SOCKET = YesPlease
106 NEEDS_NSL = YesPlease
107 NEEDS_SSL_WITH_CRYPTO = YesPlease
108 NEEDS_LIBICONV = YesPlease
109 SHELL_PATH = /usr/bin/bash
110 NO_IPV6 = YesPlease
111 NO_HSTRERROR = YesPlease
e1b6dbb5
JK
112 BASIC_CFLAGS += -I/usr/local/include
113 BASIC_LDFLAGS += -L/usr/local/lib
114 NO_STRCASESTR = YesPlease
115 NO_MEMMEM = YesPlease
116 INSTALL = ginstall
117 TAR = gtar
118endif
119ifeq ($(uname_S),Darwin)
120 NEEDS_CRYPTO_WITH_SSL = YesPlease
121 NEEDS_SSL_WITH_CRYPTO = YesPlease
122 NEEDS_LIBICONV = YesPlease
9eeff2f6
JH
123 # Note: $(uname_R) gives us the underlying Darwin version.
124 # - MacOS 10.0.* and MacOS 10.1.0 = Darwin 1.*
125 # - MacOS 10.x.* = Darwin (x+4).* for (1 <= x)
126 # i.e. "begins with [15678] and a dot" means "10.4.* or older".
728b9ac0 127 ifeq ($(shell expr "$(uname_R)" : '[15678]\.'),2)
e1b6dbb5 128 OLD_ICONV = UnfortunatelyYes
9c7a0bee 129 NO_APPLE_COMMON_CRYPTO = YesPlease
728b9ac0
TB
130 endif
131 ifeq ($(shell expr "$(uname_R)" : '[15]\.'),2)
e1b6dbb5 132 NO_STRLCPY = YesPlease
728b9ac0
TB
133 endif
134 ifeq ($(shell test "`expr "$(uname_R)" : '\([0-9][0-9]*\)\.'`" -ge 11 && echo 1),1)
4e368785 135 HAVE_GETDELIM = YesPlease
728b9ac0
TB
136 endif
137 ifeq ($(shell test "`expr "$(uname_R)" : '\([0-9][0-9]*\)\.'`" -ge 20 && echo 1),1)
bbabaad2 138 OPEN_RETURNS_EINTR = UnfortunatelyYes
728b9ac0 139 endif
e1b6dbb5
JK
140 NO_MEMMEM = YesPlease
141 USE_ST_TIMESPEC = YesPlease
142 HAVE_DEV_TTY = YesPlease
143 COMPAT_OBJS += compat/precompose_utf8.o
144 BASIC_CFLAGS += -DPRECOMPOSE_UNICODE
a42643aa 145 BASIC_CFLAGS += -DPROTECT_HFS_DEFAULT=1
9529080d 146 HAVE_BSD_SYSCTL = YesPlease
8e178ec4 147 FREAD_READS_DIRECTORIES = UnfortunatelyYes
226c0ddd 148 HAVE_NS_GET_EXECUTABLE_PATH = YesPlease
05cd988d 149 CSPRNG_METHOD = arc4random
54463d32 150 USE_ENHANCED_BASIC_REGULAR_EXPRESSIONS = YesPlease
a0b31086
JS
151
152 # Workaround for `gettext` being keg-only and not even being linked via
153 # `brew link --force gettext`, should be obsolete as of
154 # https://github.com/Homebrew/homebrew-core/pull/53489
728b9ac0 155 ifeq ($(shell test -d /usr/local/opt/gettext/ && echo y),y)
a0b31086
JS
156 BASIC_CFLAGS += -I/usr/local/include -I/usr/local/opt/gettext/include
157 BASIC_LDFLAGS += -L/usr/local/lib -L/usr/local/opt/gettext/lib
728b9ac0 158 ifeq ($(shell test -x /usr/local/opt/gettext/bin/msgfmt && echo y),y)
a0b31086 159 MSGFMT = /usr/local/opt/gettext/bin/msgfmt
728b9ac0 160 endif
d52b426a
PS
161 # On newer ARM-based machines the default installation path has changed to
162 # /opt/homebrew. Include it in our search paths so that the user does not
163 # have to configure this manually.
164 #
165 # Note that we do not employ the same workaround as above where we manually
166 # add gettext. The issue was fixed more than three years ago by now, and at
167 # that point there haven't been any ARM-based Macs yet.
728b9ac0 168 else ifeq ($(shell test -d /opt/homebrew/ && echo y),y)
d52b426a
PS
169 BASIC_CFLAGS += -I/opt/homebrew/include
170 BASIC_LDFLAGS += -L/opt/homebrew/lib
728b9ac0 171 ifeq ($(shell test -x /opt/homebrew/bin/msgfmt && echo y),y)
d52b426a 172 MSGFMT = /opt/homebrew/bin/msgfmt
728b9ac0
TB
173 endif
174 endif
f67df255
JH
175
176 # The builtin FSMonitor on MacOS builds upon Simple-IPC. Both require
177 # Unix domain sockets and PThreads.
728b9ac0
TB
178 ifndef NO_PTHREADS
179 ifndef NO_UNIX_SOCKETS
f67df255 180 FSMONITOR_DAEMON_BACKEND = darwin
a85ad67b 181 FSMONITOR_OS_SETTINGS = darwin
728b9ac0
TB
182 endif
183 endif
f67df255
JH
184
185 BASIC_LDFLAGS += -framework CoreServices
e1b6dbb5
JK
186endif
187ifeq ($(uname_S),SunOS)
188 NEEDS_SOCKET = YesPlease
189 NEEDS_NSL = YesPlease
190 SHELL_PATH = /bin/bash
191 SANE_TOOL_PATH = /usr/xpg6/bin:/usr/xpg4/bin
61f76a36 192 HAVE_ALLOCA_H = YesPlease
e1b6dbb5 193 NO_REGEX = YesPlease
e1b6dbb5
JK
194 NO_MSGFMT_EXTENDED_OPTIONS = YesPlease
195 HAVE_DEV_TTY = YesPlease
728b9ac0 196 ifeq ($(uname_R),5.6)
e1b6dbb5
JK
197 SOCKLEN_T = int
198 NO_HSTRERROR = YesPlease
199 NO_IPV6 = YesPlease
200 NO_SOCKADDR_STORAGE = YesPlease
201 NO_UNSETENV = YesPlease
47e7dee0
BS
202 NO_MKDTEMP = YesPlease
203 NO_MEMMEM = YesPlease
e1b6dbb5 204 NO_SETENV = YesPlease
47e7dee0 205 NO_STRCASESTR = YesPlease
e1b6dbb5
JK
206 NO_STRLCPY = YesPlease
207 NO_STRTOUMAX = YesPlease
208 GIT_TEST_CMP = cmp
728b9ac0
TB
209 endif
210 ifeq ($(uname_R),5.7)
e1b6dbb5
JK
211 NEEDS_RESOLV = YesPlease
212 NO_IPV6 = YesPlease
213 NO_SOCKADDR_STORAGE = YesPlease
214 NO_UNSETENV = YesPlease
47e7dee0
BS
215 NO_MKDTEMP = YesPlease
216 NO_MEMMEM = YesPlease
e1b6dbb5 217 NO_SETENV = YesPlease
47e7dee0 218 NO_STRCASESTR = YesPlease
e1b6dbb5
JK
219 NO_STRLCPY = YesPlease
220 NO_STRTOUMAX = YesPlease
221 GIT_TEST_CMP = cmp
728b9ac0
TB
222 endif
223 ifeq ($(uname_R),5.8)
e1b6dbb5 224 NO_UNSETENV = YesPlease
47e7dee0
BS
225 NO_MKDTEMP = YesPlease
226 NO_MEMMEM = YesPlease
e1b6dbb5 227 NO_SETENV = YesPlease
47e7dee0 228 NO_STRCASESTR = YesPlease
e1b6dbb5
JK
229 NO_STRTOUMAX = YesPlease
230 GIT_TEST_CMP = cmp
728b9ac0
TB
231 endif
232 ifeq ($(uname_R),5.9)
e1b6dbb5 233 NO_UNSETENV = YesPlease
47e7dee0
BS
234 NO_MKDTEMP = YesPlease
235 NO_MEMMEM = YesPlease
e1b6dbb5 236 NO_SETENV = YesPlease
47e7dee0 237 NO_STRCASESTR = YesPlease
e1b6dbb5
JK
238 NO_STRTOUMAX = YesPlease
239 GIT_TEST_CMP = cmp
728b9ac0 240 endif
47e7dee0
BS
241 ifeq ($(uname_R),5.10)
242 NO_UNSETENV = YesPlease
243 NO_MKDTEMP = YesPlease
244 NO_MEMMEM = YesPlease
245 NO_SETENV = YesPlease
246 NO_STRCASESTR = YesPlease
247 GIT_TEST_CMP = cmp
248 endif
249 ifeq ($(uname_R),5.11)
250 NO_UNSETENV = YesPlease
251 NO_SETENV = YesPlease
252 GIT_TEST_CMP = cmp
253 endif
e1b6dbb5
JK
254 INSTALL = /usr/ucb/install
255 TAR = gtar
61f76a36 256 BASIC_CFLAGS += -D__EXTENSIONS__ -D__sun__
e1b6dbb5
JK
257endif
258ifeq ($(uname_O),Cygwin)
728b9ac0 259 ifeq ($(shell expr "$(uname_R)" : '1\.[1-6]\.'),4)
e1b6dbb5 260 NO_D_TYPE_IN_DIRENT = YesPlease
e1b6dbb5
JK
261 NO_STRCASESTR = YesPlease
262 NO_MEMMEM = YesPlease
e1b6dbb5
JK
263 NO_SYMLINK_HEAD = YesPlease
264 NO_IPV6 = YesPlease
265 OLD_ICONV = UnfortunatelyYes
f593ef77
ML
266 # There are conflicting reports about this.
267 # On some boxes NO_MMAP is needed, and not so elsewhere.
268 # Try commenting this out if you suspect MMAP is more efficient
269 NO_MMAP = YesPlease
728b9ac0 270 else
064eed36
RJ
271 ifeq ($(shell expr "$(uname_R)" : '1\.7\.'),4)
272 NO_REGEX = UnfortunatelyYes
273 endif
728b9ac0 274 endif
39ba986b 275 HAVE_DEV_TTY = YesPlease
394c4dfd 276 HAVE_GETDELIM = YesPlease
a45ca6fc
RJ
277 HAVE_CLOCK_GETTIME = YesPlease
278 HAVE_CLOCK_MONOTONIC = YesPlease
50dec7c5 279 HAVE_SYSINFO = YesPlease
70ef34c8 280 CSPRNG_METHOD = arc4random
61f76a36 281 HAVE_ALLOCA_H = YesPlease
e1b6dbb5
JK
282 NEEDS_LIBICONV = YesPlease
283 NO_FAST_WORKING_DIRECTORY = UnfortunatelyYes
e1b6dbb5 284 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
e1b6dbb5 285 X = .exe
e1b6dbb5 286 UNRELIABLE_FSTAT = UnfortunatelyYes
e53a64b9 287 OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo
5b633610 288 MMAP_PREVENTS_DELETE = UnfortunatelyYes
1cadad6f 289 COMPAT_OBJS += compat/win32/path-utils.o
a5956d6a 290 FREAD_READS_DIRECTORIES = UnfortunatelyYes
e1b6dbb5
JK
291endif
292ifeq ($(uname_S),FreeBSD)
293 NEEDS_LIBICONV = YesPlease
6c6ce21b
ES
294 # Versions up to 10.1 require OLD_ICONV; 10.2 and beyond don't.
295 # A typical version string looks like "10.2-RELEASE".
728b9ac0 296 ifeq ($(shell expr "$(uname_R)" : '[1-9]\.'),2)
6c6ce21b 297 OLD_ICONV = YesPlease
728b9ac0
TB
298 endif
299 ifeq ($(firstword $(subst -, ,$(uname_R))),10.0)
6c6ce21b 300 OLD_ICONV = YesPlease
728b9ac0
TB
301 endif
302 ifeq ($(firstword $(subst -, ,$(uname_R))),10.1)
6c6ce21b 303 OLD_ICONV = YesPlease
728b9ac0 304 endif
e1b6dbb5
JK
305 NO_MEMMEM = YesPlease
306 BASIC_CFLAGS += -I/usr/local/include
307 BASIC_LDFLAGS += -L/usr/local/lib
308 DIR_HAS_BSD_GROUP_SEMANTICS = YesPlease
309 USE_ST_TIMESPEC = YesPlease
728b9ac0 310 ifeq ($(shell expr "$(uname_R)" : '4\.'),2)
e1b6dbb5
JK
311 PTHREAD_LIBS = -pthread
312 NO_UINTMAX_T = YesPlease
313 NO_STRTOUMAX = YesPlease
728b9ac0 314 endif
e1b6dbb5 315 PYTHON_PATH = /usr/local/bin/python
259f22af 316 PERL_PATH = /usr/local/bin/perl
e1b6dbb5 317 HAVE_PATHS_H = YesPlease
9529080d 318 HAVE_BSD_SYSCTL = YesPlease
226c0ddd 319 HAVE_BSD_KERN_PROC_SYSCTL = YesPlease
05cd988d 320 CSPRNG_METHOD = arc4random
995bc22d 321 PAGER_ENV = LESS=FRX LV=-c MORE=FRX
e2d90fd1 322 FREAD_READS_DIRECTORIES = UnfortunatelyYes
18a4f6be 323 FILENO_IS_A_MACRO = UnfortunatelyYes
e1b6dbb5
JK
324endif
325ifeq ($(uname_S),OpenBSD)
d5842191 326 DIR_HAS_BSD_GROUP_SEMANTICS = YesPlease
e1b6dbb5
JK
327 USE_ST_TIMESPEC = YesPlease
328 NEEDS_LIBICONV = YesPlease
329 BASIC_CFLAGS += -I/usr/local/include
330 BASIC_LDFLAGS += -L/usr/local/lib
331 HAVE_PATHS_H = YesPlease
9529080d 332 HAVE_BSD_SYSCTL = YesPlease
05cd988d 333 CSPRNG_METHOD = arc4random
4e3ecbd4 334 FREAD_READS_DIRECTORIES = UnfortunatelyYes
18a4f6be 335 FILENO_IS_A_MACRO = UnfortunatelyYes
92164af9
BS
336endif
337ifeq ($(uname_S),MirBSD)
338 NO_STRCASESTR = YesPlease
339 NO_MEMMEM = YesPlease
340 USE_ST_TIMESPEC = YesPlease
341 NEEDS_LIBICONV = YesPlease
342 HAVE_PATHS_H = YesPlease
9529080d 343 HAVE_BSD_SYSCTL = YesPlease
05cd988d 344 CSPRNG_METHOD = arc4random
e1b6dbb5
JK
345endif
346ifeq ($(uname_S),NetBSD)
728b9ac0 347 ifeq ($(shell expr "$(uname_R)" : '[01]\.'),2)
e1b6dbb5 348 NEEDS_LIBICONV = YesPlease
728b9ac0 349 endif
e1b6dbb5
JK
350 BASIC_CFLAGS += -I/usr/pkg/include
351 BASIC_LDFLAGS += -L/usr/pkg/lib $(CC_LD_DYNPATH)/usr/pkg/lib
352 USE_ST_TIMESPEC = YesPlease
e1b6dbb5 353 HAVE_PATHS_H = YesPlease
9529080d 354 HAVE_BSD_SYSCTL = YesPlease
226c0ddd 355 HAVE_BSD_KERN_PROC_SYSCTL = YesPlease
05cd988d 356 CSPRNG_METHOD = arc4random
226c0ddd 357 PROCFS_EXECUTABLE_PATH = /proc/curproc/exe
e1b6dbb5
JK
358endif
359ifeq ($(uname_S),AIX)
360 DEFAULT_PAGER = more
361 NO_STRCASESTR = YesPlease
362 NO_MEMMEM = YesPlease
363 NO_MKDTEMP = YesPlease
e1b6dbb5
JK
364 NO_STRLCPY = YesPlease
365 NO_NSEC = YesPlease
0e6d899f 366 NO_REGEX = NeedsStartEnd
e1b6dbb5
JK
367 FREAD_READS_DIRECTORIES = UnfortunatelyYes
368 INTERNAL_QSORT = UnfortunatelyYes
369 NEEDS_LIBICONV = YesPlease
370 BASIC_CFLAGS += -D_LARGE_FILES
ee662bf5 371 FILENO_IS_A_MACRO = UnfortunatelyYes
400caafb 372 NEED_ACCESS_ROOT_HANDLER = UnfortunatelyYes
728b9ac0 373 ifeq ($(shell expr "$(uname_V)" : '[1234]'),1)
e1b6dbb5 374 NO_PTHREADS = YesPlease
728b9ac0 375 else
e1b6dbb5 376 PTHREAD_LIBS = -lpthread
728b9ac0
TB
377 endif
378 ifeq ($(shell expr "$(uname_V).$(uname_R)" : '5\.1'),3)
e1b6dbb5 379 INLINE = ''
728b9ac0 380 endif
e1b6dbb5
JK
381 GIT_TEST_CMP = cmp
382endif
383ifeq ($(uname_S),GNU)
384 # GNU/Hurd
61f76a36 385 HAVE_ALLOCA_H = YesPlease
e1b6dbb5 386 NO_STRLCPY = YesPlease
e1b6dbb5
JK
387 HAVE_PATHS_H = YesPlease
388 LIBC_CONTAINS_LIBINTL = YesPlease
274a1328 389 FREAD_READS_DIRECTORIES = UnfortunatelyYes
e1b6dbb5
JK
390endif
391ifeq ($(uname_S),IRIX)
392 NO_SETENV = YesPlease
393 NO_UNSETENV = YesPlease
394 NO_STRCASESTR = YesPlease
395 NO_MEMMEM = YesPlease
e1b6dbb5
JK
396 NO_MKDTEMP = YesPlease
397 # When compiled with the MIPSpro 7.4.4m compiler, and without pthreads
398 # (i.e. NO_PTHREADS is set), and _with_ MMAP (i.e. NO_MMAP is not set),
399 # git dies with a segmentation fault when trying to access the first
400 # entry of a reflog. The conservative choice is made to always set
401 # NO_MMAP. If you suspect that your compiler is not affected by this
402 # issue, comment out the NO_MMAP statement.
403 NO_MMAP = YesPlease
404 NO_REGEX = YesPlease
e1b6dbb5
JK
405 SNPRINTF_RETURNS_BOGUS = YesPlease
406 SHELL_PATH = /usr/gnu/bin/bash
407 NEEDS_LIBGEN = YesPlease
408endif
409ifeq ($(uname_S),IRIX64)
410 NO_SETENV = YesPlease
411 NO_UNSETENV = YesPlease
412 NO_STRCASESTR = YesPlease
413 NO_MEMMEM = YesPlease
e1b6dbb5
JK
414 NO_MKDTEMP = YesPlease
415 # When compiled with the MIPSpro 7.4.4m compiler, and without pthreads
416 # (i.e. NO_PTHREADS is set), and _with_ MMAP (i.e. NO_MMAP is not set),
417 # git dies with a segmentation fault when trying to access the first
418 # entry of a reflog. The conservative choice is made to always set
419 # NO_MMAP. If you suspect that your compiler is not affected by this
420 # issue, comment out the NO_MMAP statement.
421 NO_MMAP = YesPlease
422 NO_REGEX = YesPlease
e1b6dbb5
JK
423 SNPRINTF_RETURNS_BOGUS = YesPlease
424 SHELL_PATH = /usr/gnu/bin/bash
425 NEEDS_LIBGEN = YesPlease
426endif
427ifeq ($(uname_S),HP-UX)
428 INLINE = __inline
429 NO_IPV6 = YesPlease
430 NO_SETENV = YesPlease
431 NO_STRCASESTR = YesPlease
432 NO_MEMMEM = YesPlease
e1b6dbb5
JK
433 NO_STRLCPY = YesPlease
434 NO_MKDTEMP = YesPlease
435 NO_UNSETENV = YesPlease
436 NO_HSTRERROR = YesPlease
437 NO_SYS_SELECT_H = YesPlease
e1b6dbb5
JK
438 SNPRINTF_RETURNS_BOGUS = YesPlease
439 NO_NSEC = YesPlease
728b9ac0 440 ifeq ($(uname_R),B.11.00)
e1b6dbb5
JK
441 NO_INET_NTOP = YesPlease
442 NO_INET_PTON = YesPlease
728b9ac0
TB
443 endif
444 ifeq ($(uname_R),B.10.20)
e1b6dbb5
JK
445 # Override HP-UX 11.x setting:
446 INLINE =
447 SOCKLEN_T = size_t
448 NO_PREAD = YesPlease
449 NO_INET_NTOP = YesPlease
450 NO_INET_PTON = YesPlease
728b9ac0 451 endif
e1b6dbb5
JK
452 GIT_TEST_CMP = cmp
453endif
454ifeq ($(uname_S),Windows)
455 GIT_VERSION := $(GIT_VERSION).MSVC
456 pathsep = ;
dce7d295 457 # Assume that this is built in Git for Windows' SDK
728b9ac0 458 ifeq (MINGW32,$(MSYSTEM))
dce7d295 459 prefix = /mingw32
728b9ac0 460 else
8945fba5
JS
461 ifeq (CLANGARM64,$(MSYSTEM))
462 prefix = /clangarm64
463 else
464 prefix = /mingw64
465 endif
728b9ac0 466 endif
dce7d295
JH
467 # Prepend MSVC 64-bit tool-chain to PATH.
468 #
469 # A regular Git Bash *does not* have cl.exe in its $PATH. As there is a
470 # link.exe next to, and required by, cl.exe, we have to prepend this
471 # onto the existing $PATH.
472 #
473 SANE_TOOL_PATH ?= $(msvc_bin_dir_msys)
61f76a36 474 HAVE_ALLOCA_H = YesPlease
e1b6dbb5
JK
475 NO_PREAD = YesPlease
476 NEEDS_CRYPTO_WITH_SSL = YesPlease
477 NO_LIBGEN_H = YesPlease
478 NO_POLL = YesPlease
479 NO_SYMLINK_HEAD = YesPlease
480 NO_IPV6 = YesPlease
e1b6dbb5 481 NO_SETENV = YesPlease
e1b6dbb5
JK
482 NO_STRCASESTR = YesPlease
483 NO_STRLCPY = YesPlease
e1b6dbb5 484 NO_MEMMEM = YesPlease
dce7d295 485 NEEDS_LIBICONV = YesPlease
e1b6dbb5 486 NO_STRTOUMAX = YesPlease
e1b6dbb5 487 NO_MKDTEMP = YesPlease
dce7d295 488 NO_INTTYPES_H = YesPlease
05cd988d 489 CSPRNG_METHOD = rtlgenrandom
dce7d295
JH
490 # VS2015 with UCRT claims that snprintf and friends are C99 compliant,
491 # so we don't need this:
492 #
493 # SNPRINTF_RETURNS_BOGUS = YesPlease
62c73671
JH
494
495 # The builtin FSMonitor requires Named Pipes and Threads on Windows.
496 # These are always available, so we do not have to conditionally
497 # support it.
498 FSMONITOR_DAEMON_BACKEND = win32
d33c804d
JH
499 FSMONITOR_OS_SETTINGS = win32
500
e1b6dbb5 501 NO_SVN_TESTS = YesPlease
e1b6dbb5 502 RUNTIME_PREFIX = YesPlease
86e25458 503 HAVE_WPGMPTR = YesWeDo
e1b6dbb5 504 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
59c7b881 505 USE_WIN32_IPC = YesPlease
e1b6dbb5 506 USE_WIN32_MMAP = YesPlease
5b633610 507 MMAP_PREVENTS_DELETE = UnfortunatelyYes
e1b6dbb5
JK
508 # USE_NED_ALLOCATOR = YesPlease
509 UNRELIABLE_FSTAT = UnfortunatelyYes
510 OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo
511 NO_REGEX = YesPlease
bad866a2 512 NO_GETTEXT = YesPlease
e1b6dbb5 513 NO_PYTHON = YesPlease
e0492c5b 514 ETAGS_TARGET = ETAGS
e1b6dbb5
JK
515 NO_POSIX_GOODIES = UnfortunatelyYes
516 NATIVE_CRLF = YesPlease
517 DEFAULT_HELP_FORMAT = html
619950d4 518ifeq (/mingw64,$(subst 32,64,$(subst clangarm,mingw,$(prefix))))
fb5e3378
JS
519 # Move system config into top-level /etc/
520 ETC_GITCONFIG = ../etc/gitconfig
521 ETC_GITATTRIBUTES = ../etc/gitattributes
522endif
e1b6dbb5
JK
523
524 CC = compat/vcbuild/scripts/clink.pl
525 AR = compat/vcbuild/scripts/lib.pl
526 CFLAGS =
dce7d295 527 BASIC_CFLAGS = -nologo -I. -Icompat/vcbuild/include -DWIN32 -D_CONSOLE -DHAVE_STRING_H -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE
e1b6dbb5 528 COMPAT_OBJS = compat/msvc.o compat/winansi.o \
abf38abe 529 compat/win32/flush.o \
22c3634c 530 compat/win32/path-utils.o \
e1b6dbb5 531 compat/win32/pthread.o compat/win32/syslog.o \
353d3d77 532 compat/win32/trace2_win32_process_info.o \
e1b6dbb5 533 compat/win32/dirent.o
dce7d295 534 COMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DDETECT_MSYS_TTY -DNOGDI -DHAVE_STRING_H -Icompat -Icompat/regex -Icompat/win32 -DSTRIP_EXTENSION=\".exe\"
396ff754 535 BASIC_LDFLAGS = -IGNORE:4217 -IGNORE:4049 -NOLOGO -ENTRY:wmainCRTStartup -SUBSYSTEM:CONSOLE
dce7d295
JH
536 # invalidcontinue.obj allows Git's source code to close the same file
537 # handle twice, or to access the osfhandle of an already-closed stdout
538 # See https://msdn.microsoft.com/en-us/library/ms235330.aspx
539 EXTLIBS = user32.lib advapi32.lib shell32.lib wininet.lib ws2_32.lib invalidcontinue.obj kernel32.lib ntdll.lib
e1b6dbb5
JK
540 PTHREAD_LIBS =
541 lib =
dce7d295
JH
542 BASIC_CFLAGS += $(vcpkg_inc) $(sdk_includes) $(msvc_includes)
543ifndef DEBUG
544 BASIC_CFLAGS += $(vcpkg_rel_lib)
545else
546 BASIC_CFLAGS += $(vcpkg_dbg_lib)
547endif
548 BASIC_CFLAGS += $(sdk_libs) $(msvc_libs)
549
556702f8
JH
550ifneq ($(USE_MSVC_CRTDBG),)
551 # Optionally enable memory leak reporting.
552 BASIC_CFLAGS += -DUSE_MSVC_CRTDBG
553endif
dce7d295
JH
554 # Always give "-Zi" to the compiler and "-debug" to linker (even in
555 # release mode) to force a PDB to be generated (like RelWithDebInfo).
556 BASIC_CFLAGS += -Zi
557 BASIC_LDFLAGS += -debug -Zf
558
559ifdef NO_SAFESEH
560 LDFLAGS += -SAFESEH:NO
561endif
562
e1b6dbb5 563ifndef DEBUG
dce7d295
JH
564 BASIC_CFLAGS += -GL -Gy -O2 -Oy- -MD -DNDEBUG
565 BASIC_LDFLAGS += -release -LTCG /OPT:REF /OPT:ICF /INCREMENTAL:NO /DEBUGTYPE:CV,FIXUP
e1b6dbb5
JK
566 AR += -LTCG
567else
dce7d295 568 BASIC_CFLAGS += -MDd -DDEBUG -D_DEBUG
e1b6dbb5
JK
569endif
570 X = .exe
963e1543 571
4b8a2717
JS
572 EXTRA_PROGRAMS += headless-git$X
573
963e1543 574compat/msvc.o: compat/msvc.c compat/mingw.c GIT-CFLAGS
e1b6dbb5
JK
575endif
576ifeq ($(uname_S),Interix)
577 NO_INITGROUPS = YesPlease
578 NO_IPV6 = YesPlease
579 NO_MEMMEM = YesPlease
580 NO_MKDTEMP = YesPlease
581 NO_STRTOUMAX = YesPlease
582 NO_NSEC = YesPlease
728b9ac0 583 ifeq ($(uname_R),3.5)
e1b6dbb5
JK
584 NO_INET_NTOP = YesPlease
585 NO_INET_PTON = YesPlease
586 NO_SOCKADDR_STORAGE = YesPlease
728b9ac0
TB
587 endif
588 ifeq ($(uname_R),5.2)
e1b6dbb5
JK
589 NO_INET_NTOP = YesPlease
590 NO_INET_PTON = YesPlease
591 NO_SOCKADDR_STORAGE = YesPlease
728b9ac0 592 endif
e1b6dbb5
JK
593endif
594ifeq ($(uname_S),Minix)
595 NO_IPV6 = YesPlease
596 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
597 NO_NSEC = YesPlease
598 NEEDS_LIBGEN =
599 NEEDS_CRYPTO_WITH_SSL = YesPlease
e1b6dbb5
JK
600 NEEDS_RESOLV =
601 NO_HSTRERROR = YesPlease
602 NO_MMAP = YesPlease
603 NO_CURL =
604 NO_EXPAT =
605endif
606ifeq ($(uname_S),NONSTOP_KERNEL)
607 # Needs some C99 features, "inline" is just one of them.
608 # INLINE='' would just replace one set of warnings with another and
609 # still not compile in c89 mode, due to non-const array initializations.
610 CC = cc -c99
71fb089c 611 # Build down-rev compatible objects that don't use our new getopt_long.
728b9ac0 612 ifeq ($(uname_R).$(uname_V),J06.21)
71fb089c 613 CC += -WRVU=J06.20
728b9ac0
TB
614 endif
615 ifeq ($(uname_R).$(uname_V),L17.02)
71fb089c 616 CC += -WRVU=L16.05
728b9ac0 617 endif
e1b6dbb5
JK
618 # Disable all optimization, seems to result in bad code, with -O or -O2
619 # or even -O1 (default), /usr/local/libexec/git-core/git-pack-objects
620 # abends on "git push". Needs more investigation.
71fb089c 621 CFLAGS = -g -O0 -Winline
e1b6dbb5
JK
622 # We'd want it to be here.
623 prefix = /usr/local
71fb089c
RB
624 # perl and python must be in /usr/bin on NonStop - supplied by HPE
625 # with operating system in that managed directory.
626 PERL_PATH = /usr/bin/perl
627 PYTHON_PATH = /usr/bin/python
628 # The current /usr/coreutils/rm at lowest support level does not work
629 # with the git test structure. Long paths as in
630 # 'trash directory...' cause rm to terminate prematurely without fully
631 # removing the directory at OS releases J06.21 and L17.02.
632 # Default to the older rm until those two releases are deprecated.
633 RM = /bin/rm -f
71fb089c
RB
634 NEEDS_CRYPTO_WITH_SSL = YesPlease
635 HAVE_DEV_TTY = YesPlease
e1b6dbb5
JK
636 HAVE_LIBCHARSET_H = YesPlease
637 HAVE_STRINGS_H = YesPlease
638 NEEDS_LIBICONV = YesPlease
639 NEEDS_LIBINTL_BEFORE_LIBICONV = YesPlease
640 NO_SYS_SELECT_H = UnfortunatelyYes
641 NO_D_TYPE_IN_DIRENT = YesPlease
71fb089c 642 NO_GETTEXT = YesPlease
e1b6dbb5
JK
643 NO_HSTRERROR = YesPlease
644 NO_STRCASESTR = YesPlease
e1b6dbb5
JK
645 NO_MEMMEM = YesPlease
646 NO_STRLCPY = YesPlease
647 NO_SETENV = YesPlease
648 NO_UNSETENV = YesPlease
649 NO_MKDTEMP = YesPlease
e1b6dbb5
JK
650 # Currently libiconv-1.9.1.
651 OLD_ICONV = UnfortunatelyYes
71fb089c 652 NO_REGEX = NeedsStartEnd
e1b6dbb5 653 NO_PTHREADS = UnfortunatelyYes
243a4c7e 654 FREAD_READS_DIRECTORIES = UnfortunatelyYes
e1b6dbb5
JK
655
656 # Not detected (nor checked for) by './configure'.
657 # We don't have SA_RESTART on NonStop, unfortunalety.
658 COMPAT_CFLAGS += -DSA_RESTART=0
659 # Apparently needed in compat/fnmatch/fnmatch.c.
660 COMPAT_CFLAGS += -DHAVE_STRING_H=1
661 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
662 NO_NSEC = YesPlease
663 NO_PREAD = YesPlease
664 NO_MMAP = YesPlease
665 NO_POLL = YesPlease
666 NO_INTPTR_T = UnfortunatelyYes
05cd988d 667 CSPRNG_METHOD = openssl
e1b6dbb5 668 SANE_TOOL_PATH = /usr/coreutils/bin:/usr/local/bin
f0ec22bb 669 SHELL_PATH = /usr/coreutils/bin/bash
e1b6dbb5 670endif
d254e650
H
671ifeq ($(uname_S),OS/390)
672 NO_SYS_POLL_H = YesPlease
673 NO_STRCASESTR = YesPlease
674 NO_REGEX = YesPlease
675 NO_MMAP = YesPlease
676 NO_NSEC = YesPlease
677 NO_STRLCPY = YesPlease
678 NO_MEMMEM = YesPlease
679 NO_GECOS_IN_PWENT = YesPlease
680 HAVE_STRINGS_H = YesPlease
681 NEEDS_MODE_TRANSLATION = YesPlease
987bbcd0 682 HAVE_ZOS_GET_EXECUTABLE_PATH = YesPlease
d254e650 683endif
ebd2e4a1 684ifeq ($(uname_S),MINGW)
728b9ac0 685 ifeq ($(shell expr "$(uname_R)" : '1\.'),2)
2987407f 686 $(error "Building with MSys is no longer supported")
728b9ac0 687 endif
e1b6dbb5 688 pathsep = ;
22f4c27e 689 HAVE_ALLOCA_H = YesPlease
e1b6dbb5
JK
690 NO_PREAD = YesPlease
691 NEEDS_CRYPTO_WITH_SSL = YesPlease
692 NO_LIBGEN_H = YesPlease
693 NO_POLL = YesPlease
694 NO_SYMLINK_HEAD = YesPlease
e1b6dbb5 695 NO_SETENV = YesPlease
e1b6dbb5
JK
696 NO_STRCASESTR = YesPlease
697 NO_STRLCPY = YesPlease
e1b6dbb5
JK
698 NO_MEMMEM = YesPlease
699 NEEDS_LIBICONV = YesPlease
e1b6dbb5
JK
700 NO_STRTOUMAX = YesPlease
701 NO_MKDTEMP = YesPlease
e1b6dbb5 702 NO_SVN_TESTS = YesPlease
62c73671
JH
703
704 # The builtin FSMonitor requires Named Pipes and Threads on Windows.
705 # These are always available, so we do not have to conditionally
706 # support it.
707 FSMONITOR_DAEMON_BACKEND = win32
d33c804d
JH
708 FSMONITOR_OS_SETTINGS = win32
709
e1b6dbb5 710 RUNTIME_PREFIX = YesPlease
86e25458 711 HAVE_WPGMPTR = YesWeDo
e1b6dbb5 712 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
59c7b881 713 USE_WIN32_IPC = YesPlease
e1b6dbb5 714 USE_WIN32_MMAP = YesPlease
5b633610 715 MMAP_PREVENTS_DELETE = UnfortunatelyYes
e1b6dbb5
JK
716 UNRELIABLE_FSTAT = UnfortunatelyYes
717 OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo
718 NO_REGEX = YesPlease
e1b6dbb5 719 ETAGS_TARGET = ETAGS
e1b6dbb5 720 NO_POSIX_GOODIES = UnfortunatelyYes
65db0443 721 DEFAULT_HELP_FORMAT = html
b7e6a416 722 HAVE_PLATFORM_PROCINFO = YesPlease
05cd988d 723 CSPRNG_METHOD = rtlgenrandom
396ff754 724 BASIC_LDFLAGS += -municode
7b40ae86 725 COMPAT_CFLAGS += -DNOGDI -Icompat -Icompat/win32
e1b6dbb5
JK
726 COMPAT_CFLAGS += -DSTRIP_EXTENSION=\".exe\"
727 COMPAT_OBJS += compat/mingw.o compat/winansi.o \
353d3d77 728 compat/win32/trace2_win32_process_info.o \
abf38abe 729 compat/win32/flush.o \
1cadad6f 730 compat/win32/path-utils.o \
e1b6dbb5
JK
731 compat/win32/pthread.o compat/win32/syslog.o \
732 compat/win32/dirent.o
7c9fbda6 733 BASIC_CFLAGS += -DWIN32
e1b6dbb5 734 EXTLIBS += -lws2_32
ce39c2e0 735 GITLIBS += git.res
e1b6dbb5 736 PTHREAD_LIBS =
ce39c2e0 737 RC = windres -O coff
95f31e9a 738 NATIVE_CRLF = YesPlease
e1b6dbb5 739 X = .exe
2987407f
HJ
740 # MSys2
741 prefix = /usr/
742 # Enable DEP
743 BASIC_LDFLAGS += -Wl,--nxcompat
744 # Enable ASLR (unless debugging)
728b9ac0 745 ifneq (,$(findstring -O,$(filter-out -O0 -Og,$(CFLAGS))))
2987407f 746 BASIC_LDFLAGS += -Wl,--dynamicbase
728b9ac0
TB
747 endif
748 ifeq (MINGW32,$(MSYSTEM))
2987407f
HJ
749 prefix = /mingw32
750 HOST_CPU = i686
751 BASIC_LDFLAGS += -Wl,--pic-executable,-e,_mainCRTStartup
728b9ac0
TB
752 endif
753 ifeq (MINGW64,$(MSYSTEM))
2987407f
HJ
754 prefix = /mingw64
755 HOST_CPU = x86_64
756 BASIC_LDFLAGS += -Wl,--pic-executable,-e,mainCRTStartup
cd6229b7
DA
757 else ifeq (CLANGARM64,$(MSYSTEM))
758 prefix = /clangarm64
759 HOST_CPU = aarch64
760 BASIC_LDFLAGS += -Wl,--pic-executable,-e,mainCRTStartup
728b9ac0 761 else
2987407f
HJ
762 COMPAT_CFLAGS += -D_USE_32BIT_TIME_T
763 BASIC_LDFLAGS += -Wl,--large-address-aware
728b9ac0 764 endif
2987407f
HJ
765 CC = gcc
766 COMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -DDETECT_MSYS_TTY \
767 -fstack-protector-strong
768 EXTLIBS += -lntdll
4b8a2717 769 EXTRA_PROGRAMS += headless-git$X
e1b6dbb5 770 INSTALL = /bin/install
e1b6dbb5
JK
771 INTERNAL_QSORT = YesPlease
772 HAVE_LIBCHARSET_H = YesPlease
2987407f
HJ
773 USE_GETTEXT_SCHEME = fallthrough
774 USE_LIBPCRE = YesPlease
734bf240
JS
775 ifneq (CLANGARM64,$(MSYSTEM))
776 USE_NED_ALLOCATOR = YesPlease
777 endif
619950d4 778 ifeq (/mingw64,$(subst 32,64,$(subst clangarm,mingw,$(prefix))))
2987407f
HJ
779 # Move system config into top-level /etc/
780 ETC_GITCONFIG = ../etc/gitconfig
781 ETC_GITATTRIBUTES = ../etc/gitattributes
728b9ac0 782 endif
e1b6dbb5 783endif
e1b6dbb5
JK
784ifeq ($(uname_S),QNX)
785 COMPAT_CFLAGS += -DSA_RESTART=0
081fd8d0 786 EXPAT_NEEDS_XMLPARSE_H = YesPlease
e1b6dbb5
JK
787 HAVE_STRINGS_H = YesPlease
788 NEEDS_SOCKET = YesPlease
e1b6dbb5
JK
789 NO_GETPAGESIZE = YesPlease
790 NO_ICONV = YesPlease
791 NO_MEMMEM = YesPlease
792 NO_MKDTEMP = YesPlease
e1b6dbb5
JK
793 NO_NSEC = YesPlease
794 NO_PTHREADS = YesPlease
e1b6dbb5
JK
795 NO_STRCASESTR = YesPlease
796 NO_STRLCPY = YesPlease
797endif