1# versioning 2m4_define([unique_major_version], [3]) 3m4_define([unique_minor_version], [0]) 4m4_define([unique_micro_version], [2]) 5m4_define([unique_version], [unique_major_version.unique_minor_version.unique_micro_version]) 6m4_define([unique_api_version], [unique_major_version.unique_minor_version]) 7 8# if functions have been added, set to 0; otherwise, increment 9# with every release 10m4_define([unique_interface_age], [2]) 11m4_define([unique_binary_age], [m4_eval(100 * unique_minor_version + unique_micro_version)]) 12# This is the X.Y used in -lunique-FOO-X.Y 13m4_define([unique_api_version], [3.0]) 14# This is the X.Y used in the protocol negotiation 15m4_define([unique_protocol_version], [1.0]) 16 17AC_PREREQ([2.63]) 18 19AC_INIT([unique], [unique_version], 20 [http://bugzilla.gnome.org/enter_bug.cgi?product=libunique], 21 [libunique]) 22 23AC_CONFIG_SRCDIR([unique/unique.h]) 24AC_CONFIG_MACRO_DIR([build/autotools]) 25 26AM_INIT_AUTOMAKE([1.11 no-define -Wno-portability dist-bzip2 no-dist-gzip]) 27AM_CONFIG_HEADER([config.h]) 28 29AM_SILENT_RULES([yes]) 30 31AC_PROG_CC_C_O 32 33AM_PATH_GLIB_2_0 34 35LT_PREREQ([2.2]) 36LT_INIT([disable-static]) 37 38# Honor aclocal flags 39ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS" 40 41# version symbols 42UNIQUE_MAJOR_VERSION=unique_major_version 43UNIQUE_MINOR_VERSION=unique_minor_version 44UNIQUE_MICRO_VERSION=unique_micro_version 45UNIQUE_VERSION=unique_version 46UNIQUE_API_VERSION=unique_api_version 47UNIQUE_PROTOCOL_VERSION=unique_protocol_version 48AC_SUBST(UNIQUE_MAJOR_VERSION) 49AC_SUBST(UNIQUE_MINOR_VERSION) 50AC_SUBST(UNIQUE_MICRO_VERSION) 51AC_SUBST(UNIQUE_VERSION) 52AC_SUBST(UNIQUE_API_VERSION) 53AC_SUBST(UNIQUE_PROTOCOL_VERSION) 54 55# libtool 56m4_define([lt_current], [m4_eval(100 * unique_minor_version + unique_micro_version - unique_interface_age)]) 57m4_define([lt_revision], [unique_interface_age]) 58m4_define([lt_age], [m4_eval(unique_binary_age - unique_interface_age)]) 59UNIQUE_LT_VERSION_INFO="lt_current:lt_revision:lt_age" 60UNIQUE_LT_CURRENT_MINUS_AGE=m4_eval(lt_current - lt_age) 61AC_SUBST(UNIQUE_LT_VERSION_INFO) 62AC_SUBST(UNIQUE_LT_CURRENT_MINUS_AGE) 63 64m4_define([glib_required], [2.12.0]) 65m4_define([gtk_required], [2.90.0]) 66m4_define([dbus_required], [0.70]) 67 68PKG_CHECK_MODULES(UNIQUE, glib-2.0 >= glib_required dnl 69 gtk+-3.0 >= gtk_required) 70 71GTK_CHECK_BACKEND([x11], [gtk_required], 72 [ 73 AC_PATH_XTRA 74 75 PKG_CHECK_MODULES(UNIQUE_X11, x11) 76 77 UNIQUE_CFLAGS="$UNIQUE_CFLAGS $UNIQUE_X11_CFLAGS" 78 UNIQUE_LIBS="$UNIQUE_LIBS $UNIQUE_X11_LIBS" 79 ] 80) 81 82AC_SUBST(UNIQUE_CFLAGS) 83AC_SUBST(UNIQUE_LIBS) 84 85dnl D-Bus backend dependencies 86m4_define([have_dbus_default], [yes]) 87AC_ARG_ENABLE([dbus], 88 [AC_HELP_STRING([--enable-dbus=@<:@yes/no@:>@], 89 [Whether D-BUS IPC should be enabled])], 90 [], 91 [enable_dbus=have_dbus_default]) 92 93AS_CASE([$enable_dbus], 94 95 [yes], 96 [ 97 PKG_CHECK_MODULES(DBUS, dbus-glib-1 >= dbus_required, 98 [have_dbus=yes], 99 [have_dbus=no]) 100 ], 101 102 [no], [have_dbus=no], 103 104 [AC_MSG_ERROR([Unknown argument to --enable-dbus])] 105) 106 107AS_IF([test "x$have_dbus" = "xyes"], 108 [ 109 AC_SUBST(DBUS_CFLAGS) 110 AC_SUBST(DBUS_LIBS) 111 AC_DEFINE([HAVE_DBUS], [1], [Building with D-Bus support]) 112 AC_PATH_PROG(DBUS_BINDING_TOOL, [dbus-binding-tool]) 113 ] 114) 115 116AM_CONDITIONAL([HAVE_DBUS], [test "x$have_dbus" = "xyes"]) 117 118dnl GDBus backend 119dnl This is the default backend if GIO is recent enough 120m4_define([gdbus_gio_required],[2.25.7]) 121PKG_CHECK_MODULES([GDBUS],[gio-2.0 >= gdbus_gio_required],[have_gdbus=yes],[have_gdbus=no]) 122 123AS_IF([test "x$have_gdbus" = "xyes"], 124 [ 125 AC_DEFINE([HAVE_GDBUS],[1],[Define if GDBus backend is enabled]) 126 ] 127 ) 128 129AM_CONDITIONAL([HAVE_GDBUS],[test "$have_gdbus" = "yes"]) 130 131dnl Bacon backend 132dnl This is the fallback backend, so we *need* these headers and functions 133dnl even if we end up using D-Bus 134m4_define([have_bacon_default], [yes]) 135AC_ARG_ENABLE([bacon], 136 [AC_HELP_STRING([--enable-bacon=@<:@yes/no@:>@], 137 [Whether Unix domain sockets IPC should be enabled])], 138 [], 139 [enable_bacon=have_bacon_default]) 140 141AS_IF([test "x$enable_bacon" = "xyes"], 142 [ 143 AC_CHECK_HEADERS([fcntl.h sys/types.h sys/socket.h sys/un.h], 144 [have_bacon=yes], 145 [have_bacon=no]) 146 ], 147 148 [have_bacon=no] 149) 150 151AS_IF([test "x$have_bacon" = "xyes"], 152 [ 153 AC_DEFINE([HAVE_BACON], [1], [Building with Unix domain socket support]) 154 ] 155) 156 157AM_CONDITIONAL([HAVE_BACON], [test "x$have_bacon" = "xyes"]) 158 159dnl Choose the default backend 160AC_MSG_CHECKING([for default IPC mechanism]) 161AS_IF([test "x$have_gdbus" = "xyes"], 162 [ 163 UNIQUE_DEFAULT_BACKEND=gdbus 164 AC_MSG_RESULT([GDBus]) 165 ], 166 167 [test "x$have_dbus" = "xyes"], 168 [ 169 UNIQUE_DEFAULT_BACKEND=dbus 170 AC_MSG_RESULT([D-Bus]) 171 ], 172 173 [test "x$have_bacon" = "xyes"], 174 [ 175 UNIQUE_DEFAULT_BACKEND=bacon 176 AC_MSG_RESULT([Unix domain sockets]) 177 ], 178 179 [AC_MSG_ERROR([No IPC backend enabled.])] 180) 181 182AC_SUBST(UNIQUE_DEFAULT_BACKEND) 183 184# use strict compiler flags only during development cycles 185m4_define([maintainer_flags_default], [m4_if(m4_eval(unique_minor_version % 2), [1], [yes], [no])]) 186AC_ARG_ENABLE([maintainer-flags], 187 [AC_HELP_STRING([--enable-maintainer-flags=@<:@no/yes@:>@], 188 [Use strict compiler flags @<:@default=maintainer_flags_default@:>@])], 189 [], 190 [enable_maintainer_flags=maintainer_flags_default]) 191 192AS_IF([test "x$enable_maintainer_flags" = "xyes" && test "x$GCC" = "xyes"], 193 [ 194 AS_COMPILER_FLAGS([MAINTAINER_CFLAGS], 195 ["-Wall -Wshadow -Wcast-align -Wuninitialized 196 -Wno-strict-aliasing -Wempty-body -Wformat 197 -Wformat-security -Winit-self 198 -Wdeclaration-after-statement -Wvla"]) 199 ] 200) 201 202AC_SUBST(MAINTAINER_CFLAGS) 203 204# enable debug flags and symbols 205m4_define([debug_default], [m4_if(m4_eval(unique_minor_version % 2), [1], [yes], [minimum])]) 206AC_ARG_ENABLE([debug], 207 [AC_HELP_STRING([--enable-debug=@<:@no/minimum/yes@:>@], 208 [Turn on debugging @<:@default=debug_default@:>@])], 209 [], 210 [enable_debug=debug_default]) 211 212AS_CASE([$enable_debug], 213 214 [yes], 215 [ 216 test "$cflags_set" = set || CFLAGS="$CFLAGS -g" 217 UNIQUE_DEBUG_CFLAGS="-DUNIQUE_ENABLE_DEBUG" 218 ], 219 220 [no], 221 [ 222 UNIQUE_DEBUG_CFLAGS="-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS -DG_DISABLE_CAST_CHECKS" 223 ], 224 225 [minimum], 226 [ 227 UNIQUE_DEBUG_CFLAGS="-DG_DISABLE_CAST_CHECKS" 228 ], 229 230 [AC_MSG_ERROR([Unknown argument to --enable-debug])] 231) 232 233AC_SUBST(UNIQUE_DEBUG_CFLAGS) 234 235# introspection 236GOBJECT_INTROSPECTION_CHECK([0.9.0]) 237 238# gtk-doc 239GLIB_PREFIX="`$PKG_CONFIG --variable=prefix glib-2.0`" 240GDK_PREFIX="`$PKG_CONFIG --variable=prefix gtk+-3.0`" 241GTK_PREFIX="`$PKG_CONFIG --variable=prefix gdk-3.0`" 242AC_SUBST(GLIB_PREFIX) 243AC_SUBST(GDK_PREFIX) 244AC_SUBST(GTK_PREFIX) 245 246GTK_DOC_CHECK([1.13]) 247 248AC_CONFIG_FILES([ 249 Makefile 250 unique.pc 251 build/Makefile 252 build/autotools/Makefile 253 doc/Makefile 254 doc/reference/Makefile 255 doc/reference/version.xml 256 unique/Makefile 257 unique/uniqueversion.h 258 unique/bacon/Makefile 259 unique/dbus/Makefile 260 unique/gdbus/Makefile 261 tests/Makefile 262]) 263 264AC_OUTPUT 265 266echo " 267Unique $UNIQUE_VERSION 268 269Configuration: 270 Maintainer flags: $enable_maintainer_flags 271 Debug level: $enable_debug 272 Build documentation: $enable_gtk_doc 273 Build introspection data: $enable_introspection 274 275Backends: 276 Unix Domain Socket: $have_bacon 277 D-BUS: $have_dbus 278 GDBus: $have_gdbus 279 280 Default backend: $UNIQUE_DEFAULT_BACKEND 281" 282