This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Confused by gettext on cygwin


Robert Collins wrote:

>>-----Original Message-----
>>From: Charles S. Wilson [mailto:cwilson@ece.gatech.edu]
>>copy the "linux" or "official" gettext.h into 
>>/usr/share/gettext/intl on 
>>your cygwin system.  In fact, that may not be a bad idea in 
>>ALL cases, 
>>because if somebody builds your package on cygwin and DOESN't specify 
>>--with-included-gettext, then the build will use the 
>>/usr/include/gettext.h and /usr/lib/libintl.a -- so no problems: your 
>>"official" gettextized gettext.h won't even get used in that case.
>>
>>Hmmm...perhaps the cygwin gettext package should put the official 
>>gettext.h into /usr/share/gettext/intl, and only use the modified, 
>>DLL-supporting gettext.h for /usr/include...
>>
>>
> 
> Won't that fail to link? (ld finds the .dll not the static archive?)


No, it won't.  Let's consider each case, under the assumption that 
/usr/include/gettext.h is the cygwin-modified, dll-supporting version, 
and /usr/share/gettext/intl/gettext.h is the "official" version.

1) You want to build project "foo" which depends on gettext, and you do 
NOT specify --with-included-gettext (or foo doesn't include an embedded 
copy of the gettext source code).  Then, /usr/include/gettext.h is used, 
and /usr/lib/libintl.dll.a is used.  Since dllimport is the default in 
/usr/include/gettext.h, everything is fine.

1a) You want to build project "foo" which depends on gettext, and you do 
NOT specify --with-included-gettext (or foo doesn't include an embedded 
copy of the gettext source code). BUT, you want to link statically. 
Well, then again, /usr/include/gettext.h is used, but you must specify 
-DGETTEXT_STATIC.  Also, you must specify -static when linking, and then 
/usr/lib/libintl.a will be used (these additional flag requirements are 
"normal" for statically linking system libraries on cygwin)

2) You want to build project "foo" which depends on gettext, and you 
specify --with-included-gettext (and "foo" contains an embedded copy of 
the gettext source code).  Well, configure will set things up so that 
foo/intl is in the -I include path, and in the -L libsearch path before 
the system directories.  Since gettext builds as a static lib OOB, 
foo/intl/libintl.a will build okay, and will get used during the link 
process (ld searches the -L path IN ORDER, checking each directory for 
all possible library names -- libintl.dll.a, libintl.a, etc -- before 
moving to the next directory in the path.  Since foo/intl will precede 
/usr/lib in this configuration, foo/intl/libintl.a will be found before 
/usr/lib/libintl.dll.a).  Okay, so /foo/intl/gettext.h is used during 
compilation, and foo/intl/libintl.a is used during linking -- everything 
is fine.

Note that in cases 1) and 2), /usr/share/gettext/intl/gettext.h isn't 
used.  So it doesn't matter if that file is the cygwin-ized version, the 
official version, or my mother's recipe for broccoli quiche.

3) You want to gettextize a package -- say, "bar".  Well, gettextize 
ought to work the same on every platform.  So, since gettextizing uses 
the gettext.h in /usr/share/gettext/intl/, then that file should match 
the "official" version.  This will create a "bar" package identical to 
the one that would be created if it were gettextized on linux.  And as 
explained in 2), that gettextized "bar" package will build just fine.

Did I miss anything?

--Chuck



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]