{"thread":{"id":"24009","subject":"[PATCH RFC] gettext: Support building on non-GNU with -lintl","startedAt":"2010-06-04T16:36:10Z","lastAt":"2010-06-05T14:57:38Z","messageCount":3,"participants":["Ævar Arnfjörð Bjarmason","Jakub Narebski"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"142992","messageId":"1275669370-6004-1-git-send-email-avarab@gmail.com","threadId":"24009","inReplyTo":null,"subject":"[PATCH RFC] gettext: Support building on non-GNU with -lintl","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2010-06-04T16:36:10Z","receivedAt":"2010-06-04T16:36:10Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Change the build process on non-GNU systems to use -lintl if\nNO_GETTEXT hasn't been set.\n\nSystems that use the GNU C Library don't need this, but on others the\nGNU libintl library is an externally install package, so we need to\nexplicitly link to it.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n\nWhen I got access to a FreeBSD system I found that my gettext series\ndidn't link there, because -lintl needed to be supplied. GNU gettext\nis only included in GNU libc, not other C libraries.\n\nSo here's a probe to check if we're building on a non-GNU\nsystem. I.e. not Linux, Hurd or GNU/kFreeBSD. on non-GNU we -lintl\nwhen linking unless NEEDS_LIBINTL= is supplied.\n\nWhat I'm unsure about is this part:\n    \n    +ifndef NO_GETTEXT\n    +\t# Systems that use GNU gettext and glibc are the exception\n    +\tNEEDS_LIBINTL = YesPlease\n    +endif\n\nAs far as I can see there's no other NEED_* feature that's on by\ndefault. I think it makes more sense to explicitly list those\nplatforms that are likely to have glibc, rather than try to enumerate\nall those without. Especially since that would break the build process\non any new platform that the makefile doesn't know about, but perhaps\nthere's a better way to do this.\n\nIf you're using e.g. glibc on a *BSD you can just build Git as:\n\n    gmake NEEDS_LIBINTL=\n\nThis also work, i.e. doesn't link to -lintl because NO_GETTEXT is\ngiven:\n\n    gmake NEEDS_LIBINTL=YesPlease NO_GETTEXT=YesPlease\n\nBut this works now so I'll keep it if there aren't objections, and\nperhaps the \"Platform specific defaults\" could be used for something\nelse.\n\nShould I include a GETTEXTDIR option similar to CURLDIR and EXPATDIR\nin the Makefile? Now it just assumes that it can find gettext.h and\nlibintl in the default paths.\n\n Makefile |   24 +++++++++++++++++++++++-\n 1 files changed, 23 insertions(+), 1 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex 5169aec..1dfcd65 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -28,6 +28,15 @@ all::\n # Define NO_EXPAT if you do not have expat installed.  git-http-push is\n # not built, and you cannot push using http:// and https:// transports.\n #\n+# Define NO_GETTEXT if you don't have libintl installed, or don't want\n+# to build Git with localization support.\n+#\n+# Define NEEDS_LIBINTL if you haven't defined NO_GETTEXT=YesPlease,\n+# but your system needs to be explicitly linked to -lintl. This is\n+# defined automatically if we're building gettext support on systems\n+# where we expect not to use glibc (which has libintl included in\n+# libc).\n+#\n # Define EXPATDIR=/foo/bar if your expat header and library files are in\n # /foo/bar/include and /foo/bar/lib directories.\n #\n@@ -741,6 +750,14 @@ EXTLIBS =\n # Platform specific tweaks\n #\n \n+# Platform specific defaults. Where we'd only like some feature on the\n+# minority of systems, e.g. if linking to a library isn't needed\n+# because its features are included in the GNU C library.\n+ifndef NO_GETTEXT\n+\t# Systems that use GNU gettext and glibc are the exception\n+\tNEEDS_LIBINTL = YesPlease\n+endif\n+\n # We choose to avoid \"if .. else if .. else .. endif endif\"\n # because maintaining the nesting to match is a pain.  If\n # we had \"elif\" things would have been much nicer...\n@@ -749,11 +766,13 @@ ifeq ($(uname_S),Linux)\n \tNO_STRLCPY = YesPlease\n \tNO_MKSTEMPS = YesPlease\n \tHAVE_PATHS_H = YesPlease\n+\tNEEDS_LIBINTL =\n endif\n ifeq ($(uname_S),GNU/kFreeBSD)\n \tNO_STRLCPY = YesPlease\n \tNO_MKSTEMPS = YesPlease\n \tHAVE_PATHS_H = YesPlease\n+\tNEEDS_LIBINTL =\n endif\n ifeq ($(uname_S),UnixWare)\n \tCC = cc\n@@ -923,6 +942,7 @@ ifeq ($(uname_S),GNU)\n \tNO_STRLCPY=YesPlease\n \tNO_MKSTEMPS = YesPlease\n \tHAVE_PATHS_H = YesPlease\n+\tNEEDS_LIBINTL =\n endif\n ifeq ($(uname_S),IRIX)\n \tNO_SETENV = YesPlease\n@@ -1395,7 +1415,9 @@ endif\n ifdef NO_GETTEXT\n \tCOMPAT_CFLAGS += -DNO_GETTEXT\n else\n-\tLIBINTL = -lintl\n+\tifdef NEEDS_LIBINTL\n+\t\tEXTLIBS += -lintl\n+\tendif\n endif\n \n ifeq ($(TCLTK_PATH),)\n-- \n1.7.0.4\n"},{"id":"143031","messageId":"m3aar9r9ek.fsf@localhost.localdomain","threadId":"24009","inReplyTo":"1275669370-6004-1-git-send-email-avarab@gmail.com","subject":"Re: [PATCH RFC] gettext: Support building on non-GNU with -lintl","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2010-06-05T11:42:50Z","receivedAt":"2010-06-05T11:42:50Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:\n\n> Change the build process on non-GNU systems to use -lintl if\n> NO_GETTEXT hasn't been set.\n> \n> Systems that use the GNU C Library don't need this, but on others the\n> GNU libintl library is an externally install package, so we need to\n> explicitly link to it.\n> \n> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n> ---\n\n[...]\n> diff --git a/Makefile b/Makefile\n> index 5169aec..1dfcd65 100644\n> --- a/Makefile\n> +++ b/Makefile\n> @@ -28,6 +28,15 @@ all::\n>  # Define NO_EXPAT if you do not have expat installed.  git-http-push is\n>  # not built, and you cannot push using http:// and https:// transports.\n>  #\n> +# Define NO_GETTEXT if you don't have libintl installed, or don't want\n> +# to build Git with localization support.\n> +#\n> +# Define NEEDS_LIBINTL if you haven't defined NO_GETTEXT=YesPlease,\n> +# but your system needs to be explicitly linked to -lintl. This is\n> +# defined automatically if we're building gettext support on systems\n> +# where we expect not to use glibc (which has libintl included in\n> +# libc).\n\nCould you add test for NEEDS_LIBINTL to configure.ac?  Thanks in\nadvance.\n\n-- \nJakub Narebski\nPoland\nShadeHawk on #git\n"},{"id":"143038","messageId":"AANLkTin5HPiXcgr3WKcbCSn-48BOHXUIL-E7Kw69ap6Q@mail.gmail.com","threadId":"24009","inReplyTo":"m3aar9r9ek.fsf@localhost.localdomain","subject":"Re: [PATCH RFC] gettext: Support building on non-GNU with -lintl","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2010-06-05T14:57:38Z","receivedAt":"2010-06-05T14:57:38Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"On Sat, Jun 5, 2010 at 11:42, Jakub Narebski <jnareb@gmail.com> wrote:\n> Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:\n>\n>> Change the build process on non-GNU systems to use -lintl if\n>> NO_GETTEXT hasn't been set.\n>>\n>> Systems that use the GNU C Library don't need this, but on others the\n>> GNU libintl library is an externally install package, so we need to\n>> explicitly link to it.\n>>\n>> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n>> ---\n>\n> [...]\n>> diff --git a/Makefile b/Makefile\n>> index 5169aec..1dfcd65 100644\n>> --- a/Makefile\n>> +++ b/Makefile\n>> @@ -28,6 +28,15 @@ all::\n>>  # Define NO_EXPAT if you do not have expat installed.  git-http-push is\n>>  # not built, and you cannot push using http:// and https:// transports.\n>>  #\n>> +# Define NO_GETTEXT if you don't have libintl installed, or don't want\n>> +# to build Git with localization support.\n>> +#\n>> +# Define NEEDS_LIBINTL if you haven't defined NO_GETTEXT=YesPlease,\n>> +# but your system needs to be explicitly linked to -lintl. This is\n>> +# defined automatically if we're building gettext support on systems\n>> +# where we expect not to use glibc (which has libintl included in\n>> +# libc).\n>\n> Could you add test for NEEDS_LIBINTL to configure.ac?  Thanks in\n> advance.\n\nDone:\n\n    $ uname -s ; (git clean -dxf; gmake configure  &&\nCPPFLAGS=\"-I/usr/local/include\" ./configure) > /dev/null && egrep\n\"INTL|GETTEXT\" config.mak.autogen\n    FreeBSD\n    GIT_VERSION = 1.7.0.4.732.ge63cf.dirty\n    NO_GETTEXT=\n    NEEDS_LIBINTL=YesPlease\n\nThe patch needed to get it working:\n\ndiff --git a/config.mak.in b/config.mak.in\nindex a15f3c1..c49072c 100644\n--- a/config.mak.in\n+++ b/config.mak.in\n@@ -36,6 +36,7 @@ NO_GETTEXT=@NO_GETTEXT@\n NEEDS_LIBICONV=@NEEDS_LIBICONV@\n NEEDS_SOCKET=@NEEDS_SOCKET@\n NEEDS_RESOLV=@NEEDS_RESOLV@\n+NEEDS_LIBINTL=@NEEDS_LIBINTL@\n NEEDS_LIBGEN=@NEEDS_LIBGEN@\n NO_SYS_SELECT_H=@NO_SYS_SELECT_H@\n NO_D_INO_IN_DIRENT=@NO_D_INO_IN_DIRENT@\ndiff --git a/configure.ac b/configure.ac\nindex 7bebfd8..74879b4 100644\n--- a/configure.ac\n+++ b/configure.ac\n@@ -559,6 +559,12 @@ AC_CHECK_LIB([c], [basename],\n AC_SUBST(NEEDS_LIBGEN)\n test -n \"$NEEDS_LIBGEN\" && LIBS=\"$LIBS -lgen\"\n\n+AC_CHECK_LIB([c], [gettext],\n+[NEEDS_LIBINTL=],\n+[NEEDS_LIBINTL=YesPlease])\n+AC_SUBST(NEEDS_LIBINTL)\n+test -n \"$NEEDS_LIBINTL\" && LIBS=\"$LIBS -lintl\"\n+\n ## Checks for header files.\n AC_MSG_NOTICE([CHECKS for header files])\n #\n"}]}