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

AC_INIT([geoclue],
4
        [2.1.0],
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 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
AM_MAINTAINER_MODE([enable])

AM_SILENT_RULES([yes])

# Check for programs
AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_CXX
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])

39 40
GLIB_MIN_VERSION=2.34.0
JSON_GLIB_MIN_VERSION=0.14
Zeeshan Ali's avatar
Zeeshan Ali committed
41
GEOIP_MIN_VERSION=1.5.1
42
LIBNM_GLIB_MIN_VERSION=0.9.9.0
43 44

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

46 47 48 49 50
dnl
dnl Documentation
dnl
GTK_DOC_CHECK(1.0)

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

Zeeshan Ali's avatar
Zeeshan Ali committed
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
# Geoip server
AC_ARG_ENABLE(geoip-server,
              AS_HELP_STRING([--enable-geoip-server=yes|no|auto], [Build geoip server]),
              [enable_geoip_server=$enableval],
              [enable_geoip_server=auto])
case "x$enable_geoip_server" in
  xyes)
    PKG_CHECK_MODULES(GEOIP_SERVER,
		      gio-2.0 >= $GLIB_MIN_VERSION
                      json-glib-1.0 >= $JSON_GLIB_MIN_VERSION
                      libsoup-2.4
                      geoip >= GEOIP_MIN_VERSION)
    build_geoip_server="yes"
    ;;
  xauto)
    PKG_CHECK_MODULES(GEOIP_SERVER,
		      gio-2.0 >= $GLIB_MIN_VERSION
                      json-glib-1.0 >= $JSON_GLIB_MIN_VERSION
                      libsoup-2.4
                      geoip >= GEOIP_MIN_VERSION,
                      [build_geoip_server=yes],
                      [build_geoip_server=no])
    ;;
  xno)
    build_geoip_server="xno"
    ;;
  x*)
    AC_MSG_ERROR([Unknown --enable-geoip-server argument: $enable_geoip_server])
    ;;
esac
if test "x$build_geoip_server" = "xyes"; then
  # Requires for the database update
  PKG_CHECK_MODULES(GEOIP_DBUPDATE,
93 94
		    gio-2.0 >= $GLIB_MIN_VERSION
                    libsoup-2.4)
Zeeshan Ali's avatar
Zeeshan Ali committed
95 96 97 98 99 100 101
  GEOIP_DATABASE_PATH=`$PKG_CONFIG --variable=databasedir geoip`
  AC_SUBST(GEOIP_DATABASE_PATH)
  AC_DEFINE([BUILD_GEOIP_SERVER], [1], [Build geoip server?])
else
  AC_DEFINE([BUILD_GEOIP_SERVER], [0], [Build geoip server?])
fi
AM_CONDITIONAL([BUILD_GEOIP_SERVER], [test "x$build_geoip_server" = "xyes"])
102

103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
# Demo agent
AC_ARG_ENABLE(demo-agent,
              AS_HELP_STRING([--enable-demo-agent=yes|no],
                             [Build demo agent (default=no)]),
              [enable_demo_agent=$enableval],
              [enable_demo_agent=no])
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"])

120
GNOME_COMPILE_WARNINGS([maximum])
Zeeshan Ali's avatar
Zeeshan Ali committed
121

122 123 124 125 126 127 128 129 130 131 132 133
dnl Require agent?
AC_ARG_ENABLE(require-auth,
	      AS_HELP_STRING([--enable-require-auth=yes|no],
                             [Require apps to be authorized by agent (default=no)]),
              [require_auth=$enableval],
              [require_auth=no])
if test "x$require_auth" = "xyes"; then
    AC_DEFINE([REQUIRE_AUTH], [1], [Require apps to be authorized by agent?])
else
    AC_DEFINE([REQUIRE_AUTH], [0], [Require apps to be authorized by agent?])
fi

Zeeshan Ali's avatar
Zeeshan Ali committed
134 135 136 137 138 139 140 141
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
142 143 144 145 146 147 148 149 150
# 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)

151 152 153 154 155 156 157
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)

158 159 160 161 162 163 164 165 166 167 168 169 170 171
# 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
AC_SUBST([GDBUS_CODEGEN])

if test "x$GDBUS_CODEGEN" = "x"; then
	ifelse([$2],,[AC_MSG_ERROR([gdbus-codegen not found.])],[$2])
else
	ifelse([$1],,[:],[$1])
fi

172 173 174 175 176 177 178 179 180 181
# 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"])

182 183
AC_PATH_PROG([REALPATH],[realpath])

184 185
AC_PATH_PROG([SETCAP],[setcap])

186 187 188
GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0`
AC_SUBST(GLIB_MKENUMS)

Zeeshan Ali's avatar
Zeeshan Ali committed
189 190 191
AC_CONFIG_FILES([
  Makefile
  src/Makefile
192
  src/geoclue-2.0.pc
193
  src/agent/Makefile
194
  src/geoip-server/Makefile
Zeeshan Ali's avatar
Zeeshan Ali committed
195
  po/Makefile.in
196
  data/org.freedesktop.GeoClue2.conf
Zeeshan Ali's avatar
Zeeshan Ali committed
197 198
  data/Makefile
  demo/Makefile
199 200
  docs/Makefile
  docs/version.xml
Zeeshan Ali's avatar
Zeeshan Ali committed
201 202 203 204 205 206 207 208 209 210 211 212
])

AC_OUTPUT

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

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

        prefix:                   ${prefix}
        c compiler:               ${CC} ${CFLAGS}
213
        systemdsystemunitdir:     ${systemdsystemunitdir}
Zeeshan Ali's avatar
Zeeshan Ali committed
214
])