* [PATCH RFC] gettext: Support building on non-GNU with -lintl
@ 2010-06-04 16:36 Ævar Arnfjörð Bjarmason
2010-06-05 11:42 ` Jakub Narebski
0 siblings, 1 reply; 3+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2010-06-04 16:36 UTC (permalink / raw)
To: git; +Cc: Ævar Arnfjörð Bjarmason
Change the build process on non-GNU systems to use -lintl if
NO_GETTEXT hasn't been set.
Systems that use the GNU C Library don't need this, but on others the
GNU libintl library is an externally install package, so we need to
explicitly link to it.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
When I got access to a FreeBSD system I found that my gettext series
didn't link there, because -lintl needed to be supplied. GNU gettext
is only included in GNU libc, not other C libraries.
So here's a probe to check if we're building on a non-GNU
system. I.e. not Linux, Hurd or GNU/kFreeBSD. on non-GNU we -lintl
when linking unless NEEDS_LIBINTL= is supplied.
What I'm unsure about is this part:
+ifndef NO_GETTEXT
+ # Systems that use GNU gettext and glibc are the exception
+ NEEDS_LIBINTL = YesPlease
+endif
As far as I can see there's no other NEED_* feature that's on by
default. I think it makes more sense to explicitly list those
platforms that are likely to have glibc, rather than try to enumerate
all those without. Especially since that would break the build process
on any new platform that the makefile doesn't know about, but perhaps
there's a better way to do this.
If you're using e.g. glibc on a *BSD you can just build Git as:
gmake NEEDS_LIBINTL=
This also work, i.e. doesn't link to -lintl because NO_GETTEXT is
given:
gmake NEEDS_LIBINTL=YesPlease NO_GETTEXT=YesPlease
But this works now so I'll keep it if there aren't objections, and
perhaps the "Platform specific defaults" could be used for something
else.
Should I include a GETTEXTDIR option similar to CURLDIR and EXPATDIR
in the Makefile? Now it just assumes that it can find gettext.h and
libintl in the default paths.
Makefile | 24 +++++++++++++++++++++++-
1 files changed, 23 insertions(+), 1 deletions(-)
diff --git a/Makefile b/Makefile
index 5169aec..1dfcd65 100644
--- a/Makefile
+++ b/Makefile
@@ -28,6 +28,15 @@ all::
# Define NO_EXPAT if you do not have expat installed. git-http-push is
# not built, and you cannot push using http:// and https:// transports.
#
+# Define NO_GETTEXT if you don't have libintl installed, or don't want
+# to build Git with localization support.
+#
+# Define NEEDS_LIBINTL if you haven't defined NO_GETTEXT=YesPlease,
+# but your system needs to be explicitly linked to -lintl. This is
+# defined automatically if we're building gettext support on systems
+# where we expect not to use glibc (which has libintl included in
+# libc).
+#
# Define EXPATDIR=/foo/bar if your expat header and library files are in
# /foo/bar/include and /foo/bar/lib directories.
#
@@ -741,6 +750,14 @@ EXTLIBS =
# Platform specific tweaks
#
+# Platform specific defaults. Where we'd only like some feature on the
+# minority of systems, e.g. if linking to a library isn't needed
+# because its features are included in the GNU C library.
+ifndef NO_GETTEXT
+ # Systems that use GNU gettext and glibc are the exception
+ NEEDS_LIBINTL = YesPlease
+endif
+
# We choose to avoid "if .. else if .. else .. endif endif"
# because maintaining the nesting to match is a pain. If
# we had "elif" things would have been much nicer...
@@ -749,11 +766,13 @@ ifeq ($(uname_S),Linux)
NO_STRLCPY = YesPlease
NO_MKSTEMPS = YesPlease
HAVE_PATHS_H = YesPlease
+ NEEDS_LIBINTL =
endif
ifeq ($(uname_S),GNU/kFreeBSD)
NO_STRLCPY = YesPlease
NO_MKSTEMPS = YesPlease
HAVE_PATHS_H = YesPlease
+ NEEDS_LIBINTL =
endif
ifeq ($(uname_S),UnixWare)
CC = cc
@@ -923,6 +942,7 @@ ifeq ($(uname_S),GNU)
NO_STRLCPY=YesPlease
NO_MKSTEMPS = YesPlease
HAVE_PATHS_H = YesPlease
+ NEEDS_LIBINTL =
endif
ifeq ($(uname_S),IRIX)
NO_SETENV = YesPlease
@@ -1395,7 +1415,9 @@ endif
ifdef NO_GETTEXT
COMPAT_CFLAGS += -DNO_GETTEXT
else
- LIBINTL = -lintl
+ ifdef NEEDS_LIBINTL
+ EXTLIBS += -lintl
+ endif
endif
ifeq ($(TCLTK_PATH),)
--
1.7.0.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH RFC] gettext: Support building on non-GNU with -lintl
2010-06-04 16:36 [PATCH RFC] gettext: Support building on non-GNU with -lintl Ævar Arnfjörð Bjarmason
@ 2010-06-05 11:42 ` Jakub Narebski
2010-06-05 14:57 ` Ævar Arnfjörð Bjarmason
0 siblings, 1 reply; 3+ messages in thread
From: Jakub Narebski @ 2010-06-05 11:42 UTC (permalink / raw)
To: Ævar Arnfjörð Bjarmason; +Cc: git
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
> Change the build process on non-GNU systems to use -lintl if
> NO_GETTEXT hasn't been set.
>
> Systems that use the GNU C Library don't need this, but on others the
> GNU libintl library is an externally install package, so we need to
> explicitly link to it.
>
> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
> ---
[...]
> diff --git a/Makefile b/Makefile
> index 5169aec..1dfcd65 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -28,6 +28,15 @@ all::
> # Define NO_EXPAT if you do not have expat installed. git-http-push is
> # not built, and you cannot push using http:// and https:// transports.
> #
> +# Define NO_GETTEXT if you don't have libintl installed, or don't want
> +# to build Git with localization support.
> +#
> +# Define NEEDS_LIBINTL if you haven't defined NO_GETTEXT=YesPlease,
> +# but your system needs to be explicitly linked to -lintl. This is
> +# defined automatically if we're building gettext support on systems
> +# where we expect not to use glibc (which has libintl included in
> +# libc).
Could you add test for NEEDS_LIBINTL to configure.ac? Thanks in
advance.
--
Jakub Narebski
Poland
ShadeHawk on #git
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH RFC] gettext: Support building on non-GNU with -lintl
2010-06-05 11:42 ` Jakub Narebski
@ 2010-06-05 14:57 ` Ævar Arnfjörð Bjarmason
0 siblings, 0 replies; 3+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2010-06-05 14:57 UTC (permalink / raw)
To: Jakub Narebski; +Cc: git
On Sat, Jun 5, 2010 at 11:42, Jakub Narebski <jnareb@gmail.com> wrote:
> Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
>
>> Change the build process on non-GNU systems to use -lintl if
>> NO_GETTEXT hasn't been set.
>>
>> Systems that use the GNU C Library don't need this, but on others the
>> GNU libintl library is an externally install package, so we need to
>> explicitly link to it.
>>
>> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
>> ---
>
> [...]
>> diff --git a/Makefile b/Makefile
>> index 5169aec..1dfcd65 100644
>> --- a/Makefile
>> +++ b/Makefile
>> @@ -28,6 +28,15 @@ all::
>> # Define NO_EXPAT if you do not have expat installed. git-http-push is
>> # not built, and you cannot push using http:// and https:// transports.
>> #
>> +# Define NO_GETTEXT if you don't have libintl installed, or don't want
>> +# to build Git with localization support.
>> +#
>> +# Define NEEDS_LIBINTL if you haven't defined NO_GETTEXT=YesPlease,
>> +# but your system needs to be explicitly linked to -lintl. This is
>> +# defined automatically if we're building gettext support on systems
>> +# where we expect not to use glibc (which has libintl included in
>> +# libc).
>
> Could you add test for NEEDS_LIBINTL to configure.ac? Thanks in
> advance.
Done:
$ uname -s ; (git clean -dxf; gmake configure &&
CPPFLAGS="-I/usr/local/include" ./configure) > /dev/null && egrep
"INTL|GETTEXT" config.mak.autogen
FreeBSD
GIT_VERSION = 1.7.0.4.732.ge63cf.dirty
NO_GETTEXT=
NEEDS_LIBINTL=YesPlease
The patch needed to get it working:
diff --git a/config.mak.in b/config.mak.in
index a15f3c1..c49072c 100644
--- a/config.mak.in
+++ b/config.mak.in
@@ -36,6 +36,7 @@ NO_GETTEXT=@NO_GETTEXT@
NEEDS_LIBICONV=@NEEDS_LIBICONV@
NEEDS_SOCKET=@NEEDS_SOCKET@
NEEDS_RESOLV=@NEEDS_RESOLV@
+NEEDS_LIBINTL=@NEEDS_LIBINTL@
NEEDS_LIBGEN=@NEEDS_LIBGEN@
NO_SYS_SELECT_H=@NO_SYS_SELECT_H@
NO_D_INO_IN_DIRENT=@NO_D_INO_IN_DIRENT@
diff --git a/configure.ac b/configure.ac
index 7bebfd8..74879b4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -559,6 +559,12 @@ AC_CHECK_LIB([c], [basename],
AC_SUBST(NEEDS_LIBGEN)
test -n "$NEEDS_LIBGEN" && LIBS="$LIBS -lgen"
+AC_CHECK_LIB([c], [gettext],
+[NEEDS_LIBINTL=],
+[NEEDS_LIBINTL=YesPlease])
+AC_SUBST(NEEDS_LIBINTL)
+test -n "$NEEDS_LIBINTL" && LIBS="$LIBS -lintl"
+
## Checks for header files.
AC_MSG_NOTICE([CHECKS for header files])
#
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-06-05 14:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-04 16:36 [PATCH RFC] gettext: Support building on non-GNU with -lintl Ævar Arnfjörð Bjarmason
2010-06-05 11:42 ` Jakub Narebski
2010-06-05 14:57 ` Ævar Arnfjörð Bjarmason
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).