How to detect whether we have a native toolchain configured?

I have a build that includes some JNI and we check in the libraries with the code (I know, I know). Historically, the native part was built by Make and the Java part was built by Ant, requiring the cumbersome ant classes ; make install ; ant test invocation if you want to test the latest JNI code.

I have migrated it to Gradle and now the build can proceed in one step. The problem is that not all development machines have a native compiler, so I have added a project property to skip the JNI part and use the checked-in libs.

As a usability enhancement, I’d like to default the project property to skipping the native part if the build when no C toolchains can be configured, and running it when C compiler is detected.

The thing is that I can’t find a good way to detect whether a toolchain has been configured, as the declarative nature of the native model seems to imply that it may happen at any time.

Thanks for any tips.