configure.ac 8.6 KB
Newer Older
Zeeshan Ali's avatar
Zeeshan Ali committed
1 2 3
AC_PREREQ([2.63])

AC_INIT([geoclue],
Zeeshan Ali's avatar
Zeeshan Ali committed
4
        [2.4.10],
Zeeshan Ali's avatar
Zeeshan Ali committed
5 6 7 8 9 10 11 12
        [http://bugs.freedesktop.org/enter_bug.cgi?product=GeoClue],
        [geoclue],
        [http://www.freedesktop.org/wiki/Software/GeoClue])

AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_AUX_DIR([build-aux])

13
AM_INIT_AUTOMAKE([1.11 dist-xz no-dist-gzip tar-ustar foreign -Wall -Werror -Wno-portability])
Zeeshan Ali's avatar
Zeeshan Ali committed
14 15 16 17
AM_MAINTAINER_MODE([enable])

AM_SILENT_RULES([yes])

18 19
AC_SUBST([GEOCLUE_API_VERSION], [2.0])

Zeeshan Ali's avatar
Zeeshan Ali committed
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
# Check for programs
AC_PROG_CC
AM_PROG_CC_C_O
AM_PROG_AR
AC_CHECK_TOOL([DESKTOP_FILE_VALIDATE], [desktop-file-validate], [/bin/true])

# Initialize libtool
LT_PREREQ([2.2])
LT_INIT([disable-static])

# Pkg-config
PKG_PROG_PKG_CONFIG([0.22])

# i18 support
IT_PROG_INTLTOOL(0.40.0)

GETTEXT_PACKAGE=AC_PACKAGE_NAME
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",[The name of the gettext domain])

Zeeshan Ali's avatar
Zeeshan Ali committed
40
GLIB_MIN_VERSION=2.44.0
41
JSON_GLIB_MIN_VERSION=0.14
Zeeshan Ali's avatar
Zeeshan Ali committed
42
LIBMM_GLIB_MIN_VERSION=1.6
Zeeshan Ali's avatar
Zeeshan Ali committed
43
LIBSOUP_MIN_VERSION=2.42
Ankit's avatar
Ankit committed
44
AVAHI_MIN_VERSION=0.6.10
45 46

AC_CHECK_LIB([m],[sin])
Zeeshan Ali's avatar
Zeeshan Ali committed
47

48 49 50 51 52
dnl
dnl Documentation
dnl
GTK_DOC_CHECK(1.0)

Zeeshan Ali's avatar
Zeeshan Ali committed
53 54 55 56
PKG_CHECK_MODULES(GEOCLUE, [
  glib-2.0 >= $GLIB_MIN_VERSION
  gio-2.0 >= $GLIB_MIN_VERSION
  gio-unix-2.0 >= $GLIB_MIN_VERSION
57
  json-glib-1.0 >= $JSON_GLIB_MIN_VERSION
Zeeshan Ali's avatar
Zeeshan Ali committed
58
  libsoup-2.4 >= $LIBSOUP_MIN_VERSION
Zeeshan Ali's avatar
Zeeshan Ali committed
59 60
])

61 62
# GObject-introspection support
GOBJECT_INTROSPECTION_CHECK([0.9.6])
63
VAPIGEN_CHECK()
64 65
build_introspection=no

Zeeshan Ali's avatar
Zeeshan Ali committed
66 67 68 69 70 71 72 73 74 75
# libgeoclue
AC_ARG_ENABLE(libgeoclue,
              AS_HELP_STRING([--disable-libgeoclue], [Disable convenience library]),
              [build_libgeoclue=$enableval], [build_libgeoclue=yes])
if test "x$build_libgeoclue" = "xyes"; then
  PKG_CHECK_MODULES(LIBGEOCLUE, [
    glib-2.0 >= $GLIB_MIN_VERSION
    gio-2.0 >= $GLIB_MIN_VERSION
    gio-unix-2.0 >= $GLIB_MIN_VERSION
  ])
76 77 78
  if test "x$found_introspection" == "xyes"; then
     build_introspection=yes
  fi
Zeeshan Ali's avatar
Zeeshan Ali committed
79
  build_libgeoclue=yes
80

Zeeshan Ali's avatar
Zeeshan Ali committed
81 82 83 84 85 86
  AC_DEFINE([BUILD_LIBGEOCLUE], [1], [Build convenience library?])
else
  AC_DEFINE([BUILD_LIBGEOCLUE], [0], [Build convenience library?])
fi
AM_CONDITIONAL([BUILD_LIBGEOCLUE], [test "x$build_libgeoclue" = "xyes"])

87 88 89 90
# 3G source
AC_ARG_ENABLE(3g-source,
              AS_HELP_STRING([--disable-3g-source], [Disable 3G backend (requires ModemManager)]),
              [build_3g_source=$enableval], [build_3g_source=yes])
91
if test "x$build_3g_source" = "xyes"; then
92 93 94 95 96
  build_modem_source=yes
  AC_DEFINE([GCLUE_USE_3G_SOURCE], [1], [Build 3G source?])
else
  AC_DEFINE([GCLUE_USE_3G_SOURCE], [0], [Build 3G source?])
fi
97
AM_CONDITIONAL([BUILD_3G_SOURCE], [test "x$build_3g_source" = "xyes"])
98

Zeeshan Ali's avatar
Zeeshan Ali committed
99 100 101 102
# CDMA source
AC_ARG_ENABLE(cdma-source,
              AS_HELP_STRING([--disable-cdma-source], [Disable CDMA backend (requires ModemManager)]),
              [build_cdma_source=$enableval], [build_cdma_source=yes])
103
if test "x$build_cdma_source" = "xyes"; then
Zeeshan Ali's avatar
Zeeshan Ali committed
104 105 106 107 108
  build_modem_source=yes
  AC_DEFINE([GCLUE_USE_CDMA_SOURCE], [1], [Build CDMA source?])
else
  AC_DEFINE([GCLUE_USE_CDMA_SOURCE], [0], [Build CDMA source?])
fi
109
AM_CONDITIONAL([BUILD_CDMA_SOURCE], [test "x$build_cdma_source" = "xyes"])
Zeeshan Ali's avatar
Zeeshan Ali committed
110

111 112
# GPS source
AC_ARG_ENABLE(modem-gps-source,
113
              AS_HELP_STRING([--disable-modem-gps-source], [Disable modem GPS backend (requires ModemManager)]),
114
              [build_modem_gps_source=$enableval], [build_modem_gps_source=yes])
115
if test "x$build_modem_gps_source" = "xyes"; then
116
  build_modem_source=yes
117
  AC_DEFINE([GCLUE_USE_MODEM_GPS_SOURCE], [1], [Build modem GPS source?])
118
else
119
  AC_DEFINE([GCLUE_USE_MODEM_GPS_SOURCE], [0], [Build modem GPS source?])
120
fi
121
AM_CONDITIONAL([BUILD_MODEM_GPS_SOURCE], [test "x$build_modem_gps_source" = "xyes"])
122

Zeeshan Ali's avatar
Zeeshan Ali committed
123
# Modem source is used in common by GPS, 3G and CDMA sources
124
if test "x$build_modem_source" = "xyes"; then
125 126
  require_modemmanager=yes
fi
127
AM_CONDITIONAL([BUILD_MODEM_SOURCE], [test "x$build_modem_source" = "xyes"])
128

Ankit's avatar
Ankit committed
129 130 131 132 133 134 135 136 137 138 139 140 141
# Network NMEA Source
AC_ARG_ENABLE(nmea-source,
              AS_HELP_STRING([--disable-nmea-source],
                             [Disable network NMEA source (requires avahi-client and avahi-glib)]),
              [build_nmea_source=$enableval], [build_nmea_source=yes])

if test "x$build_nmea_source" = "xyes"; then
  AC_DEFINE([GCLUE_USE_NMEA_SOURCE], [1], [Build network NMEA source?])
else
  AC_DEFINE([GCLUE_USE_NMEA_SOURCE], [0], [Build network NMEA source?])
fi
AM_CONDITIONAL([BUILD_NMEA_SOURCE], [test "x$build_nmea_source" = "xyes"])

142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161
# Backend build
AC_ARG_ENABLE(backend,
              AS_HELP_STRING([--disable-backend], [Disable backend]),
              [build_backend=$enableval], [build_backend=yes])

if test "x$build_backend" = "xyes"; then
  # Check for ModemManager if one of the sources requires it
  if test "x$require_modemmanager" = "xyes"; then
    PKG_CHECK_MODULES(ModemManager, mm-glib >= $LIBMM_GLIB_MIN_VERSION)
  fi

  if test "x$build_nmea_source" = "xyes"; then
      # Check for avahi-client and avahi-glib
      PKG_CHECK_MODULES(NMEA_SOURCE, [
                        avahi-client >= $AVAHI_MIN_VERSION
                        avahi-glib >= $AVAHI_MIN_VERSION])
  fi
  AC_DEFINE([BUILD_BACKEND], [1], [Build backend?])
else
  AC_DEFINE([BUILD_BACKEND], [0], [Build backend?])
Ankit's avatar
Ankit committed
162
fi
163
AM_CONDITIONAL([BUILD_BACKEND], [test "x$build_backend" = "xyes"])
Ankit's avatar
Ankit committed
164

165 166 167
# Demo agent
AC_ARG_ENABLE(demo-agent,
              AS_HELP_STRING([--enable-demo-agent=yes|no],
168
                             [Build demo agent (default=yes)]),
169
              [enable_demo_agent=$enableval],
170
              [enable_demo_agent=yes])
171 172 173 174 175 176 177 178 179 180 181
if test "x$enable_demo_agent" = "xyes"; then
    PKG_CHECK_MODULES(DEMO_AGENT, [
                      glib-2.0 >= $GLIB_MIN_VERSION
                      gio-2.0 >= $GLIB_MIN_VERSION
                      gio-unix-2.0 >= $GLIB_MIN_VERSION
                      libnotify])
else
    AC_DEFINE([BUILD_DEMO_AGENT], [0], [Build demo agent?])
fi
AM_CONDITIONAL([BUILD_DEMO_AGENT], [test "x$enable_demo_agent" = "xyes"])

182
GNOME_COMPILE_WARNINGS([maximum])
Zeeshan Ali's avatar
Zeeshan Ali committed
183 184 185 186 187 188 189 190 191

dnl Debugging
AC_ARG_ENABLE(debug,
	AS_HELP_STRING([--enable-debug],[enable debugging]),,
        enable_debug=no)
if test "x$enable_debug" = "xyes"; then
        CFLAGS="$CFLAGS -O0 -ggdb3"
fi

Zeeshan Ali's avatar
Zeeshan Ali committed
192 193 194 195 196 197 198 199 200
# DBus system directory
AC_ARG_WITH(dbus-sys-dir, AS_HELP_STRING([--with-dbus-sys-dir=DIR], [where D-BUS system.d directory is]))
if test -n "$with_dbus_sys_dir" ; then
    DBUS_SYS_DIR="$with_dbus_sys_dir"
else
    DBUS_SYS_DIR="${sysconfdir}/dbus-1/system.d"
fi
AC_SUBST(DBUS_SYS_DIR)

201 202 203 204 205 206 207
AC_ARG_WITH(dbus-service-user,
	    AS_HELP_STRING([--with-dbus-service-user=USER],
                           [The USER (existing) as which the service will run (default: root)]),
	    dbus_srv_user="$with_dbus_service_user",
	    dbus_srv_user="root")
AC_SUBST(dbus_srv_user)

208 209 210 211 212 213 214
# gdbus-codegen
if test x$cross_compiling != xyes; then
	GDBUS_CODEGEN=`$PKG_CONFIG --variable gdbus_codegen gio-2.0`
else
	AC_PATH_PROG([GDBUS_CODEGEN],[gdbus-codegen])
fi

215 216 217
AS_IF([test "$GDBUS_CODEGEN" = ""],[
	AC_MSG_ERROR([gdbus-codegen not found])
])
218

219 220 221 222 223 224 225 226 227 228
# systemd
AC_ARG_WITH([systemdsystemunitdir],
            AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
            [],
            [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
if test "x$with_systemdsystemunitdir" != "xno"; then
  AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
fi
AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$systemdsystemunitdir"])

229 230 231
GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0`
AC_SUBST(GLIB_MKENUMS)

232 233 234
GLIB_GENMARSHAL=`pkg-config --variable=glib_genmarshal glib-2.0`
AC_SUBST(GLIB_GENMARSHAL)

Zeeshan Ali's avatar
Zeeshan Ali committed
235 236
AC_CONFIG_FILES([
  Makefile
237
  build-aux/Makefile
Zeeshan Ali's avatar
Zeeshan Ali committed
238
  src/Makefile
239
  src/geoclue-$GEOCLUE_API_VERSION.pc:src/geoclue.pc.in
240
  src/agent/Makefile
241
  src/geocode-glib/Makefile
242
  public-api/Makefile
Zeeshan Ali's avatar
Zeeshan Ali committed
243
  po/Makefile.in
244
  data/org.freedesktop.GeoClue2.conf
245
  data/org.freedesktop.GeoClue2.Agent.conf
Zeeshan Ali's avatar
Zeeshan Ali committed
246
  data/Makefile
Zeeshan Ali's avatar
Zeeshan Ali committed
247 248
  libgeoclue/Makefile
  libgeoclue/libgeoclue-$GEOCLUE_API_VERSION.pc:libgeoclue/libgeoclue.pc.in
Zeeshan Ali's avatar
Zeeshan Ali committed
249
  demo/Makefile
250
  docs/Makefile
Zeeshan Ali's avatar
Zeeshan Ali committed
251
  docs/lib/Makefile
252
  docs/version.xml
Zeeshan Ali's avatar
Zeeshan Ali committed
253
  docs/lib/version.xml
Zeeshan Ali's avatar
Zeeshan Ali committed
254 255 256 257 258 259 260 261 262 263 264 265
])

AC_OUTPUT

dnl ==========================================================================
AC_MSG_NOTICE([

        GeoClue $VERSION
        =================

        prefix:                   ${prefix}
        c compiler:               ${CC} ${CFLAGS}
266
        systemdsystemunitdir:     ${systemdsystemunitdir}
267

268
        Backend:                  ${build_backend}
Zeeshan Ali's avatar
Zeeshan Ali committed
269
        Convenience library:      ${build_libgeoclue}
270
        Introspection:            ${build_introspection}
271
        3G source:                ${build_3g_source}
Zeeshan Ali's avatar
Zeeshan Ali committed
272
        CDMA source:              ${build_cdma_source}
273
        Modem GPS source:         ${build_modem_gps_source}
Ankit's avatar
Ankit committed
274
        Network NMEA source:      ${build_nmea_source}
Zeeshan Ali's avatar
Zeeshan Ali committed
275
])