main: add pkg-config compat stubs

feature/tap-sh
William Pitcock 2011-07-25 00:36:57 -05:00
parent 02f7f67335
commit faf2926f27
1 changed files with 13 additions and 0 deletions

13
main.c
View File

@ -25,11 +25,16 @@
#include "pkg.h" #include "pkg.h"
/* we are compatible with 0.26 of pkg-config */
#define PKGCONFIG_VERSION_EQUIV "0.26"
static int want_version = 0; static int want_version = 0;
static int want_cflags = 0; static int want_cflags = 0;
static int want_libs = 0; static int want_libs = 0;
static int want_modversion = 0; static int want_modversion = 0;
static char *required_pkgconfig_version = NULL;
static void static void
print_cflags(pkg_t *pkg, void *unused) print_cflags(pkg_t *pkg, void *unused)
{ {
@ -125,10 +130,13 @@ main(int argc, const char *argv[])
struct poptOption options[] = { struct poptOption options[] = {
{ "version", 0, POPT_ARG_NONE, &want_version, 0, "output pkgconf version" }, { "version", 0, POPT_ARG_NONE, &want_version, 0, "output pkgconf version" },
{ "atleast-pkgconfig-version", 0, POPT_ARG_STRING, &required_pkgconfig_version, 0, "require compatibility level with specified version of pkg-config" },
{ "libs", 0, POPT_ARG_NONE, &want_libs, 0, "output all linker flags" }, { "libs", 0, POPT_ARG_NONE, &want_libs, 0, "output all linker flags" },
{ "cflags", 0, POPT_ARG_NONE, &want_cflags, 0, "output all compiler flags" }, { "cflags", 0, POPT_ARG_NONE, &want_cflags, 0, "output all compiler flags" },
{ "modversion", 0, POPT_ARG_NONE, &want_modversion, 0, "output package version" }, { "modversion", 0, POPT_ARG_NONE, &want_modversion, 0, "output package version" },
{ "exists", 0, POPT_ARG_NONE, NULL, 0, "return 0 if all packages present" }, { "exists", 0, POPT_ARG_NONE, NULL, 0, "return 0 if all packages present" },
{ "print-errors", 0, POPT_ARG_NONE, NULL, 0, "dummy option for pkg-config compatibility" },
{ "short-errors", 0, POPT_ARG_NONE, NULL, 0, "dummy option for pkg-config compatibility" },
POPT_AUTOHELP POPT_AUTOHELP
{ NULL, 0, 0, NULL, 0 } { NULL, 0, 0, NULL, 0 }
}; };
@ -149,6 +157,11 @@ main(int argc, const char *argv[])
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
if (required_pkgconfig_version != NULL)
{
return 0;
}
while (1) while (1)
{ {
const char *package = poptGetArg(opt_context); const char *package = poptGetArg(opt_context);