FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Gentoo > Gentoo Development

 
 
LinkBack Thread Tools
 
Old 03-21-2011, 12:04 PM
Mike Frysinger
 
Default RFC: emboss.eclass as replacement for embassy.eclass

On Mon, Mar 21, 2011 at 6:37 AM, justin wrote:
> During closer investigation I found that it alos changes data width and
> similar. probably something which should be checked during configure.

oh god, this is why it burns

> AC_ARG_ENABLE(64,
> * AS_HELP_STRING([--enable-64], [64 bit pointers]))
> if test "${enable_64}" = "yes" ; then
> AC_MSG_CHECKING(for 64bit compilation support)
>
> dnl Test for Linux 64 bit
>
> if test "`uname`" = "Linux"; then
> CPPFLAGS="-DAJ_Linux64 $CPPFLAGS"
> fi

this all needs to be punted

> exmaple header:
>
>
> dnl Test for FreeBSD 64 bit
> #if !defined(AJ_LinuxLF) && !defined(AJ_SolarisLF) &&
> !defined(AJ_IRIXLF) && !defined(AJ_AIXLF) && !defined(AJ_HPUXLF) &&
> !defined(AJ_MACOSXLF) && !defined(AJ_FreeBSDLF) && !defined(WIN32)
> typedef int ajint;
> typedef long ajlong;
> typedef unsigned int ajuint;
> typedef short ajshort;
> typedef unsigned short ajushort;
> typedef unsigned long ajulong;
> #endif
>
>
> #ifdef AJ_LinuxLF
> #define HAVE64
> typedef int ajint;
> typedef long long ajlong;
> typedef unsigned int ajuint;
> typedef short ajshort;
> typedef unsigned short ajushort;
> typedef unsigned long long ajulong;
> #define ftell(a) ftello(a)
> #define fseek(a,b,c) fseeko(a,b,c)
> #endif

so it wants to normalize aj* types to a specific size. it'd make more
sense to include stdint.h and then do:
typedef int32_t ajint;
typedef int64_t ajlong;
typedef uint32_t ajuint;
typedef int16_t ajshort;
typedef uint16_t ajushort;
typedef uint64_t ajulong;

this should work for *all* targets

ftell vs ftello is a bit weirder. i'd say always call ftello() all
the time and let the off_t types worry about 32 bit vs 64 bit. so in
the configure script. do something like:
AC_CHECK_FUNCS([ftello fseeko])

then in the header:
#ifdef HAVE_FTELLO
#define ftell(a) ftello(a)
#endif
#ifdef HAVE_FSEEKO
#define fseek(a,b,c) fseeko(a,b,c)
#endif

and again, this should work for all targets, not just linux
-mike
 
Old 03-21-2011, 12:14 PM
Fabian Groffen
 
Default RFC: emboss.eclass as replacement for embassy.eclass

On 21-03-2011 09:04:24 -0400, Mike Frysinger wrote:
> ftell vs ftello is a bit weirder. i'd say always call ftello() all
> the time and let the off_t types worry about 32 bit vs 64 bit. so in
> the configure script. do something like:
> AC_CHECK_FUNCS([ftello fseeko])

FYI:
There is an AC_FUNC_FSEEKO macro, that is designed to deal with this
specifically, in case more is necessary.

> then in the header:
> #ifdef HAVE_FTELLO
> #define ftell(a) ftello(a)
> #endif
> #ifdef HAVE_FSEEKO
> #define fseek(a,b,c) fseeko(a,b,c)
> #endif
>
> and again, this should work for all targets, not just linux


--
Fabian Groffen
Gentoo on a different level
 
Old 03-21-2011, 12:20 PM
Mike Frysinger
 
Default RFC: emboss.eclass as replacement for embassy.eclass

On Mon, Mar 21, 2011 at 9:14 AM, Fabian Groffen wrote:
> On 21-03-2011 09:04:24 -0400, Mike Frysinger wrote:
>> ftell vs ftello is a bit weirder. *i'd say always call ftello() all
>> the time and let the off_t types worry about 32 bit vs 64 bit. *so in
>> the configure script. do something like:
>> AC_CHECK_FUNCS([ftello fseeko])
>
> FYI:
> There is an AC_FUNC_FSEEKO macro, that is designed to deal with this
> specifically, in case more is necessary.

thanks, i wasnt aware of that. that probably is much better than the
AC_CHECK_FUNCS invocation i posted above.
-mike
 
Old 03-27-2011, 02:34 PM
justin
 
Default RFC: emboss.eclass as replacement for embassy.eclass

So I need one last hint, how to correct following correctly?


#if defined (HAVE64) && !defined(AJ_MACOSXLF) && !defined(AJ_HPUXLF) &&
!defined(AJ_FreeBSDLF) && !defined(AJ_AIXLF)
struct dirent64 *dp;
#else
struct dirent *dp;
#endif

#if defined (HAVE64) && !defined(AJ_MACOSXLF) && !defined(AJ_HPUXLF) &&
!defined(AJ_FreeBSDLF) && !defined(AJ_AIXLF)
struct stat64 sbuf;
#else
struct stat sbuf;
#endif
 
Old 03-27-2011, 02:50 PM
Mike Frysinger
 
Default RFC: emboss.eclass as replacement for embassy.eclass

On Sun, Mar 27, 2011 at 10:34 AM, justin wrote:
> So I need one last hint, how to correct following correctly?
>
>
> #if defined (HAVE64) && !defined(AJ_MACOSXLF) && !defined(AJ_HPUXLF) &&
> !defined(AJ_FreeBSDLF) && !defined(AJ_AIXLF)
> * *struct dirent64 *dp;
> #else
> * *struct dirent *dp;
> #endif
>
> #if defined (HAVE64) && !defined(AJ_MACOSXLF) && !defined(AJ_HPUXLF) &&
> !defined(AJ_FreeBSDLF) && !defined(AJ_AIXLF)
> * *struct stat64 sbuf;
> #else
> * *struct stat sbuf;
> #endif

neither should be necessary with LFS. if you call
AC_USE_SYSTEM_EXTENSIONS or AC_SYS_LARGEFILE, the system will take
care of translating stat into stat64 as needed.

but in practice, i guess what they'll want to do is:
- call AC_USE_SYSTEM_EXTENSIONS at top of configure script
- add some AC_TRY_COMPILE's:
AC_CACHE_CHECK([for stat64], ac_cv_struct_stat64,
[AC_TRY_COMPILE([#include <sys/stat.h>],
[struct stat64 st],
ac_cv_struct_stat64=yes, ac_cv_struct_stat64=no)])
if test "x$ac_cv_struct_stat64" = xyes; then
AC_DEFINE(HAVE_STRUCT_STAT64)
fi
- change the code to look at HAVE_STRUCT_STAT64 instead of random
system defines

(largely untested :P)
-mike
 
Old 03-27-2011, 03:34 PM
justin
 
Default RFC: emboss.eclass as replacement for embassy.eclass

On 27/03/11 16:50, Mike Frysinger wrote:
> On Sun, Mar 27, 2011 at 10:34 AM, justin wrote:
>> So I need one last hint, how to correct following correctly?
>>
>>
>> #if defined (HAVE64) && !defined(AJ_MACOSXLF) && !defined(AJ_HPUXLF) &&
>> !defined(AJ_FreeBSDLF) && !defined(AJ_AIXLF)
>> struct dirent64 *dp;
>> #else
>> struct dirent *dp;
>> #endif
>>
>> #if defined (HAVE64) && !defined(AJ_MACOSXLF) && !defined(AJ_HPUXLF) &&
>> !defined(AJ_FreeBSDLF) && !defined(AJ_AIXLF)
>> struct stat64 sbuf;
>> #else
>> struct stat sbuf;
>> #endif
>
> neither should be necessary with LFS. if you call
> AC_USE_SYSTEM_EXTENSIONS or AC_SYS_LARGEFILE, the system will take
> care of translating stat into stat64 as needed.
>
> but in practice, i guess what they'll want to do is:
> - call AC_USE_SYSTEM_EXTENSIONS at top of configure script
> - add some AC_TRY_COMPILE's:
> AC_CACHE_CHECK([for stat64], ac_cv_struct_stat64,
> [AC_TRY_COMPILE([#include <sys/stat.h>],
> [struct stat64 st],
> ac_cv_struct_stat64=yes, ac_cv_struct_stat64=no)])
> if test "x$ac_cv_struct_stat64" = xyes; then
> AC_DEFINE(HAVE_STRUCT_STAT64)
> fi
> - change the code to look at HAVE_STRUCT_STAT64 instead of random
> system defines
>
> (largely untested :P)
> -mike
>

Thanks Mike,

compiletime and runtime tests are fine. I really owe you one!
 

Thread Tools




All times are GMT. The time now is 08:39 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org