1AC_INIT([Florence virtual keyboard], [0.6.3], [f.agrech@gmail.com], [florence])
2AC_CONFIG_HEADERS(config.h)
3AM_INIT_AUTOMAKE(no-dist-gzip dist-bzip2)
4LT_INIT
5
6# Options
7AC_ARG_WITH([docs], AS_HELP_STRING([--without-docs], [Build without docs (default: enabled)]))
8AM_CONDITIONAL([WITH_DOCS], [test "x$with_docs" != "xno"])
9AC_ARG_WITH([notification], AS_HELP_STRING([--without-notification], [Build without notification (default: enabled)]))
10AM_CONDITIONAL([WITH_NOTIFICATION], [test "x$with_notification" != "xno"])
11AC_ARG_WITH([xtst], AS_HELP_STRING([--without-xtst], [Build without Xtst extension (default: enabled)]))
12AM_CONDITIONAL([WITH_XTST], [test "x$with_xtst" != "xno"])
13AC_ARG_WITH([xrecord], AS_HELP_STRING([--without-xrecord], [Build without XRecord extension (requires the Xtst extension) (default: enabled)]))
14AM_CONDITIONAL([WITH_XRECORD], [test "x$with_xrecord" != "xno" -a "x$with_xtst" != "xno"])
15AC_ARG_WITH([at-spi], AS_HELP_STRING([--without-at-spi], [Build without at-spi(default: enabled)]))
16AM_CONDITIONAL([WITH_AT_SPI], [test "x$with_at_spi" != "xno"])
17AC_ARG_WITH([panelapplet], AS_HELP_STRING([--without-panelapplet], [Build without libpanelapplet(default: enabled)]))
18if test "x$with_xtst" = "xno" -a  "x$with_at_spi" = "xno"; then
19	AC_MSG_ERROR(You can't disable both xtst and at-spi as there is no way Florence can generate keyboard events.)
20fi
21AC_ARG_WITH([xkb], AS_HELP_STRING([--without-xkb], [Build without xkb(default: enabled)]))
22AM_CONDITIONAL([WITH_XKB], [test "x$with_xkb" != "xno"])
23if test "x$with_xkb" != "xno"; then
24	AC_DEFINE(ENABLE_XKB, ["xkb"], [xkb extension is enabled])
25fi
26AC_ARG_WITH([ramble], AS_HELP_STRING([--without-ramble], [Build without ramble mode (default: enabled)]))
27AM_CONDITIONAL([WITH_RAMBLE], [test "x$with_ramble" != "xno"])
28if test "x$with_ramble" != "xno"; then
29	AC_DEFINE(ENABLE_RAMBLE, ["ramble"], [Ramble mode is enabled])
30fi
31
32# Internationalization
33AC_PROG_INTLTOOL([0.23])
34GETTEXT_PACKAGE=florence
35AC_SUBST(GETTEXT_PACKAGE)
36AC_DEFINE(GETTEXT_PACKAGE, ["florence"], [Package name for gettext])
37ALL_LINGUAS="fr ru it"
38AM_GLIB_GNU_GETTEXT
39florencelocaledir='${prefix}/${DATADIRNAME}/locale'
40AC_SUBST(florencelocaledir)
41
42# Checks for programs.
43AC_PROG_CC
44AM_PROG_CC_C_O
45AC_PROG_GREP
46AC_PROG_SED
47PKG_PROG_PKG_CONFIG
48GLIB_GSETTINGS
49
50GNOME_DOC_INIT(,,
51	if test "x$with_docs" != "xno"; then
52		AC_MSG_ERROR([gnome-doc-utils >= $gdu_cv_version_required not found])
53	fi)
54if test "x$with_docs" != "xno"; then
55	AC_PATH_PROG(SK_CONFIG,scrollkeeper-config,no)
56	if test x$SK_CONFIG = xno; then
57		AC_MSG_ERROR(Couldn't find scrollkeeper-config. Please install the scrollkeeper package: http://scrollkeeper.sourceforge.net)
58	fi
59	SCROLLKEEPER_BUILD_REQUIRED=0.3.5
60	AC_SUBST(SCROLLKEEPER_BUILD_REQUIRED)
61fi
62
63# Checks for libraries.
64DEP_MODULES="xext gmodule-2.0 cairo librsvg-2.0 libxml-2.0 gstreamer-1.0"
65PKG_CHECK_MODULES(DEPS, $DEP_MODULES)
66
67PKG_CHECK_MODULES([GTK3], [gtk+-3.0], AC_DEFINE([ENABLE_GTK3], [], [GTK3 enabled.]),
68	AC_MSG_ERROR(gtk version 3.0 or superior required. Please install the dev package of gtk))
69
70PKG_CHECK_MODULES([GIO], [gio-2.0], AC_DEFINE([ENABLE_GIO], [], [GIO enabled.]),
71	AC_MSG_ERROR(GIO version 2.0 or superior required. Please install the dev package of gtk))
72
73if test "x$with_docs" != "xno"; then
74	PKG_CHECK_MODULES([GNOME_DOC_UTILS], [gnome-doc-utils], AC_DEFINE([ENABLE_HELP], [], [Help enabled.]), AC_MSG_ERROR(Couldn't find gnome-doc-utils.
75Please either install gnome-doc-utils package or disable docs: --without-docs configure option))
76fi
77if test "x$with_notification" != "xno"; then
78	PKG_CHECK_MODULES([LIBNOTIFY], [libnotify], AC_DEFINE([ENABLE_NOTIFICATION], [], [Notification enabled.]), AC_MSG_ERROR(Could not configure libnotify. Please either install libnotify or disable notifications: --without-notification configure option))
79	PKG_CHECK_MODULES([LIBNOTIFY_ICON], [libnotify < 0.7.0], AC_DEFINE([ENABLE_NOTIFICATION_ICON], [], [Notification icon enabled.]), AC_MSG_NOTICE([Notification icon disabled.]))
80fi
81
82if test "x$with_xtst" != "xno"; then
83	PKG_CHECK_MODULES([XTST], [xtst], AC_DEFINE([ENABLE_XTST], [], [Xtst extension enabled.]), AC_MSG_ERROR(Could not configure xtst. Please either install xtst or disable it: --without-xtst configure option))
84	if test "x$with_xrecord" != "xno"; then
85		AC_MSG_WARN([Xorg RECORD extension is severely broken in version 1.6 of Xorg: see bugs http://bugs.freedesktop.org/show_bug.cgi?id=20500 and http://bugs.freedesktop.org/show_bug.cgi?id=21971 ; Please disable xrecord if you affected by this bug: --without-xrecord option])
86		AC_DEFINE(ENABLE_XRECORD, ["xrecord"], [xrecord extension is enabled])
87	fi
88fi
89if test "x$with_at_spi" != "xno"; then
90	PKG_CHECK_MODULES([AT_SPI2], [atspi-2], AC_DEFINE([ENABLE_AT_SPI2], [], [dbus at-spi enabled.]),
91		AC_MSG_ERROR(Could not configure at-spi. Please either install at-spi or disable it: --without-at-spi configure option))
92fi
93
94# Math library
95AC_CHECK_LIB([m], [tan], AC_DEFINE(HAVE_LIBM, 1, Math lib) LIBM="-lm", AC_MSG_ERROR(Missing working libm math lib))
96
97# X11 library
98PKG_CHECK_MODULES([X11], [x11])
99
100AC_SUBST(GNOME_DOCS_UTILS_CFLAGS)
101AC_SUBST(GNOME_DOCS_UTILS_LIBS)
102AC_SUBST(LIBNOTIFY_CFLAGS)
103AC_SUBST(LIBNOTIFY_LIBS)
104AC_SUBST(XTST_CFLAGS)
105AC_SUBST(XTST_LIBS)
106AC_SUBST(AT_SPI2_CFLAGS)
107AC_SUBST(AT_SPI2_LIBS)
108AC_SUBST(LIBGNOME_CFLAGS)
109AC_SUBST(LIBGNOME_LIBS)
110AC_SUBST(DEPS_CFLAGS)
111AC_SUBST(DEPS_LIBS)
112AC_SUBST(X11_CFLAGS)
113AC_SUBST(X11_LIBS)
114AC_SUBST(LIBM)
115
116# Checks for header files.
117AC_FUNC_ALLOCA
118AC_HEADER_DIRENT
119AC_HEADER_STDC
120AC_HEADER_MAJOR
121AC_CHECK_HEADERS([math.h fcntl.h libintl.h locale.h memory.h stdio.h stdlib.h string.h strings.h sys/param.h sys/stat.h sys/types.h sys/file.h sys/time.h utime.h dirent.h unistd.h])
122
123# Checks for typedefs, structures, and compiler characteristics.
124AC_HEADER_STAT
125AC_C_CONST
126AC_CHECK_MEMBERS([struct stat.st_blksize])
127
128# Checks for library functions.
129AC_TYPE_SIZE_T
130AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
131AC_CHECK_FUNCS([setlocale memset memchr sscanf strcmp strrchr strchr strstr strcpy strncpy strcat atoi putenv fopen fclose fgets fputs lstat opendir readdir closedir])
132
133# Files generated
134ICONDIR=${prefix}/share/pixmaps
135if test "x$prefix" = "xNONE"; then
136	ICONDIR=/usr/local/share/pixmaps
137fi
138AC_SUBST(ICONDIR)
139AC_CONFIG_FILES([Makefile
140                 data/Makefile
141                 data/layouts/Makefile
142                 data/relaxng/Makefile
143                 data/styles/Makefile
144                 data/styles/bright/Makefile
145                 data/styles/default/Makefile
146                 data/styles/default/sounds/Makefile
147                 data/styles/hard/Makefile
148                 data/styles/flat/Makefile
149                 data/svg11/Makefile
150                 docs/Makefile
151                 docs/florence.1
152                 docs/florence_applet.1
153                 src/Makefile
154                 src/florence-1.0.pc
155                 po/Makefile.in])
156AC_OUTPUT
157
158