All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Дилян Палаузов" <dilyan.palauzov@aegee.org>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: [PATCH] Re: 1.7.9, libcharset missing from EXTLIBS
Date: Sun, 12 Feb 2012 17:23:36 +0100	[thread overview]
Message-ID: <4F37E788.7030202@aegee.org> (raw)
In-Reply-To: <7vfwegl4x8.fsf@alter.siamese.dyndns.org>

[-- Attachment #1: Type: text/plain, Size: 4091 bytes --]

The function locale_charset might appear in libiconv as local symbol.  In
this case linking with -lcharset delivers locale_charset, when the function
is exported from that library.  This patch defines a new Autoconf/make
variable CHARSET_LIB to contain the library exporting locale_charset and
fixes configure.ac to fill CHARSET_LIB with " -lcharset", when
locale_charset is not exported from libiconv, but is exported from
libcharset, and amends EXTLIBS to include CHARSET_LIB when HAVE_LIBCHARSET_H
is defined.

Signed-off-by: Дилян Палаузов <git-dpa@aegee.org>
---
 Makefile      |    6 ++++++
 config.mak.in |    1 +
 configure.ac  |   10 ++++++++++
 3 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/Makefile b/Makefile
index 87fb30a..571d864 100644
--- a/Makefile
+++ b/Makefile
@@ -56,6 +56,11 @@ all::
 # FreeBSD can use either, but MinGW and some others need to use
 # libcharset.h's locale_charset() instead.
 #
+# Define CHARSET_LIB to contain the additional library exporting the symbol
+# locale_charset to link against.  configure.ac checks if locale_charset is
+# exported from libiconv, if not, it checks if locale_charset is
exported from
+# libcharset and defines then CHARSET_LIB to -lcharset .
+#
 # Define LIBC_CONTAINS_LIBINTL if your gettext implementation doesn't
 # need -lintl when linking.
 #
@@ -1698,6 +1703,7 @@ endif

 ifdef HAVE_LIBCHARSET_H
 	BASIC_CFLAGS += -DHAVE_LIBCHARSET_H
+	EXTLIBS +=$(CHARSET_LIB)
 endif

 ifdef HAVE_DEV_TTY
diff --git a/config.mak.in b/config.mak.in
index 10698c8..b2ba710 100644
--- a/config.mak.in
+++ b/config.mak.in
@@ -74,3 +74,4 @@ SNPRINTF_RETURNS_BOGUS=@SNPRINTF_RETURNS_BOGUS@
 NO_PTHREADS=@NO_PTHREADS@
 PTHREAD_CFLAGS=@PTHREAD_CFLAGS@
 PTHREAD_LIBS=@PTHREAD_LIBS@
+CHARSET_LIB=@CHARSET_LIB@
diff --git a/configure.ac b/configure.ac
index 630dbdd..1c21a5b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -836,6 +836,16 @@ AC_CHECK_HEADER([libcharset.h],
 [HAVE_LIBCHARSET_H=YesPlease],
 [HAVE_LIBCHARSET_H=])
 AC_SUBST(HAVE_LIBCHARSET_H)
+# Define CHARSET_LIB if libiconv does not export the locale_charset symbol
+# and libcharset does
+CHARSET_LIB=
+AC_CHECK_LIB([iconv], [locale_charset],
+       [],
+       [AC_CHECK_LIB([charset], [locale_charset],
+                     [CHARSET_LIB=" -lcharset"])
+       ]
+)
+AC_SUBST(CHARSET_LIB)
 #
 # Define NO_STRCASESTR if you don't have strcasestr.
 GIT_CHECK_FUNC(strcasestr,
-- 
1.7.9



On 12.02.2012 11:30, Junio C Hamano wrote:
> Дилян Палаузов  <dilyan.palauzov@aegee.org> writes:
> 
>> diff -u git-1.7.9.orig/config.mak.in git-1.7.9/config.mak.in
>> --- git-1.7.9.orig/config.mak.in        2012-01-27 20:51:04.000000000 +0000
>> +++ git-1.7.9/config.mak.in     2012-02-12 00:52:41.457968080 +0000
>> @@ -74,3 +74,4 @@
>>  NO_PTHREADS=@NO_PTHREADS@
>>  PTHREAD_CFLAGS=@PTHREAD_CFLAGS@
>>  PTHREAD_LIBS=@PTHREAD_LIBS@
>> +LINK_CHARSET=@LINK_CHARSET@
>> diff -u git-1.7.9.orig/configure.ac git-1.7.9/configure.ac
>> --- git-1.7.9.orig/configure.ac 2012-01-27 20:51:04.000000000 +0000
>> +++ git-1.7.9/configure.ac      2012-02-12 00:44:29.222967868 +0000
>> @@ -836,6 +836,18 @@
>>  [HAVE_LIBCHARSET_H=YesPlease],
>>  [HAVE_LIBCHARSET_H=])
>>  AC_SUBST(HAVE_LIBCHARSET_H)
>> +# Define LINK_LIBCHARSET if libiconv does not export the
> 
> Because the use of configure is optional in our build infrastructure, I
> wouldn't have objected if this comment were missing from configure.ac, but
> the new variable *must* be described in Makefile (see the top 250 lines or
> so of that file).
> 
> I also need to point out that LINK_LIBCHARSET does not sit very well with
> the way how existing Makefile variables are named. Perhaps make the new
> variable contain the necessary string ("-lcharset" in your case), and name
> it CHARSET_LIB or something?  By doing so, when we find a platform that
> has the necessary locale_charset() not in libcharset.{a,so} but somewhere
> else, e.g. libxyzzy.a, we can accomodate it with "CHARSET_LIB = -lxyzzy".
> 
> Thanks.  Also as Ævar pointed out, please do not forget to sign off your
> patch.

[-- Attachment #2: dilyan_palauzov.vcf --]
[-- Type: text/x-vcard, Size: 381 bytes --]

begin:vcard
fn;quoted-printable:=D0=94=D0=B8=D0=BB=D1=8F=D0=BD =D0=9F=D0=B0=D0=BB=D0=B0=D1=83=D0=B7=D0=BE=
	=D0=B2
n;quoted-printable;quoted-printable:=D0=9F=D0=B0=D0=BB=D0=B0=D1=83=D0=B7=D0=BE=D0=B2;=D0=94=D0=B8=D0=BB=D1=8F=D0=BD
email;internet:dilyan.palauzov@aegee.org
tel;home:+49-721-94193270
tel;cell:+49-162-4091172
note:sip:8372@aegee.org
version:2.1
end:vcard


  reply	other threads:[~2012-02-12 16:23 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-10  1:29 1.7.9, libcharset missing from EXTLIBS Дилян Палаузов
2012-02-10  2:13 ` Junio C Hamano
2012-02-10 10:06   ` Ævar Arnfjörð Bjarmason
2012-02-10 10:21     ` Дилян Палаузов
2012-02-10 18:35       ` Junio C Hamano
2012-02-10 19:52         ` Dilyan Palauzov
2012-02-10 20:10           ` Erik Faye-Lund
2012-02-10 20:25         ` Junio C Hamano
2012-02-12  0:55           ` Дилян Палаузов
2012-02-12  1:03             ` Ævar Arnfjörð Bjarmason
2012-02-12 10:30             ` Junio C Hamano
2012-02-12 16:23               ` Дилян Палаузов [this message]
2012-02-10 13:15     ` Jakub Narebski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F37E788.7030202@aegee.org \
    --to=dilyan.palauzov@aegee.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.