[PATCH v5 12/18] Allow disabling "inline"

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Gary V. Vaughan
Date: Friday, May 14, 2010 - 2:31 am

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>
---
 Makefile      |    7 +++++++
 config.mak.in |    1 +
 configure.ac  |    6 ++++++
 3 files changed, 14 insertions(+)

Index: b/Makefile
===================================================================
--- a/Makefile
+++ b/Makefile
@@ -11,6 +11,9 @@ all::
 # Define SOCKLEN_T to a suitable type (such as 'size_t') if your
 # system headers do not define a socklen_t type.
 #
+# Define INLINE to a suitable substitute (such as '__inline' or '') if git
+# fails to compile with errors about undefined inline functions or similar.
+#
 # Define SNPRINTF_RETURNS_BOGUS if your are on a system which snprintf()
 # or vsnprintf() return -1 instead of number of characters which would
 # have been written to the final string if enough space had been available.
@@ -1090,6 +1093,10 @@ else
 BROKEN_PATH_FIX = '/^\# @@BROKEN_PATH_FIX@@$$/d'
 endif
 
+ifneq (,$(INLINE))
+	BASIC_CFLAGS += -Dinline=$(INLINE)
+endif
+
 ifneq (,$(SOCKLEN_T))
 	BASIC_CFLAGS += -Dsocklen_t=$(SOCKLEN_T)
 endif
Index: b/configure.ac
===================================================================
--- a/configure.ac
+++ b/configure.ac
@@ -327,6 +327,12 @@ GIT_PARSE_WITH(tcltk))
 AC_MSG_NOTICE([CHECKS for programs])
 #
 AC_PROG_CC([cc gcc])
+AC_C_INLINE
+case $ac_cv_c_inline in
+  inline | yes | no)	;;
+  *)			AC_SUBST([INLINE], [$ac_cv_c_inline]) ;;
+esac
+
 # which switch to pass runtime path to dynamic libraries to the linker
 AC_CACHE_CHECK([if linker supports -R], git_cv_ld_dashr, [
    SAVE_LDFLAGS="${LDFLAGS}"
Index: b/config.mak.in
===================================================================
--- a/config.mak.in
+++ b/config.mak.in
@@ -58,6 +58,7 @@ NO_INET_PTON=@NO_INET_PTON@
 NO_ICONV=@NO_ICONV@
 OLD_ICONV=@OLD_ICONV@
 NO_DEFLATE_BOUND=@NO_DEFLATE_BOUND@
+INLINE=@INLINE@
 SOCKLEN_T=@SOCKLEN_T@
 FREAD_READS_DIRECTORIES=@FREAD_READS_DIRECTORIES@
 SNPRINTF_RETURNS_BOGUS=@SNPRINTF_RETURNS_BOGUS@

-- 
Gary V. Vaughan (gary@thewrittenword.com)
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH v5 00/18] Portability patches for git-1.7.1, Gary V. Vaughan, (Fri May 14, 2:31 am)
[PATCH v5 04/18] enums: omit trailing comma for portability, Gary V. Vaughan, (Fri May 14, 2:31 am)
[PATCH v5 11/18] Some platforms lack socklen_t type, Gary V. Vaughan, (Fri May 14, 2:31 am)
[PATCH v5 12/18] Allow disabling "inline", Gary V. Vaughan, (Fri May 14, 2:31 am)
[PATCH v5 13/18] inline declaration does not work on AIX, Gary V. Vaughan, (Fri May 14, 2:31 am)
[PATCH v5 14/18] Makefile: SunOS 5.6 portability fix, Gary V. Vaughan, (Fri May 14, 2:31 am)
[PATCH v5 16/18] Makefile: HPUX11 portability fixes., Gary V. Vaughan, (Fri May 14, 2:31 am)
[PATCH v5 17/18] Makefile: HP-UX 10.20 portability fixes., Gary V. Vaughan, (Fri May 14, 2:31 am)
[PATCH v5 18/18] Makefile: Tru64 portability fix, Gary V. Vaughan, (Fri May 14, 2:31 am)
Re: [PATCH v5 00/18] Portability patches for git-1.7.1, Gary V. Vaughan, (Tue May 25, 10:56 pm)
Re: [PATCH v5 00/18] Portability patches for git-1.7.1, Gary V. Vaughan, (Mon Jun 7, 8:45 am)
Re: [PATCH v5 00/18] Portability patches for git-1.7.1, Junio C Hamano, (Mon Jun 7, 11:07 am)
Re: [PATCH v5 00/18] Portability patches for git-1.7.1, Junio C Hamano, (Thu Jun 10, 9:30 pm)