From 1aa1db96e5c222802d4f785c2a831c8eeb9fdbb9 Mon Sep 17 00:00:00 2001 From: Arch Librarian Date: Thu, 14 Jul 2005 13:04:31 +0000 Subject: [PATCH] 2001-10-19 Tor Lillqvist Author: tml Date: 2001-10-18 22:39:22 GMT 2001-10-19 Tor Lillqvist * main.c: (Win32): Add option --dont-define-prefix on Windows. The option prevents pkg-config from automatically defining an overriding value for the "prefix" variable. Unless this option is used, set "prefix" to pkg-config's installation directory, i.e. assume that the packages whose configuration files are found in the same tree where pkg-config.exe itself is, also have been configured to use the same prefix. This means that a typical "developer package" containg a subtree of headers, libraries, etc, including .pc files, can be installed in any random location. As long as pkg-config.exe is installed the same tree, things just should work. * pkg-config.1: Document it. --- ChangeLog | 18 ++++++++++++++++++ main.c | 24 ++++++++++++++++++++++++ pkg-config.1 | 9 +++++++++ 3 files changed, 51 insertions(+) diff --git a/ChangeLog b/ChangeLog index 8558823..590365d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2001-10-19 Tor Lillqvist + + * main.c: (Win32): Add option --dont-define-prefix on Windows. The + option prevents pkg-config from automatically defining an + overriding value for the "prefix" variable. + + Unless this option is used, set "prefix" to pkg-config's + installation directory, i.e. assume that the packages whose + configuration files are found in the same tree where + pkg-config.exe itself is, also have been configured to use the + same prefix. This means that a typical "developer package" + containg a subtree of headers, libraries, etc, including .pc + files, can be installed in any random location. As long as + pkg-config.exe is installed the same tree, things just should + work. + + * pkg-config.1: Document it. + 2001-09-30 Tor Lillqvist Changes for "pure" Win32 (without Cygwin or similar) support. The diff --git a/main.c b/main.c index fddd326..0647e7f 100644 --- a/main.c +++ b/main.c @@ -14,6 +14,7 @@ static int want_debug_spew = 0; static int want_verbose_errors = 0; static int want_stdout_errors = 0; +static int dont_define_prefix = 0; void debug_spew (const char *format, ...) @@ -204,6 +205,10 @@ main (int argc, char **argv) "show verbose information about missing or conflicting packages" }, { "errors-to-stdout", 0, POPT_ARG_NONE, &want_stdout_errors, 0, "print errors from --print-errors to stdout not stderr" }, +#ifdef G_OS_WIN32 + { "dont-define-prefix", 0, POPT_ARG_NONE, &dont_define_prefix, 0, + "don't set the value of prefix based on where pkg-config.exe is installed" }, +#endif POPT_AUTOHELP { NULL, 0, 0, NULL, 0 } }; @@ -321,6 +326,25 @@ main (int argc, char **argv) return 1; } +#ifdef G_OS_WIN32 + if (!dont_define_prefix) + { + gchar *prefix = g_win32_get_package_installation_directory (PACKAGE " " VERSION, NULL); + gchar *p = prefix; + + /* Turn backslashes into slashes or poptParseArgvString() will eat + * them when ${prefix} has been expanded in parse_libs(). + */ + while (*p) + { + if (*p == '\\') + *p = '/'; + p++; + } + define_global_variable ("prefix", prefix); + } +#endif + package_init (); if (want_list) diff --git a/pkg-config.1 b/pkg-config.1 index 60930e9..7daabd8 100644 --- a/pkg-config.1 +++ b/pkg-config.1 @@ -167,6 +167,15 @@ constraint after each package name, for example: .fi Remember to use \-\-print-errors if you want error messages. +.TP +.I "--dont-define-prefix" +This option is available only on Windows and prevents \fIpkg-config\fP +from automatically setting the variable "prefix" as the same directory +where \fIpkg-config\fP was installed. (This directory is determined by +asking the system where \fIpkg-config.exe\fP is located, and if that +directory is called \fIbin\fP or \fIlib\fP, using its parent +directory, otherwise itself.) + .SH ENVIRONMENT VARIABLES .TP -- 2.39.5