{"thread":{"id":"17174","subject":"Compiler requirements for git?","startedAt":"2009-01-14T18:32:56Z","lastAt":"2009-03-16T22:31:34Z","messageCount":7,"participants":["Corey Stup","Miklos Vajna","Allan Caffee","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"100456","messageId":"128172e70901141032p6e830a85i344d72e1b3bb3a89@mail.gmail.com","threadId":"17174","inReplyTo":null,"subject":"Compiler requirements for git?","fromName":"Corey Stup","fromEmail":"coreystup@gmail.com","sentAt":"2009-01-14T18:32:56Z","receivedAt":"2009-01-14T18:32:56Z","isPatch":false,"sender":{"key":"coreystup@gmail.com","avatar":null},"body":"Newbie to the group.\nI couldn't find a reference to say what the requirements are to\ncompile git.  Certainly it works with GCC, but GCC allows for all\nsorts of non standard syntax.\n\nWhen trying to compile with a C89 compliant compiler, I'm coming\nacross a couple issues:\n- \"inline\" use\n- trailing comma on the last member of enums\n\nAre these oversights or does git require GCC or a C99 compiler?\nThanks!\n"},{"id":"100500","messageId":"20090114223832.GC30710@genesis.frugalware.org","threadId":"17174","inReplyTo":"128172e70901141032p6e830a85i344d72e1b3bb3a89@mail.gmail.com","subject":"Re: Compiler requirements for git?","fromName":"Miklos Vajna","fromEmail":"vmiklos@frugalware.org","sentAt":"2009-01-14T22:38:32Z","receivedAt":"2009-01-14T22:38:32Z","isPatch":false,"sender":{"key":"vmiklos@frugalware.org","avatar":"https://gravatar.com/avatar/401c1cbbb3a5d13e650c691a2c71d6fd0b80df1a01bc74d9f1972675dd58f2bd?d=mp&s=160"},"body":"On Wed, Jan 14, 2009 at 01:32:56PM -0500, Corey Stup <coreystup@gmail.com> wrote:\n> When trying to compile with a C89 compliant compiler, I'm coming\n> across a couple issues:\n> - \"inline\" use\n\nAFAIK that can be avoided with -Dinline=.\n"},{"id":"107989","messageId":"20090314010421.GA6642@linux.vnet","threadId":"17174","inReplyTo":"20090114223832.GC30710@genesis.frugalware.org","subject":"[PATCH] Autoconf: Disable inline for compilers that don't support it.","fromName":"Allan Caffee","fromEmail":"allan.caffee@gmail.com","sentAt":"2009-03-14T01:04:21Z","receivedAt":"2009-03-14T01:04:21Z","isPatch":true,"sender":{"key":"allan.caffee@gmail.com","avatar":"https://avatars.githubusercontent.com/u/114759?v=4"},"body":"The Autoconf macro AC_C_INLINE will redefine the inline keyword to whatever the\ncurrent compiler supports (including possibly nothing).\n\nSigned-off-by: Allan Caffee <allan.caffee@gmail.com>\n---\nOn Wed, 14 Jan 2009, Miklos Vajna wrote:\n> On Wed, Jan 14, 2009 at 01:32:56PM -0500, Corey Stup\n> <coreystup@gmail.com> wrote:\n> > When trying to compile with a C89 compliant compiler, I'm coming\n> > across a couple issues:\n> > - \"inline\" use\n>\n> AFAIK that can be avoided with -Dinline=.\n\nBut some compilers support other variations of this like __inline__ or\n__inline.  Luckily Autoconf has a builtin method for handling this.\n\ndiff --git a/configure.ac b/configure.ac\nindex 082a03d..69fa25e 100644\n--- a/configure.ac\n+++ b/configure.ac\n@@ -308,6 +308,9 @@ AC_SUBST(OLD_ICONV)\n ## Checks for typedefs, structures, and compiler characteristics.\n AC_MSG_NOTICE([CHECKS for typedefs, structures, and compiler characteristics])\n #\n+# Check for compilers ability to inline functions.\n+AC_C_INLINE\n+#\n # Define NO_D_INO_IN_DIRENT if you don't have d_ino in your struct dirent.\n AC_CHECK_MEMBER(struct dirent.d_ino,\n [NO_D_INO_IN_DIRENT=],\n-- \n1.5.4.3\n"},{"id":"108020","messageId":"7vy6v7al37.fsf@gitster.siamese.dyndns.org","threadId":"17174","inReplyTo":"20090314010421.GA6642@linux.vnet","subject":"Re: [PATCH] Autoconf: Disable inline for compilers that don't support it.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-03-14T20:46:52Z","receivedAt":"2009-03-14T20:46:52Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Allan Caffee <allan.caffee@gmail.com> writes:\n\n> The Autoconf macro AC_C_INLINE will redefine the inline keyword to whatever the\n> current compiler supports (including possibly nothing).\n>\n> Signed-off-by: Allan Caffee <allan.caffee@gmail.com>\n\nAs far as I can tell, this makes scriptlet to set ac_cv_c_inline and then\nthe result is written to confdefs.h:\n\n    case $ac_cv_c_inline in\n      inline | yes) ;;\n      *)\n        case $ac_cv_c_inline in\n          no) ac_val=;;\n          *) ac_val=$ac_cv_c_inline;;\n        esac\n        cat >>confdefs.h <<_ACEOF\n    #ifndef __cplusplus\n    #define inline $ac_val\n    #endif\n    _ACEOF\n        ;;\n    esac\n\nwhich is used only during the ./configure run but not during the actual\nbuild.\n\nWhat am I missing?\n"},{"id":"108048","messageId":"20090315152127.GA7988@linux.vnet","threadId":"17174","inReplyTo":"7vy6v7al37.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] Autoconf: Disable inline for compilers that don't support it.","fromName":"Allan Caffee","fromEmail":"allan.caffee@gmail.com","sentAt":"2009-03-15T15:21:27Z","receivedAt":"2009-03-15T15:21:27Z","isPatch":true,"sender":{"key":"allan.caffee@gmail.com","avatar":"https://avatars.githubusercontent.com/u/114759?v=4"},"body":"On Sat, 14 Mar 2009, Junio C Hamano wrote:\n> Allan Caffee <allan.caffee@gmail.com> writes:\n> \n> > The Autoconf macro AC_C_INLINE will redefine the inline keyword to whatever the\n> > current compiler supports (including possibly nothing).\n> >\n> > Signed-off-by: Allan Caffee <allan.caffee@gmail.com>\n> \n> As far as I can tell, this makes scriptlet to set ac_cv_c_inline and then\n> the result is written to confdefs.h:\n> \n>     case $ac_cv_c_inline in\n>       inline | yes) ;;\n>       *)\n>         case $ac_cv_c_inline in\n>           no) ac_val=;;\n>           *) ac_val=$ac_cv_c_inline;;\n>         esac\n>         cat >>confdefs.h <<_ACEOF\n>     #ifndef __cplusplus\n>     #define inline $ac_val\n>     #endif\n>     _ACEOF\n>         ;;\n>     esac\n> \n> which is used only during the ./configure run but not during the actual\n> build.\n> \n> What am I missing?\n\nMy mistake; it looks like this macro will only work the way I described\nwhen using a config.h, which I see git is not currently doing.  I\nassumed that it would also provide a -D flag to the precompiler if a\nconfiguration header isn't used but this doesn't appear to be case (from\na cursory glance at the macros definition).  I could send a patch that\nwould set up a config header, but that would mean adding an #include\ndirective to all of the source files (or at least those using inline).\nOTOH doing so would allow git to make use of some other handy macros\nlike AC_C_CONST.  Do you think this is worth adding a configuration\nheader?\n"},{"id":"108054","messageId":"7vab7m7ecp.fsf@gitster.siamese.dyndns.org","threadId":"17174","inReplyTo":"20090315152127.GA7988@linux.vnet","subject":"Re: [PATCH] Autoconf: Disable inline for compilers that don't support it.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-03-15T19:52:54Z","receivedAt":"2009-03-15T19:52:54Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Allan Caffee <allan.caffee@gmail.com> writes:\n\n> My mistake; it looks like this macro will only work the way I described\n> when using a config.h, which I see git is not currently doing.  I\n> assumed that it would also provide a -D flag to the precompiler if a\n> configuration header isn't used but this doesn't appear to be case (from\n> a cursory glance at the macros definition).\n\nThe design of our Makefile is such that it will default to some reasonable\nvalues for the make variables depending on the environment, and people who\ndo not want to use the configure script can override them by creating\ncustom entries in config.mak manually, which is included by the Makefile.\n\nOPTIONALLY configure can be used to produce config.mak.autogen that is\nincluded just before config.mak is included (so that misdetection by\nconfigure script can be overridden away by config.mak), so the same kind\nof overriding happens.\n\nI suspect addition of config.h, unless done carefully, will close the door\nto the people who do not use configure to get certain customizations, and\nwhen the same carefulness is applied, we probably do no need to introduce\nconfig.h.\n\nFor example, for -Dinline=__inline__, I think you can:\n\n (1) Add something like this near the beginning of the Makefile:\n\n     # Define USE_THIS_INLINE=__inline__ if your compiler does not\n     # understand \"inline\", but does understand __inline__.\n     #\n     # Define NO_INLINE=UnfortunatelyYes if your compiler does not\n     # understand \"inline\" at all.\n\n (2) Add something like this after include \"config.mak\" happens in the\n     Makefile:\n\n     ifdef USE_THIS_INLINE\n         BASIC_CFLAGS += -Dinline=$(USE_THIS_INLINE)\n     else\n         ifdef NO_INLINE\n             BASIC_CFLAGS += -Dinline=\"\"\n\t endif\n     endif\n\n (3) Add your new logic to configure.ac, _and_ arrange it to substitute\n     USE_THIS_INLINE if ac_cv_c_inline is not \"inline\", and set NO_INLINE\n     if it detected that the compiler does not understand inline in any\n     shape or form.  You would need two new entries in config.mak.in, I\n     think.\n"},{"id":"108152","messageId":"20090316223134.GA6053@linux.vnet","threadId":"17174","inReplyTo":"7vab7m7ecp.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] Autoconf: Disable inline for compilers that don't support it.","fromName":"Allan Caffee","fromEmail":"allan.caffee@gmail.com","sentAt":"2009-03-16T22:31:34Z","receivedAt":"2009-03-16T22:31:34Z","isPatch":true,"sender":{"key":"allan.caffee@gmail.com","avatar":"https://avatars.githubusercontent.com/u/114759?v=4"},"body":"On Sun, 15 Mar 2009, Junio C Hamano wrote:\n> Allan Caffee <allan.caffee@gmail.com> writes:\n> > My mistake; it looks like this macro will only work the way I described\n> > when using a config.h, which I see git is not currently doing.  I\n> > assumed that it would also provide a -D flag to the precompiler if a\n> > configuration header isn't used but this doesn't appear to be case (from\n> > a cursory glance at the macros definition).\n> \n> The design of our Makefile is such that it will default to some reasonable\n> values for the make variables depending on the environment, and people who\n> do not want to use the configure script can override them by creating\n> custom entries in config.mak manually, which is included by the Makefile.\n> \n> OPTIONALLY configure can be used to produce config.mak.autogen that is\n> included just before config.mak is included (so that misdetection by\n> configure script can be overridden away by config.mak), so the same kind\n> of overriding happens.\n> \n> I suspect addition of config.h, unless done carefully, will close the door\n> to the people who do not use configure to get certain customizations, and\n> when the same carefulness is applied, we probably do no need to introduce\n> config.h.\n> \n> For example, for -Dinline=__inline__, I think you can:\n> \n>  (1) Add something like this near the beginning of the Makefile:\n> \n>      # Define USE_THIS_INLINE=__inline__ if your compiler does not\n>      # understand \"inline\", but does understand __inline__.\n>      #\n>      # Define NO_INLINE=UnfortunatelyYes if your compiler does not\n>      # understand \"inline\" at all.\n> \n>  (2) Add something like this after include \"config.mak\" happens in the\n>      Makefile:\n> \n>      ifdef USE_THIS_INLINE\n>          BASIC_CFLAGS += -Dinline=$(USE_THIS_INLINE)\n>      else\n>          ifdef NO_INLINE\n>              BASIC_CFLAGS += -Dinline=\"\"\n> \t endif\n>      endif\n> \n>  (3) Add your new logic to configure.ac, _and_ arrange it to substitute\n>      USE_THIS_INLINE if ac_cv_c_inline is not \"inline\", and set NO_INLINE\n>      if it detected that the compiler does not understand inline in any\n>      shape or form.  You would need two new entries in config.mak.in, I\n>      think.\n\nIn addition to these three possibilities we could also use config.h only\nin the event that the user decides to run configure.  When using a\nconfig header autoconf appends -DHAVE_CONFIG_H to the CPPFLAGS.  So\nthe code could conditionally include it.\n\nAlthough I'm not really sure if this still maintains the degree of user\ncontrol you're looking for.\n"}]}