From 3715fae2364d589fe46390ff08d8b824cb56815f Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 29 Jul 2012 03:20:24 -0500 Subject: [PATCH] main: move our actual version text to --about, make --version print pkg-config API version This improves compatibility with broken packages, but really, scripts should depend on: - --atleast-pkgconfig-version - --modversion pkg-config Anything else is just broken, but oh well. --- main.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/main.c b/main.c index f7175c8..c4ab74e 100644 --- a/main.c +++ b/main.c @@ -422,6 +422,12 @@ out: static void version(void) +{ + printf("%s\n", PKG_PKGCONFIG_VERSION_EQUIV); +} + +static void +about(void) { printf("%s %s%s\n", PACKAGE_NAME, PACKAGE_VERSION, HAVE_STRICT_MODE ? " [strict]" : " [pkg-config compatible]"); printf("Copyright (c) 2011 - 2012 pkgconf authors (see AUTHORS in documentation directory).\n\n"); @@ -500,9 +506,11 @@ main(int argc, char *argv[]) int want_cflags_I = 0; int want_cflags_other = 0; int want_list = 0; + int want_about = 0; struct pkg_option options[] = { { "version", no_argument, &want_version, 1, }, + { "about", no_argument, &want_about, 1, }, { "atleast-version", required_argument, NULL, 2, }, { "atleast-pkgconfig-version", required_argument, NULL, 3, }, { "libs", no_argument, &want_libs, 4, }, @@ -585,6 +593,12 @@ main(int argc, char *argv[]) else if (want_cflags_other) want_cflags = want_cflags_other; + if (want_about) + { + about(); + return EXIT_SUCCESS; + } + if (want_version) { version();