[nautilus-actions] Externalize nautilus-actions specific m4 macros



commit d5a2d39eb3547c7277af4d264f7487e25fa1c802
Author: Pierre Wieser <pwieser trychlos org>
Date:   Sat May 16 22:20:14 2009 +0200

    Externalize nautilus-actions specific m4 macros
---
 Makefile.am           |    2 +
 configure.ac          |   77 ++++++++++++----------------------------
 m4/.gitignore         |    1 +
 m4/Makefile.am        |   27 ++++++++++++++
 m4/cmdline-tools.m4   |   95 +++++++++++++++++++++++++++++++++++++++++++++++++
 m4/nautilus-extdir.m4 |   64 +++++++++++++++++++++++++++++++++
 6 files changed, 212 insertions(+), 54 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index c203950..83b2979 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -27,6 +27,8 @@
 #
 # pwi 2009-05-16 add distcheck_configure_flags and distcleanfiles
 
+ACLOCAL_AMFLAGS = -I m4
+
 SUBDIRS = \
 	libnautilus-actions	\
 	plugin				\
diff --git a/configure.ac b/configure.ac
index 343f234..02f5c42 100644
--- a/configure.ac
+++ b/configure.ac
@@ -39,19 +39,22 @@ AC_CONFIG_HEADERS([config.h])
 
 AC_CONFIG_FILES([
 	Makefile
-	libnautilus-actions/Makefile
-	plugin/Makefile
-	nact/Makefile
-	utils/Makefile
 	icons/Makefile
 	icons/16x16/Makefile
 	icons/22x22/Makefile
 	icons/32x32/Makefile
 	icons/48x48/Makefile
 	icons/scalable/Makefile
+	libnautilus-actions/Makefile
+	m4/Makefile
+	nact/Makefile
+	plugin/Makefile
 	po/Makefile.in
+	utils/Makefile
 ])
 
+AC_CONFIG_MACRO_DIR([m4])
+
 #AC_SUBST(ACLOCAL_AMFLAGS, "$ACLOCAL_FLAGS")
 
 # don't agree with maintainer mode use
@@ -63,9 +66,7 @@ AM_MAINTAINER_MODE
 AC_PROG_CC
 AC_PROG_GCC_TRADITIONAL
 AC_STDC_HEADERS
-
-# why ?
-#AM_DISABLE_STATIC
+AM_DISABLE_STATIC
 
 # other traditional tools
 AC_PROG_INSTALL
@@ -93,12 +94,12 @@ AM_GLIB_GNU_GETTEXT
 AC_PATH_PROG([GCONFTOOL],[gconftool-2])
 AM_GCONF_SOURCE_2
 
-AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
-if test "x$PKG_CONFIG" = "xno"; then
-        AC_MSG_ERROR([You need to install pkg-config])
-fi
-
 # these are the version as distributed with CentOS 4.x
+# - Gnome 2.8
+# - glib 2.4.7
+# - autoconf 2.59
+# - automake 1.9
+# - intltool 0.31
 #
 # note that requiring through pkg-config the version number of the
 # nautilus-extension library actually returns the version number of
@@ -118,6 +119,11 @@ GOBJECT_REQUIRED=2.4.0
 #AC_SUBST(GTK_REQUIRED)
 #AC_SUBST(GLADE_REQUIRED)
 
+AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
+if test "${PKG_CONFIG}" = "no"; then
+	AC_MSG_ERROR([You need to install pkg-config])
+fi
+
 PKG_CHECK_MODULES([NAUTILUS_ACTIONS], \
 	glib-2.0				>= ${GLIB_REQUIRED}			\
 	gthread-2.0				>= ${GLIB_REQUIRED}			\
@@ -132,49 +138,12 @@ PKG_CHECK_MODULES([NAUTILUS_ACTIONS], \
 AC_SUBST([NAUTILUS_ACTIONS_CFLAGS])
 AC_SUBST([NAUTILUS_ACTIONS_LIBS])
 
-AC_ARG_WITH(nautilus-extdir,
-[ AC_HELP_STRING([--with-nautilus-extdir=EXTDIR],
-					  [EXTDIR define the folder where nautilus stores its extentions plugins. [default=auto]])],
-[ NAUTILUS_EXTENSIONS_DIR=$withval ],
-[ NAUTILUS_EXTENSIONS_DIR=`$PKG_CONFIG --variable=extensiondir libnautilus-extension` ])
-
-AC_SUBST(NAUTILUS_EXTENSIONS_DIR)
-
-if test -z ${NAUTILUS_EXTENSIONS_DIR}; then
-	AC_MSG_ERROR([*** Can't determine nautilus extension folder, please use --with-nautilus-extdir options to define it manually ]);
-fi
-
-OPTIONAL_SUBDIR="utils"
-BUILD_COMMANDLINE_TOOL="yes"
-AC_ARG_ENABLE(commandline-tool,
-[  --enable-commandline-tool            define if command line tools must be build (disable it if you have GTK+ <= 2.4).
-                           [default=auto]],
-[ BUILD_COMMANDLINE_TOOL=$enableval ])
-if test "x$BUILD_COMMANDLINE_TOOL" = "xno"; then
-   OPTIONAL_SUBDIR=""
-fi
-$PKG_CONFIG glib-2.0 --max-version=2.4
-if test "x$?" = "x0"; then
-	OPTIONAL_SUBDIR=""
-fi
-AC_SUBST(OPTIONAL_SUBDIR)
-
-default_config_path=`eval echo $datadir/nautilus-actions`
-AC_DEFINE_UNQUOTED(DEFAULT_CONFIG_PATH, "$default_config_path", [Default system configuration path])
-$PKG_CONFIG glib-2.0 --atleast-version=2.8
-if test "x$?" = "x0"; then
-	AC_DEFINE_UNQUOTED(HAVE_GLIB_2_8, 1, [Version of the glib-2.0 library is at least 2.8])
-fi
+# when working in a test environment, nautilus is typically installed in
+# a non-standard location ; lets specify this here
+NACT_NAUTILUS_EXTDIR
 
-PKG_CHECK_MODULES(NAUTILUS_ACTIONS_UTILS,\
-	 glib-2.0 >= $GLIB_REQUIRED                \
-	 gthread-2.0 >= $GLIB_REQUIRED             \
-	 gmodule-2.0 >= $GLIB_REQUIRED		  \
-	 gconf-2.0 >= $GCONF_REQUIRED \
-	 gobject-2.0 >= $GOBJECT_REQUIRED \
-	 libxml-2.0 >= $LIBXML_REQUIRED)
-AC_SUBST(NAUTILUS_ACTIONS_UTILS_CFLAGS)
-AC_SUBST(NAUTILUS_ACTIONS_UTILS_LIBS)
+# building or not the commandline tools
+NACT_COMMANDLINE_TOOLS
 
 # Check for menu update function
 AC_CHECK_LIB(nautilus-extension, nautilus_menu_item_new)
diff --git a/m4/.gitignore b/m4/.gitignore
new file mode 100644
index 0000000..9f841b0
--- /dev/null
+++ b/m4/.gitignore
@@ -0,0 +1 @@
+intltool.m4
diff --git a/m4/Makefile.am b/m4/Makefile.am
new file mode 100644
index 0000000..493cb07
--- /dev/null
+++ b/m4/Makefile.am
@@ -0,0 +1,27 @@
+# Nautilus Actions
+#
+# Copyright (C) 2005 The GNOME Foundation
+# Copyright (C) 2006, 2007, 2008 Frederic Ruaudel, Rodrigo Moya
+# Copyright (C) 2009 Pierre Wieser
+#
+# 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>
+#
+# pwi 2009-05-15 creation
diff --git a/m4/cmdline-tools.m4 b/m4/cmdline-tools.m4
new file mode 100644
index 0000000..dda9f44
--- /dev/null
+++ b/m4/cmdline-tools.m4
@@ -0,0 +1,95 @@
+# Nautilus Actions
+#
+# Copyright (C) 2005 The GNOME Foundation
+# Copyright (C) 2006, 2007, 2008 Frederic Ruaudel and others (see AUTHORS)
+# Copyright (C) 2009 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)
+#
+# pwi 2009-05-16 creation
+
+# serial 1 creation
+
+# commandline tools are built on user option
+# they need gtk+ 2.4, and take interest of glib 2.8
+# default is to build them if we have gtk+ v 2.4
+
+AC_DEFUN([NACT_COMMANDLINE_TOOLS],[
+	AC_REQUIRE([_AC_ARG_NACT_COMMANDLINE_TOOLS])dnl
+	AC_REQUIRE([_AC_CHECK_NACT_COMMANDLINE_TOOLS])dnl
+
+	if test "${_ac_commandline_tools}" = "yes"; then
+
+		AC_SUBST([OPTIONAL_SUBDIR],[${_ac_subdir}])
+		AC_DEFINE_UNQUOTED([HAVE_GLIB_2_8],[${_ac_have_glib_2_8}],[Version of the glib-2.0 library is at least 2.8])
+
+		_ac_default_config_path=`eval echo $datadir/${PACKAGE_TARNAME}`
+		AC_DEFINE_UNQUOTED([DEFAULT_CONFIG_PATH],["${_ac_default_config_path}"],[Default system configuration path])
+		AC_MSG_NOTICE([defining default system configuration path as ${_ac_default_config_path}])
+		
+		PKG_CHECK_MODULES([NAUTILUS_ACTIONS_UTILS], \
+			glib-2.0	>= ${GLIB_REQUIRED}		\
+			gthread-2.0	>= ${GLIB_REQUIRED}		\
+			gmodule-2.0	>= ${GLIB_REQUIRED}		\
+			gconf-2.0	>= ${GCONF_REQUIRED}	\
+			gobject-2.0	>= ${GOBJECT_REQUIRED}	\
+			libxml-2.0	>= ${LIBXML_REQUIRED})
+		AC_SUBST([NAUTILUS_ACTIONS_UTILS_CFLAGS])
+		AC_SUBST([NAUTILUS_ACTIONS_UTILS_LIBS])
+	fi
+])
+
+AC_DEFUN([_AC_ARG_NACT_COMMANDLINE_TOOLS],[
+	AC_ARG_ENABLE(
+		[commandline-tool],
+		AC_HELP_STRING(
+			[--enable-commandline-tool],
+			[define if command line tools must be build (do not enable if you have GTK+ <= 2.4) @<:@auto@:>@]
+		),
+	[ac_enable_nact_commandline_tools=${enableval}],
+	[ac_enable_nact_commandline_tools="auto"]
+	)
+])
+
+AC_DEFUN([_AC_CHECK_NACT_COMMANDLINE_TOOLS],[
+	_ac_commandline_tools="yes"
+	_ac_have_glib_2_8=0
+	${PKG_CONFIG} gtk+-2.0 --max-version=2.4
+	if test $? -eq 0; then
+		_ac_commandline_tools="no"
+		AC_MSG_NOTICE([desactivating commandline tools as Gtk+ is too old])
+	else
+		if test "${ac_enable_nact_commandline_tools}" = "no"; then
+			_ac_commandline_tools="no"
+		else
+			${PKG_CONFIG} glib-2.0 --atleast-version=2.8
+			if test $? -eq 0; then
+				_ac_have_glib_2_8=1
+				AC_MSG_NOTICE([you have Glib greater than 2.8: fine])
+			fi
+		fi
+	fi
+	_ac_subdirs=""
+	if test "${_ac_commandline_tools}" = "yes"; then
+		_ac_subdir="utils"
+	fi
+])
diff --git a/m4/nautilus-extdir.m4 b/m4/nautilus-extdir.m4
new file mode 100644
index 0000000..f95c768
--- /dev/null
+++ b/m4/nautilus-extdir.m4
@@ -0,0 +1,64 @@
+# Nautilus Actions
+#
+# Copyright (C) 2005 The GNOME Foundation
+# Copyright (C) 2006, 2007, 2008 Frederic Ruaudel and others (see AUTHORS)
+# Copyright (C) 2009 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)
+#
+# pwi 2009-05-16 creation
+
+# serial 1 creation
+
+# let the user specify an alternate nautilus-extension dir
+# --with-nautilus-extdir=<dir>
+
+AC_DEFUN([NACT_NAUTILUS_EXTDIR],[
+	AC_REQUIRE([_AC_ARG_NACT_NAUTILUS_EXTDIR])dnl
+	AC_REQUIRE([_AC_NACT_CHECK_NAUTILUS_EXTDIR])dnl
+	if test "${ac_with_nact_nautilus_extdir}" = ""; then
+		AC_MSG_ERROR([Unable to determine nautilus extension folder, please use --with-nautilus-extdir option])
+	else
+		AC_MSG_NOTICE([installing plugin in ${ac_with_nact_nautilus_extdir}])
+		AC_SUBST([NAUTILUS_EXTENSIONS_DIR],[${ac_with_nact_nautilus_extdir}])
+	fi
+])
+
+AC_DEFUN([_AC_ARG_NACT_NAUTILUS_EXTDIR],[
+	AC_ARG_WITH(
+		[nact_nautilus_extdir],
+		AC_HELP_STRING(
+			[--with-nautilus-extdir=DIR],
+			[nautilus plugins extension directory @<:@auto@:>@]
+		),
+	[ac_with_nact_nautilus_extdir=$withval],
+	[ac_with_nact_nautilus_extdir=""]
+	)
+])
+
+AC_DEFUN([_AC_NACT_CHECK_NAUTILUS_EXTDIR],[
+	if test "${ac_with_nact_nautilus_extdir}" = ""; then
+		if test "{PKG_CONFIG}" != ""; then
+			ac_with_nact_nautilus_extdir=`${PKG_CONFIG} --variable=extensiondir libnautilus-extension`
+		fi
+	fi
+])



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