summaryrefslogtreecommitdiff
path: root/configure.ac
blob: 0ec7e66c154ed5b0d9f36f5fa405b0dfb5ebdbe1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
# clutter package version number, (as distinct from shared library version)
# An odd micro number indicates in-progress development, (eg. from git)
# An even micro number indicates a released version.
m4_define([clutter_gtk_major], [0])
m4_define([clutter_gtk_minor], [10])
m4_define([clutter_gtk_micro], [3])

m4_define([clutter_gtk_api_version], [clutter_gtk_major.clutter_gtk_minor])
m4_define([clutter_gtk_version], [clutter_gtk_major.clutter_gtk_minor.clutter_gtk_micro])

# increase the interface age for each release; if the API changes, set to 0
m4_define([clutter_gtk_interface_age], [0])
m4_define([clutter_gtk_binary_age], [m4_eval(100 * clutter_gtk_minor + clutter_gtk_micro)])

AC_PREREQ([2.59])

AC_INIT([clutter-gtk],
        [clutter_gtk_version],
        [http://bugzilla.o-hand.com/enter_bug.cgi?product=Clutter])
AC_CONFIG_SRCDIR([clutter-gtk/clutter-gtk.h])
AC_CONFIG_MACRO_DIR([build/autotools])

AM_CONFIG_HEADER([config.h])

AM_INIT_AUTOMAKE([1.9])

CLUTTER_GTK_MAJOR_VERSION=clutter_gtk_major
CLUTTER_GTK_MINOR_VERSION=clutter_gtk_minor
CLUTTER_GTK_MICRO_VERSION=clutter_gtk_micro
CLUTTER_GTK_API_VERSION=clutter_gtk_api_version
CLUTTER_GTK_VERSION=clutter_gtk_version
AC_SUBST(CLUTTER_GTK_MAJOR_VERSION)
AC_SUBST(CLUTTER_GTK_MINOR_VERSION)
AC_SUBST(CLUTTER_GTK_MICRO_VERSION)
AC_SUBST(CLUTTER_GTK_API_VERSION)
AC_SUBST(CLUTTER_GTK_VERSION)

m4_define([lt_current], [m4_eval(100 * clutter_gtk_minor + clutter_gtk_micro - clutter_gtk_interface_age)])
m4_define([lt_revision], [clutter_gtk_interface_age])
m4_define([lt_age], [m4_eval(clutter_gtk_binary_age - clutter_gtk_interface_age)])
CLUTTER_GTK_LT_CURRENT=lt_current
CLUTTER_GTK_LT_REV=lt_revision
CLUTTER_GTK_LT_AGE=lt_age
CLUTTER_GTK_LT_VERSION="$CLUTTER_GTK_LT_CURRENT:$CLUTTER_GTK_LT_REV:$CLUTTER_GTK_LT_AGE"
CLUTTER_GTK_LT_LDFLAGS="-version-info $CLUTTER_GTK_LT_VERSION"

AC_SUBST(CLUTTER_GTK_LT_VERSION)
AC_SUBST(CLUTTER_GTK_LT_LDFLAGS)

dnl ========================================================================

# Checks for programs.
AC_PROG_CC
AC_DISABLE_STATIC
AC_PROG_LIBTOOL

m4_define([clutter_req_version], [1.0.0])
m4_define([gtk_req_version], [2.12.0])
m4_define([flavour_default], [x11])
AC_ARG_WITH([flavour],
            [AC_HELP_STRING([--with-flavour=@<:@x11/win32@:>@],
                            [Select the Clutter backend, default=flavour_default])],
            [],
            [with_flavour=flavour_default])

AS_CASE([$with_flavour],
        [x11], [
          AC_DEFINE([HAVE_CLUTTER_GTK_X11], 1, [Using the X11 flavour])
          PKG_CHECK_MODULES(CLUTTER, clutter-x11-1.0 >= clutter_req_version)
          PKG_CHECK_MODULES(GTK, gtk+-x11-2.0 >= gtk_req_version)
          CLUTTER_GTK_REQUIRES="clutter-x11-1.0 gtk+-x11-2.0"
        ],

        [win32], [
          AC_DEFINE([HAVE_CLUTTER_GTK_WIN32], 1, [Using the Win32 flavour])
          PKG_CHECK_MODULES(CLUTTER, clutter-win32-1.0 >= $CLUTTER_REQUIRED)
          PKG_CHECK_MODULES(GTK, gtk+-win32-2.0 >= gtk_req_version)
          CLUTTER_GTK_REQUIRES="clutter-win32-1.0 gtk+-win32-2.0"
        ]

        [AC_MSG_ERROR([Invalid argument for --with-flavour])]
)

CLUTTER_GTK_FLAVOUR=$with_flavour
AC_SUBST(CLUTTER_GTK_FLAVOUR)

AC_SUBST(CLUTTER_GTK_REQUIRES)

AC_SUBST(CLUTTER_CFLAGS)
AC_SUBST(CLUTTER_LIBS)

AC_SUBST(GTK_CFLAGS)
AC_SUBST(GTK_LIBS)

dnl = Enable debug level ===================================================

m4_define([debug_default], [m4_if(m4_eval(clutter_gtk_minor % 2), [1], [yes], [minimum])])
AC_ARG_ENABLE([debug],
              [AC_HELP_STRING([--enable-debug=@<:@no/minimum/yes@:>@],
                              [Turns on debugging. @<:@default=debug_default@:>@])],
              [],
              [enable_debug=debug_default])

AS_CASE([$enable_debug],

        [yes], [
          test "$cflags_set" = set || CFLAGS="$CFLAGS -g"
          CLUTTER_GTK_DEBUG_CFLAGS="-DCLUTTER_GTK_ENABLE_DEBUG"
        ],

        [minimum], [
          CLUTTER_GTK_DEBUG_CFLAGS="-DCLUTTER_GTK_ENABLE_DEBUG -DG_DISABLE_CAST_CHECKS"
        ],

        [no], [
          CLUTTER_GTK_DEBUG_CFLAGS="-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS -DG_DISABLE_CAST_CHECKS"
        ],

        [AC_MSG_ERROR([Invalid argument for --enable-debug])]
)

AC_SUBST(CLUTTER_GTK_DEBUG_CFLAGS)

# use strict compiler flags only on development releases
m4_define([maintainer_flags_default], [m4_if(m4_eval(clutter_gtk_minor % 2), [1], [yes], [no])])
AC_ARG_ENABLE([maintainer-flags],
              [AC_HELP_STRING([--enable-maintainer-flags=@<:@no/yes@:>@],
                              [Use strict compiler flags @<:@default=no@:>@])],
              [],
              [enable_maintainer_flags=maintainer_flags_default])

MAINTAINER_CFLAGS=""
AS_IF([test "x$enable_maintainer_flags" = "xyes" && test "x$GCC" = "xyes"],
      [
        AS_COMPILER_FLAGS([MAINTAINER_CFLAGS],
                          ["-Werror -Wall -Wshadow -Wcast-align
                            -Wno-uninitialized -Wempty-body -Wformat-security
                            -Winit-self"])
      ]
)

AC_SUBST(MAINTAINER_CFLAGS)

dnl = GTK Doc check ========================================================

G_PREFIX=`$PKG_CONFIG --variable=prefix glib-2.0`
GDK_PREFIX=`$PKG_CONFIG --variable=prefix gdk-2.0`
GTK_PREFIX=`$PKG_CONFIG --variable=prefix gtk+-2.0`
GDK_PIXBUF_PREFIX=`$PKG_CONFIG --variable=prefix gdk-pixbuf-2.0`
CLUTTER_PREFIX=`$PKG_CONFIG --variable=prefix clutter-1.0`
AC_SUBST(G_PREFIX)
AC_SUBST(GDK_PREFIX)
AC_SUBST(GTK_PREFIX)
AC_SUBST(GDK_PIXBUF_PREFIX)
AC_SUBST(CLUTTER_PREFIX)

GTK_DOC_CHECK([1.11])

GOBJECT_INTROSPECTION_CHECK([0.6.3])

dnl ========================================================================

SHAVE_INIT([build/autotools], [enable])

AC_CONFIG_FILES([
        Makefile
        build/Makefile
        build/autotools/Makefile
        build/autotools/shave-libtool
        build/autotools/shave
        clutter-gtk/Makefile
        doc/Makefile
        doc/reference/Makefile
        doc/reference/version.xml
        examples/Makefile
        clutter-gtk.pc
])

AC_OUTPUT

dnl ========================================================================

echo ""
echo "                 ClutterGTK $VERSION"
echo "                 ==================="
echo ""
echo "                   prefix:   ${prefix}"
echo ""
echo "                  Flavour:   ${CLUTTER_GTK_FLAVOUR}"
echo "              Debug level:   ${enable_debug}"
echo "            Documentation:   ${enable_gtk_doc}"
echo "           Compiler flags:   $MAINTAINER_CFLAGS"
echo "       Introspection data:   ${enable_introspection}"
echo ""