Allow disabling "inline"
Compiler support for inline is sometimes buggy, and occasionally missing entirely. This patch adds a test for inline support, and redefines the keyword with the preprocessor if necessary at compile time. Signed-off-by: Gary V. Vaughan <gary@thewrittenword.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Gary V. Vaughan committed
May 14, 2010 at 09:31 UTC
f9f33cdc78b5893a4764b1437b59536f399a50d1
3 files changed
+14
Makefile
+7
@@ -11,6 +11,9 @@ all::
11
# Define SOCKLEN_T to a suitable type (such as 'size_t') if your
12
# system headers do not define a socklen_t type.
13
#
14
+# Define INLINE to a suitable substitute (such as '__inline' or '') if git
15
+# fails to compile with errors about undefined inline functions or similar.
16
+#
17
# Define SNPRINTF_RETURNS_BOGUS if your are on a system which snprintf()
18
# or vsnprintf() return -1 instead of number of characters which would
19
# have been written to the final string if enough space had been available.
@@ -1090,6 +1093,10 @@ else
1093
BROKEN_PATH_FIX = '/^\# @@BROKEN_PATH_FIX@@$$/d'
1094
endif
1095
1096
+ifneq (,$(INLINE))
1097
+ BASIC_CFLAGS += -Dinline=$(INLINE)
1098
+endif
1099
+
1100
ifneq (,$(SOCKLEN_T))
1101
BASIC_CFLAGS += -Dsocklen_t=$(SOCKLEN_T)
1102
endif
config.mak.in
+1
@@ -58,6 +58,7 @@ NO_INET_PTON=@NO_INET_PTON@
58
NO_ICONV=@NO_ICONV@
59
OLD_ICONV=@OLD_ICONV@
60
NO_DEFLATE_BOUND=@NO_DEFLATE_BOUND@
61
+INLINE=@INLINE@
62
SOCKLEN_T=@SOCKLEN_T@
63
FREAD_READS_DIRECTORIES=@FREAD_READS_DIRECTORIES@
64
SNPRINTF_RETURNS_BOGUS=@SNPRINTF_RETURNS_BOGUS@
configure.ac
+6
@@ -327,6 +327,12 @@ GIT_PARSE_WITH(tcltk))
327
AC_MSG_NOTICE([CHECKS for programs])
328
#
329
AC_PROG_CC([cc gcc])
330
+AC_C_INLINE
331
+case $ac_cv_c_inline in
332
+ inline | yes | no) ;;
333
+ *) AC_SUBST([INLINE], [$ac_cv_c_inline]) ;;
334
+esac
335
+
336
# which switch to pass runtime path to dynamic libraries to the linker
337
AC_CACHE_CHECK([if linker supports -R], git_cv_ld_dashr, [
338
SAVE_LDFLAGS="${LDFLAGS}"