build: make --internal of glib-genmarshal optional
[adg.git] / configure.ac
blob1e4e56c5361148a9488e1b15fe2fc14c2a682c09
1 m4_define([adg_version],[0.7.2])
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])
11 m4_define([cairo_prereq],[1.7.4])
12 m4_define([cairo_gobject_prereq],cairo_prereq)
13 m4_define([gtk2_prereq],[2.12.0])
14 m4_define([gtk3_prereq],[3.0.0])
15 m4_define([pangocairo_prereq],[1.18.0])
16 m4_define([gi_prereq],[0.9.5])dnl Picked up from clutter
19 # Initialization
21 dnl autoconf 2.62 is required by GObject introspection:
22 dnl http://live.gnome.org/GObjectIntrospection/AutotoolsIntegration
23 AC_PREREQ([2.62])
24 AC_INIT([adg-1],adg_version,[http://dev.entidi.com/p/adg/],[adg],[http://adg.entidi.com/])
25 AC_CONFIG_SRCDIR([configure.ac])
26 AC_CONFIG_HEADERS([src/config.h])
27 AC_CONFIG_AUX_DIR([build])
28 AC_CONFIG_MACRO_DIR([build])
29 AM_INIT_AUTOMAKE([1.10 gnits no-dist-gzip dist-bzip2 -Wall -Wno-portability])
31 dnl m4 backward compatibility stuff
32 m4_ifdef([AM_SILENT_RULES],
33          [AM_SILENT_RULES([yes])],
34          [AC_SUBST([AM_V_GEN],[])])
35 m4_ifdef([AM_SUBST_NOTMAKE],[],
36          [AC_DEFUN([AM_SUBST_NOTMAKE],[_AM_SUBST_NOTMAKE($@)])])
37 m4_ifdef([AM_COND_IF],[],
38          [AC_DEFUN([AM_COND_IF],
39                    [AS_IF([test -z "$$1_TRUE"],[$2],[$3])])])
42 # Check for host information
44 AC_CANONICAL_HOST
45 case "${host}" in
46   *-*-linux*)
47     guessed_host=linux
48     ;;
49   *-*-freebsd*)
50     guessed_host=freebsd
51     ;;
52   *-*-mingw*)
53     guessed_host=mingw
54     ;;
55   *-*-solaris*)
56     guessed_host=solaris
57     ;;
58   *-*-darwin*)
59     guessed_host=darwin
60     ;;
61   *-*-beos*)
62     guessed_host=beos
63     ;;
64   *-*-cygwin*)
65     guessed_host=cygwin
66     ;;
67   *-*-minix*)
68     guessed_host=minix
69     ;;
70   *-*-aix*)
71     guessed_host=aix
72     ;;
73   *)
74     guessed_host=unknown
75     ;;
76 esac
77 AM_CONDITIONAL([OS_UNIX],[test "${guessed_host}" != "mingw"])
78 AM_CONDITIONAL([OS_WINDOWS],[test "${guessed_host}" = "mingw" -o "${guessed_host}" = "cygwin"])
81 # Check for programs
83 AC_PROG_CC
84 AC_PROG_SED
85 PKG_PROG_PKG_CONFIG
86 AC_PATH_PROG([XSLTPROC],[xsltproc],[/usr/bin/xsltproc])
87 AC_PATH_PROG([GLIB_MKENUMS],[glib-mkenums],[/usr/bin/glib-mkenums])
88 AC_PATH_PROG([GLIB_GENMARSHAL],[glib-genmarshal],[/usr/bin/glib-genmarshal])
89 AC_PATH_PROG([GTESTER],[gtester],[/usr/bin/gtester])
90 AC_PATH_PROG([GTESTER_REPORT],[gtester-report],[/usr/bin/gtester-report])
91 AC_PATH_PROG([GLADE3],[glade-3],[/usr/bin/glade-3])
92 AM_COND_IF([OS_WINDOWS],
93            [AC_PATH_PROG([MAKENSIS],[makensis],[/usr/bin/makensis])
94             AC_PATH_PROG([WINE],[wine])])
97 # Check for libraries
99 AC_CHECK_LIB([m],[cos])
102 # Libtool initialization
104 AC_MSG_CHECKING([which libtool initialization strategy to adopt])
105 AC_MSG_RESULT([m4_ifset([LT_INIT],[LT-INIT],[AC-PROG-LIBTOOL])])
106 m4_ifset([LT_INIT],
107          [LT_INIT([disable-static win32-dll])],
108          [AC_DISABLE_STATIC
109           AC_LIBTOOL_WIN32_DLL
110           AC_PROG_LIBTOOL])
113 # I18n
115 AC_SUBST([ADG_API_PACKAGE],AC_PACKAGE_TARNAME-adg_api_version)
116 AC_SUBST([GETTEXT_PACKAGE],[${ADG_API_PACKAGE}])
117 AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["${ADG_API_PACKAGE}"],
118                    [Define to the domain used by gettext.])
119 ALL_LINGUAS="`grep -v '^#' "$srcdir/po/LINGUAS" | tr '\n' ' '`"
120 IT_PROG_INTLTOOL([0.35.0])
121 AM_GLIB_GNU_GETTEXT
122 GLIB_DEFINE_LOCALEDIR([LOCALEDIR])
123 AC_CONFIG_COMMANDS([default],
124                    [case "${CONFIG_FILES}" in *po-properties/Makefile.in*)
125         ${SED} -e "/POTFILES =/r po-properties/POTFILES" po-properties/Makefile.in > po-properties/Makefile
126     esac],
127                    [SED="${SED}"])
130 # Check for required packages
132 PKG_CHECK_MODULES([GLIB],[glib-2.0])
134 AC_MSG_CHECKING([if glib-genmarshal supports --internal])
135 AS_IF([$PKG_CONFIG --atleast-version 2.13.0 glib-2.0],
136       [AC_MSG_RESULT([yes])
137        GLIB_GENMARSHAL="$GLIB_GENMARSHAL --internal"],
138       [AC_MSG_RESULT([no])])
140 PKG_CHECK_MODULES([GOBJECT],[gobject-2.0 >= ]gobject_prereq)
141 PKG_CHECK_MODULES([CAIRO],[cairo >= ]cairo_prereq)
142 PKG_CHECK_MODULES([CAIRO_GOBJECT],[cairo-gobject],
143                   [AC_DEFINE_UNQUOTED([CAIRO_GOBJECT_ENABLED],[1],
144                                       [Defined if GObject support in cairo is present.])],
145                   [:])
148 # Check for optional packages
150 dnl PangoCairo
151 AC_ARG_ENABLE([pango],
152               [AS_HELP_STRING([--enable-pango],
153                               [use pango for rendering text @<:@default=check@:>@])],
154               [],[enable_pango=check])
155 AS_IF([test "x${enable_pango}" != "xno"],
156       [PKG_CHECK_MODULES([PANGO],[pangocairo >= ]pangocairo_prereq,
157                          [enable_pango=yes
158                           AC_DEFINE_UNQUOTED([PANGO_ENABLED],[1],
159                                              [Defined if the pango support is enabled.])],
160                          [AS_IF([test "x${enable_pango}" = "xyes"],
161                                 [AC_MSG_ERROR([${PANGO_PKG_ERRORS} and pango support requested])],
162                                 [enable_pango=no])])])
163 AM_CONDITIONAL([HAVE_PANGO],[test "x${enable_pango}" = "xyes"])
165 dnl GTK+ support
166 AC_ARG_WITH(gtk,
167             [AS_HELP_STRING([--with-gtk@<:@=gtk2/gtk3@:>@],
168                             [include GTK+ specific widgets @<:@default=check@:>@])],
169             [],[with_gtk=check])
170 AS_CASE(["${with_gtk}"],
171         [gtk2],      [gtk2_pkg=yes; gtk3_pkg=no],
172         [gtk3],      [gtk2_pkg=no;  gtk3_pkg=yes],
173         [check|yes], [gtk2_pkg=yes; gtk3_pkg=yes],
174         [no],        [gtk2_pkg=no;  gtk3_pkg=no],
175         [AC_MSG_ERROR([Invalid option passed to --with-gtk])])
177 # GTK+ autodetection, giving precedence to GTK+3
178 AS_IF([test "x${gtk3_pkg}" = "xyes"],
179       [PKG_CHECK_MODULES([GTK3],[gtk+-3.0 >= ]gtk3_prereq,[gtk_pkg=gtk3],[:])])
180 AS_IF([test "x${gtk2_pkg}" = "xyes" -a "x${gtk_pkg}" = "x"],
181       [PKG_CHECK_MODULES([GTK2],[gtk+-2.0 >= ]gtk2_prereq,[gtk_pkg=gtk2],[:])])
182 AS_IF([test "x${gtk_pkg}" != "x"],[with_gtk=${gtk_pkg}])
185 # Handle "check" graceful degradation
186 AS_IF([test "x${with_gtk}" = "xcheck"],[with_gtk=no])
188 # Handle failures
189 AS_IF([test "x${with_gtk}" != "xno" -a "x${gtk_pkg}" = "x"],
190       [AC_MSG_ERROR([GTK+ support explicitely required but no valid GTK+ found])])
192 AS_IF([test "x${with_gtk}" = "xgtk3"],
193       [AC_DEFINE_UNQUOTED([GTK3_ENABLED],[1],
194                           [Defined if the GTK+3 support is enabled.])])
195 AS_IF([test "x${with_gtk}" = "xgtk2"],
196       [AC_DEFINE_UNQUOTED([GTK2_ENABLED],[1],
197                           [Defined if the GTK+2 support is enabled.])])
199 AM_CONDITIONAL([HAVE_GTK], [test "x${with_gtk}" != "xno"])
200 AM_CONDITIONAL([HAVE_GTK2],[test "x${with_gtk}" = "xgtk2"])
201 AM_CONDITIONAL([HAVE_GTK3],[test "x${with_gtk}" = "xgtk3"])
203 dnl Glade catalog dir
204 AC_ARG_WITH(glade_catalogdir,
205             [AS_HELP_STRING([--with-glade-catalogdir@<:@=DIR@:>@],
206                             [where to install the glade catalogs @<:@default=check@:>@])],
207             [],[with_glade_catalogdir=check])
209 # Both "check" and "yes" mean gladeui autodetection,
210 # but "yes" will fail on gladeui not found
211 AS_IF([test "x${with_glade_catalogdir}" = "xcheck" -o "x${with_glade_catalogdir}" = "xyes"],
212       [glade_pkg=check])
214 # gladeui autodetection, giving precedence to gladeui-2.0 if possible
215 AS_IF([test "x${glade_pkg}" = "xcheck" -a "x${with_gtk}" != "xgtk2"],
216       [PKG_CHECK_MODULES([GLADEUI2],[gladeui-2.0],[glade_pkg=gladeui-2.0],[:])])
217 AS_IF([test "x${glade_pkg}" = "xcheck"],
218       [PKG_CHECK_MODULES([GLADEUI1],[gladeui-1.0],[glade_pkg=gladeui-1.0],[:])])
219 AS_IF([test "x${glade_pkg}" != "x" -a "x${glade_pkg}" != "xcheck"],
220       [NTD_UNEXPAND([${glade_pkg}],
221                     [catalogdir],
222                     [with_glade_catalogdir="${NTD_UNEXPANDED}"],
223                     [AC_MSG_ERROR([${glade_pkg} found but pkg-config file invalid])])])
225 # Handle "yes" failure
226 AS_IF([test "x${glade_pkg}" = "xcheck" -a "x${with_glade_catalogdir}" = "xyes"],
227       [AC_MSG_ERROR([Glade support explicitely required but no valid gladeui found])])
229 # Handle "check" graceful degradation
230 AS_IF([test "x${glade_pkg}" = "xcheck" -a "x${with_glade_catalogdir}" = "xcheck"],
231       [with_glade_catalogdir=no])
233 AM_CONDITIONAL([HAVE_GLADE],[test "x${with_glade_catalogdir}" != "xno"])
234 AM_COND_IF([HAVE_GLADE],
235            [enable_glade=yes
236             report_glade="
237                   Glade catalog dir: ${with_glade_catalogdir}"],
238            [enable_glade=no
239             report_glade=""])
240 AC_SUBST([GLADE_CATALOGDIR],${with_glade_catalogdir})
242 dnl gtk-doc
243 GTK_DOC_CHECK(gtkdoc_prereq)
245 dnl GObject introspection
246 GOBJECT_INTROSPECTION_CHECK(gi_prereq)
247 AC_ARG_WITH(girdir,
248             [AS_HELP_STRING([--with-girdir=DIR],
249                             [where the gir files are installed @<:@default=check@:>@])],
250             [],[with_girdir=check])
251 AS_IF([test "x${enable_introspection}" = "xyes" -a "x${with_girdir}" = "xcheck"],
252       [NTD_UNEXPAND([gobject-introspection-1.0],
253                     [girdir],
254                     [with_girdir="${NTD_UNEXPANDED}"])])
255 AC_SUBST([GIRDIR],${with_girdir})
256 AC_ARG_WITH(typelibdir,
257             [AS_HELP_STRING([--with-typelibdir=DIR],
258                             [where the typelib files are installed @<:@default=check@:>@])],
259             [],[with_typelibdir=check])
260 AS_IF([test "x${enable_introspection}" = "xyes" -a "x${with_typelibdir}" = "xcheck"],
261       [NTD_UNEXPAND([gobject-introspection-1.0],
262                     [typelibdir],
263                     [with_typelibdir="${NTD_UNEXPANDED}"])])
264 AC_SUBST([TYPELIBDIR],${with_typelibdir})
265 AM_COND_IF([HAVE_INTROSPECTION],
266            [report_introspection="
267          Where to install gir files: ${with_girdir}
268  Where to install the typelib files: ${with_typelibdir}"],
269            [report_introspection=""])
271 dnl GLib test framework
272 AC_ARG_ENABLE([test_framework],
273               [AS_HELP_STRING([--enable-test-framework],
274                               [enable GLib test framework @<:@default=check@:>@])],
275               [],[enable_test_framework=check])
276 AS_IF([test "x${enable_test_framework}" != "xno"],
277       [PKG_CHECK_EXISTS([glib-2.0 >= 2.16.0],
278                         [enable_test_framework=yes],
279                         [AS_IF([test "x${enable_test_framework}" = "xyes"],
280                                [AC_MSG_ERROR([The test framework needs glib2-2.16.0 or later])],
281                                [enable_test_framework=no])])])
282 AM_CONDITIONAL([HAVE_TEST_FRAMEWORK],[test "x${enable_test_framework}" = "xyes"])
285 # Check for compiler characteristics
287 AC_C_CONST
290 # Windows substitutions for NSis installer
292 dnl By default DLLDIR is set to "$prefix/bin", with "$prefix" got from
293 dnl gobject-2.0.pc: all the DLLs *must* be under the same directory.
294 AC_ARG_VAR([DLLDIR], Place where Windows DLLs must be picked from)
295 AS_IF([test -z "$DLLDIR"],
296       [DLLDIR="$($PKG_CONFIG --variable=prefix gobject-2.0)/bin"])
297 AM_SUBST_NOTMAKE([DLLDIR])
299 dnl -win$ARCH will be appended to the installer file name
300 AS_IF([test "x${host_cpu}" = "xx86_64"],[ARCH=64],[ARCH=32])
301 AC_SUBST([ARCH])
302 AM_SUBST_NOTMAKE([ARCH])
305 # Additional substitutions
307 dnl The GObject dependency can be made optional by skipping
308 dnl the building of the GObject wrappers.
309 CPML_REQUIRES='cairo >= cairo_prereq gobject-2.0 >= gobject_prereq'
310 AM_COND_IF([HAVE_PANGO],
311       [ADG_REQUIRES='pangocairo >= pangocairo_prereq'
312        ADG_H_ADDITIONAL='
313 #include <pango/pango.h>
314 #include "adg/adg-text.h"
315 #include "adg/adg-pango-style.h"
317       [ADG_REQUIRES='gobject-2.0 >= gobject_prereq'
318        ADG_H_ADDITIONAL=''])
319 AM_COND_IF([HAVE_GTK3],[ADG_REQUIRES='gtk+-3.0 >= gtk3_prereq'])
320 AM_COND_IF([HAVE_GTK2],[ADG_REQUIRES='gtk+-2.0 >= gtk2_prereq'])
321 AM_COND_IF([HAVE_GTK],
322            [ADG_H_ADDITIONAL="${ADG_H_ADDITIONAL}
323 #include <gtk/gtk.h>
324 #include \"adg/adg-gtk-utils.h\"
325 #include \"adg/adg-gtk-area.h\"
326 #include \"adg/adg-gtk-layout.h\"
328             ADG_CANVAS_H_ADDITIONAL='
329 #include <gtk/gtk.h>
331 void            adg_canvas_set_paper            (AdgCanvas      *canvas,
332                                                  const gchar    *paper_name,
333                                                  GtkPageOrientation orientation);
334 void            adg_canvas_set_page_setup       (AdgCanvas      *canvas,
335                                                  GtkPageSetup   *page_setup);
336 GtkPageSetup *  adg_canvas_get_page_setup       (AdgCanvas      *canvas);
338            [ADG_CANVAS_H_ADDITIONAL=''])
340 AC_SUBST([CPML_API_VERSION],cpml_api_version)
341 AC_SUBST([CPML_LT_VERSION],cpml_lt_version)
342 AC_SUBST([CPML_REQUIRES])
343 AC_SUBST([ADG_API_VERSION],adg_api_version)
344 AC_SUBST([ADG_LT_VERSION],adg_lt_version)
345 AC_SUBST([ADG_REQUIRES])
346 AC_SUBST([ADG_H_ADDITIONAL])
347 AC_SUBST([ADG_CANVAS_H_ADDITIONAL])
349 AM_SUBST_NOTMAKE([CPML_REQUIRES])
350 AM_SUBST_NOTMAKE([ADG_REQUIRES])
351 AM_SUBST_NOTMAKE([ADG_H_ADDITIONAL])
352 AM_SUBST_NOTMAKE([ADG_CANVAS_H_ADDITIONAL])
354 dnl CPML compiler flags and library dependencies
355 CPML_CFLAGS="$CAIRO_CFLAGS $GOBJECT_CFLAGS"
356 CPML_LIBS="$CAIRO_LIBS $GOBJECT_LIBS"
357 AC_SUBST([CPML_CFLAGS])
358 AC_SUBST([CPML_LIBS])
360 dnl ADG compiler flags and library dependencies
361 ADG_CFLAGS="$CAIRO_GOBJECT_CFLAGS"
362 ADG_LIBS="$CAIRO_GOBJECT_LIBS"
363 AM_COND_IF([HAVE_PANGO],
364            [ADG_CFLAGS="$PANGO_CFLAGS $ADG_CFLAGS"
365             ADG_LIBS="$PANGO_LIBS $ADG_LIBS"])
366 AM_COND_IF([HAVE_GTK2],
367            [ADG_CFLAGS="$GTK2_CFLAGS $ADG_CFLAGS"
368             ADG_LIBS="$GTK2_LIBS $ADG_LIBS"])
369 AM_COND_IF([HAVE_GTK3],
370            [ADG_CFLAGS="$GTK3_CFLAGS $ADG_CFLAGS"
371             ADG_LIBS="$GTK3_LIBS $ADG_LIBS"])
372 AC_SUBST([ADG_CFLAGS])
373 AC_SUBST([ADG_LIBS])
376 # Generation
378 AC_CONFIG_FILES([build/adg.nsi
379                  Makefile
380                  src/Makefile
381                  src/cpml/cpml-1.pc
382                  src/cpml/Makefile
383                  src/cpml/tests/Makefile
384                  src/adg/adg-1.pc
385                  src/adg.h
386                  src/adg/Makefile
387                  src/adg/adg-canvas.h
388                  src/adg/tests/Makefile
389                  demo/Makefile
390                  demo/cpml-demo.ui
391                  demo/adg-demo.ui
392                  po/Makefile.in
393                  po-properties/Makefile.in
394                  docs/Makefile
395                  docs/cpml/Makefile
396                  docs/cpml/bookinfo.xml
397                  docs/adg/Makefile
398                  docs/adg/bookinfo.xml])
399 AC_CONFIG_FILES([demo/adg-glade],[chmod +x demo/adg-glade])
400 AC_OUTPUT
403 # Report
405 AC_MSG_NOTICE([generating report
407 AC_PACKAGE_NAME adg_version will be built with the following options:
408 ----------------------------------------------------------
409                   API compatibility: adg_api_version
410                 CPML library to use: internal (cpml-adg_version)
411          Build pango based entities: ${enable_pango}
412                        GTK+ support: ${with_gtk}
413              Install glade catalogs: ${enable_glade}${report_glade}
414                 Build API reference: ${enable_gtk_doc}
415              GObject instrospection: ${enable_introspection}${report_introspection}
416              Test framework support: ${enable_test_framework}