git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Autoconf: Disable inline for compilers that don't support it.

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 15, 2009, 19:52 UTC
Message-ID
<7vab7m7ecp.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<20090315152127.GA7988@linux.vnet>
Allan Caffee <allan.caffee@gmail.com> writes:
Show 5 quoted lines
> My mistake; it looks like this macro will only work the way I described
> when using a config.h, which I see git is not currently doing.  I
> assumed that it would also provide a -D flag to the precompiler if a
> configuration header isn't used but this doesn't appear to be case (from
> a cursory glance at the macros definition).

The design of our Makefile is such that it will default to some reasonable values for the make variables depending on the environment, and people who do not want to use the configure script can override them by creating custom entries in config.mak manually, which is included by the Makefile.

OPTIONALLY configure can be used to produce config.mak.autogen that is included just before config.mak is included (so that misdetection by configure script can be overridden away by config.mak), so the same kind of overriding happens.

I suspect addition of config.h, unless done carefully, will close the door to the people who do not use configure to get certain customizations, and when the same carefulness is applied, we probably do no need to introduce config.h.

For example, for -Dinline=__inline__, I think you can:
 (1) Add something like this near the beginning of the Makefile:
     # Define USE_THIS_INLINE=__inline__ if your compiler does not
     # understand "inline", but does understand __inline__.
     #
     # Define NO_INLINE=UnfortunatelyYes if your compiler does not
     # understand "inline" at all.
 (2) Add something like this after include "config.mak" happens in the
     Makefile:
     ifdef USE_THIS_INLINE
         BASIC_CFLAGS += -Dinline=$(USE_THIS_INLINE)
     else
         ifdef NO_INLINE
             BASIC_CFLAGS += -Dinline=""
	 endif
     endif
 (3) Add your new logic to configure.ac, _and_ arrange it to substitute
     USE_THIS_INLINE if ac_cv_c_inline is not "inline", and set NO_INLINE
     if it detected that the compiler does not understand inline in any
     shape or form.  You would need two new entries in config.mak.in, I
     think.
Previous: Allan CaffeeNext: Allan Caffee
Message 6 of 7 in “Compiler requirements for git?”
  1. Corey StupJan 14, 2009
  2. Miklos VajnaJan 14, 2009
  3. Autoconf: Disable inline for compilers that don't support it.Allan Caffee, Mar 14, 2009
  4. Junio C HamanoMar 14, 2009
  5. Allan CaffeeMar 15, 2009
  6. Junio C HamanoMar 15, 2009
  7. Allan CaffeeMar 16, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.