[nautilus-actions] Define --enable-gconf configure option



commit 41498459605a9b3087ecb4e72ec7aa9b78e2e476
Author: Pierre Wieser <pwieser trychlos org>
Date:   Tue Feb 15 00:51:35 2011 +0100

    Define --enable-gconf configure option
    
    + Define HAVE_GCONF conditional.

 ChangeLog                      |    8 ++
 configure.ac                   |   11 +--
 data/gconf-schemas/Makefile.am |    6 ++-
 m4/na-check-for-gconf.m4       |  142 ++++++++++++++++++++++++++++++++++++++++
 m4/na-enable-manuals.m4        |    1 -
 5 files changed, 158 insertions(+), 10 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index ae8a4bb..201a9f3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2011-02-14 Pierre Wieser <pwieser trychlos org>
 
+	Add --enable-gconf configure argument
+	Define HAVE_GCONF conditional
+
+	* m4/na-check-for-gconf.m4: New file.
+
+	* configure.ac:
+	* data/gconf-schemas/Makefile.am: Updated accordingly.
+
 	Only GConf writing operations are marked deprecated
 
 	* src/api/na-gconf-monitor.h:
diff --git a/configure.ac b/configure.ac
index 95837a7..fb5bc97 100644
--- a/configure.ac
+++ b/configure.ac
@@ -111,10 +111,8 @@ AC_SUBST([GETTEXT_PACKAGE])
 AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["${GETTEXT_PACKAGE}"],[gettext package])
 AM_GLIB_GNU_GETTEXT
 
-# GConf support
-AC_PATH_PROG([GCONFTOOL],[gconftool-2],[no])
-AM_GCONF_SOURCE_2
-AC_DEFINE_UNQUOTED([HAVE_GCONF],[1],[Whether we compile against the GConf library])
+# 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
@@ -191,10 +189,6 @@ AC_DEFINE_UNQUOTED([NA_CONFIG_OPTIONS],["$0 ${config_options}"],["Configure opti
 
 AC_OUTPUT
 
-if test "x${enable_schemas_install}" = "xno"; then
-	msg_schemas_install="disabled"; else
-	msg_schemas_install="enabled in ${GCONF_SCHEMA_FILE_DIR}"
-fi
 msg_gtk_doc=`if test "x${enable_gtk_doc}" = "xno"; then echo "disabled"; else echo "enabled"; fi`
 msg_gtk_version=""
 if test "${have_gtk3}" = "yes"; then msg_gtk_version="Gtk+ 3.0"; 
@@ -207,6 +201,7 @@ $as_echo "
 	Nautilus extensions directory   ${with_nautilus_extdir}
 	Gtk+ version                    ${msg_gtk_version}
 	Default I/O provider            ${with_default_io_provider}
+	GConf enabled                   ${enable_gconf}
 	GConf schemas installation      ${msg_schemas_install}
 	Maintainer mode                 ${msg_maintainer_mode}
 	API Reference generation        ${msg_gtk_doc}
diff --git a/data/gconf-schemas/Makefile.am b/data/gconf-schemas/Makefile.am
index d422837..bb74698 100644
--- a/data/gconf-schemas/Makefile.am
+++ b/data/gconf-schemas/Makefile.am
@@ -26,6 +26,8 @@
 #   Pierre Wieser <pwieser trychlos org>
 #   ... and many others (see AUTHORS)
 
+if HAVE_GCONF
+
 schemas_in_files = \
 	nautilus-actions-prefs.schemas.in					\
 	nautilus-actions-confs.schemas.in					\
@@ -34,7 +36,7 @@ schemas_in_files = \
 schemas_files = $(schemas_in_files:.schemas.in=.schemas)
 
 nautilus-actions-confs.schemas.in:
-	$(top_srcdir)/src/utils/nautilus-actions-schemas -s > $@
+	$(top_srcdir)/src/utils/na-print-schemas -s > $@
 
 schemasdir = $(pkgdatadir)/gconf-schemas
 
@@ -73,3 +75,5 @@ uninstall-hook:
 			GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) --makefile-uninstall-rule $$p; \
 		done \
 	fi
+
+endif
diff --git a/m4/na-check-for-gconf.m4 b/m4/na-check-for-gconf.m4
new file mode 100644
index 0000000..6b1a962
--- /dev/null
+++ b/m4/na-check-for-gconf.m4
@@ -0,0 +1,142 @@
+# Nautilus-Actions
+# A Nautilus extension which offers configurable context menu actions.
+#
+# Copyright (C) 2005 The GNOME Foundation
+# Copyright (C) 2006, 2007, 2008 Frederic Ruaudel and others (see AUTHORS)
+# Copyright (C) 2009, 2010, 2011 Pierre Wieser and others (see AUTHORS)
+#
+# This Program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This Program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with this Library; see the file COPYING.  If not,
+# write to the Free Software Foundation, Inc., 59 Temple Place,
+# Suite 330, Boston, MA 02111-1307, USA.
+#
+# Authors:
+#   Frederic Ruaudel <grumz grumz net>
+#   Rodrigo Moya <rodrigo gnome-db org>
+#   Pierre Wieser <pwieser trychlos org>
+#   ... and many others (see AUTHORS)
+
+# serial 1 creation
+
+dnl pwi 2011-02-14
+dnl this is a copy of the original AM_GCONF_SOURCE_2 which is just a bit hacked
+dnl in order to define the conditionals event when we want disabled GConf
+dnl syntax: NA_GCONF_SOURCE_2([have_gconf])
+dnl
+dnl AM_GCONF_SOURCE_2
+dnl Defines GCONF_SCHEMA_CONFIG_SOURCE which is where you should install schemas
+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],
+[
+	if test "$1" = "yes"; then
+		if test "x$GCONF_SCHEMA_INSTALL_SOURCE" = "x"; then
+			GCONF_SCHEMA_CONFIG_SOURCE=`gconftool-2 --get-default-source`
+		else
+			GCONF_SCHEMA_CONFIG_SOURCE=$GCONF_SCHEMA_INSTALL_SOURCE
+		fi
+	fi
+
+  AC_ARG_WITH([gconf-source],
+              AC_HELP_STRING([--with-gconf-source=sourceaddress],
+                             [Config database for installing schema files.]),
+              [GCONF_SCHEMA_CONFIG_SOURCE="$withval"],)
+
+  AC_SUBST(GCONF_SCHEMA_CONFIG_SOURCE)
+
+	if test "$1" = "yes"; then
+		AC_MSG_RESULT([Using config source $GCONF_SCHEMA_CONFIG_SOURCE for schema installation])
+	fi
+
+  if test "x$GCONF_SCHEMA_FILE_DIR" = "x"; then
+    GCONF_SCHEMA_FILE_DIR='$(sysconfdir)/gconf/schemas'
+  fi
+
+  AC_ARG_WITH([gconf-schema-file-dir],
+              AC_HELP_STRING([--with-gconf-schema-file-dir=dir],
+                             [Directory for installing schema files.]),
+              [GCONF_SCHEMA_FILE_DIR="$withval"],)
+
+  AC_SUBST(GCONF_SCHEMA_FILE_DIR)
+
+	if test "$1" = "yes"; then
+		AC_MSG_RESULT([Using $GCONF_SCHEMA_FILE_DIR as install directory for schema files])
+	fi
+
+  AC_ARG_ENABLE(schemas-install,
+        AC_HELP_STRING([--disable-schemas-install],
+                       [Disable the schemas installation]),
+     [case ${enableval} in
+       yes|no) ;;
+       *) AC_MSG_ERROR([bad value ${enableval} for --enable-schemas-install]) ;;
+      esac])
+
+	if test "x${enable_schemas_install}" = "xno" -o "$1" != "yes"; then
+		msg_schemas_install="disabled"; else
+		msg_schemas_install="enabled in ${GCONF_SCHEMA_FILE_DIR}"
+	fi
+      
+  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],[
+	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"])
+])
diff --git a/m4/na-enable-manuals.m4 b/m4/na-enable-manuals.m4
index 228e5f8..b7f35e2 100644
--- a/m4/na-enable-manuals.m4
+++ b/m4/na-enable-manuals.m4
@@ -97,7 +97,6 @@ AC_DEFUN([_CHECK_FOR_HTML_MANUALS],[
 
 	AC_SUBST([WITH_DB2HTML],[${with_db2html}])
 	AC_SUBST([WITH_GDT],[${with_gdt}])
-
 	AM_CONDITIONAL([ENABLE_HTML_MANUALS], [test "x${enable_html_manuals}" != "xno"])
 ])
 



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