[nautilus-actions] Review m4 GConf check macro behavior



commit ed14e600ad7ce0ac946223e880a0aa777fb530bc
Author: Pierre Wieser <pwieser trychlos org>
Date:   Thu Jan 30 19:48:24 2014 +0100

    Review m4 GConf check macro behavior

 ChangeLog                |    2 +
 configure.ac             |   22 +++----
 m4/na-check-for-gconf.m4 |  140 ++++++++++++++++++++++++++++------------------
 3 files changed, 96 insertions(+), 68 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 7b97d15..14e93a3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2014-01-30 Pierre Wieser <pwieser trychlos org>
 
+       * m4/na-check-for-gconf.m4: Review m4 GConf check macro behavior.
+
        * m4/na-maintainer-mode.m4: Renamed to m4/na-maintainer.m4.
        * m4/na-maintainer.m4: Macros are renamed as NA_MAINTAINER_xxxx.
 
diff --git a/configure.ac b/configure.ac
index 9b860bb..f3f3e2a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -71,6 +71,15 @@ AM_GLIB_GNU_GETTEXT
 # a counter of fatal warnings emitted
 let fma_fatal_count=0
 
+# we are using pkgconfig for all development libraries we need
+AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
+if test "${PKG_CONFIG}" = "no"; then
+       AC_MSG_ERROR([You need to install pkg-config])
+fi
+
+# Have and want GConf support ?
+NA_CHECK_FOR_GCONF
+
 ###
 
 AC_CONFIG_FILES([
@@ -111,19 +120,6 @@ AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
 # Enable deprecated functions ?
 NA_MAINTAINER_CHECK_FOR_DEPRECATED
 
-# Have and want GConf support ?
-NA_CHECK_FOR_GCONF
-
-# note that requiring through pkg-config the version number of the
-# nautilus-extension library actually returns the version number of
-# nautilus itself (e.g. 2.24.2) instead of the library version info
-# (1.1.0) ; for the usual final user, this is very analog to requiring
-# a whole gnome version
-AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
-if test "${PKG_CONFIG}" = "no"; then
-       AC_MSG_ERROR([You need to install pkg-config])
-fi
-
 # Oldest supported distribution: Ubuntu 10 LTS (Gnome 2.30): april 2013
 glib_required=2.24.0
 gtk_required=2.20.0
diff --git a/m4/na-check-for-gconf.m4 b/m4/na-check-for-gconf.m4
index 8f2369e..bfb1413 100644
--- a/m4/na-check-for-gconf.m4
+++ b/m4/na-check-for-gconf.m4
@@ -25,7 +25,90 @@
 #   Pierre Wieser <pwieser trychlos org>
 #   ... and many others (see AUTHORS)
 
-# serial 1 creation
+# serial 2 review the macro behavior
+
+dnl let the user choose whether to compile with GConf enabled
+dnl --enable-gconf
+dnl
+dnl defaults to automatically enable GConf if it is present on the
+dnl compiling system, or disable it if it is absent
+dnl if --enable-gconf is specified, then GConf subsystem must be present
+dnl
+dnl Please note that, from the packager point of view, we should have
+dnl both GConf2 and GConf2-devel package, in order to be able to build
+dnl and distribute the 'na-gconf' I/O provider
+
+AC_DEFUN([NA_CHECK_FOR_GCONF],[
+       AC_REQUIRE([_AC_NA_ARG_GCONF])dnl
+       AC_REQUIRE([_AC_NA_CHECK_GCONF])dnl
+])
+
+AC_DEFUN([_AC_NA_ARG_GCONF],[
+       AC_ARG_ENABLE(
+               [gconf],
+               AC_HELP_STRING(
+                       [--enable-gconf],
+                       [whether to enable GConf subsystem @<:@auto@:>@]),
+               [enable_gconf=$enableval],
+               [enable_gconf="auto"])
+])
+
+AC_DEFUN([_AC_NA_CHECK_GCONF],[
+       AC_MSG_CHECKING([whether GConf is enabled])
+       AC_MSG_RESULT([${enable_gconf}])
+       compile_with_gconf="no"
+
+       dnl if --enable-gconf is not specified, then we make the choice
+       dnl based on the presence of GConf subsystem (and development
+       dnl libraries)
+       if test "${enable_gconf}" = "auto"; then
+               AC_PATH_PROG([have_gconf],[gconftool-2],[yes],[no])
+               if test "${have_gconf}" = "yes"; then
+                       compile_with_gconf="yes"
+               fi
+
+       dnl if --enable-gconf is set to yes, then check that the subsystem
+       dnl is installed
+       else
+               if test "${enable_gconf}" = "yes"; then
+                       AC_PATH_PROG([have_gconf],[gconftool-2],[yes],[no])
+                       if test "${have_gconf}" = "no"; then
+                               AC_MSG_WARN([GConf2 subsystem is missing])
+                               let na_fatal_count+=1
+                       else
+                               compile_with_gconf="yes"
+                       fi
+               fi
+       fi
+
+       dnl if want to compile with GConf, then check that we have the
+       dnl development libraries
+
+       if test "${compile_with_gconf}" = "yes"; then
+               PKG_CHECK_MODULES([GCONF],
+                       [gconf-2.0 >= 2.8.0],[have_gconf_devel="yes"],[have_gconf_devel="no"])
+               if test "${have_gconf_devel}" = "no"; then
+                       if test "${enable_gconf}" != "auto"; then
+                               AC_MSG_WARN([GConf2 development libraries are missing. Please install 
GConf2-devel package])
+                               let na_fatal_count+=1
+                       fi
+                       compile_with_gconf="no"
+               else
+                       msg_gconf2_version=$(pkg-config --modversion gconf-2.0)
+               fi
+       fi
+
+       if test "${compile_with_gconf}" = "yes"; then
+               AC_SUBST([AM_CPPFLAGS],["${AM_CPPFLAGS} -DHAVE_GCONF"])
+               NAUTILUS_ACTIONS_CFLAGS="${NAUTILUS_ACTIONS_CFLAGS} ${GCONF_CFLAGS}"
+               NAUTILUS_ACTIONS_LIBS="${NAUTILUS_ACTIONS_LIBS} ${GCONF_LIBS}"
+               AC_DEFINE_UNQUOTED([HAVE_GCONF],[1],[Whether we compile against the GConf library])
+       fi
+
+       _NA_GCONF_SOURCE_2(["${compile_with_gconf}"])
+
+       AM_CONDITIONAL([HAVE_GCONF], [test "${compile_with_gconf}" = "yes"])
+])
 
 dnl pwi 2011-02-14
 dnl this is a copy of the original AM_GCONF_SOURCE_2 which is just a bit hacked
@@ -38,7 +121,7 @@ dnl  (i.e. pass to gconftool-2)
 dnl Defines GCONF_SCHEMA_FILE_DIR which is a filesystem directory where
 dnl  you should install foo.schemas files
 
-AC_DEFUN([NA_GCONF_SOURCE_2],
+AC_DEFUN([_NA_GCONF_SOURCE_2],
 [
        if test "$1" = "yes"; then
                if test "x$GCONF_SCHEMA_INSTALL_SOURCE" = "x"; then
@@ -89,56 +172,3 @@ AC_DEFUN([NA_GCONF_SOURCE_2],
       
   AM_CONDITIONAL([GCONF_SCHEMAS_INSTALL], [test "$enable_schemas_install" != no -a "$1" = "yes"])
 ])
-
-dnl let the user choose whether to compile with GConf enabled
-dnl --enable-gconf
-dnl
-dnl defaults to automatically enable GConf if it is present on the compiling
-dnl system, or disable it if it is absent
-dnl if --enable-gconf is specified, then GConf subsystem must be present
-
-AC_DEFUN([NA_CHECK_FOR_GCONF],[
-       AC_REQUIRE([_AC_NA_ARG_GCONF])dnl
-       AC_REQUIRE([_AC_NA_CHECK_GCONF])dnl
-])
-
-AC_DEFUN([_AC_NA_ARG_GCONF],[
-       AC_ARG_ENABLE(
-               [gconf],
-               AC_HELP_STRING(
-                       [--enable-gconf],
-                       [whether to enable GConf subsystem @<:@auto@:>@]
-               ),
-       [enable_gconf=$enableval],
-       [enable_gconf="auto"]
-       )
-])
-
-AC_DEFUN([_AC_NA_CHECK_GCONF],[
-       AC_MSG_CHECKING([whether GConf is enabled])
-       AC_MSG_RESULT([${enable_gconf}])
-
-       if test "${enable_gconf}" = "auto"; then
-               AC_PATH_PROG([GCONFTOOL],[gconftool-2],[no])
-               if test "${GCONFTOOL}" = "no"; then
-                       enable_gconf="no"
-               else
-                       enable_gconf="yes"
-               fi
-       else
-               if test "${enable_gconf}" = "yes"; then
-                       AC_PATH_PROG([GCONFTOOL],[gconftool-2],[no])
-                       if test "${GCONFTOOL}" = "no"; then
-                               AC_MSG_ERROR([gconftool-2: program not found])
-                       fi
-               fi
-       fi
-       
-       if test "${enable_gconf}" = "yes"; then
-               AC_SUBST([AM_CPPFLAGS],["${AM_CPPFLAGS} -DHAVE_GCONF"])
-               AC_DEFINE_UNQUOTED([HAVE_GCONF],[1],[Whether we compile against the GConf library])
-       fi
-
-       NA_GCONF_SOURCE_2(["${enable_gconf}"])
-       AM_CONDITIONAL([HAVE_GCONF], [test "${enable_gconf}" = "yes"])
-])


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]