1 m4_define([adg_version],[0.7.5])
2 m4_define([adg_api_version],[1.0])
3 m4_define([adg_lt_version],[3:0:0])
5 m4_define([cpml_version],adg_version)
6 m4_define([cpml_api_version],adg_api_version)
7 m4_define([cpml_lt_version],[2:0:0])
9 m4_define([gtkdoc_prereq], [1.12] )dnl Support introspection annotations
10 m4_define([gobject_prereq], [2.10.1])dnl Required by GTypeInitiallyUnowned (glib 2.10.0 was broken)
11 m4_define([cairo_prereq], [1.7.4] )dnl Required by cairo_scaled_font_text_to_glyphs()
12 m4_define([gtk2_prereq], [2.18.0])dnl Required by gtk_widget_get_allocation()
13 m4_define([gtk3_prereq], [3.0.0] )dnl First stable release
14 m4_define([pangocairo_prereq],[1.10.0])dnl Cairo support in Pango
15 m4_define([gi_prereq], [1.0.0] )dnl First stable release
20 dnl autoconf 2.62 is required by GObject introspection:
21 dnl http://live.gnome.org/GObjectIntrospection/AutotoolsIntegration
23 AC_INIT([adg-1],adg_version,[http://dev.entidi.com/p/adg/],[adg],[http://adg.entidi.com/])
24 AC_CONFIG_SRCDIR([configure.ac])
25 AC_CONFIG_HEADERS([src/config.h])
26 AC_CONFIG_AUX_DIR([build])
27 AC_CONFIG_MACRO_DIR([build])
28 AM_INIT_AUTOMAKE([1.10 gnits no-dist-gzip dist-bzip2 -Wall -Wno-portability])
30 dnl m4 backward compatibility stuff
31 m4_ifdef([AM_SILENT_RULES],
32 [AM_SILENT_RULES([yes])],
33 [AC_SUBST([AM_V_GEN],[])])
34 m4_ifdef([AM_SUBST_NOTMAKE],[],
35 [AC_DEFUN([AM_SUBST_NOTMAKE],[_AM_SUBST_NOTMAKE($@)])])
36 m4_ifdef([AM_COND_IF],[],
37 [AC_DEFUN([AM_COND_IF],
38 [AS_IF([test -z "$$1_TRUE"],[$2],[$3])])])
40 AC_DEFUN([ADG_DEPENDENCY],
41 [EXTRADIR="$EXTRADIR --extra-dir=$($PKG_CONFIG --variable=prefix $1)/share/gtk-doc/html/$2"])
43 # Check for host information
78 AM_CONDITIONAL([OS_UNIX],[test "${guessed_host}" != "mingw"])
79 AM_CONDITIONAL([OS_WINDOWS],[test "${guessed_host}" = "mingw" -o "${guessed_host}" = "cygwin"])
87 AC_PATH_PROG([XSLTPROC],[xsltproc],[/usr/bin/xsltproc])
88 AC_PATH_PROG([GLIB_MKENUMS],[glib-mkenums],[/usr/bin/glib-mkenums])
89 AC_PATH_PROG([GLIB_GENMARSHAL],[glib-genmarshal],[/usr/bin/glib-genmarshal])
90 AC_PATH_PROG([GTESTER],[gtester],[/usr/bin/gtester])
91 AC_PATH_PROG([GTESTER_REPORT],[gtester-report],[/usr/bin/gtester-report])
92 AC_PATH_PROG([GLADE3],[glade-3],[/usr/bin/glade-3])
97 AC_CHECK_LIB([m],[cos])
100 dnl GLib 2.16 is required by _adg_dgettext() for
101 dnl g_win32_get_package_installation_directory_of_module()
102 AM_COND_IF([OS_WINDOWS],
103 [AC_PATH_PROG([MAKENSIS],[makensis],[/usr/bin/makensis])
104 AC_PATH_PROG([WINE],[wine])
105 AC_ARG_VAR([WINDRES],[Command for Windows resources manipulation])
106 AC_CHECK_TOOL([WINDRES],[windres])
107 PKG_CHECK_MODULES([GLIB],[glib-2.0 >= 2.16])])
110 # Libtool initialization
112 AC_MSG_CHECKING([which libtool initialization strategy to adopt])
113 AC_MSG_RESULT([m4_ifset([LT_INIT],[LT-INIT],[AC-PROG-LIBTOOL])])
115 [LT_INIT([disable-static win32-dll])],
123 dnl The following macro is required in order to be able to use
124 dnl autopoint (formerly called gettextize) from autoreconf.
125 dnl The argument is a trade-off between modern and supported.
126 AM_GNU_GETTEXT_VERSION([0.17])
128 AM_GNU_GETTEXT([external])
129 AC_SUBST([ADG_API_PACKAGE],AC_PACKAGE_TARNAME)
130 AC_SUBST([GETTEXT_PACKAGE],[${ADG_API_PACKAGE}])
131 AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["${ADG_API_PACKAGE}"],
132 [Define to the domain used by gettext.])
135 # Check for required packages
137 PKG_CHECK_MODULES([GLIB],[glib-2.0])
138 ADG_DEPENDENCY([glib-2.0],[glib])
139 PKG_CHECK_MODULES([GOBJECT],[gobject-2.0 >= ]gobject_prereq)
140 ADG_DEPENDENCY([gobject-2.0],[gobject])
141 PKG_CHECK_MODULES([CAIRO],[cairo >= ]cairo_prereq)
142 ADG_DEPENDENCY([cairo],[cairo])
145 # Check for optional packages
148 AC_ARG_ENABLE([pango],
149 [AS_HELP_STRING([--enable-pango],
150 [use pango for rendering text @<:@default=check@:>@])],
151 [],[enable_pango=check])
152 AS_IF([test "x${enable_pango}" != "xno"],
153 [PKG_CHECK_MODULES([PANGO],[pangocairo >= ]pangocairo_prereq,
155 AC_DEFINE_UNQUOTED([PANGO_ENABLED],[1],
156 [Defined if the pango support is enabled.])
157 ADG_DEPENDENCY([pangocairo],[pango])],
158 [AS_IF([test "x${enable_pango}" = "xyes"],
159 [AC_MSG_ERROR([${PANGO_PKG_ERRORS} and pango support requested])],
160 [enable_pango=no])])])
161 AM_CONDITIONAL([HAVE_PANGO],[test "x${enable_pango}" = "xyes"])
165 [AS_HELP_STRING([--with-gtk@<:@=gtk2/gtk3@:>@],
166 [include GTK+ specific widgets @<:@default=check@:>@])],
168 AS_CASE(["${with_gtk}"],
169 [gtk2], [gtk2_pkg=yes; gtk3_pkg=no],
170 [gtk3], [gtk2_pkg=no; gtk3_pkg=yes],
171 [check|yes], [gtk2_pkg=yes; gtk3_pkg=yes],
172 [no], [gtk2_pkg=no; gtk3_pkg=no],
173 [AC_MSG_ERROR([Invalid option passed to --with-gtk])])
175 # GTK+ autodetection, giving precedence to GTK+3
176 AS_IF([test "x${gtk3_pkg}" = "xyes"],
177 [PKG_CHECK_MODULES([GTK3],[gtk+-3.0 >= ]gtk3_prereq,
179 ADG_DEPENDENCY([gtk+-3.0],[gtk3])],
181 AS_IF([test "x${gtk2_pkg}" = "xyes" -a "x${gtk_pkg}" = "x"],
182 [PKG_CHECK_MODULES([GTK2],[gtk+-2.0 >= ]gtk2_prereq,
184 ADG_DEPENDENCY([gtk+-2.0],[gtk2])],
186 AS_IF([test "x${gtk_pkg}" != "x"],[with_gtk=${gtk_pkg}])
188 # Handle "check" graceful degradation
189 AS_IF([test "x${with_gtk}" = "xcheck"],[with_gtk=no])
192 AS_IF([test "x${with_gtk}" != "xno" -a "x${gtk_pkg}" = "x"],
193 [AC_MSG_ERROR([GTK+ support explicitely required but no valid GTK+ found])])
195 AS_IF([test "x${with_gtk}" = "xgtk3"],
196 [AC_DEFINE_UNQUOTED([GTK3_ENABLED],[1],
197 [Defined if the GTK+3 support is enabled.])])
198 AS_IF([test "x${with_gtk}" = "xgtk2"],
199 [AC_DEFINE_UNQUOTED([GTK2_ENABLED],[1],
200 [Defined if the GTK+2 support is enabled.])])
202 AM_CONDITIONAL([HAVE_GTK], [test "x${with_gtk}" != "xno"])
203 AM_CONDITIONAL([HAVE_GTK2],[test "x${with_gtk}" = "xgtk2"])
204 AM_CONDITIONAL([HAVE_GTK3],[test "x${with_gtk}" = "xgtk3"])
206 dnl Glade catalog dir
207 AC_ARG_WITH(glade_catalogdir,
208 [AS_HELP_STRING([--with-glade-catalogdir@<:@=DIR@:>@],
209 [where to install the glade catalogs @<:@default=check@:>@])],
210 [],[with_glade_catalogdir=check])
212 # Both "check" and "yes" mean gladeui autodetection,
213 # but "yes" will fail on gladeui not found
214 AS_IF([test "x${with_glade_catalogdir}" = "xcheck" -o "x${with_glade_catalogdir}" = "xyes"],
217 # gladeui autodetection, giving precedence to gladeui-2.0 if possible
218 AS_IF([test "x${glade_pkg}" = "xcheck" -a "x${with_gtk}" != "xgtk2"],
219 [PKG_CHECK_MODULES([GLADEUI2],[gladeui-2.0],[glade_pkg=gladeui-2.0],[:])])
220 AS_IF([test "x${glade_pkg}" = "xcheck"],
221 [PKG_CHECK_MODULES([GLADEUI1],[gladeui-1.0],[glade_pkg=gladeui-1.0],[:])])
222 AS_IF([test "x${glade_pkg}" != "x" -a "x${glade_pkg}" != "xcheck"],
223 [NTD_UNEXPAND([${glade_pkg}],
225 [with_glade_catalogdir="${NTD_UNEXPANDED}"],
226 [AC_MSG_ERROR([${glade_pkg} found but pkg-config file invalid])])])
228 # Handle "yes" failure
229 AS_IF([test "x${glade_pkg}" = "xcheck" -a "x${with_glade_catalogdir}" = "xyes"],
230 [AC_MSG_ERROR([Glade support explicitely required but no valid gladeui found])])
232 # Handle "check" graceful degradation
233 AS_IF([test "x${glade_pkg}" = "xcheck" -a "x${with_glade_catalogdir}" = "xcheck"],
234 [with_glade_catalogdir=no])
236 AM_CONDITIONAL([HAVE_GLADE],[test "x${with_glade_catalogdir}" != "xno"])
237 AM_COND_IF([HAVE_GLADE],
240 Glade catalog dir: ${with_glade_catalogdir}"],
243 AC_SUBST([GLADE_CATALOGDIR],${with_glade_catalogdir})
246 GTK_DOC_CHECK(gtkdoc_prereq)
248 dnl GObject introspection
249 GOBJECT_INTROSPECTION_CHECK(gi_prereq)
251 [AS_HELP_STRING([--with-girdir=DIR],
252 [where the gir files are installed @<:@default=check@:>@])],
253 [],[with_girdir=check])
254 AS_IF([test "x${enable_introspection}" = "xyes" -a "x${with_girdir}" = "xcheck"],
255 [NTD_UNEXPAND([gobject-introspection-1.0],
257 [with_girdir="${NTD_UNEXPANDED}"])])
258 AC_SUBST([GIRDIR],${with_girdir})
259 AC_ARG_WITH(typelibdir,
260 [AS_HELP_STRING([--with-typelibdir=DIR],
261 [where the typelib files are installed @<:@default=check@:>@])],
262 [],[with_typelibdir=check])
263 AS_IF([test "x${enable_introspection}" = "xyes" -a "x${with_typelibdir}" = "xcheck"],
264 [NTD_UNEXPAND([gobject-introspection-1.0],
266 [with_typelibdir="${NTD_UNEXPANDED}"])])
267 AC_SUBST([TYPELIBDIR],${with_typelibdir})
268 AM_COND_IF([HAVE_INTROSPECTION],
269 [report_introspection="
270 Where to install gir files: ${with_girdir}
271 Where to install the typelib files: ${with_typelibdir}"],
272 [report_introspection=""])
274 dnl If introspection is used GObject support in cairo must be enabled,
275 dnl that is the cairo-gobject library must be present. That support
276 dnl was introduced since cairo 1.10.0.
277 PKG_CHECK_MODULES([CAIRO_GOBJECT],[cairo-gobject],
278 [AC_DEFINE_UNQUOTED([CAIRO_GOBJECT_ENABLED],[1],
279 [Defined if GObject support in cairo is present.])],
280 [AS_IF([test "x${enable_introspection}" = "xyes"],
281 [AC_MSG_ERROR([GObject introspection requires the cairo-gobject library])])])
283 dnl GLib test framework
284 AC_ARG_ENABLE([test_framework],
285 [AS_HELP_STRING([--enable-test-framework],
286 [enable GLib test framework @<:@default=check@:>@])],
287 [],[enable_test_framework=check])
288 AS_IF([test "x${enable_test_framework}" != "xno"],
289 [PKG_CHECK_EXISTS([glib-2.0 >= 2.16.0],
290 [enable_test_framework=yes],
291 [AS_IF([test "x${enable_test_framework}" = "xyes"],
292 [AC_MSG_ERROR([The test framework needs glib2-2.16.0 or later])],
293 [enable_test_framework=no])])])
294 AM_CONDITIONAL([HAVE_TEST_FRAMEWORK],[test "x${enable_test_framework}" = "xyes"])
297 # Check for compiler characteristics
302 # Windows substitutions for NSis installer
304 dnl Get the USRDIR from gobject-2.0.pc: all the dependencies *must* be
305 dnl installed under the same prefix.
306 USRDIR="$($PKG_CONFIG --variable=prefix gobject-2.0)"
308 AM_SUBST_NOTMAKE([USRDIR])
310 dnl -win$ARCH will be appended to the installer file name
311 AS_IF([test "x${host_cpu}" = "xx86_64"],[ARCH=64],[ARCH=32])
313 AM_SUBST_NOTMAKE([ARCH])
316 # Additional substitutions
318 dnl The GObject dependency can be made optional by skipping
319 dnl the building of the GObject wrappers.
320 CPML_REQUIRES='cairo >= cairo_prereq gobject-2.0 >= gobject_prereq'
321 AM_COND_IF([HAVE_PANGO],
322 [ADG_REQUIRES='pangocairo >= pangocairo_prereq'
324 #include <pango/pango.h>
325 #include "adg/adg-text.h"
326 #include "adg/adg-pango-style.h"
328 [ADG_REQUIRES='gobject-2.0 >= gobject_prereq'
329 ADG_H_ADDITIONAL=''])
330 AM_COND_IF([HAVE_GTK3],[ADG_REQUIRES='gtk+-3.0 >= gtk3_prereq'])
331 AM_COND_IF([HAVE_GTK2],[ADG_REQUIRES='gtk+-2.0 >= gtk2_prereq'])
332 AM_COND_IF([HAVE_GTK],
333 [ADG_H_ADDITIONAL="${ADG_H_ADDITIONAL}
335 #include \"adg/adg-gtk-utils.h\"
336 #include \"adg/adg-gtk-area.h\"
337 #include \"adg/adg-gtk-layout.h\"
339 ADG_CANVAS_H_ADDITIONAL='
342 void adg_canvas_set_paper (AdgCanvas *canvas,
343 const gchar *paper_name,
344 GtkPageOrientation orientation);
345 void adg_canvas_set_page_setup (AdgCanvas *canvas,
346 GtkPageSetup *page_setup);
347 GtkPageSetup * adg_canvas_get_page_setup (AdgCanvas *canvas);
349 [ADG_CANVAS_H_ADDITIONAL=''])
351 AC_SUBST([CPML_API_VERSION],cpml_api_version)
352 AC_SUBST([CPML_LT_VERSION],cpml_lt_version)
353 AC_SUBST([CPML_REQUIRES])
354 AC_SUBST([ADG_API_VERSION],adg_api_version)
355 AC_SUBST([ADG_LT_VERSION],adg_lt_version)
356 AC_SUBST([ADG_REQUIRES])
357 AC_SUBST([ADG_H_ADDITIONAL])
358 AC_SUBST([ADG_CANVAS_H_ADDITIONAL])
360 AM_SUBST_NOTMAKE([CPML_REQUIRES])
361 AM_SUBST_NOTMAKE([ADG_REQUIRES])
362 AM_SUBST_NOTMAKE([ADG_H_ADDITIONAL])
363 AM_SUBST_NOTMAKE([ADG_CANVAS_H_ADDITIONAL])
365 dnl CPML compiler flags and library dependencies
366 CPML_CFLAGS="$CAIRO_CFLAGS $GOBJECT_CFLAGS"
367 CPML_LIBS="$CAIRO_LIBS $GOBJECT_LIBS"
368 AC_SUBST([CPML_CFLAGS])
369 AC_SUBST([CPML_LIBS])
371 dnl ADG compiler flags and library dependencies
372 ADG_CFLAGS="$CAIRO_GOBJECT_CFLAGS"
373 ADG_LIBS="$CAIRO_GOBJECT_LIBS"
374 AM_COND_IF([HAVE_PANGO],
375 [ADG_CFLAGS="$PANGO_CFLAGS $ADG_CFLAGS"
376 ADG_LIBS="$PANGO_LIBS $ADG_LIBS"])
377 AM_COND_IF([HAVE_GTK2],
378 [ADG_CFLAGS="$GTK2_CFLAGS $ADG_CFLAGS"
379 ADG_LIBS="$GTK2_LIBS $ADG_LIBS"])
380 AM_COND_IF([HAVE_GTK3],
381 [ADG_CFLAGS="$GTK3_CFLAGS $ADG_CFLAGS"
382 ADG_LIBS="$GTK3_LIBS $ADG_LIBS"])
383 AC_SUBST([ADG_CFLAGS])
391 AC_CONFIG_FILES([build/adg.nsi
396 src/cpml/tests/Makefile
401 src/adg/tests/Makefile
408 docs/cpml/bookinfo.xml
410 docs/adg/bookinfo.xml])
411 AC_CONFIG_FILES([demo/adg-glade],[chmod +x demo/adg-glade])
417 AC_MSG_NOTICE([generating report
419 AC_PACKAGE_NAME adg_version will be built with the following options:
420 ----------------------------------------------------------
421 API compatibility: adg_api_version
422 CPML library to use: internal (cpml-adg_version)
423 Build pango based entities: ${enable_pango}
424 GTK+ support: ${with_gtk}
425 Install glade catalogs: ${enable_glade}${report_glade}
426 Build API reference: ${enable_gtk_doc}
427 GObject instrospection: ${enable_introspection}${report_introspection}
428 Test framework support: ${enable_test_framework}