~kees/libunity/remote-search-none

1
2
3
4
5
6
7
8
9
10
11
12
13
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
# When releasing also remember to update the soname as instructed below
AC_INIT(libunity, 6.5.2)

AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
AM_CONFIG_HEADER(config.h)
AM_MAINTAINER_MODE

m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
AC_CONFIG_MACRO_DIR([m4])

CFLAGS="$CFLAGS"

# Before making a release, the LIBUNITY_LT_VERSION string should be updated.
# The string is of the form C:R:A.
# - If interfaces have been changed or added, but binary compatibility has
#   been preserved, change to C+1:0:A+1
# - If binary compatibility has been broken (eg removed or changed interfaces)
#   change to C+1:0:0
# - If the interface is the same as the previous version, change to C:R+1:A
LIBUNITY_LT_CURRENT=9
LIBUNITY_LT_REV=2
LIBUNITY_LT_AGE=0
LIBUNITY_LT_VERSION="$LIBUNITY_LT_CURRENT:$LIBUNITY_LT_REV:$LIBUNITY_LT_AGE"
LIBUNITY_LT_LDFLAGS="-version-info $LIBUNITY_LT_VERSION -export-symbols-regex '^unity_.*'"

AC_SUBST(LIBUNITY_LT_CURRENT)
AC_SUBST(LIBUNITY_LT_VERSION)
AC_SUBST(LIBUNITY_LT_LDFLAGS)

LIBPROTOCOL_LT_CURRENT=0
LIBPROTOCOL_LT_REV=0
LIBPROTOCOL_LT_AGE=0
LIBPROTOCOL_LT_VERSION="$LIBPROTOCOL_LT_CURRENT:$LIBPROTOCOL_LT_REV:$LIBPROTOCOL_LT_AGE"
LIBPROTOCOL_LT_LDFLAGS="-version-info $LIBPROTOCOL_LT_VERSION -export-symbols-regex '^unity_protocol_.*'"

AC_SUBST(LIBPROTOCOL_LT_CURRENT)
AC_SUBST(LIBPROTOCOL_LT_VERSION)
AC_SUBST(LIBPROTOCOL_LT_LDFLAGS)

GIR_MAJOR=6
GIR_MINOR=0
AC_SUBST([GIR_VERSION],[$GIR_MAJOR.$GIR_MINOR])
AC_DEFINE_UNQUOTED(GIR_VERSION, [$GIR_VERSION], [GIR version])

###################################################################
# Check essential build programs
###################################################################
AC_ISC_POSIX
AC_PROG_CC
AM_PROG_CC_STDC
AC_HEADER_STDC
AM_PROG_LIBTOOL
AM_PROG_VALAC([0.16.0])
AS_IF([test -z "$VALAC"], [AC_MSG_ERROR(["Can't find suitable vala compiler."])])

###################################################################
# Check for Python - we need to know where to install overrides
###################################################################
AM_PATH_PYTHON

####################################################################
# Compiler generate debug code
####################################################################
AC_ARG_ENABLE([debug],
              AC_HELP_STRING([--enable-debug=@<:@no/yes@:>@], [build with debug symbols @<:@default=no@:>@]),,
              [enable_debug=no])

if test "x$enable_debug" = "xyes"; then
	CFLAGS="-ggdb $CFLAGS"
	AC_DEFINE(ENABLE_DEBUG, 1, [build with extra debug information])
fi

AM_CONDITIONAL(ENABLE_DEBUG, test "$enable_debug" = "yes")

####################################################################
# Integration tests
####################################################################
AC_ARG_ENABLE([integration-tests],
              AC_HELP_STRING([--enable-integration-tests=@<:@no/yes@:>@], [run the integration test suite @<:@default=no@:>@]),,
              [enable_integration_tests=no])

if test "x$enable_integration_tests" = "xyes"; then
	AC_DEFINE(ENABLE_INTEGRATION_TESTS, 1, [enable integration tests])
fi

AM_CONDITIONAL(ENABLE_INTEGRATION_TESTS, test "$enable_integration_tests" = "yes")

####################################################################
# Trace logging
####################################################################
AC_ARG_ENABLE([trace-log],
              AC_HELP_STRING([--enable-trace-log=@<:@no/yes@:>@], [compile with trace logging statements @<:@default=no@:>@]),,
              [enable_trace_log=no])

if test "x$enable_trace_log" = "xyes"; then
	AC_DEFINE(ENABLE_TRACE_LOG, 1, [enable trace logging])
fi

AM_CONDITIONAL(ENABLE_TRACE_LOG, test "$enable_trace_log" = "yes")

####################################################################
# C compiler warnings
####################################################################
AC_ARG_ENABLE([c-warnings],
              AC_HELP_STRING([--enable-c-warnings=@<:@no/yes@:>@], [show warnings from the C compiler @<:@default=no@:>@]),,
              [enable_c_warnings=no])

if test "x$enable_c_warnings" = "xyes"; then
	AC_DEFINE(ENABLE_C_WARNINGS, 1, [show warnings from the C compiler])
fi

AM_CONDITIONAL(ENABLE_C_WARNINGS, test "$enable_c_warnings" = "yes")

####################################################################
# GObject Introspection
# (we get .gir for free with Vala, but needed for the .typelib)
####################################################################
AC_MSG_CHECKING([for gobject-introspection m4 macros])
m4_ifdef([GOBJECT_INTROSPECTION_CHECK], , AC_MSG_FAILURE([failed. Please install the package 'gobject-introspection' in order to compile libunity]))
AC_MSG_RESULT([yes])

GOBJECT_INTROSPECTION_CHECK([0.10.0])

#################################################
# Docs
#################################################

AC_ARG_ENABLE([docs],
    AS_HELP_STRING([--enable-docs], [Enable documentation generation]),
    [enable_docs=$enableval], [enable_docs="no"])

found_valadoc=no
AS_IF([test "x$enable_docs" != "xno"], [
    AC_PATH_PROG(VALADOC, valadoc, :)
    AS_IF([test -x "$VALADOC"], [
        found_valadoc=yes
        AC_SUBST(VALADOC)
        # FIXME: remove once we have valadoc >=0.3.3
        AS_IF([$VALAC --version | grep -q 0.16],
              VALADOC_DRIVER=0.16.x,
              [$VALAC --version | grep -q '0.17\|0.18'],
              VALADOC_DRIVER=0.18.x,
              VALADOC_DRIVER="`$VALAC --version`")
        AC_SUBST(VALADOC_DRIVER)
    ], [
        AS_IF([test "x$enable_docs" == "xyes"], AC_MSG_ERROR([Unable to find valadoc]))
    ])
])

AM_CONDITIONAL(ENABLE_DOCS, test "x$found_valadoc" = "xyes")

####################################################################
# Headless tests
####################################################################
AC_ARG_ENABLE([headless-tests],
              AS_HELP_STRING([--enable-headless-tests=@<:@no/yes@:>@],[enable headless test suite (requires Xvfb) @<:@default=no@:>@]),,
              [enable_headless_tests=no])

AM_CONDITIONAL([ENABLE_HEADLESS_TESTS],[test "x$enable_headless_tests" != "xno"])

if test "x$enable_headless_tests" = "xyes"; then
  AC_PATH_PROG([XVFB],[Xvfb])
  AC_PATH_PROG([DBUS_LAUNCH],[dbus-launch])
fi

###########################
# gcov coverage reporting
###########################
m4_include([m4/gcov.m4])
AC_TDD_GCOV
AM_CONDITIONAL([HAVE_GCOV], [test "x$ac_cv_check_gcov" = xyes])
AM_CONDITIONAL([HAVE_LCOV], [test "x$ac_cv_check_lcov" = xyes])
AM_CONDITIONAL([HAVE_GCOVR], [test "x$ac_cv_check_gcovr" = xyes])
AC_SUBST(COVERAGE_CFLAGS)
AC_SUBST(COVERAGE_LDFLAGS)

####################################################################
# Check library deps
####################################################################
GLIB_REQUIRED=2.26
PKG_CHECK_MODULES(GLIB2, [glib-2.0 >= $GLIB_REQUIRED ])
PKG_CHECK_MODULES(GOBJECT2, [gobject-2.0 >= $GLIB_REQUIRED ])
PKG_CHECK_MODULES(GIO2, [gio-2.0 >= $GLIB_REQUIRED ])
PKG_CHECK_MODULES(GIO_UNIX2, [gio-unix-2.0])
PKG_CHECK_MODULES(GEE, [gee-1.0 >= 0.6.0])
PKG_CHECK_MODULES(DEE, [dee-1.0 >= 1.0.4])
PKG_CHECK_MODULES(DBUSMENU, [dbusmenu-glib-0.4 >= 0.3.93])
PKG_CHECK_MODULES(GTK3, [gtk+-3.0 >= 3.4.1])
PKG_CHECK_MODULES(GMODULE, [gmodule-2.0 >= 2.32.1])

LIBUNITY_CFLAGS="$GLIB2_CFLAGS $GOBJECT2_CFLAGS $GIO2_CFLAGS $GIO_UNIX2_CFLAGS $GEE_CFLAGS $DEE_CFLAGS $DBUSMENU_CFLAGS"
LIBUNITY_LIBS="$GLIB2_LIBS $GOBJECT2_LIBS $GIO2_LIBS $GIO_UNIX2_LIBS $GEE_LIBS $DEE_LIBS $DBUSMENU_LIBS"
LIBUNITY_PACKAGES="--pkg glib-2.0 --pkg gobject-2.0 --pkg gio-2.0 --pkg gio-unix-2.0 --pkg gee-1.0 --pkg dee-1.0 --pkg Dbusmenu-0.4"
AC_SUBST(LIBUNITY_CFLAGS)
AC_SUBST(LIBUNITY_LIBS)
AC_SUBST(LIBUNITY_PACKAGES)

UNITYTOOL_CFLAGS="$GTK3_CFLAGS $GMODULE_CFLAGS"
UNITYTOOL_LIBS="$GTK3_LIBS $GMODULE_LIBS"
AC_SUBST(UNITYTOOL_CFLAGS)
AC_SUBST(UNITYTOOL_LIBS)

AC_PATH_PROG(GLIB_RESCOMPILE, glib-compile-resources)
AC_SUBST(GLIB_MKENUMS)

AC_PATH_PROG(GLIB_MKENUMS, glib-mkenums)
AC_SUBST(GLIB_MKENUMS)

AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
AC_SUBST(GLIB_GENMARSHAL)

######################################################################
# Send directory information
######################################################################
AC_DEFINE_UNQUOTED(DATADIR, "${prefix}/share",[Data directory])

AC_OUTPUT([
unity.pc
unity-protocol-private.pc
Makefile
bindings/Makefile
bindings/python/Makefile
data/Makefile
doc/Makefile
doc/reference/Makefile
examples/Makefile
protocol/Makefile
src/Makefile
tools/Makefile
test/Makefile
test/C/Makefile
test/vala/Makefile
vapi/Makefile
])

AC_MSG_NOTICE([

  libunity v$VERSION (soname $LIBUNITY_LT_VERSION)
         (protocol soname $LIBPROTOCOL_LT_VERSION)
  ------------------------------

  Build environment
    Prefix             : ${prefix}
    Build GI typelib   : ${enable_introspection}
    Documentation      : ${enable_docs}
    C warnings         : ${enable_c_warnings}
    Trace logging      : ${enable_trace_log}

  Testing
    Integration tests  : ${enable_integration_tests}
    Headless tests     : ${enable_headless_tests}
    Coverage reporting : ${use_gcov}
])