Commit 21d3b563 authored by iain's avatar iain

Add new files, change build system

parent fe4bcf62
SUBDIRS = geoclue example data doxygen @EXTRA_SUBDIRS@ SUBDIRS = interfaces geoclue
EXTRA_DIST = geoclue.pc.in
DISTCLEANFILES = geoclue.pc
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = geoclue.pc
AC_INIT(geoclue/position.c) AC_PREREQ(2.59)
AC_INIT(geoclue, 0.1, http://geoclue.freedesktop.org)
PACKAGE=geoclue AC_CONFIG_SRCDIR(geoclue/gc-iface-geoclue.c)
AM_CONFIG_HEADER(config.h)
VERSION=0.9 AM_INIT_AUTOMAKE([1.9 foreign])
GEOCLUE_VERSION=0.1
AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
AC_PROG_CC AC_PROG_CC
AC_ISC_POSIX
AC_PROG_INSTALL AC_PROG_INSTALL
AC_PROG_LIBTOOL AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_GCC_TRADITIONAL
AM_PROG_LIBTOOL
PKG_CHECK_MODULES(GEOCLUE, [
glib-2.0
dbus-glib-1 >= 0.60
])
AC_SUBST(GEOCLUE_LIBS)
AC_SUBST(GEOCLUE_CFLAGS)
AC_PATH_PROG(DBUS_BINDING_TOOL, dbus-binding-tool) AC_PATH_PROG(DBUS_BINDING_TOOL, dbus-binding-tool)
AC_SUBST(DBUS_BINDING_TOOL)
AM_CONFIG_HEADER(config.h)
AM_GCONF_SOURCE_2
AC_PATH_PROG(GCONFTOOL, gconftool-2)
AC_ARG_ENABLE(dev,
[AC_HELP_STRING([--enable-dev],
[Only compile client libraries disable backends and applets])],
[enable_dev=yes],
[enable_dev=no])
AC_ARG_ENABLE(panel-applet,
[AC_HELP_STRING([--enable-panel-applet],
[Compile the panel applet])],
[enable_panel_applet=yes],
[enable_panel_applet=no])
AC_ARG_ENABLE(gpsd,
[AC_HELP_STRING([--enable-gpsd],
[Compile the gpsd backend])],
[enable_gpsd=yes],
[enable_gpsd=no])
AC_ARG_ENABLE(system-bus,
[AC_HELP_STRING([--enable-system-bus],
[Use the system bus instead of session bus])],
enable_system_bus="$enableval",
enable_system_bus=no)
AM_CONDITIONAL(USE_SYSTEM_BUS, test x$enable_system_bus = xyes)
if test x$enable_system_bus = xyes; then
AC_DEFINE(GEOCLUE_DBUS_BUS, DBUS_BUS_SYSTEM, Use the system bus)
else
AC_DEFINE(GEOCLUE_DBUS_BUS, DBUS_BUS_SESSION, Use the session bus)
fi
DBUS_SYSTEM_POLICY_DIR=`pkg-config dbus-1 --variable=sysconfdir`/dbus-1/system.d
AC_SUBST(DBUS_SYSTEM_POLICY_DIR)
PKG_CHECK_MODULES(DEPS, gconf-2.0 dbus-glib-1 gtk+-2.0 gthread-2.0)
AC_SUBST(DEPS_CFLAGS)
AC_SUBST(DEPS_LIBS)
PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
AC_SUBST(GOBJECT_CFLAGS)
AC_SUBST(GOBJECT_LIBS)
PKG_CHECK_MODULES(GLIB, glib-2.0)
AC_SUBST(GLIB_CFLAGS)
AC_SUBST(GLIB_LIBS)
DBUS_SERVICES_DIR=`pkg-config dbus-1 --variable=exec_prefix`/share/dbus-1/services
AC_SUBST(DBUS_SERVICES_DIR)
if test "x$enable_dev" = "xno"
then
if test "x$enable_gpsd" = "xyes"
then
dnl Check for GPSD headers
AC_CHECK_HEADERS([gps.h], [ac_cv_gps_h=yes])
if test "x$ac_cv_gps_h" != xyes; then
AC_MSG_ERROR([Install gpsd Debian package or its source-code equivalent])
fi
AC_CHECK_LIB(gps, gps_open,[ac_cv_libgps=yes] )
if test "x$ac_cv_libgps" != xyes; then
AC_MSG_ERROR([Install gpsd Debian package or its source-code equivalent])
fi
dnl check for libgpsbt and libgpsmgr
AC_CHECK_LIB(gpsmgr, gpsmgr_is_gpsd_running)
AC_CHECK_LIB(gpsbt, gpsbt_start)
BACKEND_SUBDIRS="position_gpsd"
AC_OUTPUT(
backend/position_gpsd/Makefile
)
fi #gpds
dnl check for libconic
PKG_CHECK_MODULES(CONIC, conic dbus-1, [have_libconic=yes], [have_libconic=no])
AC_SUBST(CONIC_CFLAGS)
AC_SUBST(CONIC_LIBS)
if test "x$have_libconic" = "xyes"; then
AC_DEFINE(HAVE_LIBCONIC, 1, [define if libconic is installed])
fi
PKG_CHECK_MODULES(HTTPXML, libsoup-2.2 libxml-2.0)
AC_SUBST(HTTPXML_CFLAGS)
AC_SUBST(HTTPXML_LIBS)
APPLET_CFLAGS=
APPLET_LIBS=
if test "x$enable_panel_applet" = "xyes"
then
PKG_CHECK_MODULES(APPLET, libpanelapplet-2.0)
EXTRA_SUBDIRS="applet"
AC_OUTPUT(
applet/Makefile
)
fi
AC_SUBST(APPLET_CFLAGS)
AC_SUBST(APPLET_LIBS)
PKG_CHECK_MODULES(YAHOO, gconf-2.0 libxml-2.0 dbus-glib-1 gtk+-2.0)
AC_SUBST(YAHOO_CFLAGS)
AC_SUBST(YAHOO_LIBS)
dnl substitute subdirs into makefiles
BACKEND_SUBDIRS="${BACKEND_SUBDIRS} common map_yahoo geocode_yahoo position_manual position_hostip position_plazes"
AC_OUTPUT(
backend/Makefile
backend/common/Makefile
backend/map_yahoo/Makefile
backend/geocode_yahoo/Makefile
backend/position_manual/Makefile
backend/position_hostip/Makefile
backend/position_plazes/Makefile
)
EXTRA_SUBDIRS="${EXTRA_SUBDIRS} backend"
fi
dnl substitute subdirs into makefiles CFLAGS="$CFLAGS -g -Wall -Werror -Wno-format"
AC_SUBST(EXTRA_SUBDIRS)
AC_SUBST(BACKEND_SUBDIRS)
AC_OUTPUT(Makefile AC_CONFIG_FILES([
geoclue/Makefile Makefile
example/Makefile interfaces/Makefile
data/Makefile geoclue/Makefile
doxygen/Makefile ])
doxygen/doxygen.conf
geoclue.pc
)
AC_OUTPUT
lib_LTLIBRARIES = libgeoclue-backend.la
BUILT_SOURCES = \
gc-iface-geoclue-glue.h
libgeoclue_backend_la_SOURCES = \
$(BUILT_SOURCES) \
gc-iface-geoclue.c
libgeoclue_backend_la_CFLAGS = \
-I$(top_srcdir) \
-I$(top_builddir) \
$(GEOCLUE_CFLAGS)
EXTRA_DIST = \
$(BUILT_SOURCES)
CLEANFILES = $(BUILT_SOURCES) \
stamp-gc-iface-geoclue-glue.h
%-glue.h: stamp-%-glue.h
@true
stamp-gc-iface-geoclue-glue.h: ../interfaces/gc-iface-geoclue.xml
$(DBUS_BINDING_TOOL) --prefix=gc_iface_geoclue --mode=glib-server $< > xgen-$(@F) \
&& (cmp -s xgen-$(@F) $(@F:stamp-%=%) || cp xgen-$(@F) $(@F:stamp-%=%)) \
&& rm -f xgen-$(@F) \
&& echo timestamp > $(@F)
/*
* Geoclue
* gc-iface-geoclue.c - GInterface for org.freedesktop.Geoclue
*
* Author: Iain Holmes <iain@openedhand.com>
*/
#include <glib.h>
#include <dbus/dbus-glib.h>
#include <geoclue/gc-iface-geoclue.h>
enum {
STATUS_CHANGED,
LAST_SIGNAL
};
static guint signals[LAST_SIGNAL] = {0};
static gboolean gc_iface_geoclue_get_version (GcIfaceGeoclue *gc,
int *major,
int *minor,
int *micro,
GError **error);
static gboolean gc_iface_geoclue_get_status (GcIfaceGeoclue *gc,
gboolean *status,
GError **error);
static gboolean gc_iface_geoclue_shutdown (GcIfaceGeoclue *gc,
GError **error);
#include "gc-iface-geoclue-glue.h"
static void
gc_iface_geoclue_base_init (gpointer klass)
{
static gboolean initialized = FALSE;
if (initialized) {
return;
}
initialized = TRUE;
signals[STATUS_CHANGED] = g_signal_new ("status-changed",
G_OBJECT_CLASS_TYPE (klass),
G_SIGNAL_RUN_LAST, 0,
NULL, NULL,
g_cclosure_marshal_VOID__BOOLEAN,
G_TYPE_NONE, 1,
G_TYPE_BOOLEAN);
dbus_g_object_type_install_info (gc_iface_geoclue_get_type (),
&dbus_glib_gc_iface_geoclue_object_info);
}
GType
gc_iface_geoclue_get_type (void)
{
static GType type = 0;
if (!type) {
const GTypeInfo info = {
sizeof (GcIfaceGeoclueClass),
gc_iface_geoclue_base_init,
NULL,
};
type = g_type_register_static (G_TYPE_INTERFACE,
"GcIfaceGeoclue", &info, 0);
}
return type;
}
static gboolean
gc_iface_geoclue_get_version (GcIfaceGeoclue *gc,
int *major,
int *minor,
int *micro,
GError **error)
{
return GC_IFACE_GEOCLUE_GET_CLASS (gc)->get_version (gc, major,
minor, micro,
error);
}
static gboolean
gc_iface_geoclue_get_status (GcIfaceGeoclue *gc,
gboolean *status,
GError **error)
{
return GC_IFACE_GEOCLUE_GET_CLASS (gc)->get_status (gc, status,
error);
}
static gboolean
gc_iface_geoclue_shutdown (GcIfaceGeoclue *gc,
GError **error)
{
return GC_IFACE_GEOCLUE_GET_CLASS (gc)->shutdown (gc, error);
}
/*
* Geoclue
* gc-iface-geoclue.c - GInterface for org.freedesktop.Geoclue
*
* Author: Iain Holmes <iain@openedhand.com>
*/
#ifndef _GC_IFACE_GEOCLUE_H
#define _GC_IFACE_GEOCLUE_H
G_BEGIN_DECLS
#define GC_TYPE_IFACE_GEOCLUE (gc_iface_geoclue_get_type ())
#define GC_IFACE_GEOCLUE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GC_TYPE_IFACE_GEOCLUE, GcIfaceGeoclue))
#define GC_IFACE_GEOCLUE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GC_TYPE_IFACE_GEOCLUE, GcIfaceGeoclueClass))
#define GC_IS_IFACE_GEOCLUE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GC_TYPE_IFACE_GEOCLUE))
#define GC_IS_IFACE_GEOCLUE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GC_TYPE_IFACE_GEOCLUE))
#define GC_IFACE_GEOCLUE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GC_TYPE_IFACE_GEOCLUE, GcIfaceGeoclueClass))
typedef struct _GcIfaceGeoclue GcIfaceGeoclue; /* Dummy typedef */
typedef struct _GcIfaceGeoclueClass GcIfaceGeoclueClass;
struct _GcIfaceGeoclueClass {
GTypeInterface base_iface;
/* signals */
void (* status_changed) (GcIfaceGeoclue *geoclue,
gboolean available);
/* vtable */
gboolean (*get_version) (GcIfaceGeoclue *geoclue,
int *major,
int *minor,
int *micro,
GError **error);
gboolean (*get_status) (GcIfaceGeoclue *geoclue,
gboolean *available,
GError **error);
gboolean (*shutdown) (GcIfaceGeoclue *geoclue,
GError **error);
};
GType gc_iface_geoclue_get_type (void);
G_END_DECLS
#endif
EXTRA_DIST = gc-iface-geoclue.xml
<?xml version="1.0" encoding="UTF-8" ?>
<node name="/">
<interface name="org.freedesktop.Geoclue">
<method name="GetVersion">
<arg type="i" name="major" direction="out" />
<arg type="i" name="minor" direction="out" />
<arg type="i" name="micro" direction="out" />
</method>
<property name="ServiceName" type="s" access="read" />
<method name="GetStatus">
<arg type="b" name="active" direction="out" />
</method>
<signal name="StatusChanged">
<arg type="b" name="active" direction="out" />
</signal>
<method name="Shutdown" />
</interface>
</node>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment