I am currently writing a C program that reads and writes files that might be over 2 GiB in size. On linux feature_test_macros(7) specifies:
Use the confstr interface or the corresponding getconf program and try the various _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS, etc. options until you find one that works. This will give you CFLAGS, LDFLAGS, and LIBS needed for an appropriate environment.
_CS_POSIX_V7_ILP32_OFFBIG_CFLAGS
CFLAGS
LDFLAGS
LIBS