If your code is sensitive to the size of long long, can you use the predefine:
__SIZEOF_LONG_LONG__
If that doesn't work, then you can use:
gcc -dM -E - < /dev/null
to tell you what predefines a gcc compiler has (I would probably look for predefines more specific to what your code is sensitive to than look for a particular compiler).
I also wonder a little about your original problem statement since "%lld" should be a way to always print "long long" and if you have a matched set of compiler and library, then it should adjust both together. If you are using "%ld" instead, this works in situations where "long" is the same size as "long long" but may not work when these are different sizes.
--mev, Mike Vermeulen