2001-06-05 Havoc Pennington <hp@redhat.com>

Author: hp
Date: 2001-06-05 18:41:27 GMT
2001-06-05  Havoc Pennington  <hp@redhat.com>

	* main.c: add --errors-to-stdout so you can capture them with backticks

	* pkg.m4: set FOO_PKG_ERRORS after a failed check, so people can
	print the errors.
This commit is contained in:
Arch Librarian 2005-07-14 13:04:10 +00:00
parent 282c3b775f
commit 1dd0d3d262
4 changed files with 32 additions and 6 deletions

View file

@ -1,5 +1,12 @@
2001-06-05 Havoc Pennington <hp@redhat.com>
* main.c: add --errors-to-stdout so you can capture them with backticks
* pkg.m4: set FOO_PKG_ERRORS after a failed check, so people can
print the errors.
2001-06-05 Havoc Pennington <hp@redhat.com>
* parse.c: never use flockfile, getc_unlocked
2001-06-05 Havoc Pennington <hp@redhat.com>

15
main.c
View file

@ -13,13 +13,15 @@
static int want_debug_spew = 0;
static int want_verbose_errors = 0;
static int want_stdout_errors = 0;
void
debug_spew (const char *format, ...)
{
va_list args;
gchar *str;
FILE* stream;
g_return_if_fail (format != NULL);
if (!want_debug_spew)
@ -29,8 +31,13 @@ debug_spew (const char *format, ...)
str = g_strdup_vprintf (format, args);
va_end (args);
fputs (str, stderr);
fflush (stdout);
if (want_stdout_errors)
stream = stdout;
else
stream = stderr;
fputs (str, stream);
fflush (stream);
g_free (str);
}
@ -193,6 +200,8 @@ main (int argc, char **argv)
"show verbose information about missing or conflicting packages" },
{ "silence-errors", 0, POPT_ARG_NONE, &want_silence_errors, 0,
"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" },
POPT_AUTOHELP
{ NULL, 0, 0, NULL, 0 }
};

View file

@ -83,6 +83,10 @@ option is only useful with options such as "--cflags" or
"--modversion" that print errors by default. The PKG_CONFIG_DEBUG_SPEW
environment variable overrides this option.
.TP
.I "--errors-to-stdout"
If printing errors, print them to stdout rather than the default stderr
.PP
The following options are used to compile and link programs:
.TP
@ -212,6 +216,8 @@ If a module is missing or has the wrong version, by default configure
will abort with a message. To replace the default action,
specify an ACTION-IF-NOT-FOUND. PKG_CHECK_MODULES will not print any
error messages if you specify your own ACTION-IF-NOT-FOUND.
However, it will set the variable MYSTUFF_PKG_ERRORS, which you can
use to display what went wrong.
.SH METADATA FILE SYNTAX
To add a library to the set of packages \fIpkg-config\fP knows about,

8
pkg.m4
View file

@ -1,6 +1,7 @@
dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
dnl also defines GSTUFF_PKG_ERRORS on error
AC_DEFUN(PKG_CHECK_MODULES,
[
succeeded=no
@ -16,6 +17,7 @@ AC_DEFUN(PKG_CHECK_MODULES,
else
if ! $PKG_CONFIG --atleast-pkgconfig-version 0.7.0; then
echo "*** Your version of pkg-config is too old. You need version 0.7.0 or newer."
echo "*** See http://www.freedesktop.org/software/pkgconfig"
else
AC_MSG_CHECKING(for $2)
@ -33,8 +35,10 @@ AC_DEFUN(PKG_CHECK_MODULES,
else
$1_CFLAGS=""
$1_LIBS=""
## If we have a custom action on failure, don't print errors
ifelse([$4], , $PKG_CONFIG --print-errors "$2",)
## If we have a custom action on failure, don't print errors, but
## do set a variable so people can do so.
$1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
ifelse([$4], ,echo $1_PKG_ERRORS,)
fi
AC_SUBST($1_CFLAGS)