~ubuntu-branches/ubuntu/intrepid/bluez/intrepid

« back to all changes in this revision

Viewing changes to acinclude.m4

  • Committer: Bazaar Package Importer
  • Author(s): Mario Limonciello
  • Date: 2008-10-07 12:10:29 UTC
  • Revision ID: james.westby@ubuntu.com-20081007121029-4gup4fmmh2vfo5nh
Tags: upstream-4.12
ImportĀ upstreamĀ versionĀ 4.12

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
AC_DEFUN([AC_PROG_CC_PIE], [
 
2
        AC_CACHE_CHECK([whether ${CC-cc} accepts -fPIE], ac_cv_prog_cc_pie, [
 
3
                echo 'void f(){}' > conftest.c
 
4
                if test -z "`${CC-cc} -fPIE -pie -c conftest.c 2>&1`"; then
 
5
                        ac_cv_prog_cc_pie=yes
 
6
                else
 
7
                        ac_cv_prog_cc_pie=no
 
8
                fi
 
9
                rm -rf conftest*
 
10
        ])
 
11
])
 
12
 
 
13
AC_DEFUN([GTK_DOC_CHECK], [
 
14
        AC_ARG_WITH([html-dir],
 
15
                AS_HELP_STRING([--with-html-dir=PATH], [path to installed docs]),,
 
16
                                        [with_html_dir='${datadir}/gtk-doc/html'])
 
17
        HTML_DIR="$with_html_dir"
 
18
        AC_SUBST([HTML_DIR])
 
19
 
 
20
        AC_ARG_ENABLE([gtk-doc],
 
21
                AS_HELP_STRING([--enable-gtk-doc], [use gtk-doc to build documentation [[default=no]]]),,
 
22
                                        [enable_gtk_doc=no])
 
23
 
 
24
        if test x$enable_gtk_doc = xyes; then
 
25
                ifelse([$1],[],
 
26
                        [PKG_CHECK_EXISTS([gtk-doc],,
 
27
                                AC_MSG_ERROR([gtk-doc not installed and --enable-gtk-doc requested]))],
 
28
                        [PKG_CHECK_EXISTS([gtk-doc >= $1],,
 
29
                                AC_MSG_ERROR([You need to have gtk-doc >= $1 installed to build gtk-doc]))])
 
30
        fi
 
31
 
 
32
        AC_MSG_CHECKING([whether to build gtk-doc documentation])
 
33
        AC_MSG_RESULT($enable_gtk_doc)
 
34
 
 
35
        AC_PATH_PROGS(GTKDOC_CHECK,gtkdoc-check,)
 
36
 
 
37
        AM_CONDITIONAL([ENABLE_GTK_DOC], [test x$enable_gtk_doc = xyes])
 
38
        AM_CONDITIONAL([GTK_DOC_USE_LIBTOOL], [test -n "$LIBTOOL"])
 
39
])
 
40
 
 
41
AC_DEFUN([AC_FUNC_PPOLL], [
 
42
        AC_CHECK_FUNC(ppoll, dummy=yes, AC_DEFINE(NEED_PPOLL, 1,
 
43
                        [Define to 1 if you need the ppoll() function.]))
 
44
])
 
45
 
 
46
AC_DEFUN([AC_INIT_BLUEZ], [
 
47
        AC_PREFIX_DEFAULT(/usr/local)
 
48
 
 
49
        if (test "${CFLAGS}" = ""); then
 
50
                CFLAGS="-Wall -O2"
 
51
        fi
 
52
 
 
53
        if (test "${prefix}" = "NONE"); then
 
54
                dnl no prefix and no sysconfdir, so default to /etc
 
55
                if (test "$sysconfdir" = '${prefix}/etc'); then
 
56
                        AC_SUBST([sysconfdir], ['/etc'])
 
57
                fi
 
58
 
 
59
                dnl no prefix and no localstatedir, so default to /var
 
60
                if (test "$localstatedir" = '${prefix}/var'); then
 
61
                        AC_SUBST([localstatedir], ['/var'])
 
62
                fi
 
63
 
 
64
                dnl no prefix and no libexecdir, so default to /lib
 
65
                if (test "$libexecdir" = '${exec_prefix}/libexec'); then
 
66
                        AC_SUBST([libexecdir], ['/lib'])
 
67
                fi
 
68
 
 
69
                dnl no prefix and no mandir, so use ${prefix}/share/man as default
 
70
                if (test "$mandir" = '${prefix}/man'); then
 
71
                        AC_SUBST([mandir], ['${prefix}/share/man'])
 
72
                fi
 
73
 
 
74
                prefix="${ac_default_prefix}"
 
75
        fi
 
76
 
 
77
        if (test "${libdir}" = '${exec_prefix}/lib'); then
 
78
                libdir="${prefix}/lib"
 
79
        fi
 
80
 
 
81
        plugindir="${libdir}/bluetooth/plugins"
 
82
 
 
83
        if (test "$sysconfdir" = '${prefix}/etc'); then
 
84
                configdir="${prefix}/etc/bluetooth"
 
85
        else
 
86
                configdir="${sysconfdir}/bluetooth"
 
87
        fi
 
88
 
 
89
        if (test "$localstatedir" = '${prefix}/var'); then
 
90
                storagedir="${prefix}/var/lib/bluetooth"
 
91
        else
 
92
                storagedir="${localstatedir}/lib/bluetooth"
 
93
        fi
 
94
 
 
95
        AC_DEFINE_UNQUOTED(CONFIGDIR, "${configdir}",
 
96
                                [Directory for the configuration files])
 
97
        AC_DEFINE_UNQUOTED(STORAGEDIR, "${storagedir}",
 
98
                                [Directory for the storage files])
 
99
])
 
100
 
 
101
AC_DEFUN([AC_PATH_DBUS], [
 
102
        PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.0, dummy=yes,
 
103
                                AC_MSG_ERROR(D-Bus library is required))
 
104
        AC_CHECK_LIB(dbus-1, dbus_watch_get_unix_fd, dummy=yes,
 
105
                AC_DEFINE(NEED_DBUS_WATCH_GET_UNIX_FD, 1,
 
106
                        [Define to 1 if you need the dbus_watch_get_unix_fd() function.]))
 
107
        AC_SUBST(DBUS_CFLAGS)
 
108
        AC_SUBST(DBUS_LIBS)
 
109
])
 
110
 
 
111
AC_DEFUN([AC_PATH_GLIB], [
 
112
        PKG_CHECK_MODULES(GLIB, glib-2.0, dummy=yes,
 
113
                                AC_MSG_ERROR(GLib library is required))
 
114
        AC_SUBST(GLIB_CFLAGS)
 
115
        AC_SUBST(GLIB_LIBS)
 
116
])
 
117
 
 
118
AC_DEFUN([AC_PATH_GMODULE], [
 
119
        PKG_CHECK_MODULES(GMODULE, gmodule-2.0, dummy=yes,
 
120
                                AC_MSG_ERROR(GModule library is required))
 
121
        AC_CHECK_LIB(dl, dlopen, dummy=yes, dummy=no)
 
122
        AC_SUBST(GMODULE_CFLAGS)
 
123
        AC_SUBST(GMODULE_LIBS)
 
124
])
 
125
 
 
126
AC_DEFUN([AC_PATH_GSTREAMER], [
 
127
        PKG_CHECK_MODULES(GSTREAMER, gstreamer-0.10 gstreamer-plugins-base-0.10, gstreamer_found=yes, gstreamer_found=no)
 
128
        AC_SUBST(GSTREAMER_CFLAGS)
 
129
        AC_SUBST(GSTREAMER_LIBS)
 
130
        GSTREAMER_PLUGINSDIR=`$PKG_CONFIG --variable=pluginsdir gstreamer-0.10`
 
131
        AC_SUBST(GSTREAMER_PLUGINSDIR)
 
132
])
 
133
 
 
134
AC_DEFUN([AC_PATH_PULSE], [
 
135
        PKG_CHECK_MODULES(PULSE, libpulse, pulse_found=yes, pulse_found=no)
 
136
        AC_SUBST(PULSE_CFLAGS)
 
137
        AC_SUBST(PULSE_LIBS)
 
138
])
 
139
 
 
140
AC_DEFUN([AC_PATH_ALSA], [
 
141
        PKG_CHECK_MODULES(ALSA, alsa, alsa_found=yes, alsa_found=no)
 
142
        AC_CHECK_LIB(rt, clock_gettime, ALSA_LIBS="$ALSA_LIBS -lrt", alsa_found=no)
 
143
        AC_SUBST(ALSA_CFLAGS)
 
144
        AC_SUBST(ALSA_LIBS)
 
145
])
 
146
 
 
147
AC_DEFUN([AC_PATH_USB], [
 
148
        PKG_CHECK_MODULES(USB, libusb, usb_found=yes, usb_found=no)
 
149
        AC_SUBST(USB_CFLAGS)
 
150
        AC_SUBST(USB_LIBS)
 
151
        AC_CHECK_LIB(usb, usb_get_busses, dummy=yes,
 
152
                AC_DEFINE(NEED_USB_GET_BUSSES, 1,
 
153
                        [Define to 1 if you need the usb_get_busses() function.]))
 
154
        AC_CHECK_LIB(usb, usb_interrupt_read, dummy=yes,
 
155
                AC_DEFINE(NEED_USB_INTERRUPT_READ, 1,
 
156
                        [Define to 1 if you need the usb_interrupt_read() function.]))
 
157
])
 
158
 
 
159
AC_DEFUN([AC_PATH_NETLINK], [
 
160
        PKG_CHECK_MODULES(NETLINK, libnl-1, netlink_found=yes, netlink_found=no)
 
161
        AC_SUBST(NETLINK_CFLAGS)
 
162
        AC_SUBST(NETLINK_LIBS)
 
163
])
 
164
 
 
165
AC_DEFUN([AC_PATH_SNDFILE], [
 
166
        PKG_CHECK_MODULES(SNDFILE, sndfile, sndfile_found=yes, sndfile_found=no)
 
167
        AC_SUBST(SNDFILE_CFLAGS)
 
168
        AC_SUBST(SNDFILE_LIBS)
 
169
])
 
170
 
 
171
AC_DEFUN([AC_ARG_BLUEZ], [
 
172
        debug_enable=no
 
173
        fortify_enable=yes
 
174
        pie_enable=yes
 
175
        sndfile_enable=${sndfile_found}
 
176
        netlink_enable=no
 
177
        hal_enable=${hal_found}
 
178
        usb_enable=${usb_found}
 
179
        alsa_enable=${alsa_found}
 
180
        gstreamer_enable=${gstreamer_found}
 
181
        audio_enable=yes
 
182
        input_enable=yes
 
183
        serial_enable=yes
 
184
        network_enable=yes
 
185
        service_enable=yes
 
186
        tools_enable=yes
 
187
        hidd_enable=no
 
188
        pand_enable=no
 
189
        dund_enable=no
 
190
        cups_enable=no
 
191
        test_enable=no
 
192
        bccmd_enable=no
 
193
        hid2hci_enable=no
 
194
        dfutool_enable=no
 
195
        manpages_enable=yes
 
196
        configfiles_enable=yes
 
197
        initscripts_enable=no
 
198
        pcmciarules_enable=no
 
199
        telephony_driver=dummy
 
200
 
 
201
        AC_ARG_ENABLE(fortify, AC_HELP_STRING([--disable-fortify], [disable compile time buffer checks]), [
 
202
                fortify_enable=${enableval}
 
203
        ])
 
204
 
 
205
        AC_ARG_ENABLE(pie, AC_HELP_STRING([--disable-pie], [disable position independent executables flag]), [
 
206
                pie_enable=${enableval}
 
207
        ])
 
208
 
 
209
        AC_ARG_ENABLE(network, AC_HELP_STRING([--disable-network], [disable network plugin]), [
 
210
                network_enable=${enableval}
 
211
        ])
 
212
 
 
213
        AC_ARG_ENABLE(serial, AC_HELP_STRING([--disable-serial], [disable serial plugin]), [
 
214
                serial_enable=${enableval}
 
215
        ])
 
216
 
 
217
        AC_ARG_ENABLE(input, AC_HELP_STRING([--disable-input], [disable input plugin]), [
 
218
                input_enable=${enableval}
 
219
        ])
 
220
 
 
221
        AC_ARG_ENABLE(audio, AC_HELP_STRING([--disable-audio], [disable audio plugin]), [
 
222
                audio_enable=${enableval}
 
223
        ])
 
224
 
 
225
        AC_ARG_ENABLE(service, AC_HELP_STRING([--disable-service], [disable service plugin]), [
 
226
                service_enable=${enableval}
 
227
        ])
 
228
 
 
229
        AC_ARG_ENABLE(gstreamer, AC_HELP_STRING([--enable-gstreamer], [enable GStreamer support]), [
 
230
                gstreamer_enable=${enableval}
 
231
        ])
 
232
 
 
233
        AC_ARG_ENABLE(alsa, AC_HELP_STRING([--enable-alsa], [enable ALSA support]), [
 
234
                alsa_enable=${enableval}
 
235
        ])
 
236
 
 
237
        AC_ARG_ENABLE(usb, AC_HELP_STRING([--enable-usb], [enable USB support]), [
 
238
                usb_enable=${enableval}
 
239
        ])
 
240
 
 
241
        AC_ARG_ENABLE(netlink, AC_HELP_STRING([--enable-netlink], [enable NETLINK support]), [
 
242
                netlink_enable=${enableval}
 
243
        ])
 
244
 
 
245
        AC_ARG_ENABLE(tools, AC_HELP_STRING([--enable-tools], [install Bluetooth utilities]), [
 
246
                tools_enable=${enableval}
 
247
        ])
 
248
 
 
249
        AC_ARG_ENABLE(bccmd, AC_HELP_STRING([--enable-bccmd], [install BCCMD interface utility]), [
 
250
                bccmd_enable=${enableval}
 
251
        ])
 
252
 
 
253
        AC_ARG_ENABLE(hid2hci, AC_HELP_STRING([--enable-hid2hci], [install HID mode switching utility]), [
 
254
                hid2hci_enable=${enableval}
 
255
        ])
 
256
 
 
257
        AC_ARG_ENABLE(dfutool, AC_HELP_STRING([--enable-dfutool], [install DFU firmware upgrade utility]), [
 
258
                dfutool_enable=${enableval}
 
259
        ])
 
260
 
 
261
        AC_ARG_ENABLE(hidd, AC_HELP_STRING([--enable-hidd], [install HID daemon]), [
 
262
                hidd_enable=${enableval}
 
263
        ])
 
264
 
 
265
        AC_ARG_ENABLE(pand, AC_HELP_STRING([--enable-pand], [install PAN daemon]), [
 
266
                pand_enable=${enableval}
 
267
        ])
 
268
 
 
269
        AC_ARG_ENABLE(dund, AC_HELP_STRING([--enable-dund], [install DUN daemon]), [
 
270
                dund_enable=${enableval}
 
271
        ])
 
272
 
 
273
        AC_ARG_ENABLE(cups, AC_HELP_STRING([--enable-cups], [install CUPS backend support]), [
 
274
                cups_enable=${enableval}
 
275
        ])
 
276
 
 
277
        AC_ARG_ENABLE(test, AC_HELP_STRING([--enable-test], [install test programs]), [
 
278
                test_enable=${enableval}
 
279
        ])
 
280
 
 
281
        AC_ARG_ENABLE(manpages, AC_HELP_STRING([--enable-manpages], [install Bluetooth manual pages]), [
 
282
                manpages_enable=${enableval}
 
283
        ])
 
284
 
 
285
        AC_ARG_ENABLE(configfiles, AC_HELP_STRING([--enable-configfiles], [install Bluetooth config files]), [
 
286
                configfiles_enable=${enableval}
 
287
        ])
 
288
 
 
289
        AC_ARG_ENABLE(initscripts, AC_HELP_STRING([--enable-initscripts], [install Bluetooth boot scripts]), [
 
290
                initscripts_enable=${enableval}
 
291
        ])
 
292
 
 
293
        AC_ARG_ENABLE(pcmciarules, AC_HELP_STRING([--enable-pcmciarules], [install PCMCIA udev rules]), [
 
294
                pcmciarules_enable=${enableval}
 
295
        ])
 
296
 
 
297
        AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [enable compiling with debugging information]), [
 
298
                debug_enable=${enableval}
 
299
        ])
 
300
 
 
301
        AC_ARG_WITH(telephony, AC_HELP_STRING([--with-telephony=DRIVER], [select telephony driver]), [
 
302
                telephony_driver=${withval}
 
303
        ])
 
304
 
 
305
        AC_SUBST([TELEPHONY_DRIVER], [telephony-${telephony_driver}.c])
 
306
 
 
307
        if (test "${fortify_enable}" = "yes"); then
 
308
                CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=2"
 
309
        fi
 
310
 
 
311
        if (test "${pie_enable}" = "yes" && test "${ac_cv_prog_cc_pie}" = "yes"); then
 
312
                CFLAGS="$CFLAGS -fPIC"
 
313
                LDFLAGS="$LDFLAGS -pie"
 
314
        fi
 
315
 
 
316
        if (test "${debug_enable}" = "yes" && test "${ac_cv_prog_cc_g}" = "yes"); then
 
317
                CFLAGS="$CFLAGS -g -O0"
 
318
        fi
 
319
 
 
320
        if (test "${usb_enable}" = "yes" && test "${usb_found}" = "yes"); then
 
321
                AC_DEFINE(HAVE_LIBUSB, 1, [Define to 1 if you have USB library.])
 
322
        fi
 
323
 
 
324
        AC_SUBST([BLUEZ_CFLAGS], ['-I$(top_builddir)/include'])
 
325
        AC_SUBST([BLUEZ_LIBS], ['$(top_builddir)/lib/libbluetooth.la'])
 
326
 
 
327
        AC_SUBST([GDBUS_CFLAGS], ['-I$(top_srcdir)/gdbus'])
 
328
        AC_SUBST([GDBUS_LIBS], ['$(top_builddir)/gdbus/libgdbus.la'])
 
329
 
 
330
        AC_SUBST([SBC_CFLAGS], ['-I$(top_srcdir)/sbc'])
 
331
        AC_SUBST([SBC_LIBS], ['$(top_builddir)/sbc/libsbc.la'])
 
332
 
 
333
        AM_CONDITIONAL(SNDFILE, test "${sndfile_enable}" = "yes" && test "${sndfile_found}" = "yes")
 
334
        AM_CONDITIONAL(NETLINK, test "${netlink_enable}" = "yes" && test "${netlink_found}" = "yes")
 
335
        AM_CONDITIONAL(USB, test "${usb_enable}" = "yes" && test "${usb_found}" = "yes")
 
336
        AM_CONDITIONAL(SBC, test "${alsa_enable}" = "yes" || test "${gstreamer_enable}" = "yes")
 
337
        AM_CONDITIONAL(ALSA, test "${alsa_enable}" = "yes" && test "${alsa_found}" = "yes")
 
338
        AM_CONDITIONAL(GSTREAMER, test "${gstreamer_enable}" = "yes" && test "${gstreamer_found}" = "yes")
 
339
        AM_CONDITIONAL(AUDIOPLUGIN, test "${audio_enable}" = "yes")
 
340
        AM_CONDITIONAL(INPUTPLUGIN, test "${input_enable}" = "yes")
 
341
        AM_CONDITIONAL(SERIALPLUGIN, test "${serial_enable}" = "yes")
 
342
        AM_CONDITIONAL(NETWORKPLUGIN, test "${network_enable}" = "yes")
 
343
        AM_CONDITIONAL(SERVICEPLUGIN, test "${service_enable}" = "yes")
 
344
        AM_CONDITIONAL(HIDD, test "${hidd_enable}" = "yes")
 
345
        AM_CONDITIONAL(PAND, test "${pand_enable}" = "yes")
 
346
        AM_CONDITIONAL(DUND, test "${dund_enable}" = "yes")
 
347
        AM_CONDITIONAL(CUPS, test "${cups_enable}" = "yes")
 
348
        AM_CONDITIONAL(TEST, test "${test_enable}" = "yes")
 
349
        AM_CONDITIONAL(TOOLS, test "${tools_enable}" = "yes")
 
350
        AM_CONDITIONAL(BCCMD, test "${bccmd_enable}" = "yes")
 
351
        AM_CONDITIONAL(HID2HCI, test "${hid2hci_enable}" = "yes" && test "${usb_found}" = "yes")
 
352
        AM_CONDITIONAL(DFUTOOL, test "${dfutool_enable}" = "yes" && test "${usb_found}" = "yes")
 
353
        AM_CONDITIONAL(MANPAGES, test "${manpages_enable}" = "yes")
 
354
        AM_CONDITIONAL(CONFIGFILES, test "${configfiles_enable}" = "yes")
 
355
        AM_CONDITIONAL(INITSCRIPTS, test "${initscripts_enable}" = "yes")
 
356
        AM_CONDITIONAL(PCMCIARULES, test "${pcmciarules_enable}" = "yes")
 
357
])