Merge: nitc: check pkg-config packages availability later
authorJean Privat <jean@pryen.org>
Fri, 26 Jan 2018 21:12:15 +0000 (16:12 -0500)
committerJean Privat <jean@pryen.org>
Fri, 26 Jan 2018 21:12:15 +0000 (16:12 -0500)
commitbb5ac13ecaf7c5d2677bce450a118da01068fde1
tree71dbbd60d6e915613d9b606383f27bbdc7456bbc
parenta59e09668c0ed1f9ead39acb8a25e3840f3135a0
parenteff1d428bfcc3bad8422c27f9ade2870d05fa993
Merge: nitc: check pkg-config packages availability later

The `pkgconfig` annotation tells the compiler to use the `pkg-config` command in order to get the C compiler and linker options required to build the user C code. The availability of each package was tested twice, once at reading the annotation and once in the generated Makefile. This PR moves the first check later, with the generation of the Makefile. There is still two checks, one by the Nit compiler with a prettier output, and one by the Makefile in case it is distributed with the generated C source files.

This fixes an issue we've had when compiling for Android and iOS, where the result of the annotation was not used but still blocked the compilation if the host did not have the package. And leaving the check to the Makefile give a chance to the programmer to tweak it before the C compilation when cross-compiling.

The error message thrown by the Makefile is less user-friendly as we lose the reference to the Nit source file and line number. This should not be much on an issue since it is rarely a programming error, more of a system configuration error, but it could be improved upon if it becomes an issue.

Pull-Request: #2610
Reviewed-by: Jean Privat <jean@pryen.org>