From 3cd6b337ea6399013060df8372edded055189aa0 Mon Sep 17 00:00:00 2001 From: Derek Atkins Date: Thu, 12 Jan 2006 22:47:08 +0000 Subject: [PATCH] * configure.in: fixes to make configure more quiet - move PKG_CONFIG check early in the process - use --silence-errors more * macros/pkg.m4: work around a pkg-config bug that outputs errors to stderr even when you tell it to output to stdout. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@12332 57a11ea4-9604-0410-9ed3-97b8803252fd --- ChangeLog | 6 +++++ configure.in | 42 +++++++++++++++++----------------- macros/pkg.m4 | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 89 insertions(+), 21 deletions(-) create mode 100644 macros/pkg.m4 diff --git a/ChangeLog b/ChangeLog index 281ce21b05..8428b12bbe 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,12 @@ * configure.in: add --enable-qof so build defaults to internal qof. + * configure.in: fixes to make configure more quiet + - move PKG_CONFIG check early in the process + - use --silence-errors more + * macros/pkg.m4: work around a pkg-config bug that outputs + errors to stderr even when you tell it to output to stdout. + 2006-01-10 David Hampton * src/gnome-utils/gnc-gnome-utils.c: diff --git a/configure.in b/configure.in index a4c51fddac..12c3c9606e 100644 --- a/configure.in +++ b/configure.in @@ -114,6 +114,21 @@ if test "x$ac_cv_header_ltdl_h" = xno; then AC_MSG_ERROR([Cannot find ltdl.h -- libtool-devel not installed?]) fi +### -------------------------------------------------------------------------- +### See if we have pkg-config + +AC_PATH_PROG(PKG_CONFIG,pkg-config) +if test "x$PKG_CONFIG" = x; then + # @*%&$ Ximian programmers renamed this application + AC_PATH_PROG(PKG_CONFIG,pkgconfig) + if test "x$PKG_CONFIG" = x; then + AC_MSG_ERROR([Could not find the pkg-config (or pkgconfig) program.],) + fi +fi + +### -------------------------------------------------------------------------- +### Glib checks.. + AM_PATH_GLIB_2_0(2.4.0,,AC_MSG_ERROR([ *** GLIB >= 2.4 is required to build Gnucash; please make sure you have the *** development headers installed. The latest version of GLIB is @@ -356,16 +371,7 @@ else fi ### -------------------------------------------------------------------------- -### See if we have pkg-config - -AC_PATH_PROG(PKG_CONFIG,pkg-config) -if test "x$PKG_CONFIG" = x; then - # @*%&$ Ximian programmers renamed this application - AC_PATH_PROG(PKG_CONFIG,pkgconfig) - if test "x$PKG_CONFIG" = x; then - AC_MSG_ERROR([Could not find the pkg-config (or pkgconfig) program.],) - fi -fi +### look for gconf PKG_CHECK_MODULES(GCONF, gconf-2.0 >= "2.0") AC_SUBST(GCONF_CFLAGS) @@ -417,11 +423,6 @@ AC_ARG_ENABLE(qof, AC_ARG_WITH(qof, [ --with-qof=path prefix for Query Object Framework - QOF (auto)]) QOF_REQUIRED=0.6.0 -AC_PATH_PROG(PKG_CONFIG, pkg-config, no) -if test pkg-config = no; then - AC_MSG_ERROR([Please install pkgconfig]) - exit 1 -fi if test "$gnc_enable_qof" = yes ; then AC_MSG_CHECKING([for QOF, version >= $QOF_REQUIRED]) if test "$withval" != "yes"; then @@ -509,14 +510,13 @@ dnl Q: What does PKG_CHECK_MODULES create? dnl A: Just _CFLAGS and _LIBS, apparently [pkg.m4] dnl $4=true => don't die in case of failure. -PKG_CHECK_MODULES(GSF, libgsf-1 >= 1.12.2 - libgsf-gnome-1 >= 1.12.2,,true) -if $PKG_CONFIG 'libgsf-1 >= 1.12.2' +PKG_CHECK_MODULES(GSF, libgsf-1 >= 1.12.2 libgsf-gnome-1 >= 1.12.2,,true) +if $PKG_CONFIG --silence-errors 'libgsf-1 >= 1.12.2' then AC_DEFINE(HAVE_LIBGSF,1,[System has libgsf-1.12.2 or better]) HAVE_LIBGSF=yes else - AC_MSG_NOTICE(using internally-packaged libgsf) + AC_MSG_RESULT(using internally-packaged libgsf) GSF_CFLAGS='-I${top_srcdir}/lib/libgsf-1.12.3' GSF_LIBS='${top_builddir}/lib/libgsf-1.12.3/gsf/libgsf-1.la' HAVE_LIBGSF=no @@ -527,12 +527,12 @@ AC_SUBST(GSF_LIBS) dnl $4=true => don't die if failure. PKG_CHECK_MODULES(GOFFICE, libgoffice-1 >= 0.0.4,,true) -if $PKG_CONFIG 'libgoffice-1 >= 0.0.4' +if $PKG_CONFIG --silence-errors 'libgoffice-1 >= 0.0.4' then AC_DEFINE(HAVE_GOFFICE,1,[System has goffice-0.0.4 or better]) HAVE_GOFFICE=yes else - AC_MSG_NOTICE(using internally-packaged goffice) + AC_MSG_RESULT(using internally-packaged goffice) GOFFICE_CFLAGS='-I${top_srcdir}/lib/goffice-0.0.4' GOFFICE_LIBS='${top_builddir}/lib/goffice-0.0.4/goffice/libgoffice-1.la' HAVE_GOFFICE=no diff --git a/macros/pkg.m4 b/macros/pkg.m4 new file mode 100644 index 0000000000..0f8f844ae7 --- /dev/null +++ b/macros/pkg.m4 @@ -0,0 +1,62 @@ +dnl This was originally from pkgconfig +dnl modified for GnuCash to make it more quiet +dnl in the face of missing config files. +dnl also, pkg-config --errors-to-stdout does not work as advertized on FC3 +dnl so we need to redirect stderr to stdout. + +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 + + if test -z "$PKG_CONFIG"; then + AC_PATH_PROG(PKG_CONFIG, pkg-config, no) + fi + + if test "$PKG_CONFIG" = "no" ; then + echo "*** The pkg-config script could not be found. Make sure it is" + echo "*** in your path, or set the PKG_CONFIG environment variable" + echo "*** to the full path to pkg-config." + echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." + else + PKG_CONFIG_MIN_VERSION=0.9.0 + if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then + AC_MSG_CHECKING(for $2) + + if $PKG_CONFIG --silence-errors --exists "$2" ; then + AC_MSG_RESULT(yes) + succeeded=yes + + AC_MSG_CHECKING($1_CFLAGS) + $1_CFLAGS=`$PKG_CONFIG --cflags "$2"` + AC_MSG_RESULT($$1_CFLAGS) + + AC_MSG_CHECKING($1_LIBS) + $1_LIBS=`$PKG_CONFIG --libs "$2"` + AC_MSG_RESULT($$1_LIBS) + else + $1_CFLAGS="" + $1_LIBS="" + ## 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" 2>&1` + ifelse([$4], ,echo $$1_PKG_ERRORS,) + fi + + AC_SUBST($1_CFLAGS) + AC_SUBST($1_LIBS) + else + echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." + echo "*** See http://www.freedesktop.org/software/pkgconfig" + fi + fi + + if test $succeeded = yes; then + ifelse([$3], , :, [$3]) + else + ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4]) + fi +]) + +