threads / patch / 29662

patchDon't append -lintl when there is no gettext support

Subject: [PATCH 1/1] Don't append -lintl when there is no gettext support

## tl;dr

4 messages between Feb 18, 2012 and Feb 20, 2012. Diffs are folded; open one to read it.

replies: 3people: 2as markdown or json

John Szakmeister· Feb 18, 2012, 19:38 UTC · lore

[PATCH 0/1] Make libintl in libc detection more robust

When building the latest release, I noticed that pthreads support was disabled. It turns out that the libintl in libc support is adding "-lintl" to LIBS, even though I don't have that library on my Mac. This patch fixes the issue by moving the check for libintl.h closer to the checks for libintl in libc, and only adding "-lintl" when NO_GETTEXT is empty.

This is my first time submitting a patch to git. I hope I've done things correctly!

John Szakmeister (1):
  Don't append -lintl when there is no gettext support
 configure.ac |   20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)
-- 
1.7.9.1
John Szakmeister· Feb 18, 2012, 19:38 UTC · re: John Szakmeister · lore

The check for libintl in a C library incorrectly assumes that if it's not builtin then it must exist externally. Instead, let's check for the existence of libintl.h first. If libintl.h exists, and libintl is not in libc, then we append the library.

Signed-off-by: John Szakmeister <john@szakmeister.net>
---
 configure.ac |   20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)
Show changes to configure.ac +12 −8
diff --git a/configure.ac b/configure.ac
index 630dbdd..8471f5c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -640,7 +640,18 @@ AC_CHECK_LIB([c], [gettext],
 [LIBC_CONTAINS_LIBINTL=YesPlease],
 [LIBC_CONTAINS_LIBINTL=])
 AC_SUBST(LIBC_CONTAINS_LIBINTL)
-test -n "$LIBC_CONTAINS_LIBINTL" || LIBS="$LIBS -lintl"
+
+#
+# Define NO_GETTEXT if you don't want Git output to be translated.
+# A translated Git requires GNU libintl or another gettext implementation
+AC_CHECK_HEADER([libintl.h],
+[NO_GETTEXT=],
+[NO_GETTEXT=YesPlease])
+AC_SUBST(NO_GETTEXT)
+
+if test -z "$NO_GETTEXT"; then
+    test -n "$LIBC_CONTAINS_LIBINTL" || LIBS="$LIBS -lintl"
+fi
 
 ## Checks for header files.
 AC_MSG_NOTICE([CHECKS for header files])
@@ -824,13 +835,6 @@ AC_CHECK_HEADER([paths.h],
 [HAVE_PATHS_H=])
 AC_SUBST(HAVE_PATHS_H)
 #
-# Define NO_GETTEXT if you don't want Git output to be translated.
-# A translated Git requires GNU libintl or another gettext implementation
-AC_CHECK_HEADER([libintl.h],
-[NO_GETTEXT=],
-[NO_GETTEXT=YesPlease])
-AC_SUBST(NO_GETTEXT)
-#
 # Define HAVE_LIBCHARSET_H if have libcharset.h
 AC_CHECK_HEADER([libcharset.h],
 [HAVE_LIBCHARSET_H=YesPlease],
-- 
1.7.9.1
Junio C Hamano· Feb 20, 2012, 08:34 UTC · re: John Szakmeister · lore

Re: [PATCH 0/1] Make libintl in libc detection more robust

John Szakmeister <john@szakmeister.net> writes:
> This is my first time submitting a patch to git.  I hope I've done
> things correctly!

Looks good, except for the subject line that would have been better to say something like:

    configure: don't use -lintl when there is no gettext support
I'll tweak the log message and queue.
Thanks.
John Szakmeister· Feb 20, 2012, 13:40 UTC · re: Junio C Hamano · lore

Re: [PATCH 0/1] Make libintl in libc detection more robust

On Mon, Feb 20, 2012 at 3:34 AM, Junio C Hamano <gitster@pobox.com> wrote:
Show 9 quoted lines
> John Szakmeister <john@szakmeister.net> writes:
>
>> This is my first time submitting a patch to git.  I hope I've done
>> things correctly!
>
> Looks good, except for the subject line that would have been better to say
> something like:
>
>    configure: don't use -lintl when there is no gettext support

You're right, that's much better. I'll keep your feedback in mind for next time.

> I'll tweak the log message and queue.
Thanks Junio!
-John

← back to recent threads