File: configure.ac

package info (click to toggle)
libunique 1.1.6-4
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 2,704 kB
  • sloc: sh: 10,371; ansic: 2,472; xml: 1,345; makefile: 238
file content (287 lines) | stat: -rw-r--r-- 8,044 bytes parent folder | download | duplicates (4)
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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
# versioning
m4_define([unique_major_version], [1])
m4_define([unique_minor_version], [1])
m4_define([unique_micro_version], [6])
m4_define([unique_version], [unique_major_version.unique_minor_version.unique_micro_version])
m4_define([unique_api_version], [unique_major_version.unique_minor_version])

# if functions have been added, set to 0; otherwise, increment
# with every release
m4_define([unique_interface_age], [6])
m4_define([unique_binary_age], [m4_eval(100 * unique_minor_version + unique_micro_version)])
# This is the X.Y used in -lunique-FOO-X.Y
m4_define([unique_api_version], [1.0])
# This is the X.Y used in the protocol negotiation
m4_define([unique_protocol_version], [1.0])

AC_PREREQ([2.59])

AC_INIT([unique], [unique_version],
        [http://bugzilla.gnome.org/enter_bug.cgi?product=libunique],
        [libunique])

AC_CONFIG_SRCDIR([unique/unique.h])
AC_CONFIG_MACRO_DIR([build/autotools])

AM_INIT_AUTOMAKE([1.10])
AM_CONFIG_HEADER([config.h])

# version symbols
UNIQUE_MAJOR_VERSION=unique_major_version
UNIQUE_MINOR_VERSION=unique_minor_version
UNIQUE_MICRO_VERSION=unique_micro_version
UNIQUE_VERSION=unique_version
UNIQUE_API_VERSION=unique_api_version
UNIQUE_PROTOCOL_VERSION=unique_protocol_version
AC_SUBST(UNIQUE_MAJOR_VERSION)
AC_SUBST(UNIQUE_MINOR_VERSION)
AC_SUBST(UNIQUE_MICRO_VERSION)
AC_SUBST(UNIQUE_VERSION)
AC_SUBST(UNIQUE_API_VERSION)
AC_SUBST(UNIQUE_PROTOCOL_VERSION)

# libtool
m4_define([lt_current], [m4_eval(100 * unique_minor_version + unique_micro_version - unique_interface_age)])
m4_define([lt_revision], [unique_interface_age])
m4_define([lt_age], [m4_eval(unique_binary_age - unique_interface_age)])
UNIQUE_LT_VERSION_INFO="lt_current:lt_revision:lt_age"
UNIQUE_LT_CURRENT_MINUS_AGE=m4_eval(lt_current - lt_age)
AC_SUBST(UNIQUE_LT_VERSION_INFO)
AC_SUBST(UNIQUE_LT_CURRENT_MINUS_AGE)

AC_ISC_POSIX
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_MAKE_SET
AC_C_CONST
AC_PROG_LIBTOOL
AC_PATH_PROG(GLIB_MKENUMS, [glib-mkenums])
AC_PATH_PROG(GLIB_GENMARSHAL, [glib-genmarshal])

AM_SANITY_CHECK
AM_PROG_CC_STDC

# Honor aclocal flags
ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS"

m4_define([glib_required], [2.12.0])
m4_define([gtk_required],  [2.11.0])
m4_define([dbus_required], [0.70])

PKG_CHECK_MODULES(UNIQUE, glib-2.0 >= glib_required dnl
                          gtk+-2.0 >= gtk_required)

gdktarget=`$PKG_CONFIG --variable=target gdk-2.0`
AS_IF([test "X$gdktarget" = "Xx11"],
      [
        AC_PATH_XTRA

        PKG_CHECK_MODULES(UNIQUE_X11, x11)

        UNIQUE_CFLAGS="$UNIQUE_CFLAGS $UNIQUE_X11_CFLAGS"
        UNIQUE_LIBS="$UNIQUE_LIBS $UNIQUE_X11_LIBS"
      ]
)

AC_SUBST(UNIQUE_CFLAGS)
AC_SUBST(UNIQUE_LIBS)

dnl D-Bus backend dependencies
m4_define([have_dbus_default], [yes])
AC_ARG_ENABLE([dbus],
              [AC_HELP_STRING([--enable-dbus=@<:@yes/no@:>@],
                              [Whether D-BUS IPC should be enabled])],
              [],
              [enable_dbus=have_dbus_default])

AS_CASE([$enable_dbus],

        [yes],
        [
          PKG_CHECK_MODULES(DBUS, dbus-glib-1 >= dbus_required,
                            [have_dbus=yes],
                            [have_dbus=no])
        ],

        [no], [have_dbus=no],

        [AC_MSG_ERROR([Unknown argument to --enable-dbus])]
)

AS_IF([test "x$have_dbus" = "xyes"],
      [
        AC_SUBST(DBUS_CFLAGS)
        AC_SUBST(DBUS_LIBS)
        AC_DEFINE([HAVE_DBUS], [1], [Building with D-Bus support])
        AC_PATH_PROG(DBUS_BINDING_TOOL, [dbus-binding-tool])
      ]
)

AM_CONDITIONAL([HAVE_DBUS], [test "x$have_dbus" = "xyes"])

dnl Bacon backend
dnl This is the fallback backend, so we *need* these headers and functions
dnl even if we end up using D-Bus
dnl D-Bus backend dependencies
m4_define([have_bacon_default], [yes])
AC_ARG_ENABLE([bacon],
              [AC_HELP_STRING([--enable-bacon=@<:@yes/no@:>@],
                              [Whether Unix domain sockets IPC should be enabled])],
              [],
              [enable_bacon=have_bacon_default])

AS_IF([test "x$enable_bacon" = "xyes"],
      [
        AC_CHECK_HEADERS([fcntl.h sys/types.h sys/socket.h sys/un.h],
                         [have_bacon=yes],
                         [have_bacon=no])
      ],

      [have_bacon=no]
)

AS_IF([test "x$have_bacon" = "xyes"],
      [
        AC_DEFINE([HAVE_BACON], [1], [Building with Unix domain socket support])
      ]
)

AM_CONDITIONAL([HAVE_BACON], [test "x$have_bacon" = "xyes"])

dnl Choose the default backend
AC_MSG_CHECKING([for default IPC mechanism])
AS_IF([test "x$have_dbus" = "xyes"],
      [
        UNIQUE_DEFAULT_BACKEND=dbus
        AC_MSG_RESULT([D-Bus])
      ],

      [test "x$have_bacon" = "xyes"],
      [
        UNIQUE_DEFAULT_BACKEND=bacon
        AC_MSG_RESULT([Unix domain sockets])
      ],

      [AC_MSG_ERROR([No IPC backend enabled.])]
)

AC_SUBST(UNIQUE_DEFAULT_BACKEND)

# use strict compiler flags only on development releases
m4_define([maintainer_flags_default], [m4_if(m4_eval(unique_minor_version % 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])

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)

# enable debug flags and symbols
m4_define([debug_default], [m4_if(m4_eval(unique_minor_version % 2), [1], [yes], [minimum])])
AC_ARG_ENABLE([debug],
              [AC_HELP_STRING([--enable-debug=@<:@no/minimum/yes@:>@],
                              [Turn on debugging @<:@default=debug_default@:>@])],
              [],
              [enable_debug=debug_default])

AS_CASE([$enable_debug],

        [yes],
        [
          test "$cflags_set" = set || CFLAGS="$CFLAGS -g"
          UNIQUE_DEBUG_CFLAGS="-DUNIQUE_ENABLE_DEBUG"
        ],

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

        [minimum],
        [
          UNIQUE_DEBUG_CFLAGS="-DG_DISABLE_CAST_CHECKS"
        ]

        [AC_MSG_ERROR([Unknown argument to --enable-debug])]
)

AC_SUBST(UNIQUE_DEBUG_CFLAGS)

# i18n stuff
ALL_LINGUAS=""
AM_GLIB_GNU_GETTEXT

GETTEXT_PACKAGE=unique
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],
                   ["$GETTEXT_PACKAGE"],
                   [Define the gettext package to be used])

AM_GLIB_DEFINE_LOCALEDIR(UNIQUE_LOCALEDIR)

# introspection
GOBJECT_INTROSPECTION_CHECK([0.6.3])

# gtk-doc
GTK_DOC_CHECK([1.11])

# nice builds
m4_ifdef([AM_SILENT_RULES],
         [
           AM_SILENT_RULES([yes])
           use_shave=no
         ],
         [
           SHAVE_INIT([build/autotools], [enable])
           AC_CONFIG_FILES([
                build/autotools/shave-libtool
                build/autotools/shave
           ])
           use_shave=yes
         ])

AM_CONDITIONAL([USE_SHAVE], [test "x$use_shave" = "xyes"])

AC_CONFIG_FILES([
        Makefile
        unique.pc
        build/Makefile
        build/autotools/Makefile
        doc/Makefile
        doc/reference/Makefile
        doc/reference/version.xml
        unique/Makefile
        unique/uniqueversion.h
        unique/bacon/Makefile
        unique/dbus/Makefile
        tests/Makefile
        po/Makefile.in
])

AC_OUTPUT

echo "
Unique $UNIQUE_VERSION

Configuration:
            Maintainer flags: $enable_maintainer_flags
                 Debug level: $enable_debug
         Build documentation: $enable_gtk_doc
    Build introspection data: $enable_introspection

Backends:
          Unix Domain Socket: $have_bacon
                       D-BUS: $have_dbus

             Default backend: $UNIQUE_DEFAULT_BACKEND
"