1# This file is part of MATE Utils.
2#
3# MATE Utils is free software: you can redistribute it and/or modify
4# it under the terms of the GNU General Public License as published by
5# the Free Software Foundation, either version 2 of the License, or
6# (at your option) any later version.
7#
8# MATE Utils is distributed in the hope that it will be useful,
9# but WITHOUT ANY WARRANTY; without even the implied warranty of
10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11# GNU General Public License for more details.
12#
13# You should have received a copy of the GNU General Public License
14# along with MATE Utils.  If not, see <https://www.gnu.org/licenses/>.
15
16m4_define([mate_utils_major], [1])
17m4_define([mate_utils_minor], [26])
18m4_define([mate_utils_micro], [0])
19
20m4_define([mate_utils_version], [mate_utils_major.mate_utils_minor.mate_utils_micro])
21
22AC_INIT([mate-utils],
23        [mate_utils_version],
24        [https://mate-desktop.org/])
25
26AC_CONFIG_MACRO_DIR([m4])
27
28AC_CONFIG_HEADERS([config.h])
29AM_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
30AM_SILENT_RULES([yes])
31
32MATE_COMMON_INIT
33MATE_DEBUG_CHECK([no])
34MATE_COMPILE_WARNINGS
35
36AC_PROG_CXX
37AC_PROG_CC
38AC_PROG_CPP
39AC_STDC_HEADERS
40AC_PROG_INSTALL
41AC_PROG_LN_S
42AC_PROG_MAKE_SET
43AM_PROG_LIBTOOL
44AC_PATH_PROG(GLIB_GENMARSHAL, [glib-genmarshal])
45AC_PATH_PROG(GLIB_MKENUMS, [glib-mkenums])
46
47dnl ICONS: convert svg to png
48AC_PATH_PROG(RSVG_CONVERT, rsvg-convert)
49AM_CONDITIONAL([HAVE_RSVG_CONVERT], [test "x$RSVG_CONVERT" != x])
50AC_PATH_PROG(INKSCAPE, inkscape)
51AM_CONDITIONAL([HAVE_INKSCAPE], [test "x$INKSCAPE" != x])
52
53# GLIB_COMPILE_RESOURCES
54AC_ARG_VAR([GLIB_COMPILE_RESOURCES],[glib-compile-resources bin])
55AC_PATH_PROG([GLIB_COMPILE_RESOURCES],[glib-compile-resources],[])
56if test -z "$GLIB_COMPILE_RESOURCES"; then
57  AC_MSG_ERROR([glib-compile-resources not found])
58fi
59
60# XMLLINT
61AC_ARG_VAR([XMLLINT],[xmllint bin])
62AC_PATH_PROG([XMLLINT],[xmllint],[])
63if test -z "$XMLLINT"; then
64  AC_MSG_ERROR([xmllint not found])
65fi
66
67AC_PATH_XTRA
68
69AC_C_CONST
70AC_C_INLINE
71AC_TYPE_OFF_T
72AC_TYPE_PID_T
73AC_TYPE_SIZE_T
74AC_STRUCT_ST_RDEV
75AC_HEADER_TIME
76AC_STRUCT_TM
77AC_TYPE_SIGNAL
78AC_FUNC_STRFTIME
79AC_CHECK_FUNCS([getpgid])
80
81
82# Before making a release, the LT_VERSION string should be modified.
83# The string is of the form C:R:A.
84# - If interfaces have been changed or added, but binary compatibility has
85#   been preserved, change to C+1:0:A+1
86# - If binary compatibility has been broken (eg removed or changed interfaces)
87#   change to C+1:0:0
88# - If the interface is the same as the previous version, change to C:R+1:A
89
90LIBGDICT_LT_VERSION=6:7:0
91AC_SUBST(LIBGDICT_LT_VERSION)
92
93dnl pkg-config check
94
95GLIB_REQUIRED=2.50.0
96GIO_REQUIRED=2.50.0
97GIO_UNIX_REQUIRED=2.18.0
98GTK_REQUIRED=3.22.0
99LIBMATE_PANEL_APPLET_REQUIRED=1.17.0
100LIBGTOP_REQUIRED=2.12.0
101LIBCANBERRA_GTK_REQUIRED=0.4
102UDISKS2_REQUIRED=1.90.0
103
104AC_SUBST(GTK_REQUIRED)
105
106# common checks
107PKG_CHECK_MODULES(GLIB, glib-2.0 >= $GLIB_REQUIRED)
108AC_SUBST(GLIB_CFLAGS)
109AC_SUBST(GLIB_LIBS)
110
111PKG_CHECK_MODULES(GTHREAD, gthread-2.0 >= $GLIB_REQUIRED)
112AC_SUBST(GTHREAD_CFLAGS)
113AC_SUBST(GTHREAD_LIBS)
114
115PKG_CHECK_MODULES(GIO, gio-2.0 >= $GIO_REQUIRED)
116AC_SUBST(GIO_CFLAGS)
117AC_SUBST(GIO_LIBS)
118
119PKG_CHECK_MODULES(GIO_UNIX, gio-unix-2.0 >= $GIO_UNIX_REQUIRED)
120AC_SUBST(GIO_UNIX_CFLAGS)
121AC_SUBST(GIO_UNIX_LIBS)
122
123PKG_CHECK_MODULES(GTK, gtk+-3.0 >= $GTK_REQUIRED)
124AC_SUBST(GTK_CFLAGS)
125AC_SUBST(GTK_LIBS)
126
127AC_ARG_ENABLE([disk-image-mounter],
128               [AC_HELP_STRING([--enable-disk-image-mounter=@<:@yes/no@:>@],
129                               [Whether to build the Disk Image Mounter utility])],
130               [],
131               [enable_disk_image_mounter=yes])
132
133AS_CASE([$enable_disk_image_mounter],
134        [yes],
135        [
136		PKG_CHECK_MODULES(UDISKS2, [udisks2 >= $UDISKS2_REQUIRED])
137		AC_SUBST(UDISKS2_CFLAGS)
138		AC_SUBST(UDISKS2_LIBS)
139        ],
140
141        [no], [],
142
143        [*], [AC_MSG_ERROR([Invalid value for --enable-disk-image-mounter])]
144)
145
146AM_CONDITIONAL([BUILD_DISK_IMAGE_MOUNTER], [test "x$enable_disk_image_mounter" = "xyes"])
147
148# libeggsmclient
149PKG_CHECK_MODULES(LIBEGG, sm >= 1.0.0 ice >= 1.0.0 gtk+-3.0 >= $GTK_REQUIRED)
150AC_SUBST(LIBEGG_CFLAGS)
151AC_SUBST(LIBEGG_LIBS)
152
153# libgdict requires just gtk+
154PKG_CHECK_MODULES(LIBGDICT, glib-2.0 >= $GLIB_REQUIRED
155                            gtk+-3.0 >= $GTK_REQUIRED)
156AC_SUBST(LIBGDICT_CFLAGS)
157AC_SUBST(LIBGDICT_LIBS)
158
159# For each cycle:
160# 	first release: increment major += 1, minor = micro = 0;
161# 	each release before API freeze: minor += 1;
162# 	each release after API freeze: micro += 1;
163# Even if this library is not part of the developers platform, we
164# follow the same rules: no ABI breakage (unless unavoidable) and
165# no API breakage past the API freeze.
166m4_define([gdict_major_version], [1])
167m4_define([gdict_minor_version], [1])
168m4_define([gdict_micro_version], [0])
169m4_define([gdict_version], [gdict_major_version.gdict_minor_version.gdict_micro_version])
170
171GDICT_MAJOR_VERSION=gdict_major_version
172GDICT_MINOR_VERSION=gdict_minor_version
173GDICT_MICRO_VERSION=gdict_micro_version
174GDICT_VERSION=gdict_version
175
176AC_SUBST(GDICT_MAJOR_VERSION)
177AC_SUBST(GDICT_MINOR_VERSION)
178AC_SUBST(GDICT_MICRO_VERSION)
179AC_SUBST(GDICT_VERSION)
180
181# xext for mate-screenshot; in theory checking for xext should be
182# enough but there are a lot of broken distros out there
183PKG_CHECK_MODULES(XSHAPE, xext x11,
184                  [AC_CHECK_HEADERS(X11/extensions/shape.h, XSHAPE_LIBS="-lXext -lX11")])
185AC_SUBST(XSHAPE_LIBS)
186
187AC_ARG_ENABLE([gdict-applet],
188               [AC_HELP_STRING([--enable-gdict-applet=@<:@yes/no@:>@],
189                               [Whether to build the Dictionary mate-panel applet])],
190               [],
191               [enable_gdict_applet=yes])
192
193AS_CASE([$enable_gdict_applet],
194        [yes],
195        [
196          # Gdict applet checks
197          PKG_CHECK_MODULES(APPLET, libmatepanelapplet-4.0 >= $LIBMATE_PANEL_APPLET_REQUIRED)
198          AC_SUBST(APPLET_LIBS)
199          AC_SUBST(APPLET_CFLAGS)
200        ],
201
202        [no], [],
203
204        [*], [AC_MSG_ERROR([Invalid value for --enable-gdict-applet])]
205)
206
207AM_CONDITIONAL([BUILD_GDICT_APPLET], [test "x$enable_gdict_applet" = "xyes"])
208
209# Baobab checks
210PKG_CHECK_MODULES(LIBGTOP, libgtop-2.0 >= $LIBGTOP_REQUIRED)
211AC_SUBST(LIBGTOP_CFLAGS)
212AC_SUBST(LIBGTOP_LIBS)
213
214PKG_CHECK_MODULES(LIBCANBERRA_GTK, libcanberra-gtk3 >= $LIBCANBERRA_GTK_REQUIRED)
215AC_SUBST(LIBCANBERRA_GTK_CFLAGS)
216AC_SUBST(LIBCANBERRA_GTK_LIBS)
217
218dnl ***************************************************************
219dnl Other miscellaneous checks
220dnl ***************************************************************
221
222dnl Enable debug messages
223AS_CASE([$ax_enable_debug],
224        [yes],[GDICT_DEBUG_CFLAGS="-DGDICT_ENABLE_DEBUG"],
225        [no],[GDICT_DEBUG_CFLAGS="-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS -DG_DISABLE_CAST_CHECKS"],
226        [*],[GDICT_DEBUG_CFLAGS="-DG_DISABLE_CAST_CHECKS"]
227)
228AC_SUBST(GDICT_DEBUG_CFLAGS)
229
230dnl IPv6 support
231AC_MSG_CHECKING([whether to enable IPv6])
232AC_ARG_ENABLE([ipv6],
233              [AC_HELP_STRING([--enable-ipv6=@<:@yes/no@:>@],
234                              [Enables compilation of IPv6 code])],
235              [],
236              [enable_ipv6=yes])
237
238AS_IF([test "x$enable_ipv6" = "xyes"],
239      [
240        AC_TRY_COMPILE(
241          [
242            #include <sys/socket.h>
243            #include <sys/types.h>
244          ],
245          [
246            struct sockaddr_storage ss;
247            socket(AF_INET6, SOCK_STREAM, 0)
248          ],
249          [have_ipv6=yes],
250          [have_ipv6=no]
251        )
252      ]
253)
254
255AS_IF([test "x$have_ipv6" = "xyes"],
256      [
257        have_getaddrinfo=no
258        AC_CHECK_FUNC(getaddrinfo, have_getaddrinfo=yes)
259
260        AS_IF([test "x$have_getaddrinfo" != "xyes"],
261              [
262                for lib in bsd socket inet; do
263                  AC_CHECK_LIB($lib,
264                               [getaddrinfo],
265                               ["LIBS=$LIBS -l$lib"; have_getaddrinfo=yes; break])
266                done
267              ]
268        )
269
270        AS_IF([test "x$have_getaddrinfo" = "xyes"],
271              [AC_DEFINE([ENABLE_IPV6], [1], [Define whether IPv6 support is enabled])]
272        )
273      ]
274)
275
276dnl mate-search-tool checks
277withval=""
278AC_ARG_WITH([grep],
279            AC_HELP_STRING([--with-grep=@<:@grep command@:>@]
280                           [Specify where to find the grep binary]),
281            [
282              AS_IF([test x$withval != x],
283                    [AC_MSG_RESULT(${withval} is used for mate-search-tool.)],
284
285                    [AC_MSG_RESULT(grep is used for mate-search-tool.)]
286              )
287            ])
288
289AS_IF([test x$withval != x],
290      [GREP_COMMAND="$withval"],
291
292      [GREP_COMMAND="grep"]
293)
294
295AC_SUBST(GREP_COMMAND)
296
297
298dnl logview checks
299AC_ARG_ENABLE([zlib],
300              [AC_HELP_STRING([--disable-zlib], [disable zlib support])])
301msg_zlib=no
302Z_LIBS=
303
304AS_IF([test "x$enable_zlib" != "xno"],
305      [
306        AC_CHECK_HEADER([zlib.h], [AC_CHECK_LIB([z], [inflate], [msg_zlib=yes])])
307
308        AS_IF([test "x$msg_zlib" = "xyes"],
309              [
310                AC_DEFINE(HAVE_ZLIB, [1],
311                          [Define to 1 if we're building with ZLib support])
312                Z_LIBS="-lz"
313              ]
314        )
315      ]
316)
317
318AC_SUBST(Z_LIBS)
319
320dnl Internationalization
321AM_GNU_GETTEXT([external])
322AM_GNU_GETTEXT_VERSION([0.19.8])
323AM_GNU_GETTEXT_REQUIRE_VERSION([0.19.8])
324AM_CONDITIONAL([USE_NLS], [test "x${USE_NLS}" = "xyes"])
325
326GETTEXT_PACKAGE=AC_PACKAGE_NAME
327AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], "$GETTEXT_PACKAGE", [Define the gettext package to use])
328AC_SUBST(GETTEXT_PACKAGE)
329
330GLIB_GSETTINGS
331
332dnl gtk-doc stuff
333GTK_DOC_CHECK([1.10])
334
335dnl yelp-tools stuff
336YELP_HELP_INIT
337
338AC_CONFIG_FILES([
339Makefile
340
341po/Makefile.in
342
343baobab/Makefile
344baobab/data/Makefile
345baobab/data/org.mate.disk-usage-analyzer.gschema.xml
346baobab/pixmaps/Makefile
347baobab/src/Makefile
348baobab/help/Makefile
349
350logview/Makefile
351logview/data/Makefile
352logview/data/org.mate.system-log.gschema.xml
353logview/data/icons/Makefile
354logview/help/Makefile
355logview/src/Makefile
356logview/src/tests/Makefile
357
358gsearchtool/Makefile
359gsearchtool/data/Makefile
360gsearchtool/data/org.mate.search-tool.gschema.xml
361gsearchtool/help/Makefile
362gsearchtool/mate-submodules/Makefile
363gsearchtool/mate-submodules/libegg/Makefile
364gsearchtool/libmateui-deprecated/Makefile
365gsearchtool/src/Makefile
366
367mate-dictionary/Makefile
368mate-dictionary/libgdict/Makefile
369mate-dictionary/libgdict/gdict-version.h
370mate-dictionary/libgdict/mate-dict.pc
371mate-dictionary/data/Makefile
372mate-dictionary/data/org.mate.dictionary.gschema.xml
373mate-dictionary/docs/Makefile
374mate-dictionary/docs/reference/Makefile
375mate-dictionary/docs/reference/gdict/Makefile
376mate-dictionary/docs/reference/gdict/version.xml
377mate-dictionary/help/Makefile
378mate-dictionary/src/Makefile
379
380mate-screenshot/Makefile
381mate-screenshot/data/Makefile
382mate-screenshot/data/org.mate.screenshot.gschema.xml
383mate-screenshot/src/Makefile
384])
385
386AM_COND_IF([BUILD_DISK_IMAGE_MOUNTER],
387           [AC_CONFIG_FILES([mate-disk-image-mounter/Makefile
388                             mate-disk-image-mounter/data/Makefile
389                             mate-disk-image-mounter/src/Makefile])
390           ]
391)
392
393AC_OUTPUT
394
395dnl <= Configuration summary =>
396
397echo "
398mate-utils $VERSION configuration summary:
399
400                   Compiler flags : $CFLAGS
401           Compiler warning flags : $WARN_CFLAGS
402                     Linker flags : $LDFLAGS
403
404                           prefix : $prefix
405                      sysconf dir : $sysconfdir
406                          bin dir : $bindir
407                         sbin dir : $sbindir
408                         data dir : $datadir
409
410     Debug messages (libmatedict) : $enable_debug
411      API Reference (libmatedict) : $enable_gtk_doc
412  Logview built with ZLib support : $msg_zlib
413     Dictionary mate-panel applet : $enable_gdict_applet
414          Native Language support : ${USE_NLS}
415"
416