If you just have an application using autoconf then you should simple
go and use the AC_SYS_LARGEFILE
macro - it will check whether
the current system needs some #define's to enable 64bit off_t and when
that is the case then it is enabled right away.
All other might want to check `man getconf`
as one can also
get a number of flags from them, e.g. `getconf LFS_LIBS`
and
the `getconf LFS_CFLAGS`
might be most helpful. These are
however the abbreviations found on gnu'ish systems, please check the
documentation for more portable ones.
$ getconf LFS_CFLAGS -D_FILE_OFFSET_BITS=64
When you are writing a library then it might be the best to follow the
style of GTK to just use off_t internally - that will allow you to
compile the library again with AC_SYS_LARGEFILE
. Use a 64bit
integer in the header that will be used also on systems that would not
seem to ever need. Even win32 happens to be 64bit wide when compiled on
an alpha processor.
If you still have some dependency on off_t in the exported interface of your binary or library then it is a good thing to mark that somewhere. And simply reject when software gets compiled with the wrong model than your library was compiled as:
# if _FILE_OFFSET_BITS+0 != 64 && MYLIB_FILE_OFFSET_BITS == 64 # error need to compile as largefile when using MYLIB # endif
See also: widely used AX_PREFIX_CONFIG_H