Bug 833 - fixes for msvc users
Summary: fixes for msvc users
Alias: None
Product: pkg-config
Classification: Unclassified
Component: src (show other bugs)
Version: unspecified
Hardware: x86 (IA32) Windows (All)
: high normal
Assignee: Tollef Fog Heen
QA Contact:
URL: http://severna.homeip.net/gtk-win32.html
Depends on:
Reported: 2004-07-06 18:02 UTC by Todd Fisher
Modified: 2012-05-29 17:22 UTC (History)
0 users

See Also:
i915 platform:
i915 features:

a patch to allow pkg-config to be compilied with msvc (26.12 KB, patch)
2004-07-06 18:03 UTC, Todd Fisher
Details | Splinter Review
alloca support in msvc C library via malloc.h (18.58 KB, patch)
2004-07-27 13:16 UTC, Todd Fisher
Details | Splinter Review

Description Todd Fisher 2004-07-06 18:02:11 UTC
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.
Comment 1 Todd Fisher 2004-07-06 18:03:21 UTC
Created attachment 447 [details] [review]
a patch to allow pkg-config to be compilied with msvc
Comment 2 Todd Fisher 2004-07-27 13:16:26 UTC
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
Comment 3 Carlo Bramini 2009-03-31 02:35:02 UTC
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.
Comment 4 Dan Nicholson 2012-05-29 17:22:25 UTC
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.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.