How can I test for the size of the mint type at compile time?

It is useful to know the size of LibraryLink's mint type at compile time, for interoperability with other libraries. For example, should I use the MLPutInteger32 or MLPutInteger64 MathLink call to send a mint?

How can I find out the size of mint at compile time?

The MINT_32 macro will be defined if sizeof(mint) == 4 (i.e. if mint is 32-bit). So simply use
#ifdef MINT_32

It is the CCompilerDriver package that ensures that this macro is defined when necessary, by adding -DMINT_32 to the compiler command. If you compile manually, without using functions like CreateLibrary, it will be your responsibility to define it when appropriate.