Igor Marnat wrote:
Hello Frank! Thank you for your answer, sorry for delay, I was out of the city.
FH> More C sillyness IMHO. Do you know of any conditionals we could use FH> to check for uClibc (or more generally, to find out if FH> _FILE_OFFSET_BITS=64 will work)? If so, we might be able to do FH> something like this:
FH> #include <foo>
FH> #if <blah> FH> #define _LARGEFILE64_SOURCE FH> #define _FILE_OFFSET_BITS 64 FH> #endif
FH> #include <actual headers>
As far as I know, there are two main C libraries at the moment: glibc for usual platforms and uClibc for embedded platforms. Both of them contain file <source_dir>/include/features.h. In uClibc there is macro __UCLIBC__ defined in this file. It is possible to turn off large file support in uClibc, whereas in glibc it is always on (if GNU_SOURCE is defined). Anyway, in uClibc sources in file include/features.h there are two macros: __UCLIBC__ allows to determine if uClibc is in use, and __UCLIBC_HAS_LFS__ allows to determine if large file support is turned on. Is it possible to take them in consideration to make GPC more suitable for embedded platforms?
So you might want to try adding an autoconf check for <features.h>, and changing rts/rts.h to something like:
#ifdef HAVE_FEATURES_H #include <features.h> #endif
#if !defined (__UCLIBC__) || defined (__UCLIBC_HAS_LFS__) [ ... _LARGEFILE64_SOURCE etc. defines ... ] #endif
If this works, send me a patch so I can integrate it.
However, I generally don't like system-specific code (as opposed to feature-specific code). So if you find any macros with more general names, I'd strongly prefer them instead.
Igor Marnat wrote:
Anyway, if exist C libraries where large-file-support may be turned off then GPC should consider such possibility, otherwise it will restrict library usage.
Ideally, we should cater for all of them with generic (combinations of) macros, if anyone knows such a thing ...
Frank