1AC_PREREQ(2.50)
2
3m4_define([muffin_major_version], [4])
4m4_define([muffin_minor_version], [8])
5m4_define([muffin_micro_version], [0])
6
7m4_define([muffin_version],
8          [muffin_major_version.muffin_minor_version.muffin_micro_version])
9
10m4_define([muffin_plugin_api_version], [0])
11
12AC_INIT([muffin], [muffin_version],
13        [https://github.com/linuxmint/muffin/issues])
14
15m4_ifdef([AX_IS_RELEASE], [AX_IS_RELEASE([always])])
16
17AC_CONFIG_SRCDIR(src/core/display.c)
18AC_CONFIG_HEADERS(config.h)
19AC_CONFIG_SUBDIRS([cogl clutter])
20
21AC_CONFIG_MACRO_DIR(m4)
22AM_INIT_AUTOMAKE([1.11 no-dist-gzip dist-xz tar-ustar subdir-objects])
23m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])],)
24AM_MAINTAINER_MODE([enable])
25
26AC_GNU_SOURCE
27
28MUFFIN_MAJOR_VERSION=muffin_major_version
29MUFFIN_MINOR_VERSION=muffin_minor_version
30MUFFIN_MICRO_VERSION=muffin_micro_version
31MUFFIN_VERSION=muffin_version
32MUFFIN_PLUGIN_API_VERSION=muffin_plugin_api_version
33AC_SUBST(MUFFIN_MAJOR_VERSION)
34AC_SUBST(MUFFIN_MINOR_VERSION)
35AC_SUBST(MUFFIN_MICRO_VERSION)
36AC_SUBST(MUFFIN_VERSION)
37AC_SUBST(MUFFIN_PLUGIN_API_VERSION)
38
39# Make the muffin versions visible to the cogl and clutter subdirs
40export MUFFIN_PLUGIN_API_VERSION MUFFIN_VERSION
41
42MUFFIN_PLUGIN_DIR="$libdir/$PACKAGE/plugins"
43AC_SUBST(MUFFIN_PLUGIN_DIR)
44
45# Honor aclocal flags
46AC_SUBST([ACLOCAL_AMFLAGS], ["-I $ac_macro_dir \${ACLOCAL_FLAGS}"])
47
48GETTEXT_PACKAGE=muffin
49AC_SUBST(GETTEXT_PACKAGE)
50AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",[Name of default gettext domain])
51
52LT_PREREQ([2.2.6])
53LT_INIT([disable-static])
54
55# Debian / Ubuntu set this flag to 'no' in libtool, causing linking errors
56# (i.e when linking against muffin-clutter). Not to explicitly redefine such
57# deps, we enable this flag for everybody.
58link_all_deplibs=yes
59link_all_deplibs_CXX=yes
60
61IT_PROG_INTLTOOL([0.34.90])
62AC_PROG_CC
63AM_PROG_CC_C_O
64AC_ISC_POSIX
65AC_PROG_INSTALL
66AC_PROG_SED
67AC_HEADER_STDC
68AC_LIBTOOL_WIN32_DLL
69AM_PROG_LIBTOOL
70PKG_PROG_PKG_CONFIG([0.21])
71
72# Sets GLIB_GENMARSHAL and GLIB_MKENUMS
73AM_PATH_GLIB_2_0([2.50.3])
74
75#### Integer sizes
76
77AC_CHECK_SIZEOF(char)
78AC_CHECK_SIZEOF(short)
79AC_CHECK_SIZEOF(long)
80AC_CHECK_SIZEOF(int)
81AC_CHECK_SIZEOF(void *)
82AC_CHECK_SIZEOF(long long)
83AC_CHECK_SIZEOF(__int64)
84
85## byte order
86AC_C_BIGENDIAN
87
88#### Usability of visibility attributes
89gl_VISIBILITY
90AC_DEFINE(LOCAL_SYMBOL, [], [attribute of the non-exported symbols])
91AC_DEFINE(API_EXPORTED, [], [attribute of the symbols exported in the API])
92if test $HAVE_VISIBILITY = 1; then
93     AC_DEFINE(LOCAL_SYMBOL, [__attribute__ ((visibility ("hidden")))])
94     AC_DEFINE(API_EXPORTED, [__attribute__ ((visibility ("default")))])
95fi
96
97
98CANBERRA_GTK=libcanberra-gtk3
99CANBERRA_GTK_VERSION=0.26
100
101MUFFIN_PC_MODULES="
102   gtk+-3.0 >= 3.9.12
103   gio-unix-2.0 >= 2.35.1
104   glib-2.0
105   pango >= 1.14.0
106   cairo >= 1.10.0
107   json-glib-1.0
108   cinnamon-desktop >= 2.4.0
109   xcomposite >= 0.3
110   xcursor
111   xdamage
112   xext
113   xfixes
114   xi >= 1.6.0
115   xkbfile
116   xkeyboard-config
117   xkbcommon >= 0.4.3
118   xkbcommon-x11
119   xrender
120   x11-xcb
121   xcb-randr
122   xcb-res
123   gl
124   egl
125"
126
127GLIB_GSETTINGS
128
129AC_ARG_ENABLE(verbose-mode,
130  AC_HELP_STRING([--disable-verbose-mode],
131                 [disable muffin's ability to do verbose logging, for embedded/size-sensitive custom builds]),,
132  enable_verbose_mode=yes)
133dnl '
134
135if test x$enable_verbose_mode = xyes; then
136    AC_DEFINE(WITH_VERBOSE_MODE,1,[Build with verbose mode support])
137fi
138
139AC_ARG_ENABLE([gtk-doc],
140  AC_HELP_STRING([--enable-gtk-doc],
141                 [use gtk-doc to build documentation [[default=yes]]]),,
142  enable_gtk_doc=yes)
143
144# prefixes for fixing gtk-doc references
145CAIRO_PREFIX="`$PKG_CONFIG --variable=prefix cairo`"
146GLIB_PREFIX="`$PKG_CONFIG --variable=prefix glib-2.0`"
147PANGO_PREFIX="/usr"
148ATK_PREFIX="`$PKG_CONFIG --variable=prefix atk`"
149GDKPIXBUF_PREFIX="`$PKG_CONFIG --variable=prefix gdk-pixbuf-2.0`"
150AC_SUBST(CAIRO_PREFIX)
151AC_SUBST(GLIB_PREFIX)
152AC_SUBST(PANGO_PREFIX)
153AC_SUBST(ATK_PREFIX)
154AC_SUBST(GDKPIXBUF_PREFIX)
155
156AC_ARG_ENABLE(sm,
157  AC_HELP_STRING([--disable-sm],
158                 [disable muffin's session management support, for embedded/size-sensitive custom non-GNOME builds]),,
159  enable_sm=auto)
160dnl '
161
162
163AC_ARG_ENABLE(startup-notification,
164  AC_HELP_STRING([--disable-startup-notification],
165                 [disable muffin's startup notification support, for embedded/size-sensitive custom non-GNOME builds]),,
166  enable_startup_notification=auto)
167dnl '
168
169AC_ARG_WITH(libcanberra,
170  AC_HELP_STRING([--without-libcanberra],
171                 [disable the use of libcanberra for playing sounds]),,
172  with_libcanberra=auto)
173
174AC_ARG_ENABLE(xsync,
175  AC_HELP_STRING([--disable-xsync],
176                 [disable muffin's use of the XSync extension]),,
177  enable_xsync=auto)
178dnl '
179
180AC_ARG_ENABLE(shape,
181  AC_HELP_STRING([--disable-shape],
182                 [disable muffin's use of the shaped window extension]),,
183  enable_shape=auto)
184dnl '
185
186## try definining HAVE_BACKTRACE
187AC_CHECK_HEADERS(execinfo.h, [AC_CHECK_FUNCS(backtrace)])
188
189AM_GLIB_GNU_GETTEXT
190
191## here we get the flags we'll actually use
192PKG_CHECK_MODULES(ALL, glib-2.0 >= 2.37.3)
193PKG_CHECK_MODULES(MUFFIN_MESSAGE, gtk+-3.0)
194PKG_CHECK_MODULES(MUFFIN_WINDOW_DEMO, gtk+-3.0)
195
196# Unconditionally use this dir to avoid a circular dep with gnomecc
197GNOME_KEYBINDINGS_KEYSDIR="${datadir}/gnome-control-center/keybindings"
198AC_SUBST(GNOME_KEYBINDINGS_KEYSDIR)
199
200STARTUP_NOTIFICATION_VERSION=0.7
201AC_MSG_CHECKING([Startup notification library >= $STARTUP_NOTIFICATION_VERSION])
202if $PKG_CONFIG --atleast-version $STARTUP_NOTIFICATION_VERSION libstartup-notification-1.0; then
203   have_startup_notification=yes
204else
205   have_startup_notification=no
206fi
207AC_MSG_RESULT($have_startup_notification)
208
209if test x$enable_startup_notification = xyes; then
210   have_startup_notification=yes
211   echo "startup-notification support forced on"
212elif test x$enable_startup_notification = xauto; then
213   true
214else
215   have_startup_notification=no
216fi
217
218if test x$have_startup_notification = xyes; then
219  echo "Building with libstartup-notification"
220  MUFFIN_PC_MODULES="$MUFFIN_PC_MODULES libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION"
221  AC_DEFINE(HAVE_STARTUP_NOTIFICATION, , [Building with startup notification support])
222else
223  echo "Building without libstartup-notification"
224fi
225
226have_libcanberra=no
227AC_MSG_CHECKING([libcanberra-gtk])
228if test x$with_libcanberra = xno ; then
229  AC_MSG_RESULT([disabled])
230else
231  if $PKG_CONFIG --exists $CANBERRA_GTK '>=' $CANBERRA_GTK_VERSION; then
232    have_libcanberra=yes
233    AC_MSG_RESULT(yes)
234    MUFFIN_PC_MODULES="$MUFFIN_PC_MODULES $CANBERRA_GTK"
235    AC_DEFINE([HAVE_LIBCANBERRA], 1, [Building with libcanberra for playing sounds])
236  else
237    AC_MSG_RESULT(no)
238    if test x$with_libcanberra = xyes ; then
239      AC_MSG_ERROR([libcanberra forced and libcanberra-gtk was not found])
240    fi
241  fi
242fi
243
244INTROSPECTION_VERSION=0.9.2
245GOBJECT_INTROSPECTION_CHECK([$INTROSPECTION_VERSION])
246
247if test x$found_introspection != xno; then
248  AC_DEFINE(HAVE_INTROSPECTION, 1, [Define if GObject introspection is available])
249  MUFFIN_PC_MODULES="$MUFFIN_PC_MODULES gobject-introspection-1.0"
250  # Since we don't make any guarantees about stability and we don't support
251  # parallel install, there's no real reason to change directories, filenames,
252  # etc. as we change the Muffin tarball version. Note that this must match
253  # api_version in src/Makefile.am
254
255  # This is set to a magic number which is different from the API which
256  # Mutter uses.  Otherwise there will be dependency conflicts in RPM
257  # based distributions that automatically resolve typelib file dependencies.
258  META_GIR=Meta_Muffin_0_gir
259  # META_GIR=[Meta_]muffin_major_version[_]muffin_minor_version[_gir]
260  AC_SUBST(META_GIR)
261fi
262
263AC_MSG_CHECKING([Xcursor])
264if $PKG_CONFIG xcursor; then
265     have_xcursor=yes
266  else
267     have_xcursor=no
268  fi
269  AC_MSG_RESULT($have_xcursor)
270
271if test x$have_xcursor = xyes; then
272  echo "Building with Xcursor"
273  MUFFIN_PC_MODULES="$MUFFIN_PC_MODULES xcursor"
274  AC_DEFINE(HAVE_XCURSOR, , [Building with Xcursor support])
275fi
276
277PKG_CHECK_MODULES(MUFFIN, $MUFFIN_PC_MODULES)
278
279AC_PATH_XTRA
280
281ALL_X_LIBS="$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"
282
283# Check for Xinerama extension (Solaris impl or Xfree impl)
284muffin_save_cppflags="$CPPFLAGS"
285CPPFLAGS="$CPPFLAGS $X_CFLAGS"
286
287AC_ARG_ENABLE(xinerama,
288  AC_HELP_STRING([--disable-xinerama],
289                 [disable muffin's use of the Xinerama extension]),
290  try_xinerama=$enable_xinerama,try_xinerama=yes)
291dnl '
292
293use_solaris_xinerama=no
294use_xfree_xinerama=no
295if test "${try_xinerama}" != no; then
296    case "$host" in
297        *-*-solaris*)
298            # Check for solaris
299            use_solaris_xinerama=yes
300            AC_CHECK_LIB(Xext, XineramaGetInfo,
301                         use_solaris_xinerama=yes, use_solaris_xinerama=no,
302                         $ALL_X_LIBS)
303            if test "x$use_solaris_xinerama" = "xyes"; then
304                AC_CHECK_HEADER(X11/extensions/xinerama.h,
305                                if test -z "`echo $ALL_X_LIBS | grep "\-lXext" 2> /dev/null`"; then
306                                    X_EXTRA_LIBS="-lXext $X_EXTRA_LIBS"
307                                fi
308                                AC_DEFINE(HAVE_SOLARIS_XINERAMA, , [Have Solaris-style Xinerama])
309                                AC_DEFINE(HAVE_XINERAMA, , [Have some version of Xinerama]),
310                                use_solaris_xinerama=no,
311                                [#include <X11/Xlib.h>])
312            fi
313            AC_MSG_CHECKING(for Xinerama support on Solaris)
314            AC_MSG_RESULT($use_solaris_xinerama);
315            ;;
316        *)
317            # Check for XFree
318            use_xfree_xinerama=yes
319            AC_CHECK_LIB(Xinerama, XineramaQueryExtension,
320                [AC_CHECK_HEADER(X11/extensions/Xinerama.h,
321                                 X_EXTRA_LIBS="-lXinerama $X_EXTRA_LIBS"
322                                 if test -z "`echo $ALL_X_LIBS | grep "\-lXext" 2> /dev/null`"; then
323                                     X_EXTRA_LIBS="-lXext $X_EXTRA_LIBS"
324                                 fi
325                                 AC_DEFINE(HAVE_XFREE_XINERAMA, , [Have XFree86-style Xinerama])
326                                 AC_DEFINE(HAVE_XINERAMA,, [Have some version of Xinerama]),
327                                 use_xfree_xinerama=no,
328                                 [#include <X11/Xlib.h>])],
329                use_xfree_xinerama=no, -lXext $ALL_X_LIBS)
330            AC_MSG_CHECKING(for Xinerama support on XFree86)
331            AC_MSG_RESULT($use_xfree_xinerama);
332            ;;
333    esac
334fi
335
336CPPFLAGS="$muffin_save_cppflags"
337
338SHAPE_LIBS=
339found_shape=no
340AC_CHECK_LIB(Xext, XShapeQueryExtension,
341               [AC_CHECK_HEADER(X11/extensions/shape.h,
342                                SHAPE_LIBS=-lXext found_shape=yes)],
343               , $ALL_X_LIBS)
344
345if test x$enable_shape = xno; then
346   found_shape=no
347fi
348
349if test x$enable_shape = xyes; then
350   if test "$found_shape" = "no"; then
351      AC_MSG_ERROR([--enable-shape forced and Shape not found])
352      exit 1
353   fi
354fi
355
356if test "x$found_shape" = "xyes"; then
357   AC_DEFINE(HAVE_SHAPE, , [Have the shape extension library])
358fi
359
360found_xkb=no
361AC_CHECK_LIB(X11, XkbQueryExtension,
362               [AC_CHECK_HEADER(X11/XKBlib.h,
363                                found_xkb=yes)],
364	, $ALL_X_LIBS)
365
366if test "x$found_xkb" = "xyes"; then
367   AC_DEFINE(HAVE_XKB, , [Have keyboard extension library])
368fi
369
370
371RANDR_LIBS=
372found_randr=no
373AC_CHECK_LIB(Xrandr, XRRUpdateConfiguration,
374               [AC_CHECK_HEADER(X11/extensions/Xrandr.h,
375                                RANDR_LIBS=-lXrandr found_randr=yes,,
376				[#include <X11/Xlib.h>])],
377               , -lXrender -lXext $ALL_X_LIBS)
378
379if test "x$found_randr" = "xyes"; then
380   AC_DEFINE(HAVE_RANDR, , [Have the Xrandr extension library])
381fi
382
383XSYNC_LIBS=
384found_xsync=no
385AC_CHECK_LIB(Xext, XSyncQueryExtension,
386               [AC_CHECK_HEADER(X11/extensions/sync.h,
387                                found_xsync=yes,,
388				[#include <X11/Xlib.h>])],
389               , $ALL_X_LIBS)
390
391if test x$enable_xsync = xno; then
392   found_xsync=no
393fi
394
395if test x$enable_xsync = xyes; then
396   if test "$found_xsync" = "no"; then
397      AC_MSG_ERROR([--enable-xsync forced and XSync not found])
398      exit 1
399   fi
400fi
401
402if test "x$found_xsync" = "xyes"; then
403   XSYNC_LIBS=-lXext
404   AC_DEFINE(HAVE_XSYNC, , [Have the Xsync extension library])
405fi
406
407MUFFIN_LIBS="$MUFFIN_LIBS $XSYNC_LIBS $RANDR_LIBS $SHAPE_LIBS $X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS -lm"
408MUFFIN_MESSAGE_LIBS="$MUFFIN_MESSAGE_LIBS $X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"
409MUFFIN_WINDOW_DEMO_LIBS="$MUFFIN_WINDOW_DEMO_LIBS $X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS -lm"
410MUFFIN_PROPS_LIBS="$MUFFIN_PROPS_LIBS $X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"
411
412found_sm=no
413case "$MUFFIN_LIBS" in
414 *-lSM*)
415    found_sm=yes
416    ;;
417 *)
418  AC_CHECK_LIB(SM, SmcSaveYourselfDone,
419               [AC_CHECK_HEADERS(X11/SM/SMlib.h,
420                                MUFFIN_LIBS="-lSM -lICE $MUFFIN_LIBS" found_sm=yes)],
421               , $MUFFIN_LIBS)
422    ;;
423esac
424
425if test x$enable_sm = xno; then
426   found_sm=no
427fi
428
429if test x$enable_sm = xyes; then
430   if test "$found_sm" = "no"; then
431      AC_MSG_ERROR([--enable-sm forced and -lSM not found])
432      exit 1
433   fi
434fi
435
436if test "$found_sm" = "yes"; then
437   AC_DEFINE(HAVE_SM, , [Building with SM support])
438fi
439
440AM_CONDITIONAL(HAVE_SM, test "$found_sm" = "yes")
441
442HOST_ALIAS=$host_alias
443AC_SUBST(HOST_ALIAS)
444
445AC_PATH_PROG(GDK_PIXBUF_CSOURCE, gdk-pixbuf-csource, no)
446
447if test x"$GDK_PIXBUF_CSOURCE" = xno; then
448  AC_MSG_ERROR([gdk-pixbuf-csource executable not found in your path - should be installed with GTK])
449fi
450
451AC_SUBST(GDK_PIXBUF_CSOURCE)
452
453AC_PATH_PROG(ZENITY, zenity, no)
454if test x"$ZENITY" = xno; then
455  AC_MSG_ERROR([zenity not found in your path - needed for dialogs])
456fi
457
458AC_ARG_ENABLE(debug,
459	[  --enable-debug		enable debugging],,
460	enable_debug=no)
461if test "x$enable_debug" = "xyes"; then
462	CFLAGS="$CFLAGS -g -O"
463fi
464
465GTK_DOC_CHECK([1.15], [--flavour no-tmpl])
466
467AC_CHECK_DECL([GL_EXT_x11_sync_object],
468              [],
469              [AC_MSG_ERROR([GL_EXT_x11_sync_object definition not found, please update your GL headers])],
470              [#include <GL/glx.h>])
471
472m4_ifdef([AX_COMPILER_FLAGS],
473         [AX_COMPILER_FLAGS([WARN_CFLAGS],[WARN_LDFLAGS])])
474
475AC_ARG_ENABLE(clutter-doc,
476	[  --disable-clutter-doc		disable Clutter docs generation],,
477	clutter_doc=yes)
478
479AM_CONDITIONAL(CLUTTER_DOC, test "$clutter_doc" = "yes")
480
481AC_CONFIG_FILES([
482Makefile
483data/Makefile
484doc/Makefile
485doc/man/Makefile
486doc/reference/Makefile
487doc/reference/muffin/Makefile
488doc/reference/muffin/muffin-docs.sgml
489doc/reference/clutter/Makefile
490doc/reference/clutter/clutter-docs.xml
491doc/reference/cogl/Makefile
492doc/reference/cogl/cogl-docs.xml
493src/Makefile
494src/wm-tester/Makefile
495src/libmuffin.pc
496src/muffin-plugins.pc
497src/tools/Makefile
498src/compositor/plugins/Makefile
499po/Makefile.in
500])
501
502AC_OUTPUT
503
504COGL_PC_VERSION=$(grep Version: cogl/cogl/muffin-cogl-$MUFFIN_PLUGIN_API_VERSION.pc|awk '{ print $2; }')
505AS_IF([test "x$COGL_PC_VERSION" != "x$MUFFIN_VERSION"],
506      [AC_MSG_ERROR([muffin-cogl pkg-config file not updated, rerun ./configure])])
507
508CLUTTER_PC_VERSION=$(grep Version: clutter/clutter/muffin-clutter-$MUFFIN_PLUGIN_API_VERSION.pc|awk '{ print $2; }')
509AS_IF([test "x$CLUTTER_PC_VERSION" != "x$MUFFIN_VERSION"],
510      [AC_MSG_ERROR([muffin-clutter pkg-config file not updated, rerun ./configure])])
511
512if test x$enable_verbose_mode = xno; then
513        echo "*** WARNING WARNING WARNING WARNING WARNING"
514        echo "*** Building without verbose mode"
515        echo "*** This means there's no way to debug muffin problems."
516        echo "*** Please build normal desktop versions of muffin"
517        echo "*** with verbose mode enabled so users can use it when they report bugs."
518fi
519
520dnl ==========================================================================
521echo "
522muffin-$VERSION
523
524	prefix:                   ${prefix}
525	source code location:	  ${srcdir}
526	compiler:		  ${CC}
527
528	XFree86 Xinerama:         ${use_xfree_xinerama}
529	Solaris Xinerama:         ${use_solaris_xinerama}
530	Startup notification:     ${have_startup_notification}
531	libcanberra:              ${have_libcanberra}
532	Introspection:            ${found_introspection}
533	Session management:       ${found_sm}
534	Shape extension:          ${found_shape}
535	Xsync:                    ${found_xsync}
536	Xcursor:                  ${have_xcursor}
537"
538