{"thread":{"id":"29590","subject":"1.7.9, libcharset missing from EXTLIBS","startedAt":"2012-02-10T01:29:24Z","lastAt":"2012-02-12T16:23:36Z","messageCount":13,"participants":["Дилян Палаузов","Junio C Hamano","Ævar Arnfjörð Bjarmason","Jakub Narebski","Dilyan Palauzov","Erik Faye-Lund"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"184307","messageId":"4F3472F4.4060605@aegee.org","threadId":"29590","inReplyTo":null,"subject":"1.7.9, libcharset missing from EXTLIBS","fromName":"Дилян Палаузов","fromEmail":"dilyan.palauzov@aegee.org","sentAt":"2012-02-10T01:29:24Z","receivedAt":"2012-02-10T01:29:24Z","isPatch":false,"sender":{"key":"dilyan.palauzov@aegee.org","avatar":null},"body":"Hello,\n\ngit 1.7.9 makes use of libcharset and /Makefile contains:\n\nifdef HAVE_LIBCHARSET_H\n         BASIC_CFLAGS += -DHAVE_LIBCHARSET_H\nendif\n\nwhen building git-daemon., the compiler reports\nmake V=1\ncc  -I. -DUSE_LIBPCRE -pthread -DHAVE_PATHS_H -DHAVE_LIBCHARSET_H \n-DHAVE_DEV_TTY -DSHA1_HEADER='<openssl/sha.h>'  -DNO_STRLCPY -o \ngit-daemon -L/usr/lib64 -L/lib64  daemon.o libgit.a xdiff/lib.a  -lpcre \n-lz  -liconv  -lcrypto -pthread\n/tmp/ccvPEthi.ltrans0.ltrans.o: In function `main':\nccvPEthi.ltrans0.o:(.text.startup+0x59): undefined reference to \n`locale_charset'\ncollect2: ld returned 1 exit status\nmake: *** [git-daemon] Error 1\n\n\nand the problem is, that libcharset is not used when linking.  To solve \nthis, please replace the above extract from /Makefile with\n\nifdef HAVE_LIBCHARSET_H\n         BASIC_CFLAGS += -DHAVE_LIBCHARSET_H\n\tEXTLIBS += -lcharset\nendif\n\nСъс здраве\n   Дилян\n\n\nbegin:vcard\nfn;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=\n\t=D0=B2\nn;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\nemail;internet:dilyan.palauzov@aegee.org\ntel;home:+49-721-94193270\ntel;cell:+49-162-4091172\nnote:sip:8372@aegee.org\nversion:2.1\nend:vcard\n\n"},{"id":"184311","messageId":"7v1uq3toyq.fsf@alter.siamese.dyndns.org","threadId":"29590","inReplyTo":"4F3472F4.4060605@aegee.org","subject":"Re: 1.7.9, libcharset missing from EXTLIBS","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-02-10T02:13:49Z","receivedAt":"2012-02-10T02:13:49Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Дилян Палаузов  <dilyan.palauzov@aegee.org> writes:\n\n> Hello,\n>\n> git 1.7.9 makes use of libcharset and /Makefile contains:\n>\n> ifdef HAVE_LIBCHARSET_H\n>         BASIC_CFLAGS += -DHAVE_LIBCHARSET_H\n> endif\n> ...\n> and the problem is, that libcharset is not used when linking.  To\n> solve this, please replace the above extract from /Makefile with\n>\n> ifdef HAVE_LIBCHARSET_H\n>         BASIC_CFLAGS += -DHAVE_LIBCHARSET_H\n> \tEXTLIBS += -lcharset\n> endif\n\nThanks.\n\nWhat platform is this?  Is there a guarantee that any and all system that\nuse \"#include <libcharset.h>\" has to link with \"-lcharset\"?\n\nWhat I am wondering is there are systems that need to include the header,\nbut locale_charset() does not live in /lib/libcharset.a, in which case we\ncannot make HAVE_LIBCHARSET_H imply use of -lcharset.\n"},{"id":"184342","messageId":"CACBZZX45=mr=FMqFF+Pw4KPaDAtvs-ePLbFATpyFA93vSfZatw@mail.gmail.com","threadId":"29590","inReplyTo":"7v1uq3toyq.fsf@alter.siamese.dyndns.org","subject":"Re: 1.7.9, libcharset missing from EXTLIBS","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2012-02-10T10:06:43Z","receivedAt":"2012-02-10T10:06:43Z","isPatch":false,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"2012/2/10 Junio C Hamano <gitster@pobox.com>:\n> Дилян Палаузов  <dilyan.palauzov@aegee.org> writes:\n>\n>> Hello,\n>>\n>> git 1.7.9 makes use of libcharset and /Makefile contains:\n>>\n>> ifdef HAVE_LIBCHARSET_H\n>>         BASIC_CFLAGS += -DHAVE_LIBCHARSET_H\n>> endif\n>> ...\n>> and the problem is, that libcharset is not used when linking.  To\n>> solve this, please replace the above extract from /Makefile with\n>>\n>> ifdef HAVE_LIBCHARSET_H\n>>         BASIC_CFLAGS += -DHAVE_LIBCHARSET_H\n>>       EXTLIBS += -lcharset\n>> endif\n>\n> Thanks.\n>\n> What platform is this?  Is there a guarantee that any and all system that\n> use \"#include <libcharset.h>\" has to link with \"-lcharset\"?\n>\n> What I am wondering is there are systems that need to include the header,\n> but locale_charset() does not live in /lib/libcharset.a, in which case we\n> cannot make HAVE_LIBCHARSET_H imply use of -lcharset.\n\nI've had some similar (privately sent) bug reports about the i18n\nstuff from someone who built his own Linux distro.\n\nBasically we make assumptions that certain stuff will be in the C\nlibrary on certain platforms, certain headers go with certain\nlibraries etc.\n\nEvidently none of this can really be relied upon and we'd have to\nprobe for each one if we wanted to make it reliable.\n"},{"id":"184343","messageId":"4F34EF9D.8030509@aegee.org","threadId":"29590","inReplyTo":"CACBZZX45=mr=FMqFF+Pw4KPaDAtvs-ePLbFATpyFA93vSfZatw@mail.gmail.com","subject":"Re: 1.7.9, libcharset missing from EXTLIBS","fromName":"Дилян Палаузов","fromEmail":"dilyan.palauzov@aegee.org","sentAt":"2012-02-10T10:21:17Z","receivedAt":"2012-02-10T10:21:17Z","isPatch":false,"sender":{"key":"dilyan.palauzov@aegee.org","avatar":null},"body":"Hello,\n\n>> What platform is this?  Is there a guarantee that any and all system that\n>> use \"#include<libcharset.h>\" has to link with \"-lcharset\"?\n>\n> I've had some similar (privately sent) bug reports about the i18n\n> stuff from someone who built his own Linux distro.\n\nI run Linux from scratch.\n\n>> What I am wondering is there are systems that need to include the header,\n>> but locale_charset() does not live in /lib/libcharset.a, in which case we\n>> cannot make HAVE_LIBCHARSET_H imply use of -lcharset.\n\nI do not understand this.  If you want to use a function from \nlibcharset, you have to use both #include <libcharset.h> and -lcharset.\n\nСъс здраве\n   Дилян\n\nOn 10.02.2012 11:06, Ævar Arnfjörð Bjarmason wrote:\n> 2012/2/10 Junio C Hamano<gitster@pobox.com>:\n>> Дилян Палаузов<dilyan.palauzov@aegee.org>  writes:\n>>\n>>> Hello,\n>>>\n>>> git 1.7.9 makes use of libcharset and /Makefile contains:\n>>>\n>>> ifdef HAVE_LIBCHARSET_H\n>>>          BASIC_CFLAGS += -DHAVE_LIBCHARSET_H\n>>> endif\n>>> ...\n>>> and the problem is, that libcharset is not used when linking.  To\n>>> solve this, please replace the above extract from /Makefile with\n>>>\n>>> ifdef HAVE_LIBCHARSET_H\n>>>          BASIC_CFLAGS += -DHAVE_LIBCHARSET_H\n>>>        EXTLIBS += -lcharset\n>>> endif\n>>\n>> Thanks.\n>>\n>> What platform is this?  Is there a guarantee that any and all system that\n>> use \"#include<libcharset.h>\" has to link with \"-lcharset\"?\n>>\n>> What I am wondering is there are systems that need to include the header,\n>> but locale_charset() does not live in /lib/libcharset.a, in which case we\n>> cannot make HAVE_LIBCHARSET_H imply use of -lcharset.\n>\n> I've had some similar (privately sent) bug reports about the i18n\n> stuff from someone who built his own Linux distro.\n>\n> Basically we make assumptions that certain stuff will be in the C\n> library on certain platforms, certain headers go with certain\n> libraries etc.\n>\n> Evidently none of this can really be relied upon and we'd have to\n> probe for each one if we wanted to make it reliable.\n\n\nbegin:vcard\nfn;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=\n\t=D0=B2\nn;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\nemail;internet:dilyan.palauzov@aegee.org\ntel;home:+49-721-94193270\ntel;cell:+49-162-4091172\nnote:sip:8372@aegee.org\nversion:2.1\nend:vcard\n\n"},{"id":"184350","messageId":"m37gzuvni4.fsf@localhost.localdomain","threadId":"29590","inReplyTo":"CACBZZX45=mr=FMqFF+Pw4KPaDAtvs-ePLbFATpyFA93vSfZatw@mail.gmail.com","subject":"Re: 1.7.9, libcharset missing from EXTLIBS","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2012-02-10T13:15:34Z","receivedAt":"2012-02-10T13:15:34Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:\n> 2012/2/10 Junio C Hamano <gitster@pobox.com>:\n>> Дилян Палаузов  <dilyan.palauzov@aegee.org> writes:\n\n>>> git 1.7.9 makes use of libcharset and /Makefile contains:\n> >>\n>>> ifdef HAVE_LIBCHARSET_H\n>>>         BASIC_CFLAGS += -DHAVE_LIBCHARSET_H\n>>> endif\n>>> ...\n>>> and the problem is, that libcharset is not used when linking.  To\n>>> solve this, please replace the above extract from /Makefile with\n>>>\n>>> ifdef HAVE_LIBCHARSET_H\n>>>         BASIC_CFLAGS += -DHAVE_LIBCHARSET_H\n>>>         EXTLIBS += -lcharset\n>>> endif\n[....]\n> I've had some similar (privately sent) bug reports about the i18n\n> stuff from someone who built his own Linux distro.\n> \n> Basically we make assumptions that certain stuff will be in the C\n> library on certain platforms, certain headers go with certain\n> libraries etc.\n> \n> Evidently none of this can really be relied upon and we'd have to\n> probe for each one if we wanted to make it reliable.\n\nWell, there is always *optional* configure.ac to do detection;\n\"make configure; ./configure <options>\" will generate config.mak.autogen\nwith appropriate options -- we can add autodetection if -lcharset\nmust be added.\n\n-- \nJakub Narębski\n"},{"id":"184376","messageId":"7vipjer0yn.fsf@alter.siamese.dyndns.org","threadId":"29590","inReplyTo":"4F34EF9D.8030509@aegee.org","subject":"Re: 1.7.9, libcharset missing from EXTLIBS","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-02-10T18:35:12Z","receivedAt":"2012-02-10T18:35:12Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Дилян Палаузов <dilyan.palauzov@aegee.org> writes:\n\n>>> What I am wondering is there are systems that need to include the header,\n>>> but locale_charset() does not live in /lib/libcharset.a, in which case we\n>>> cannot make HAVE_LIBCHARSET_H imply use of -lcharset.\n>\n> I do not understand this.  If you want to use a function from\n> libcharset, you have to use both #include <libcharset.h> and\n> -lcharset.\n\nYou are mistaken.\n\nThe only constraint is that you have to \"#include <libcharset.h>\" and need\nto link with the library that has locale_charset() defined.  Does everybody\nhas that function in -lcharset, or a system you do not know have it in some\nother library?\n\nFor example, Msysgit part defines HAVE_LIBCHARSET_H but it apparently does\nnot need -lcharset. It could be that the port is incomplete, but another\npossibility is that perhaps the function is in part of libc and does not\neven need -lcharset passed to the linker.\n\nIf you look at our Makefile, you see \"On this platform foo() can be\nobtained by linking with -lfoo, but on this other platform you need to\nlink with -lbar\" gotchas around some libraries (e.g. ssl/crypto), and I am\nwondering if this function has a similar issue.\n"},{"id":"184384","messageId":"20120210205242.Horde.Ip6kLu3yGeFPNXWKXsdW3wA@webmail.aegee.org","threadId":"29590","inReplyTo":"7vipjer0yn.fsf@alter.siamese.dyndns.org","subject":"Re: 1.7.9, libcharset missing from EXTLIBS","fromName":"Dilyan Palauzov","fromEmail":"dilyan.palauzov@aegee.org","sentAt":"2012-02-10T19:52:42Z","receivedAt":"2012-02-10T19:52:42Z","isPatch":false,"sender":{"key":"dilyan.palauzov@aegee.org","avatar":null},"body":"Hello,\n\non my system locale_charset is included in libiconv as local symbol  \nand thus linking with -liconv is not sufficient.\n\n   nm /usr/lib64/libiconv.so.2.5.1 | grep locale\n   0000000000012694 t locale_charset\n\nwhereas in libcharset the symbol is global:\n\n   nm /usr/lib64/libcharset.so.1 |grep locale\n   0000000000000c50 T locale_charset\n\nlooking at libiconv-1.4/lib/Makefile.in there is written\n\nSOURCES = $(srcdir)/iconv.c $(srcdir)/../libcharset/lib/localcharset.c  \n$(srcdir)/relocatable.c\n\nOBJECTS = iconv.lo localcharset.lo relocatable.lo  \n$(OBJECTS_EXP_@WOE32DLL@) $(OBJECTS_RES_@WOE32@)\n\nlibiconv.la : $(OBJECTS)\n         $(LIBTOOL_LINK) $(CC) $(LDFLAGS) $(CFLAGS) -o libiconv.la  \n-rpath $(libdir) -version-info $(LIBICONV_VERSION_INFO) -no-undefined  \n$(OBJECTS)\n\nthis means, that libiconv.la includes $(OBJECTS) and thus  \nlibiconv-1.4/libcharset/lib/localecharset.c .\n\nIn libiconv-1.4/libcharset/lib/localecharset.c is written\n\n#ifdef STATIC\nSTATIC\n#endif\nconst char *\nlocale_charset (void) { ...}\n\nand the preliminary localcharset.o still has locale_charset as global symbol:\n\nlibiconv-1.14/lib/.libs # nm localcharset.o |grep locale\n0000000000000000 T locale_charset\n\nDigging further, in libiconv-1.4/include/iconv.h some functions are  \nprefixed with LIBICONV_DLL_EXPORTED , which is the same as\n#define LIBICONV_DLL_EXPORTED  \n__attribute__((__visibility__(\"default\"))) , all the rest including  \nlocale_charset is compiled with  \n__attribute__((__visibility__(\"hidden\"))), and hence locale_charset is  \nnot exported from libiconv.\n\nGreetings\n   Dilian\n\n\n----- Message from Дилян Палаузов <dilyan.palauzov@aegee.org> ---------\n    Date: Fri, 10 Feb 2012 02:29:24 +0100\n    From: Дилян Палаузов <dilyan.palauzov@aegee.org>\nSubject: 1.7.9, libcharset missing from EXTLIBS\n      To: git@vger.kernel.org\n\n\n> Hello,\n>\n> git 1.7.9 makes use of libcharset and /Makefile contains:\n>\n> ifdef HAVE_LIBCHARSET_H\n>         BASIC_CFLAGS += -DHAVE_LIBCHARSET_H\n> endif\n>\n> when building git-daemon., the compiler reports\n> make V=1\n> cc  -I. -DUSE_LIBPCRE -pthread -DHAVE_PATHS_H -DHAVE_LIBCHARSET_H  \n> -DHAVE_DEV_TTY -DSHA1_HEADER='<openssl/sha.h>'  -DNO_STRLCPY -o  \n> git-daemon -L/usr/lib64 -L/lib64  daemon.o libgit.a xdiff/lib.a   \n> -lpcre -lz  -liconv  -lcrypto -pthread\n> /tmp/ccvPEthi.ltrans0.ltrans.o: In function `main':\n> ccvPEthi.ltrans0.o:(.text.startup+0x59): undefined reference to  \n> `locale_charset'\n> collect2: ld returned 1 exit status\n> make: *** [git-daemon] Error 1\n>\n>\n> and the problem is, that libcharset is not used when linking.  To  \n> solve this, please replace the above extract from /Makefile with\n>\n> ifdef HAVE_LIBCHARSET_H\n>         BASIC_CFLAGS += -DHAVE_LIBCHARSET_H\n> \tEXTLIBS += -lcharset\n> endif\n>\n> Със здраве\n>   Дилян\n\n\n----- End message from Дилян Палаузов <dilyan.palauzov@aegee.org> -----\n"},{"id":"184388","messageId":"CABPQNSaj=-Rr8G0KDvvNJrGOZO2-fREjf=wgc9EiDc-JBRpmTQ@mail.gmail.com","threadId":"29590","inReplyTo":"20120210205242.Horde.Ip6kLu3yGeFPNXWKXsdW3wA@webmail.aegee.org","subject":"Re: 1.7.9, libcharset missing from EXTLIBS","fromName":"Erik Faye-Lund","fromEmail":"kusmabite@gmail.com","sentAt":"2012-02-10T20:10:20Z","receivedAt":"2012-02-10T20:10:20Z","isPatch":false,"sender":{"key":"kusmabite@gmail.com","avatar":"https://avatars.githubusercontent.com/u/47073?v=4"},"body":"2012/2/10 Dilyan Palauzov <Dilyan.Palauzov@aegee.org>:\n> Hello,\n>\n> on my system locale_charset is included in libiconv as local symbol and thus\n> linking with -liconv is not sufficient.\n>\n>  nm /usr/lib64/libiconv.so.2.5.1 | grep locale\n>  0000000000012694 t locale_charset\n>\n> whereas in libcharset the symbol is global:\n>\n>  nm /usr/lib64/libcharset.so.1 |grep locale\n>  0000000000000c50 T locale_charset\n>\n\nThis is from the import library for libiconv we use for Git for Windows:\n\n$ nm /mingw/lib/libiconv.dll.a | grep locale_charset\n00000000 I __imp__locale_charset\n00000000 T _locale_charset\n\nLooks pretty defined to me.\n"},{"id":"184393","messageId":"7vd39mph9x.fsf@alter.siamese.dyndns.org","threadId":"29590","inReplyTo":"7vipjer0yn.fsf@alter.siamese.dyndns.org","subject":"Re: 1.7.9, libcharset missing from EXTLIBS","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-02-10T20:25:46Z","receivedAt":"2012-02-10T20:25:46Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Дилян Палаузов <dilyan.palauzov@aegee.org> writes:\n>\n>>>> What I am wondering is there are systems that need to include the header,\n>>>> but locale_charset() does not live in /lib/libcharset.a, in which case we\n>>>> cannot make HAVE_LIBCHARSET_H imply use of -lcharset.\n>>\n>> I do not understand this.  If you want to use a function from\n>> libcharset, you have to use both #include <libcharset.h> and\n>> -lcharset.\n>\n> You are mistaken.\n>\n> The only constraint is that you have to \"#include <libcharset.h>\" and need\n> to link with the library that has locale_charset() defined.\n\nI think the follow-ups in this thread already demonstrated why it is an\ninsufficient solution to make HAVE_LIBCHARSET_H imply -lcharset.\n\nWe would instead need:\n\n\tifeq ($(uname_S),MyHomeBrewLinux)\n        \tHAVE_LIBCHARSET_H = YesPlease\n                EXTLIBS += -lcharset\n\tendif\n\nor\n\n\t# Define NEEDS_CHARSETLIB if you use HAVE_LIBCHARSET_H and\n        # need to link with -lcharset\n\tNEEDS_CHARSETLIB =\n\n\tifeq ($(uname_S),MyHomeBrewLinux)\n        \tHAVE_LIBCHARSET_H = YesPlease\n\t\tNEEDS_CHARSETLIB = YesPlease\n\tendif\n\n\tifdef NEEDS_CHARSETLIB\n        \tEXTLIBS += -lcharset\n\tendif        \n\nor something like that, I guess.\n"},{"id":"184496","messageId":"4F370DE5.70400@aegee.org","threadId":"29590","inReplyTo":"7vd39mph9x.fsf@alter.siamese.dyndns.org","subject":"Re: 1.7.9, libcharset missing from EXTLIBS","fromName":"Дилян Палаузов","fromEmail":"dilyan.palauzov@aegee.org","sentAt":"2012-02-12T00:55:01Z","receivedAt":"2012-02-12T00:55:01Z","isPatch":false,"sender":{"key":"dilyan.palauzov@aegee.org","avatar":null},"body":"Hello,\n\nplease consider the patch below as fix for the problem.  It checks if \nlocale_charset is not in libiconv, but in libcharset and in this case \nappends -lcharset to EXTLIBS.\n\nСъс здраве\n   Дилян\n\ndiff -u git-1.7.9.orig/config.mak.in git-1.7.9/config.mak.in\n--- git-1.7.9.orig/config.mak.in        2012-01-27 20:51:04.000000000 +0000\n+++ git-1.7.9/config.mak.in     2012-02-12 00:52:41.457968080 +0000\n@@ -74,3 +74,4 @@\n  NO_PTHREADS=@NO_PTHREADS@\n  PTHREAD_CFLAGS=@PTHREAD_CFLAGS@\n  PTHREAD_LIBS=@PTHREAD_LIBS@\n+LINK_CHARSET=@LINK_CHARSET@\ndiff -u git-1.7.9.orig/configure.ac git-1.7.9/configure.ac\n--- git-1.7.9.orig/configure.ac 2012-01-27 20:51:04.000000000 +0000\n+++ git-1.7.9/configure.ac      2012-02-12 00:44:29.222967868 +0000\n@@ -836,6 +836,18 @@\n  [HAVE_LIBCHARSET_H=YesPlease],\n  [HAVE_LIBCHARSET_H=])\n  AC_SUBST(HAVE_LIBCHARSET_H)\n+# Define LINK_LIBCHARSET if libiconv does not export the locale_charset \nsymbol\n+# and liblibcharset does\n+LINK_CHARSET=\n+AC_CHECK_LIB([iconv], [locale_charset],\n+       [],\n+       [AC_CHECK_LIB([charset], [locale_charset],\n+                     [LINK_CHARSET=Yes])\n+       ]\n+)\n+AC_SUBST(LINK_CHARSET)\n+\n+\n  #\n  # Define NO_STRCASESTR if you don't have strcasestr.\n  GIT_CHECK_FUNC(strcasestr,\ndiff -u git-1.7.9.orig/Makefile git-1.7.9/Makefile\n--- git-1.7.9.orig/Makefile     2012-01-27 20:51:04.000000000 +0000\n+++ git-1.7.9/Makefile  2012-02-12 00:35:23.982967555 +0000\n@@ -1692,6 +1692,9 @@\n\n  ifdef HAVE_LIBCHARSET_H\n         BASIC_CFLAGS += -DHAVE_LIBCHARSET_H\n+ifdef LINK_CHARSET\n+       EXTLIBS += -lcharset\n+endif\n  endif\n\n  ifdef HAVE_DEV_TTY\n\nOn 10.02.2012 21:25, Junio C Hamano wrote:\n> Junio C Hamano<gitster@pobox.com>  writes:\n>\n>> Дилян Палаузов<dilyan.palauzov@aegee.org>  writes:\n>>\n>>>>> What I am wondering is there are systems that need to include the header,\n>>>>> but locale_charset() does not live in /lib/libcharset.a, in which case we\n>>>>> cannot make HAVE_LIBCHARSET_H imply use of -lcharset.\n>>>\n>>> I do not understand this.  If you want to use a function from\n>>> libcharset, you have to use both #include<libcharset.h>  and\n>>> -lcharset.\n>>\n>> You are mistaken.\n>>\n>> The only constraint is that you have to \"#include<libcharset.h>\" and need\n>> to link with the library that has locale_charset() defined.\n>\n> I think the follow-ups in this thread already demonstrated why it is an\n> insufficient solution to make HAVE_LIBCHARSET_H imply -lcharset.\n>\n> We would instead need:\n>\n> \tifeq ($(uname_S),MyHomeBrewLinux)\n>          \tHAVE_LIBCHARSET_H = YesPlease\n>                  EXTLIBS += -lcharset\n> \tendif\n>\n> or\n>\n> \t# Define NEEDS_CHARSETLIB if you use HAVE_LIBCHARSET_H and\n>          # need to link with -lcharset\n> \tNEEDS_CHARSETLIB =\n>\n> \tifeq ($(uname_S),MyHomeBrewLinux)\n>          \tHAVE_LIBCHARSET_H = YesPlease\n> \t\tNEEDS_CHARSETLIB = YesPlease\n> \tendif\n>\n> \tifdef NEEDS_CHARSETLIB\n>          \tEXTLIBS += -lcharset\n> \tendif\n>\n> or something like that, I guess.\n>\n\n\nbegin:vcard\nfn;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=\n\t=D0=B2\nn;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\nemail;internet:dilyan.palauzov@aegee.org\ntel;home:+49-721-94193270\ntel;cell:+49-162-4091172\nnote:sip:8372@aegee.org\nversion:2.1\nend:vcard\n\n"},{"id":"184497","messageId":"CACBZZX4QB4yU5XKKSzUgrx-Q_-ehjjGQ-mdFLh0CNYZ2mx3siA@mail.gmail.com","threadId":"29590","inReplyTo":"4F370DE5.70400@aegee.org","subject":"Re: 1.7.9, libcharset missing from EXTLIBS","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2012-02-12T01:03:42Z","receivedAt":"2012-02-12T01:03:42Z","isPatch":false,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"2012/2/12 Дилян Палаузов <dilyan.palauzov@aegee.org>:\n\n\nThis looks good to me, could you please re-submit it as described in\nDocumentation/SubmittingPatches? I.e. with a signed-off-by etc.\n"},{"id":"184505","messageId":"7vfwegl4x8.fsf@alter.siamese.dyndns.org","threadId":"29590","inReplyTo":"4F370DE5.70400@aegee.org","subject":"Re: 1.7.9, libcharset missing from EXTLIBS","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-02-12T10:30:43Z","receivedAt":"2012-02-12T10:30:43Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Дилян Палаузов  <dilyan.palauzov@aegee.org> writes:\n\n> diff -u git-1.7.9.orig/config.mak.in git-1.7.9/config.mak.in\n> --- git-1.7.9.orig/config.mak.in        2012-01-27 20:51:04.000000000 +0000\n> +++ git-1.7.9/config.mak.in     2012-02-12 00:52:41.457968080 +0000\n> @@ -74,3 +74,4 @@\n>  NO_PTHREADS=@NO_PTHREADS@\n>  PTHREAD_CFLAGS=@PTHREAD_CFLAGS@\n>  PTHREAD_LIBS=@PTHREAD_LIBS@\n> +LINK_CHARSET=@LINK_CHARSET@\n> diff -u git-1.7.9.orig/configure.ac git-1.7.9/configure.ac\n> --- git-1.7.9.orig/configure.ac 2012-01-27 20:51:04.000000000 +0000\n> +++ git-1.7.9/configure.ac      2012-02-12 00:44:29.222967868 +0000\n> @@ -836,6 +836,18 @@\n>  [HAVE_LIBCHARSET_H=YesPlease],\n>  [HAVE_LIBCHARSET_H=])\n>  AC_SUBST(HAVE_LIBCHARSET_H)\n> +# Define LINK_LIBCHARSET if libiconv does not export the\n\nBecause the use of configure is optional in our build infrastructure, I\nwouldn't have objected if this comment were missing from configure.ac, but\nthe new variable *must* be described in Makefile (see the top 250 lines or\nso of that file).\n\nI also need to point out that LINK_LIBCHARSET does not sit very well with\nthe way how existing Makefile variables are named. Perhaps make the new\nvariable contain the necessary string (\"-lcharset\" in your case), and name\nit CHARSET_LIB or something?  By doing so, when we find a platform that\nhas the necessary locale_charset() not in libcharset.{a,so} but somewhere\nelse, e.g. libxyzzy.a, we can accomodate it with \"CHARSET_LIB = -lxyzzy\".\n\nThanks.  Also as Ævar pointed out, please do not forget to sign off your\npatch.\n"},{"id":"184519","messageId":"4F37E788.7030202@aegee.org","threadId":"29590","inReplyTo":"7vfwegl4x8.fsf@alter.siamese.dyndns.org","subject":"[PATCH] Re: 1.7.9, libcharset missing from EXTLIBS","fromName":"Дилян Палаузов","fromEmail":"dilyan.palauzov@aegee.org","sentAt":"2012-02-12T16:23:36Z","receivedAt":"2012-02-12T16:23:36Z","isPatch":true,"sender":{"key":"dilyan.palauzov@aegee.org","avatar":null},"body":"The function locale_charset might appear in libiconv as local symbol.  In\nthis case linking with -lcharset delivers locale_charset, when the function\nis exported from that library.  This patch defines a new Autoconf/make\nvariable CHARSET_LIB to contain the library exporting locale_charset and\nfixes configure.ac to fill CHARSET_LIB with \" -lcharset\", when\nlocale_charset is not exported from libiconv, but is exported from\nlibcharset, and amends EXTLIBS to include CHARSET_LIB when HAVE_LIBCHARSET_H\nis defined.\n\nSigned-off-by: Дилян Палаузов <git-dpa@aegee.org>\n---\n Makefile      |    6 ++++++\n config.mak.in |    1 +\n configure.ac  |   10 ++++++++++\n 3 files changed, 17 insertions(+), 0 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex 87fb30a..571d864 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -56,6 +56,11 @@ all::\n # FreeBSD can use either, but MinGW and some others need to use\n # libcharset.h's locale_charset() instead.\n #\n+# Define CHARSET_LIB to contain the additional library exporting the symbol\n+# locale_charset to link against.  configure.ac checks if locale_charset is\n+# exported from libiconv, if not, it checks if locale_charset is\nexported from\n+# libcharset and defines then CHARSET_LIB to -lcharset .\n+#\n # Define LIBC_CONTAINS_LIBINTL if your gettext implementation doesn't\n # need -lintl when linking.\n #\n@@ -1698,6 +1703,7 @@ endif\n\n ifdef HAVE_LIBCHARSET_H\n \tBASIC_CFLAGS += -DHAVE_LIBCHARSET_H\n+\tEXTLIBS +=$(CHARSET_LIB)\n endif\n\n ifdef HAVE_DEV_TTY\ndiff --git a/config.mak.in b/config.mak.in\nindex 10698c8..b2ba710 100644\n--- a/config.mak.in\n+++ b/config.mak.in\n@@ -74,3 +74,4 @@ SNPRINTF_RETURNS_BOGUS=@SNPRINTF_RETURNS_BOGUS@\n NO_PTHREADS=@NO_PTHREADS@\n PTHREAD_CFLAGS=@PTHREAD_CFLAGS@\n PTHREAD_LIBS=@PTHREAD_LIBS@\n+CHARSET_LIB=@CHARSET_LIB@\ndiff --git a/configure.ac b/configure.ac\nindex 630dbdd..1c21a5b 100644\n--- a/configure.ac\n+++ b/configure.ac\n@@ -836,6 +836,16 @@ AC_CHECK_HEADER([libcharset.h],\n [HAVE_LIBCHARSET_H=YesPlease],\n [HAVE_LIBCHARSET_H=])\n AC_SUBST(HAVE_LIBCHARSET_H)\n+# Define CHARSET_LIB if libiconv does not export the locale_charset symbol\n+# and libcharset does\n+CHARSET_LIB=\n+AC_CHECK_LIB([iconv], [locale_charset],\n+       [],\n+       [AC_CHECK_LIB([charset], [locale_charset],\n+                     [CHARSET_LIB=\" -lcharset\"])\n+       ]\n+)\n+AC_SUBST(CHARSET_LIB)\n #\n # Define NO_STRCASESTR if you don't have strcasestr.\n GIT_CHECK_FUNC(strcasestr,\n-- \n1.7.9\n\n\n\nOn 12.02.2012 11:30, Junio C Hamano wrote:\n> Дилян Палаузов  <dilyan.palauzov@aegee.org> writes:\n> \n>> diff -u git-1.7.9.orig/config.mak.in git-1.7.9/config.mak.in\n>> --- git-1.7.9.orig/config.mak.in        2012-01-27 20:51:04.000000000 +0000\n>> +++ git-1.7.9/config.mak.in     2012-02-12 00:52:41.457968080 +0000\n>> @@ -74,3 +74,4 @@\n>>  NO_PTHREADS=@NO_PTHREADS@\n>>  PTHREAD_CFLAGS=@PTHREAD_CFLAGS@\n>>  PTHREAD_LIBS=@PTHREAD_LIBS@\n>> +LINK_CHARSET=@LINK_CHARSET@\n>> diff -u git-1.7.9.orig/configure.ac git-1.7.9/configure.ac\n>> --- git-1.7.9.orig/configure.ac 2012-01-27 20:51:04.000000000 +0000\n>> +++ git-1.7.9/configure.ac      2012-02-12 00:44:29.222967868 +0000\n>> @@ -836,6 +836,18 @@\n>>  [HAVE_LIBCHARSET_H=YesPlease],\n>>  [HAVE_LIBCHARSET_H=])\n>>  AC_SUBST(HAVE_LIBCHARSET_H)\n>> +# Define LINK_LIBCHARSET if libiconv does not export the\n> \n> Because the use of configure is optional in our build infrastructure, I\n> wouldn't have objected if this comment were missing from configure.ac, but\n> the new variable *must* be described in Makefile (see the top 250 lines or\n> so of that file).\n> \n> I also need to point out that LINK_LIBCHARSET does not sit very well with\n> the way how existing Makefile variables are named. Perhaps make the new\n> variable contain the necessary string (\"-lcharset\" in your case), and name\n> it CHARSET_LIB or something?  By doing so, when we find a platform that\n> has the necessary locale_charset() not in libcharset.{a,so} but somewhere\n> else, e.g. libxyzzy.a, we can accomodate it with \"CHARSET_LIB = -lxyzzy\".\n> \n> Thanks.  Also as Ævar pointed out, please do not forget to sign off your\n> patch.\n\n\nbegin:vcard\nfn;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=\n\t=D0=B2\nn;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\nemail;internet:dilyan.palauzov@aegee.org\ntel;home:+49-721-94193270\ntel;cell:+49-162-4091172\nnote:sip:8372@aegee.org\nversion:2.1\nend:vcard\n\n"}]}