1 diff --git a/libpkgconf.pc.in b/libpkgconf.pc.in
2 index d278136e3..ef0c7db5f 100644
5 @@ -8,4 +8,4 @@ Description: a library for accessing and manipulating development framework conf
6 URL: http://github.com/pkgconf/pkgconf
7 Version: @PACKAGE_VERSION@
8 CFlags: -I${includedir}/pkgconf
9 -Libs: -L${libdir} -lpkgconf
10 +Libs: -L${libdir} -lpkgconf @build_static@
11 diff --git a/meson.build b/meson.build
12 index e7822b8da..8f7aa0075 100644
15 @@ -45,6 +45,13 @@ cdata.set('abs_top_builddir', meson.build_root())
19 +libtype = get_option('default_library')
20 +if libtype == 'static'
21 + build_static = '-DPKGCONFIG_IS_STATIC'
26 libpkgconf = library('pkgconf',
27 'libpkgconf/argvsplit.c',
29 @@ -60,7 +67,7 @@ libpkgconf = library('pkgconf',
33 - c_args: '-DLIBPKGCONF_EXPORT',
34 + c_args: ['-DLIBPKGCONF_EXPORT', build_static],
38 @@ -73,13 +80,16 @@ pkg.generate(libpkgconf,
39 url: 'http://github.com/pkgconf/pkgconf',
40 filebase : 'libpkgconf',
42 + extra_cflags : build_static
46 pkgconf_exe = executable('pkgconf',
49 'cli/renderer-msvc.c',
50 link_with : libpkgconf,
51 + c_args: build_static,
54 if get_option('tests')