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

4 messages from 2012-02-18 to 2012-02-20. Participants: John Szakmeister, Junio C Hamano.
Thread: https://gitlist.dev/t/29662

## John Szakmeister, 2012-02-18 19:38

Subject: [PATCH 0/1] Make libintl in libc detection more robust
Message-ID: <1329593884-9999-1-git-send-email-john@szakmeister.net>
URL: https://gitlist.dev/e/1329593884-9999-1-git-send-email-john%40szakmeister.net

```
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, 2012-02-18 19:38

Subject: [PATCH 1/1] Don't append -lintl when there is no gettext support
Message-ID: <1329593884-9999-2-git-send-email-john@szakmeister.net>
URL: https://gitlist.dev/e/1329593884-9999-2-git-send-email-john%40szakmeister.net
In-Reply-To: <1329593884-9999-1-git-send-email-john@szakmeister.net>

```
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(-)

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, 2012-02-20 08:34

Subject: Re: [PATCH 0/1] Make libintl in libc detection more robust
Message-ID: <7vd399nbt2.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vd399nbt2.fsf%40alter.siamese.dyndns.org
In-Reply-To: <1329593884-9999-1-git-send-email-john@szakmeister.net>

```
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, 2012-02-20 13:40

Subject: Re: [PATCH 0/1] Make libintl in libc detection more robust
Message-ID: <CAEBDL5WzYFWdnF=pqHq3wc3GRU-pxS6=1Xw8LP=cogck8wYAAg@mail.gmail.com>
URL: https://gitlist.dev/e/CAEBDL5WzYFWdnF%3DpqHq3wc3GRU-pxS6%3D1Xw8LP%3Dcogck8wYAAg%40mail.gmail.com
In-Reply-To: <7vd399nbt2.fsf@alter.siamese.dyndns.org>

```
On Mon, Feb 20, 2012 at 3:34 AM, Junio C Hamano <gitster@pobox.com> wrote:
> 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

```
