summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorBerke Viktor <bviktor@hexchat.org>2012-10-21 08:06:09 +0200
committerBerke Viktor <bviktor@hexchat.org>2012-10-21 08:06:09 +0200
commit62c9375bc9e3d4b9cc8abd5fc1c4cccb621382b5 (patch)
treeffea1b7187742835ff5a45626d1878c5ffbdf6fe
parentbc57507a4ceee92050a5eb8ac17dfd8b5d264b7a (diff)
Compilation fixes and integration with HexChat
-rw-r--r--configure.ac22
-rw-r--r--plugins/Makefile.am6
-rw-r--r--plugins/sysinfo/Makefile.am7
-rw-r--r--plugins/sysinfo/pci.c2
-rw-r--r--plugins/sysinfo/xsys.c7
5 files changed, 40 insertions, 4 deletions
diff --git a/configure.ac b/configure.ac
index 2934abd6..1bf0e373 100644
--- a/configure.ac
+++ b/configure.ac
@@ -150,6 +150,10 @@ AC_ARG_ENABLE(sasl,
 [  --disable-sasl          disable the SASL plugin],
         sasl=$enableval, sasl=yes)
 
+AC_ARG_ENABLE(sysinfo,
+[  --disable-sysinfo      disable the SysInfo plugin],
+        sysinfo=$enableval, sysinfo=yes)
+
 AC_ARG_ENABLE(dbus,
 [  --disable-dbus          disable DBUS support],
         dbus=$enableval, dbus=yes)
@@ -586,6 +590,21 @@ if test "$sasl" != "no"; then
 	fi
 fi
 
+dnl *********************************************************************
+dnl ** SYSINFO **********************************************************
+dnl *********************************************************************
+
+if test "$sysinfo" != "no"; then
+	AC_MSG_CHECKING(for plugin interface used by SysInfo)
+	sysinfo=no
+	if test "$plugin" = yes; then
+		AC_MSG_RESULT([yes])
+		PKG_CHECK_MODULES(LIBPCI, libpci >= 3.0.0, [sysinfo=yes], [])
+	else
+		AC_MSG_RESULT([plugins are disabled, use the --enable-plugin option for SysInfo])
+	fi
+fi
+
 dnl #######################################################################
 dnl # Check for DBUS libraries
 dnl #######################################################################
@@ -679,6 +698,7 @@ AM_CONDITIONAL(DO_CHECKSUM, test "x$checksum" = "xyes")
 AM_CONDITIONAL(DO_DOAT, test "x$doat" = "xyes")
 AM_CONDITIONAL(DO_FISHLIM, test "x$fishlim" = "xyes")
 AM_CONDITIONAL(DO_SASL, test "x$sasl" = "xyes")
+AM_CONDITIONAL(DO_SYSINFO, test "x$sysinfo" = "xyes")
 AM_CONDITIONAL(USE_DBUS, test "x$dbus" = "xyes")
 AM_CONDITIONAL(DO_GCONF, test "x$GCONFTOOL" != "xno")
 
@@ -944,6 +964,7 @@ plugins/checksum/Makefile
 plugins/doat/Makefile
 plugins/fishlim/Makefile
 plugins/sasl/Makefile
+plugins/sysinfo/Makefile
 intl/Makefile
 po/Makefile.in
 ])
@@ -979,6 +1000,7 @@ echo Checksum .............. : $checksum
 echo Do At ................. : $doat
 echo FiSHLiM ............... : $fishlim
 echo SASL .................. : $sasl
+echo SysInfo ............... : $sysinfo
 echo
 echo The binary will be installed in $prefix/bin
 echo
diff --git a/plugins/Makefile.am b/plugins/Makefile.am
index 53c59bf9..4a9cee09 100644
--- a/plugins/Makefile.am
+++ b/plugins/Makefile.am
@@ -33,5 +33,9 @@ if DO_CHECKSUM
 checksumdir = checksum
 endif
 
+if DO_SYSINFO
+sysinfodir = sysinfo
+endif
+
 #SUBDIRS = . $(pythondir) $(perldir) mailcheck xdcc
-SUBDIRS = . $(pythondir) $(perldir) $(tcldir) $(sasldir) $(doatdir) $(fishlimdir) $(checksumdir)
+SUBDIRS = . $(pythondir) $(perldir) $(tcldir) $(sasldir) $(doatdir) $(fishlimdir) $(checksumdir) $(sysinfodir)
diff --git a/plugins/sysinfo/Makefile.am b/plugins/sysinfo/Makefile.am
new file mode 100644
index 00000000..3db39470
--- /dev/null
+++ b/plugins/sysinfo/Makefile.am
@@ -0,0 +1,7 @@
+libdir = $(hexchatlibdir)/plugins
+
+lib_LTLIBRARIES = sysinfo.la
+sysinfo_la_SOURCES = hwmon.c match.c parse.c pci.c xsys.c
+sysinfo_la_LDFLAGS = -avoid-version -module
+sysinfo_la_LIBADD = -lpci
+AM_CPPFLAGS = $(COMMON_CFLAGS) -I$(srcdir)/..
diff --git a/plugins/sysinfo/pci.c b/plugins/sysinfo/pci.c
index 21f23c3e..221df850 100644
--- a/plugins/sysinfo/pci.c
+++ b/plugins/sysinfo/pci.c
@@ -27,6 +27,8 @@
 #include <pci/pci.h>
 #include "xsys.h"
 
+#define PCIIDS "/usr/share/misc/pci.ids"
+
 static struct pci_filter filter;       /* Device filter */
 static struct pci_access *pacc;
 int bus, dev, func; /* Location of the card */
diff --git a/plugins/sysinfo/xsys.c b/plugins/sysinfo/xsys.c
index 531c9233..171282ff 100644
--- a/plugins/sysinfo/xsys.c
+++ b/plugins/sysinfo/xsys.c
@@ -33,6 +33,7 @@ static xchat_plugin *ph;
 
 static char name[] = "SysInfo";
 static char desc[] = "Display info about your hardware and OS";
+static char version[] = "2.2";
 static char format[bsize] = "%B%1%B[%2]";
 unsigned int percentages = 1;
 
@@ -64,7 +65,7 @@ int xchat_plugin_init(xchat_plugin *plugin_handle, char **plugin_name,
 	ph = plugin_handle;
 	*plugin_name    = name;
 	*plugin_desc    = desc;
-	*plugin_version = VER_STRING;
+	*plugin_version = version;
 
 	xchat_hook_command(ph, "XSYS2FORMAT",XCHAT_PRI_NORM, format_cb,    NULL, NULL);
 	xchat_hook_command(ph, "PERCENTAGES",XCHAT_PRI_NORM, percentages_cb,   NULL, NULL);
@@ -261,9 +262,9 @@ static int sysinfo_cb(char *word[], char *word_eol[], void *userdata)
 static int xsys_cb(char *word[], char *word_eol[], void *userdata)
 {
 	if((long)userdata)
-		xchat_printf(ph, "You are using %s v%s (http://dev.gentoo.org/~chainsaw/xsys)", name, VER_STRING);
+		xchat_printf(ph, "You are using %s v%s (http://dev.gentoo.org/~chainsaw/xsys)", name, version);
 	else
-		xchat_commandf(ph, "me is using %s v%s (http://dev.gentoo.org/~chainsaw/xsys)", name, VER_STRING);
+		xchat_commandf(ph, "me is using %s v%s (http://dev.gentoo.org/~chainsaw/xsys)", name, version);
 	
 	return XCHAT_EAT_ALL;
 }