[build] Ensure "const" is a valid keyword
[adg.git] / configure.ac
blob866db55e352449aa07c7f631ba67a8a355bdd3ff
1 m4_define([adg_version],[0.5.5])
2 m4_define([adg_api_version],[1.0])
4 m4_define([gtkdoc_prereq],[1.9])
5 m4_define([gobject_prereq],[2.4.0])
6 m4_define([cairo_prereq],[1.7.4])
7 m4_define([gtk_prereq],[2.12.0])
10 # Initialization
12 AC_PREREQ([2.59])
13 AC_INIT([Automatic Drawing Generation],adg_version,
14         [http://dev.entidi.com/p/adg/],[adg],[http://adg.entidi.com/])
15 AC_CONFIG_SRCDIR([configure.ac])
16 AC_CONFIG_HEADERS([config.h])
17 AC_CONFIG_MACRO_DIR([build])
18 AM_INIT_AUTOMAKE([1.6 gnits no-dist-gzip dist-bzip2 -Wall])
21 # Check for host information
23 AC_CANONICAL_HOST
24 case "${host}" in
25   *-*-linux*)
26     guessed_host=linux
27     ;;
28   *-*-freebsd*)
29     guessed_host=freebsd
30     ;;
31   *-*-mingw*)
32     guessed_host=mingw
33     ;;
34   *-*-solaris*)
35     guessed_host=solaris
36     ;;
37   *-*-darwin*)
38     guessed_host=darwin
39     ;;
40   *-*-beos*)
41     guessed_host=beos
42     ;;
43   *-*-cygwin*)
44     guessed_host=cygwin
45     ;;
46   *-*-minix)
47     guessed_host=minix
48     ;;
49   *-*-aix*)
50     guessed_host=aix
51     ;;
52   *)
53     guessed_host=unknown
54     ;;
55 esac
56 AM_CONDITIONAL([OS_UNIX],[test "${guessed_host}" != "mingw"])
57 AM_CONDITIONAL([OS_WIN32],[test "${guessed_host}" == "mingw" -o "${guessed_host}" == "cygwin"])
60 # Check for programs
62 AC_PROG_CC
63 PKG_PROG_PKG_CONFIG
64 AC_PATH_PROG([XSLTPROC],[xsltproc],[/usr/bin/xsltproc])
65 AC_PATH_PROG([GLIB_MKENUMS],[glib-mkenums],[/usr/bin/glib-mkenums])
66 AC_PATH_PROG([GLIB_GENMARSHAL],[glib-genmarshal],[/usr/bin/glib-genmarshal])
67 AC_PATH_PROG([GTESTER],[gtester],[/usr/bin/gtester])
68 AC_PATH_PROG([GTESTER_REPORT],[gtester-report],[/usr/bin/gtester-report])
70 m4_ifdef([LT_INIT],
71          [LT_INIT([disable-static])],
72          [AC_DISABLE_STATIC
73           AC_PROG_LIBTOOL])
76 # Check for functions
78 dnl Alloca is required by cpml, so it should be removed
79 dnl in case the adg and cpml libraries will be splitted
80 AC_FUNC_ALLOCA
83 # I18n
85 AC_SUBST([GETTEXT_PACKAGE],adg-adg_api_version)
86 AC_DEFINE([GETTEXT_PACKAGE],"AC_PACKAGE_TARNAME-adg_api_version",
87           [Define to the domain used by gettext.])
88 ALL_LINGUAS=""
89 AM_GLIB_GNU_GETTEXT
90 GLIB_DEFINE_LOCALEDIR([LOCALEDIR])
91 AC_OUTPUT_COMMANDS([case "${CONFIG_FILES}" in *po-properties/Makefile.in*)
92         sed -e "/POTFILES =/r po-properties/POTFILES" po-properties/Makefile.in > po-properties/Makefile
93       esac])
96 # Check for required packages
98 GTK_DOC_CHECK(gtkdoc_prereq)
99 PKG_CHECK_MODULES([GOBJECT2],[gobject-2.0 >= ]gobject_prereq)
100 PKG_CHECK_MODULES([CAIRO],[cairo >= ]cairo_prereq)
103 # Check for optional GTK+2 support
105 AC_ARG_ENABLE([gtk2],
106               [AS_HELP_STRING([--enable-gtk2],
107                               [include GKT+2 specific widgets @<:@default=check@:>@])],
108               [],[enable_gtk2=check])
109 AS_IF([test "x${enable_gtk2}" != "xno"],
110       [PKG_CHECK_MODULES([GTK2],[gtk+-2.0 >= ]gtk_prereq,
111                          [enable_gtk2=yes],
112                          [AS_IF([test "x${enable_gtk2}" = "xyes"],
113                                 [AC_MSG_ERROR([$GTK2_PKG_ERRORS and GTK+2 support requested])],
114                                 [enable_gtk2=no])])])
115 AM_CONDITIONAL([HAVE_GTK2],[test "x${enable_gtk2}" = "xyes"])
118 # Check for optional GLib test framework
120 AC_ARG_ENABLE([test_framework],
121               [AS_HELP_STRING([--enable-test-framework],
122                               [enable GLib test framework @<:@default=check@:>@])],
123               [],[enable_test_framework=check])
124 AS_IF([test "x${enable_test_framework}" != "xno"],
125       [PKG_CHECK_EXISTS([glib-2.0 >= 2.16.0],
126                         [enable_test_framework=yes],
127                         [AS_IF([test "x${enable_test_framework}" = "xyes"],
128                                [AC_MSG_ERROR([The test framework needs glib2-2.16.0 or later])],
129                                [enable_test_framework=no])])])
130 AM_CONDITIONAL([HAVE_TEST_FRAMEWORK],[test "x${enable_test_framework}" = "xyes"])
133 # Check for compiler characteristics
135 AC_C_CONST
138 # Final step
140 CPML_REQUIRES='cairo >= cairo_prereq'
141 CPML_CFLAGS="${CAIRO_CFLAGS}"
142 CPML_LIBS="${CAIRO_LIBS}"
143 AS_IF([test "x${enable_gtk2}" = "xyes"],
144       [ADG_REQUIRES='gtk+-2.0 >= gtk_prereq'
145        ADG_CFLAGS="${GTK2_CFLAGS}"
146        ADG_LIBS="${GTK2_LIBS}"],
147       [ADG_REQUIRES='gobject-2.0 >= gobject_prereq'
148        ADG_CFLAGS="${GOBJECT2_CFLAGS} ${CAIRO_CFLAGS}"
149        ADG_LIBS="${GOBJECT2_LIBS} ${CAIRO_LIBS}"])
150 AC_SUBST([CPML_REQUIRES])
151 AC_SUBST([CPML_CFLAGS])
152 AC_SUBST([CPML_LIBS])
153 AC_SUBST([ADG_REQUIRES])
154 AC_SUBST([ADG_CFLAGS])
155 AC_SUBST([ADG_LIBS])
157 SHAVE_INIT([build],[enable])
158 AC_CONFIG_FILES([build/shave
159                  build/shave-libtool
160                  Makefile
161                  cpml/cpml.pc
162                  cpml/Makefile
163                  adg/adg.pc
164                  adg/Makefile
165                  demo/Makefile
166                  po/Makefile.in
167                  po-properties/Makefile.in
168                  tests/Makefile
169                  docs/Makefile
170                  docs/cpml/Makefile
171                  docs/cpml/bookinfo.xml
172                  docs/adg/Makefile
173                  docs/adg/bookinfo.xml])
174 AC_OUTPUT
177 # Report
179 echo ""
180 echo 'ADG canvas adg_version will be built with the following options:'
181 echo "----------------------------------------------------------"
182 echo '                  API compatibility: adg_api_version'
183 echo '                CPML library to use: internal (cpml-adg_version)'
184 echo " AdgWidget support (requires GTK+2): ${enable_gtk2}"
185 echo "                Build API reference: ${enable_gtk_doc}"
186 echo "             Test framework support: ${enable_test_framework}"
187 echo ""