I would like to use pkg-config to compile gtk+ application under windows using
pkg-config. Idly pkg-config would just check the environment variable CC or CXX
to determine if the compilier flags should be gnu style or msvc style. The first
part of my work was to get pkg-config compiling with msvc. To do so i had to
replace alloc since msvc doesn't have alloc. I'm sure it is possible to use an
alternate alloc implementation say from gettext, but I think it is ok to #ifdef
the use of alloc and malloc, to allow msvc to compile pkg-config.
The next part of the patch addresses the issue that libraries listed in the .pc
files don't specify whether or not they are named libpkg.lib or just pkg.lib so
if the user passes the --msvc-syntax flag and it is a win32 build then we scan
through the environment variable LIB checking each library to see if it exists
in that path as libpkg.lib or just pkg.lib to determine which one to return.
I've had much better success in this way and have been able to compile using
both gcc and msvc from one gnu make file.
Created attachment 447 [details] [review]
a patch to allow pkg-config to be compilied with msvc
Created attachment 530 [details] [review]
alloca support in msvc C library via malloc.h
I updated the patch to include support for alloca in win32. I didn't realize
the msvc c library includes an alloca function in malloc.h
pkg-config already compiles perfectly under Win32 (I did it).
Personally, I also do not agree with some hard-coded paths, they will most probably (or surely) break compatibility between cygwin and msys.
Unless you want to add support for the dual malloc/alloca solution (but I do not understand why you should need it...), in my opinion this bug should be rejected.
I'm pretty sure all the platform specific things have been shoved off onto glib, including alloca. I didn't test, but I think pkg-config should build fine from MSVC so long as a working glib is available. Please reopen if this if not the case.