changeset 22:fbad40babe88

build system update: - ported Makefile.in from pidgin-twitter. - ported autogen.sh from pidgin-twitter. - moved some declarations and definitions to pidgin-audacious.h - updated configure.in to go along with new Makefile. - removed aclocal.m4 from version control.
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Mon, 06 Oct 2008 18:18:06 +0900
parents 83002f858ee9
children dffc9604a9fb
files Makefile.in aclocal.m4 autogen.sh configure.in pidgin-audacious.c pidgin-audacious.h
diffstat 6 files changed, 175 insertions(+), 251 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile.in	Sun Oct 05 14:19:55 2008 +0900
+++ b/Makefile.in	Mon Oct 06 18:18:06 2008 +0900
@@ -1,32 +1,46 @@
-TARGET = pidgin-audacious3.so
+OBJECTIVE = pidgin-audacious3.so
+SRC = pidgin-audacious.c
+HDR = ${SRC:.c=.h}
+
+PIDGIN_PLUGIN_DIR = @PIDGIN_PREFIX@/lib/pidgin
+PIDGIN_DATA_DIR = @PIDGIN_PREFIX@/share
+
 PIDGIN_CFLAGS = @PIDGIN_CFLAGS@
+GLIB_CFLAGS = @GLIB_CFLAGS@
 AUD_CFLAGS = @AUD_CFLAGS@
 DBUS_GLIB_CFLAGS = @DBUS_GLIB_CFLAGS@
-CFLAGS = -fPIC -shared -Wall $(PIDGIN_CFLAGS) $(AUD_CFLAGS) $(DBUS_GLIB_CFLAGS)
+CFLAGS = -fPIC -shared -Wall $(PIDGIN_CFLAGS) $(GLIB_CFLAGS) $(AUD_CFLAGS) $(DBUS_GLIB_CFLAGS) -DDATADIR=\"$(PIDGIN_DATA_DIR)\"
 
+GLIB_LIBS = @GLIB_LIBS@
 AUD_LIBS = @AUD_LIBS@
 AUD_LIB_DIR = @AUD_LIB_DIR@
 DBUS_GLIB_LIBS = @DBUS_GLIB_LIBS@
 DBUS_GLIB_LIB_DIR = @DBUS_GLIB_LIB_DIR@
-LDFLAGS = $(AUD_LIBS) $(DBUS_GLIB_LIBS)
+LDFLAGS = $(AUD_LIBS) $(DBUS_GLIB_LIBS) $(GLIB_LIBS)
 
-PIDGIN_LIB_DIR = @PIDGIN_LIB_DIR@
+all: $(OBJECTIVE)
 
 
-default: $(TARGET)
-
-$(TARGET): pidgin-audacious.c
-	gcc -o $@ $< $(CFLAGS) $(LDFLAGS) -g -Wl,-rpath=$(AUD_LIB_DIR)
+$(OBJECTIVE): $(SRC) $(HDR)
+	gcc -o $@ $(SRC) $(CFLAGS) $(LDFLAGS) -g -Wl,-rpath=$(AUD_LIB_DIR)
 
 
-install: $(TARGET)
-	install -m 755 $(TARGET) $(PIDGIN_LIB_DIR)/pidgin
+install: $(OBJECTIVE)
+	install -m 755 $(OBJECTIVE) $(PIDGIN_PLUGIN_DIR)
 
 
 clean:
-	rm -f $(TARGET)
+	rm -f $(OBJECTIVE)
 
 
 distclean: clean
-	rm -f Makefile config.log config.status *~
-	rm -rf autom4te.cache
+	rm -f Makefile config.log config.status
+
+
+maintainer-clean: distclean
+	rm -rf autom4te.cache aclocal.m4 *~
+
+
+release: maintainer-clean
+	rm -f .hgtags
+	rm -rf .hg
--- a/aclocal.m4	Sun Oct 05 14:19:55 2008 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,171 +0,0 @@
-# generated automatically by aclocal 1.10 -*- Autoconf -*-
-
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005, 2006  Free Software Foundation, Inc.
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
-# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
-# 
-# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
-#
-# 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 program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-# PKG_PROG_PKG_CONFIG([MIN-VERSION])
-# ----------------------------------
-AC_DEFUN([PKG_PROG_PKG_CONFIG],
-[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
-m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
-AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
-if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
-	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
-fi
-if test -n "$PKG_CONFIG"; then
-	_pkg_min_version=m4_default([$1], [0.9.0])
-	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
-	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
-		AC_MSG_RESULT([yes])
-	else
-		AC_MSG_RESULT([no])
-		PKG_CONFIG=""
-	fi
-		
-fi[]dnl
-])# PKG_PROG_PKG_CONFIG
-
-# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
-#
-# Check to see whether a particular set of modules exists.  Similar
-# to PKG_CHECK_MODULES(), but does not set variables or print errors.
-#
-#
-# Similar to PKG_CHECK_MODULES, make sure that the first instance of
-# this or PKG_CHECK_MODULES is called, or make sure to call
-# PKG_CHECK_EXISTS manually
-# --------------------------------------------------------------
-AC_DEFUN([PKG_CHECK_EXISTS],
-[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
-if test -n "$PKG_CONFIG" && \
-    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
-  m4_ifval([$2], [$2], [:])
-m4_ifvaln([$3], [else
-  $3])dnl
-fi])
-
-
-# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
-# ---------------------------------------------
-m4_define([_PKG_CONFIG],
-[if test -n "$PKG_CONFIG"; then
-    if test -n "$$1"; then
-        pkg_cv_[]$1="$$1"
-    else
-        PKG_CHECK_EXISTS([$3],
-                         [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
-			 [pkg_failed=yes])
-    fi
-else
-	pkg_failed=untried
-fi[]dnl
-])# _PKG_CONFIG
-
-# _PKG_SHORT_ERRORS_SUPPORTED
-# -----------------------------
-AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
-[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
-if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
-        _pkg_short_errors_supported=yes
-else
-        _pkg_short_errors_supported=no
-fi[]dnl
-])# _PKG_SHORT_ERRORS_SUPPORTED
-
-
-# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
-# [ACTION-IF-NOT-FOUND])
-#
-#
-# Note that if there is a possibility the first call to
-# PKG_CHECK_MODULES might not happen, you should be sure to include an
-# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
-#
-#
-# --------------------------------------------------------------
-AC_DEFUN([PKG_CHECK_MODULES],
-[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
-AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
-AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
-
-pkg_failed=no
-AC_MSG_CHECKING([for $1])
-
-_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
-_PKG_CONFIG([$1][_LIBS], [libs], [$2])
-
-m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
-and $1[]_LIBS to avoid the need to call pkg-config.
-See the pkg-config man page for more details.])
-
-if test $pkg_failed = yes; then
-        _PKG_SHORT_ERRORS_SUPPORTED
-        if test $_pkg_short_errors_supported = yes; then
-	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$2"`
-        else 
-	        $1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
-        fi
-	# Put the nasty error message in config.log where it belongs
-	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
-
-	ifelse([$4], , [AC_MSG_ERROR(dnl
-[Package requirements ($2) were not met:
-
-$$1_PKG_ERRORS
-
-Consider adjusting the PKG_CONFIG_PATH environment variable if you
-installed software in a non-standard prefix.
-
-_PKG_TEXT
-])],
-		[AC_MSG_RESULT([no])
-                $4])
-elif test $pkg_failed = untried; then
-	ifelse([$4], , [AC_MSG_FAILURE(dnl
-[The pkg-config script could not be found or is too old.  Make sure it
-is in your PATH or set the PKG_CONFIG environment variable to the full
-path to pkg-config.
-
-_PKG_TEXT
-
-To get pkg-config, see <http://www.freedesktop.org/software/pkgconfig>.])],
-		[$4])
-else
-	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
-	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
-        AC_MSG_RESULT([yes])
-	ifelse([$3], , :, [$3])
-fi[]dnl
-])# PKG_CHECK_MODULES
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/autogen.sh	Mon Oct 06 18:18:06 2008 +0900
@@ -0,0 +1,57 @@
+#!/bin/sh
+
+[ -f configure.in ] || {
+  echo "autogen.sh: run this command only at the top of a pidgin-audacious source tree."
+  exit 1
+}
+
+DIE=0
+
+(autoconf --version) < /dev/null > /dev/null 2>&1 || {
+  echo
+  echo "You must have autoconf installed to compile pidgin-audacious."
+  echo "Get ftp://ftp.gnu.org/pub/gnu/autoconf/autoconf-2.62.tar.gz"
+  echo "(or a newer version if it is available)"
+  DIE=1
+  NO_AUTOCONF=yes
+}
+
+(automake --version) < /dev/null > /dev/null 2>&1 || {
+  echo
+  echo "You must have automake installed to compile pidgin-audacious."
+  echo "Get ftp://ftp.gnu.org/pub/gnu/automake/automake-1.10.1.tar.gz"
+  echo "(or a newer version if it is available)"
+  DIE=1
+  NO_AUTOMAKE=yes
+}
+
+# if no automake, don't bother testing for aclocal
+test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || {
+  echo
+  echo "**Error**: Missing \`aclocal'.  The version of \`automake'"
+  echo "installed doesn't appear recent enough."
+  echo "Get ftp://ftp.gnu.org/pub/gnu/automake/automake-1.10.1.tar.gz"
+  echo "(or a newer version if it is available)"
+  DIE=1
+}
+
+# if no autoconf, don't bother testing for autoheader
+test -n "$NO_AUTOCONF" || (autoheader --version) < /dev/null > /dev/null 2>&1 || {
+  echo
+  echo "**Error**: Missing \`autoheader'.  The version of \`autoheader'"
+  echo "installed doesn't appear recent enough."
+  echo "Get ftp://ftp.gnu.org/pub/gnu/autoconf/autoconf-2.62.tar.gz"
+  echo "(or a newer version if it is available)"
+  DIE=1
+}
+
+if test "$DIE" -eq 1; then
+        exit 1
+fi
+
+echo "Generating configure script and Makefiles for pidgin-audacious."
+
+echo "Running aclocal ..."
+aclocal -I .
+echo "Running autoconf ..."
+autoconf
--- a/configure.in	Sun Oct 05 14:19:55 2008 +0900
+++ b/configure.in	Mon Oct 06 18:18:06 2008 +0900
@@ -2,7 +2,7 @@
 # Process this file with autoconf to produce a configure script.
 
 AC_PREREQ(2.59)
-AC_INIT(pidgin-audacioius, 2.0.0, yaz@honeyplanet.jp)
+AC_INIT(pidgin-audacioius, 3.0.0, yaz@honeyplanet.jp)
 AC_CONFIG_SRCDIR([pidgin-audacious.c])
 
 # Checks for programs.
@@ -10,11 +10,11 @@
 AC_PROG_INSTALL
 
 # Checks for libraries.
-PKG_CHECK_MODULES(AUDACIOUS, [audacious >= 1.4.0], , [
+PKG_CHECK_MODULES(AUDACIOUS, [audacious >= 1.5.0], , [
         AC_MSG_RESULT(no)
         AC_MSG_ERROR([
 
-You must have audacious >= 1.4.0 development headers installed to build.
+You must have audacious >= 1.5.0 development headers installed to build.
 ])])
 AUD_CFLAGS=`pkg-config --cflags audacious 2> /dev/null`
 AUD_LIBS=`pkg-config --libs audacious 2> /dev/null`
@@ -23,18 +23,36 @@
 AC_SUBST(AUD_LIBS)
 AC_SUBST(AUD_LIB_DIR)
 
-PKG_CHECK_MODULES(PIDGIN, [pidgin >= 2.0.0], , [
+PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.14.0], , [
         AC_MSG_RESULT(no)
         AC_MSG_ERROR([
 
-You must have pidgin >= 2.0.0 development headers installed to build.
+You must have glib >= 2.14.0 development headers installed to build.
+])])
+
+GLIB_CFLAGS=`pkg-config --cflags glib-2.0 2> /dev/null`
+GLIB_LIBS=`pkg-config --libs glib-2.0 2> /dev/null`
+GLIB_LIB_DIR=`pkg-config --variable=lib_dir glib-2.0 2> /dev/null`
+AC_SUBST(GLIB_CFLAGS)
+AC_SUBST(GLIB_LIBS)
+AC_SUBST(GLIB_LIB_DIR)
+
+PKG_CHECK_MODULES(PIDGIN, [pidgin >= 2.5.0], , [
+        AC_MSG_RESULT(no)
+        AC_MSG_ERROR([
+
+You must have pidgin >= 2.5.0 development headers installed to build.
 ])])
 PIDGIN_CFLAGS=`pkg-config --cflags pidgin 2> /dev/null`
 PIDGIN_LIBS=`pkg-config --libs pidgin 2> /dev/null`
-PIDGIN_LIB_DIR=`pkg-config --variable=libdir pidgin 2> /dev/null`
+if test x"$prefix" = x"NONE" ; then
+        PIDGIN_PREFIX=`pkg-config --variable=prefix pidgin 2> /dev/null`
+else
+        PIDGIN_PREFIX=$prefix
+fi
 AC_SUBST(PIDGIN_CFLAGS)
 AC_SUBST(PIDGIN_LIBS)
-AC_SUBST(PIDGIN_LIB_DIR)
+AC_SUBST(PIDGIN_PREFIX)
 
 PKG_CHECK_MODULES(DBUSGLIB, [dbus-glib-1 >= 0.72], , [
         AC_MSG_RESULT(no)
--- a/pidgin-audacious.c	Sun Oct 05 14:19:55 2008 +0900
+++ b/pidgin-audacious.c	Mon Oct 06 18:18:06 2008 +0900
@@ -17,66 +17,7 @@
  */
 #define PURPLE_PLUGINS 1
 
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <glib.h>
-#include <dbus/dbus.h>
-#include <dbus/dbus-glib.h>
-
-#include "gtkplugin.h"
-#include "util.h"
-#include "debug.h"
-#include "connection.h"
-#include "version.h"
-#include "cmds.h"
-#include "savedstatuses.h"
-
-#define PIDGINAUD_PLUGIN_ID     "pidgin_audacious"
-#define PLUGIN_NAME             "Pidgin-Audacious"
-
-/* preferences */
-#define OPT_PIDGINAUD           "/plugins/pidgin_audacious"
-#define OPT_PROCESS_STATUS      OPT_PIDGINAUD "/process_status"
-#define OPT_PROCESS_USERINFO    OPT_PIDGINAUD "/process_userinfo"
-#define OPT_SONG_TEMPLATE       OPT_PIDGINAUD "/song_template"
-#define OPT_PASTE_TEMPLATE      OPT_PIDGINAUD "/paste_template"
-#define OPT_LOG_OUTPUT          OPT_PIDGINAUD "/log_output"
-#define OPT_PLAYER              OPT_PIDGINAUD "/player"
-
-/* templates */
-#define TITLE   "%title"
-#define ARTIST  "%artist"
-#define ALBUM   "%album"
-#define GENRE   "%genre"
-#define DEFAULT_SONG_TEMPLATE   "%title - %artist"
-#define DEFAULT_PLAYER          "audacious"
-#define SONG_TOKEN              "%song"
-#define NO_SONG_MESSAGE         "No song being played."
-
-/* constants */
-#define DBUS_TIMEOUT 1000
-#define PLAYING 0
-#define PAUSED  1
-#define STOPPED 2
-
-/* custom data type */
-typedef struct song_tuple {
-    gchar *title;
-    gchar *artist;
-    gchar *album;
-    gchar *genre;
-} song_tuple;
-
-/* mpris data containers */
-#define DBUS_TYPE_MPRIS_STATUS (dbus_g_type_get_struct ("GValueArray", G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INVALID))
-
-#define DBUS_TYPE_G_STRING_VALUE_HASHTABLE (dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_VALUE))
-
-/* debug macros */
-#define aud_debug(fmt, ...)	do { if(purple_prefs_get_bool(OPT_LOG_OUTPUT)) purple_debug(PURPLE_DEBUG_INFO, PLUGIN_NAME, "%s():%4d:  " fmt, __FUNCTION__, (int)__LINE__, ## __VA_ARGS__); } while(0);
-
-#define aud_error(fmt, ...)	do { if(purple_prefs_get_bool(OPT_LOG_OUTPUT)) purple_debug(PURPLE_DEBUG_ERROR, PLUGIN_NAME, "%s():%4d:  " fmt, __FUNCTION__, (int)__LINE__, ## __VA_ARGS__); } while(0);
+#include "pidgin-audacious.h"
 
 /* globals */
 static GHashTable *seed_status;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pidgin-audacious.h	Mon Oct 06 18:18:06 2008 +0900
@@ -0,0 +1,65 @@
+#ifndef _PIDGIN_AUDACIOUS_H_
+#define _PIDGIN_AUDACIOUS_H_
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+#include <dbus/dbus.h>
+#include <dbus/dbus-glib.h>
+
+#include "gtkplugin.h"
+#include "util.h"
+#include "debug.h"
+#include "connection.h"
+#include "version.h"
+#include "cmds.h"
+#include "savedstatuses.h"
+
+#define PIDGINAUD_PLUGIN_ID     "pidgin_audacious"
+#define PLUGIN_NAME             "Pidgin-Audacious"
+
+/* preferences */
+#define OPT_PIDGINAUD           "/plugins/pidgin_audacious"
+#define OPT_PROCESS_STATUS      OPT_PIDGINAUD "/process_status"
+#define OPT_PROCESS_USERINFO    OPT_PIDGINAUD "/process_userinfo"
+#define OPT_SONG_TEMPLATE       OPT_PIDGINAUD "/song_template"
+#define OPT_PASTE_TEMPLATE      OPT_PIDGINAUD "/paste_template"
+#define OPT_LOG_OUTPUT          OPT_PIDGINAUD "/log_output"
+#define OPT_PLAYER              OPT_PIDGINAUD "/player"
+
+/* templates */
+#define TITLE   "%title"
+#define ARTIST  "%artist"
+#define ALBUM   "%album"
+#define GENRE   "%genre"
+#define DEFAULT_SONG_TEMPLATE   "%title - %artist"
+#define DEFAULT_PLAYER          "audacious"
+#define SONG_TOKEN              "%song"
+#define NO_SONG_MESSAGE         "No song being played."
+
+/* constants */
+#define DBUS_TIMEOUT 1000
+#define PLAYING 0
+#define PAUSED  1
+#define STOPPED 2
+
+/* custom data type */
+typedef struct song_tuple {
+    gchar *title;
+    gchar *artist;
+    gchar *album;
+    gchar *genre;
+} song_tuple;
+
+/* mpris data containers */
+#define DBUS_TYPE_MPRIS_STATUS (dbus_g_type_get_struct ("GValueArray", G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INVALID))
+
+#define DBUS_TYPE_G_STRING_VALUE_HASHTABLE (dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_VALUE))
+
+/* debug macros */
+#define aud_debug(fmt, ...)	do { if(purple_prefs_get_bool(OPT_LOG_OUTPUT)) purple_debug(PURPLE_DEBUG_INFO, PLUGIN_NAME, "%s():%4d:  " fmt, __FUNCTION__, (int)__LINE__, ## __VA_ARGS__); } while(0);
+
+#define aud_error(fmt, ...)	do { if(purple_prefs_get_bool(OPT_LOG_OUTPUT)) purple_debug(PURPLE_DEBUG_ERROR, PLUGIN_NAME, "%s():%4d:  " fmt, __FUNCTION__, (int)__LINE__, ## __VA_ARGS__); } while(0);
+
+#endif