summaryrefslogtreecommitdiff
path: root/configure.ac
blob: c2441888f67b1b007a073f13777f8e4c82c80dba (plain)
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
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
# This file is part of MATE Utils.
#
# MATE Utils is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# MATE Utils is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with MATE Utils.  If not, see <https://www.gnu.org/licenses/>.

m4_define([mate_utils_major], [1])
m4_define([mate_utils_minor], [28])
m4_define([mate_utils_micro], [0])

m4_define([mate_utils_version], [mate_utils_major.mate_utils_minor.mate_utils_micro])

AC_INIT([mate-utils],
        [mate_utils_version],
        [https://mate-desktop.org/])

AC_CONFIG_MACRO_DIR([m4])

AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE([1.11 foreign subdir-objects dist-xz no-dist-gzip check-news]) #the foreign flavour disables warnings if README, NEWS such files are not present which are issued in the default gnu flavour
AM_SILENT_RULES([yes])

MATE_COMMON_INIT
MATE_DEBUG_CHECK([no])
MATE_COMPILE_WARNINGS

AC_PROG_CXX
AC_PROG_CC
AC_PROG_CPP
AC_STDC_HEADERS
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AM_PROG_LIBTOOL
AC_PATH_PROG(GLIB_GENMARSHAL, [glib-genmarshal])
AC_PATH_PROG(GLIB_MKENUMS, [glib-mkenums])

dnl ICONS: convert svg to png
AC_PATH_PROG(RSVG_CONVERT, rsvg-convert)
AM_CONDITIONAL([HAVE_RSVG_CONVERT], [test "x$RSVG_CONVERT" != x])
AC_PATH_PROG(INKSCAPE, inkscape)
AM_CONDITIONAL([HAVE_INKSCAPE], [test "x$INKSCAPE" != x])

# GLIB_COMPILE_RESOURCES
AC_ARG_VAR([GLIB_COMPILE_RESOURCES],[glib-compile-resources bin])
AC_PATH_PROG([GLIB_COMPILE_RESOURCES],[glib-compile-resources],[])
if test -z "$GLIB_COMPILE_RESOURCES"; then
  AC_MSG_ERROR([glib-compile-resources not found])
fi

# XMLLINT
AC_ARG_VAR([XMLLINT],[xmllint bin])
AC_PATH_PROG([XMLLINT],[xmllint],[])
if test -z "$XMLLINT"; then
  AC_MSG_ERROR([xmllint not found])
fi

AC_PATH_XTRA

AC_C_CONST
AC_C_INLINE
AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_STRUCT_ST_RDEV
AC_HEADER_TIME
AC_STRUCT_TM
AC_TYPE_SIGNAL
AC_FUNC_STRFTIME
AC_CHECK_FUNCS([getpgid])


# Before making a release, the LT_VERSION string should be modified.
# 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

LIBGDICT_LT_VERSION=6:7:0
AC_SUBST(LIBGDICT_LT_VERSION)

dnl pkg-config check

GLIB_REQUIRED=2.50.0
GIO_REQUIRED=2.50.0
GIO_UNIX_REQUIRED=2.18.0
GTK_REQUIRED=3.22.0
LIBMATE_PANEL_APPLET_REQUIRED=1.17.0
LIBGTOP_REQUIRED=2.12.0
LIBCANBERRA_GTK_REQUIRED=0.4
MATE_DESKTOP_REQUIRED=1.27.1
UDISKS2_REQUIRED=1.90.0

AC_SUBST(GTK_REQUIRED)

# common checks
PKG_CHECK_MODULES(GLIB, glib-2.0 >= $GLIB_REQUIRED)
AC_SUBST(GLIB_CFLAGS)
AC_SUBST(GLIB_LIBS)

PKG_CHECK_MODULES(GTHREAD, gthread-2.0 >= $GLIB_REQUIRED)
AC_SUBST(GTHREAD_CFLAGS)
AC_SUBST(GTHREAD_LIBS)

PKG_CHECK_MODULES(GIO, gio-2.0 >= $GIO_REQUIRED)
AC_SUBST(GIO_CFLAGS)
AC_SUBST(GIO_LIBS)

PKG_CHECK_MODULES(GIO_UNIX, gio-unix-2.0 >= $GIO_UNIX_REQUIRED)
AC_SUBST(GIO_UNIX_CFLAGS)
AC_SUBST(GIO_UNIX_LIBS)

PKG_CHECK_MODULES(GTK, gtk+-3.0 >= $GTK_REQUIRED)
AC_SUBST(GTK_CFLAGS)
AC_SUBST(GTK_LIBS)

PKG_CHECK_MODULES(MATE_DESKTOP, mate-desktop-2.0 >= $MATE_DESKTOP_REQUIRED)
AC_SUBST(MATE_DESKTOP_CFLAGS)
AC_SUBST(MATE_DESKTOP_LIBS)

AC_ARG_ENABLE([disk-image-mounter],
               [AS_HELP_STRING([--enable-disk-image-mounter=@<:@yes/no@:>@],
                               [Whether to build the Disk Image Mounter utility])],
               [],
               [enable_disk_image_mounter=yes])

AS_CASE([$enable_disk_image_mounter],
        [yes],
        [
		PKG_CHECK_MODULES(UDISKS2, [udisks2 >= $UDISKS2_REQUIRED])
		AC_SUBST(UDISKS2_CFLAGS)
		AC_SUBST(UDISKS2_LIBS)
        ],

        [no], [],

        [*], [AC_MSG_ERROR([Invalid value for --enable-disk-image-mounter])]
)

AM_CONDITIONAL([BUILD_DISK_IMAGE_MOUNTER], [test "x$enable_disk_image_mounter" = "xyes"])

# libeggsmclient
PKG_CHECK_MODULES(LIBEGG, sm >= 1.0.0 ice >= 1.0.0 gtk+-3.0 >= $GTK_REQUIRED)
AC_SUBST(LIBEGG_CFLAGS)
AC_SUBST(LIBEGG_LIBS)

# libgdict requires just gtk+
PKG_CHECK_MODULES(LIBGDICT, glib-2.0 >= $GLIB_REQUIRED
                            gtk+-3.0 >= $GTK_REQUIRED)
AC_SUBST(LIBGDICT_CFLAGS)
AC_SUBST(LIBGDICT_LIBS)

# For each cycle:
# 	first release: increment major += 1, minor = micro = 0;
# 	each release before API freeze: minor += 1;
# 	each release after API freeze: micro += 1;
# Even if this library is not part of the developers platform, we
# follow the same rules: no ABI breakage (unless unavoidable) and
# no API breakage past the API freeze.
m4_define([gdict_major_version], [1])
m4_define([gdict_minor_version], [1])
m4_define([gdict_micro_version], [0])
m4_define([gdict_version], [gdict_major_version.gdict_minor_version.gdict_micro_version])

GDICT_MAJOR_VERSION=gdict_major_version
GDICT_MINOR_VERSION=gdict_minor_version
GDICT_MICRO_VERSION=gdict_micro_version
GDICT_VERSION=gdict_version

AC_SUBST(GDICT_MAJOR_VERSION)
AC_SUBST(GDICT_MINOR_VERSION)
AC_SUBST(GDICT_MICRO_VERSION)
AC_SUBST(GDICT_VERSION)

# xext for mate-screenshot; in theory checking for xext should be
# enough but there are a lot of broken distros out there
PKG_CHECK_MODULES(XSHAPE, xext x11,
                  [AC_CHECK_HEADERS(X11/extensions/shape.h, XSHAPE_LIBS="-lXext -lX11")])
AC_SUBST(XSHAPE_LIBS)

AC_ARG_ENABLE([gdict-applet],
               [AS_HELP_STRING([--enable-gdict-applet=@<:@yes/no@:>@],
                               [Whether to build the Dictionary mate-panel applet])],
               [],
               [enable_gdict_applet=yes])

AS_CASE([$enable_gdict_applet],
        [yes],
        [
          # Gdict applet checks
          PKG_CHECK_MODULES(APPLET, libmatepanelapplet-4.0 >= $LIBMATE_PANEL_APPLET_REQUIRED)
          AC_SUBST(APPLET_LIBS)
          AC_SUBST(APPLET_CFLAGS)
        ],

        [no], [],

        [*], [AC_MSG_ERROR([Invalid value for --enable-gdict-applet])]
)

AM_CONDITIONAL([BUILD_GDICT_APPLET], [test "x$enable_gdict_applet" = "xyes"])

#============================================================================
# Dictionary Applet in-process and Wayland support
#============================================================================

AC_ARG_ENABLE([wayland],
              [AS_HELP_STRING([--enable-wayland],
                              [Explicitly enable or disable Wayland support
                               (default is to enable only if Wayland client development library is detected)])],
              [enable_wayland=$enableval],
              [enable_wayland=auto])
AC_ARG_ENABLE([in-process],
              [AS_HELP_STRING([--enable-in-process],
                              [Enable in-process build of dictionary applet (default: no, required for wayland)])],
              [enable_in_process=$enableval],
              [dnl the default follows whether Wayland is requested or not,
               dnl as Wayland support requires it but we d rather not have it
               dnl otherwise for the moment
               enable_in_process=$enable_wayland])

dnl $enable_in_process is gonna be either:
dnl - "no" if explicitly disabled
dnl - "yes" if explicitly enabled or if Wayland is explicitly enabled
dnl - "auto" if nothing specific is requested, in which case, default back to "no"
AS_IF([test "x$enable_in_process" != xyes], [enable_in_process=no])

WAYLAND_DEPS="gtk-layer-shell-0 >= $GTK_LAYER_SHELL_REQUIRED_VERSION wayland-client gdk-wayland-3.0 >= $GDK_WAYLAND_REQUIRED_VERSION"
AS_CASE(["x$enable_wayland$enable_in_process"],
        [xautoyes], [PKG_CHECK_MODULES([WAYLAND], [$WAYLAND_DEPS],
                                       [enable_wayland=yes], [enable_wayland=no])],
        [xyesyes], [PKG_CHECK_MODULES([WAYLAND], [$WAYLAND_DEPS])],
        [xyes*], [AC_MSG_ERROR([--enable-wayland requires --enable-in-process])],
        [enable_wayland=no])

AM_CONDITIONAL([ENABLE_IN_PROCESS], [test "x$enable_in_process" = "xyes"])
AS_IF([test "x$enable_in_process" = "xyes"],
      [AC_DEFINE([ENABLE_IN_PROCESS], [1], [Enable if you want to build the panel applet in-process])])
AM_CONDITIONAL(ENABLE_WAYLAND, [test "x$enable_wayland" = "xyes"])
AS_IF([test "x$enable_wayland" = "xyes"],
      [AC_DEFINE([ENABLE_WAYLAND], [1], [Enable if you want to build the panel applet in-process])])

# Convenience C define selecting the right applet factory
AS_IF([test "x$enable_in_process" = "xyes"],
      [factory=MATE_PANEL_APPLET_IN_PROCESS_FACTORY],
      [factory=MATE_PANEL_APPLET_OUT_PROCESS_FACTORY])
AC_DEFINE_UNQUOTED([PANEL_APPLET_FACTORY], [$factory], [Panel applet factory])

# Baobab checks
PKG_CHECK_MODULES(LIBGTOP, libgtop-2.0 >= $LIBGTOP_REQUIRED)
AC_SUBST(LIBGTOP_CFLAGS)
AC_SUBST(LIBGTOP_LIBS)

PKG_CHECK_MODULES(LIBCANBERRA_GTK, libcanberra-gtk3 >= $LIBCANBERRA_GTK_REQUIRED)
AC_SUBST(LIBCANBERRA_GTK_CFLAGS)
AC_SUBST(LIBCANBERRA_GTK_LIBS)

dnl ***************************************************************
dnl Other miscellaneous checks
dnl ***************************************************************

dnl Enable debug messages
AS_CASE([$ax_enable_debug],
        [yes],[GDICT_DEBUG_CFLAGS="-DGDICT_ENABLE_DEBUG"],
        [no],[GDICT_DEBUG_CFLAGS="-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS -DG_DISABLE_CAST_CHECKS"],
        [*],[GDICT_DEBUG_CFLAGS="-DG_DISABLE_CAST_CHECKS"]
)
AC_SUBST(GDICT_DEBUG_CFLAGS)

dnl IPv6 support
AC_MSG_CHECKING([whether to enable IPv6])
AC_ARG_ENABLE([ipv6],
              [AS_HELP_STRING([--enable-ipv6=@<:@yes/no@:>@],
                              [Enables compilation of IPv6 code])],
              [],
              [enable_ipv6=yes])

AS_IF([test "x$enable_ipv6" = "xyes"],
      [
        AC_TRY_COMPILE(
          [
            #include <sys/socket.h>
            #include <sys/types.h>
          ],
          [
            struct sockaddr_storage ss;
            socket(AF_INET6, SOCK_STREAM, 0)
          ],
          [have_ipv6=yes],
          [have_ipv6=no]
        )
      ]
)

AS_IF([test "x$have_ipv6" = "xyes"],
      [
        have_getaddrinfo=no
        AC_CHECK_FUNC(getaddrinfo, have_getaddrinfo=yes)

        AS_IF([test "x$have_getaddrinfo" != "xyes"],
              [
                for lib in bsd socket inet; do
                  AC_CHECK_LIB($lib,
                               [getaddrinfo],
                               ["LIBS=$LIBS -l$lib"; have_getaddrinfo=yes; break])
                done
              ]
        )

        AS_IF([test "x$have_getaddrinfo" = "xyes"],
              [AC_DEFINE([ENABLE_IPV6], [1], [Define whether IPv6 support is enabled])]
        )
      ]
)

dnl mate-search-tool checks
withval=""
AC_ARG_WITH([grep],
            AS_HELP_STRING([--with-grep=@<:@grep command@:>@]
                           [Specify where to find the grep binary]),
            [
              AS_IF([test x$withval != x],
                    [AC_MSG_RESULT(${withval} is used for mate-search-tool.)],

                    [AC_MSG_RESULT(grep is used for mate-search-tool.)]
              )
            ])

AS_IF([test x$withval != x],
      [GREP_COMMAND="$withval"],

      [GREP_COMMAND="grep"]
)

AC_SUBST(GREP_COMMAND)


dnl logview checks
AC_ARG_ENABLE([zlib],
              [AS_HELP_STRING([--disable-zlib], [disable zlib support])])
msg_zlib=no
Z_LIBS=

AS_IF([test "x$enable_zlib" != "xno"],
      [
        AC_CHECK_HEADER([zlib.h], [AC_CHECK_LIB([z], [inflate], [msg_zlib=yes])])

        AS_IF([test "x$msg_zlib" = "xyes"],
              [
                AC_DEFINE(HAVE_ZLIB, [1],
                          [Define to 1 if we're building with ZLib support])
                Z_LIBS="-lz"
              ]
        )
      ]
)

AC_SUBST(Z_LIBS)

dnl Internationalization
AM_GNU_GETTEXT([external])
AM_GNU_GETTEXT_VERSION([0.19.8])
AM_GNU_GETTEXT_REQUIRE_VERSION([0.19.8])
AM_CONDITIONAL([USE_NLS], [test "x${USE_NLS}" = "xyes"])

GETTEXT_PACKAGE=AC_PACKAGE_NAME
AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], "$GETTEXT_PACKAGE", [Define the gettext package to use])
AC_SUBST(GETTEXT_PACKAGE)

GLIB_GSETTINGS

dnl gtk-doc stuff
GTK_DOC_CHECK([1.10])

dnl yelp-tools stuff
YELP_HELP_INIT

AC_CONFIG_FILES([
Makefile

po/Makefile.in

baobab/Makefile
baobab/data/Makefile
baobab/data/org.mate.disk-usage-analyzer.gschema.xml
baobab/pixmaps/Makefile
baobab/src/Makefile
baobab/help/Makefile

logview/Makefile
logview/data/Makefile
logview/data/org.mate.system-log.gschema.xml
logview/data/icons/Makefile
logview/help/Makefile
logview/src/Makefile
logview/src/tests/Makefile

gsearchtool/Makefile
gsearchtool/data/Makefile
gsearchtool/data/org.mate.search-tool.gschema.xml
gsearchtool/help/Makefile
gsearchtool/mate-submodules/Makefile
gsearchtool/mate-submodules/libegg/Makefile
gsearchtool/libmateui-deprecated/Makefile
gsearchtool/src/Makefile

mate-dictionary/Makefile
mate-dictionary/libgdict/Makefile
mate-dictionary/libgdict/gdict-version.h
mate-dictionary/libgdict/mate-dict.pc
mate-dictionary/data/Makefile
mate-dictionary/data/org.mate.dictionary.gschema.xml
mate-dictionary/docs/Makefile
mate-dictionary/docs/reference/Makefile
mate-dictionary/docs/reference/gdict/Makefile
mate-dictionary/docs/reference/gdict/version.xml
mate-dictionary/help/Makefile
mate-dictionary/src/Makefile

mate-screenshot/Makefile
mate-screenshot/data/Makefile
mate-screenshot/data/org.mate.screenshot.gschema.xml
mate-screenshot/src/Makefile
])

AM_COND_IF([BUILD_DISK_IMAGE_MOUNTER],
           [AC_CONFIG_FILES([mate-disk-image-mounter/Makefile
                             mate-disk-image-mounter/data/Makefile
                             mate-disk-image-mounter/src/Makefile])
           ]
)

AC_OUTPUT

dnl <= Configuration summary =>

echo "
mate-utils $VERSION configuration summary:

                   Compiler flags : $CFLAGS
           Compiler warning flags : $WARN_CFLAGS
                     Linker flags : $LDFLAGS

                           prefix : $prefix
                      sysconf dir : $sysconfdir
                          bin dir : $bindir
                         sbin dir : $sbindir
                         data dir : $datadir

     Debug messages (libmatedict) : $enable_debug
      API Reference (libmatedict) : $enable_gtk_doc
  Logview built with ZLib support : $msg_zlib
     Dictionary mate-panel applet : $enable_gdict_applet
     Dictionary applet in-process : $enable_in_process
Dictionary applet wayland support : $enable_wayland
          Native Language support : ${USE_NLS}
"