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>
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)
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);
}
"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 }
};
"--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
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,
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
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)
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)