1AC_INIT([YAD], [7.3], [https://github.com/v1cont/yad/issues/], yad, [https://github.com/v1cont/yad/])
2AC_CONFIG_AUX_DIR([build])
3
4AM_INIT_AUTOMAKE([1.11 foreign dist-xz no-dist-gzip])
5AM_SILENT_RULES([yes])
6
7AC_PREREQ([2.59])
8
9AC_CONFIG_HEADERS([config.h])
10AC_CONFIG_SRCDIR([src])
11
12AM_MAINTAINER_MODE
13
14IT_PROG_INTLTOOL([0.40.0])
15
16AC_PROG_CC
17
18PKG_CHECK_MODULES([GTK], [gtk+-3.0 >= 3.22.0 gtk+-unix-print-3.0])
19AC_SUBST([GTK_CFLAGS])
20AC_SUBST([GTK_LIBS])
21
22dnl rgb.txt
23AC_ARG_WITH([rgb],
24	[AS_HELP_STRING([--with-rgb=PATH],
25			[set path to rgb.txt file (default - /etc/X11/rgb.txt)])],
26	[with_rgb=$withval], [with_rgb=/etc/X11/rgb.txt])
27AC_DEFINE_UNQUOTED([RGB_FILE], ["$with_rgb"], [Path to rgb.txt file])
28
29dnl html widget
30AC_ARG_ENABLE([html],
31	[AS_HELP_STRING([--enable-html],
32			[Build YAD with HTML widget])],
33	[build_html=$enableval], [build_html=yes])
34if test x$build_html = xyes; then
35    PKG_CHECK_MODULES([HTML], [webkit2gtk-4.0], [have_html=yes], [have_html=no])
36else
37    have_html=no
38fi
39AC_SUBST([HTML_CFLAGS])
40AC_SUBST([HTML_LIBS])
41AM_CONDITIONAL([HTML], [test x$have_html = xyes])
42
43if test x$have_html = xyes; then
44    AC_DEFINE([HAVE_HTML], [1], [Define this if you have webkit2gt library])
45fi
46
47dnl status icon widget
48AC_ARG_ENABLE([tray],
49	[AS_HELP_STRING([--enable-tray],
50			[Build YAD with status icon])],
51	[build_tray=$enableval], [build_tray=yes])
52AM_CONDITIONAL([TRAY], [test x$build_tray = xyes])
53
54if test x$build_tray = xyes; then
55    AC_DEFINE([HAVE_TRAY], [1], [Define this if you need status icon])
56fi
57
58dnl spell check
59AC_ARG_ENABLE([spell],
60	[AS_HELP_STRING([--enable-spell],
61			[Build YAD with Spell check support (default - yes)])],
62	[with_spell=$enableval], [with_spell=yes])
63if test x$with_spell = xyes; then
64    PKG_CHECK_MODULES([SPELL], [gspell-1], [have_spell=yes], [have_spell=no])
65else
66    have_spell=no
67fi
68AC_SUBST([SPELL_CFLAGS])
69AC_SUBST([SPELL_LIBS])
70
71if test x$have_spell = xyes; then
72    AC_DEFINE([HAVE_SPELL], [1], [Define this if you need spell check support])
73fi
74
75dnl sourceview
76AC_ARG_ENABLE([sourceview],
77	[AS_HELP_STRING([--enable-sourceview],
78			[Build YAD with GtkSourceView support (default - yes)])],
79	[with_sourceview=$enableval], [with_sourceview=yes])
80if test x$with_sourceview = xyes; then
81    PKG_CHECK_MODULES([SOURCEVIEW], [gtksourceview-3.0], [have_sourceview=yes], [have_sourceview=no])
82else
83    have_sourceview=no
84fi
85AC_SUBST([SOURCEVIEW_CFLAGS])
86AC_SUBST([SOURCEVIEW_LIBS])
87
88if test x$have_sourceview = xyes; then
89    AC_DEFINE([HAVE_SOURCEVIEW], [1], [Define this if you need GtkSourceView support])
90fi
91
92dnl icon browser
93AC_ARG_ENABLE([standalone],
94	[AS_HELP_STRING([--enable-standalone],
95			[Build standalone YAD binary (wihtout gsettings)])],
96	[build_sa=$enableval], [build_sa=no])
97AM_CONDITIONAL([STANDALONE], [test x$build_sa = xyes])
98if test x$build_sa = xyes; then
99    AC_DEFINE([STANDALONE], [1], [Define this if you need standalone YAD binary])
100fi
101
102dnl pfd
103AC_ARG_ENABLE([pfd],
104	[AS_HELP_STRING([--enable-pfd],
105			[Build pfd utility])],
106	[build_pfd=$enableval], [build_pfd=yes])
107if test x$build_pfd = xyes; then
108    PKG_CHECK_MODULES([PFD], [pango], [build_pfd=yes], [build_pfd=no])
109fi
110AC_SUBST([PFD_CFLAGS])
111AC_SUBST([PFD_LIBS])
112AM_CONDITIONAL([BUILD_PFD], [test x$build_pfd = xyes])
113
114dnl icon browser
115AC_ARG_ENABLE([icon-browser],
116	[AS_HELP_STRING([--enable-icon-browser],
117			[Build YAD icon browser])],
118	[build_ib=$enableval], [build_ib=yes])
119AM_CONDITIONAL([BUILD_IB], [test x$build_ib = xyes])
120
121# GSettings
122GLIB_GSETTINGS
123
124AC_SEARCH_LIBS(round, m)
125
126# *******************************
127# Internationalization
128# *******************************
129
130GETTEXT_PACKAGE=yad
131AC_SUBST([GETTEXT_PACKAGE])
132AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], ["$GETTEXT_PACKAGE"], [Gettext domain])
133
134AM_GLIB_GNU_GETTEXT
135
136# *******************************
137
138AC_SUBST([AM_CFLAGS])
139AC_SUBST([AM_CPPFLAGS])
140AC_SUBST([AM_LDFLAGS])
141
142# *******************************
143
144AC_CONFIG_FILES([
145Makefile
146po/Makefile.in
147src/Makefile
148data/Makefile
149data/icons/Makefile
150data/icons/16x16/Makefile
151data/icons/24x24/Makefile
152data/icons/32x32/Makefile
153data/icons/48x48/Makefile
154data/icons/96x96/Makefile
155data/icons/128x128/Makefile
156data/yad.m4
157data/yad.spec
158])
159
160AC_OUTPUT
161
162echo
163echo "Build configuratioh:"
164echo "  Status icon          - $build_tray"
165echo "  HTML widget          - $have_html"
166echo "  GtkSourceView        - $have_sourceview"
167echo "  Spell checking       - $have_spell"
168echo "  Path to rgb.txt      - $with_rgb"
169echo "  Standalone build     - $build_sa"
170echo "  pfd                  - $build_pfd"
171echo "  Icon browser         - $build_ib"
172echo
173