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
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"
20
AC_ARG_ENABLE([gtk-doc],
21
AS_HELP_STRING([--enable-gtk-doc], [use gtk-doc to build documentation [[default=no]]]),,
24
if test x$enable_gtk_doc = xyes; then
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]))])
32
AC_MSG_CHECKING([whether to build gtk-doc documentation])
33
AC_MSG_RESULT($enable_gtk_doc)
35
AC_PATH_PROGS(GTKDOC_CHECK,gtkdoc-check,)
37
AM_CONDITIONAL([ENABLE_GTK_DOC], [test x$enable_gtk_doc = xyes])
38
AM_CONDITIONAL([GTK_DOC_USE_LIBTOOL], [test -n "$LIBTOOL"])
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.]))
46
AC_DEFUN([AC_INIT_BLUEZ], [
47
AC_PREFIX_DEFAULT(/usr/local)
49
if (test "${CFLAGS}" = ""); then
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'])
59
dnl no prefix and no localstatedir, so default to /var
60
if (test "$localstatedir" = '${prefix}/var'); then
61
AC_SUBST([localstatedir], ['/var'])
64
dnl no prefix and no libexecdir, so default to /lib
65
if (test "$libexecdir" = '${exec_prefix}/libexec'); then
66
AC_SUBST([libexecdir], ['/lib'])
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'])
74
prefix="${ac_default_prefix}"
77
if (test "${libdir}" = '${exec_prefix}/lib'); then
78
libdir="${prefix}/lib"
81
plugindir="${libdir}/bluetooth/plugins"
83
if (test "$sysconfdir" = '${prefix}/etc'); then
84
configdir="${prefix}/etc/bluetooth"
86
configdir="${sysconfdir}/bluetooth"
89
if (test "$localstatedir" = '${prefix}/var'); then
90
storagedir="${prefix}/var/lib/bluetooth"
92
storagedir="${localstatedir}/lib/bluetooth"
95
AC_DEFINE_UNQUOTED(CONFIGDIR, "${configdir}",
96
[Directory for the configuration files])
97
AC_DEFINE_UNQUOTED(STORAGEDIR, "${storagedir}",
98
[Directory for the storage files])
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)
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)
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)
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)
134
AC_DEFUN([AC_PATH_PULSE], [
135
PKG_CHECK_MODULES(PULSE, libpulse, pulse_found=yes, pulse_found=no)
136
AC_SUBST(PULSE_CFLAGS)
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)
147
AC_DEFUN([AC_PATH_USB], [
148
PKG_CHECK_MODULES(USB, libusb, usb_found=yes, usb_found=no)
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.]))
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)
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)
171
AC_DEFUN([AC_ARG_BLUEZ], [
175
sndfile_enable=${sndfile_found}
177
hal_enable=${hal_found}
178
usb_enable=${usb_found}
179
alsa_enable=${alsa_found}
180
gstreamer_enable=${gstreamer_found}
196
configfiles_enable=yes
197
initscripts_enable=no
198
pcmciarules_enable=no
199
telephony_driver=dummy
201
AC_ARG_ENABLE(fortify, AC_HELP_STRING([--disable-fortify], [disable compile time buffer checks]), [
202
fortify_enable=${enableval}
205
AC_ARG_ENABLE(pie, AC_HELP_STRING([--disable-pie], [disable position independent executables flag]), [
206
pie_enable=${enableval}
209
AC_ARG_ENABLE(network, AC_HELP_STRING([--disable-network], [disable network plugin]), [
210
network_enable=${enableval}
213
AC_ARG_ENABLE(serial, AC_HELP_STRING([--disable-serial], [disable serial plugin]), [
214
serial_enable=${enableval}
217
AC_ARG_ENABLE(input, AC_HELP_STRING([--disable-input], [disable input plugin]), [
218
input_enable=${enableval}
221
AC_ARG_ENABLE(audio, AC_HELP_STRING([--disable-audio], [disable audio plugin]), [
222
audio_enable=${enableval}
225
AC_ARG_ENABLE(service, AC_HELP_STRING([--disable-service], [disable service plugin]), [
226
service_enable=${enableval}
229
AC_ARG_ENABLE(gstreamer, AC_HELP_STRING([--enable-gstreamer], [enable GStreamer support]), [
230
gstreamer_enable=${enableval}
233
AC_ARG_ENABLE(alsa, AC_HELP_STRING([--enable-alsa], [enable ALSA support]), [
234
alsa_enable=${enableval}
237
AC_ARG_ENABLE(usb, AC_HELP_STRING([--enable-usb], [enable USB support]), [
238
usb_enable=${enableval}
241
AC_ARG_ENABLE(netlink, AC_HELP_STRING([--enable-netlink], [enable NETLINK support]), [
242
netlink_enable=${enableval}
245
AC_ARG_ENABLE(tools, AC_HELP_STRING([--enable-tools], [install Bluetooth utilities]), [
246
tools_enable=${enableval}
249
AC_ARG_ENABLE(bccmd, AC_HELP_STRING([--enable-bccmd], [install BCCMD interface utility]), [
250
bccmd_enable=${enableval}
253
AC_ARG_ENABLE(hid2hci, AC_HELP_STRING([--enable-hid2hci], [install HID mode switching utility]), [
254
hid2hci_enable=${enableval}
257
AC_ARG_ENABLE(dfutool, AC_HELP_STRING([--enable-dfutool], [install DFU firmware upgrade utility]), [
258
dfutool_enable=${enableval}
261
AC_ARG_ENABLE(hidd, AC_HELP_STRING([--enable-hidd], [install HID daemon]), [
262
hidd_enable=${enableval}
265
AC_ARG_ENABLE(pand, AC_HELP_STRING([--enable-pand], [install PAN daemon]), [
266
pand_enable=${enableval}
269
AC_ARG_ENABLE(dund, AC_HELP_STRING([--enable-dund], [install DUN daemon]), [
270
dund_enable=${enableval}
273
AC_ARG_ENABLE(cups, AC_HELP_STRING([--enable-cups], [install CUPS backend support]), [
274
cups_enable=${enableval}
277
AC_ARG_ENABLE(test, AC_HELP_STRING([--enable-test], [install test programs]), [
278
test_enable=${enableval}
281
AC_ARG_ENABLE(manpages, AC_HELP_STRING([--enable-manpages], [install Bluetooth manual pages]), [
282
manpages_enable=${enableval}
285
AC_ARG_ENABLE(configfiles, AC_HELP_STRING([--enable-configfiles], [install Bluetooth config files]), [
286
configfiles_enable=${enableval}
289
AC_ARG_ENABLE(initscripts, AC_HELP_STRING([--enable-initscripts], [install Bluetooth boot scripts]), [
290
initscripts_enable=${enableval}
293
AC_ARG_ENABLE(pcmciarules, AC_HELP_STRING([--enable-pcmciarules], [install PCMCIA udev rules]), [
294
pcmciarules_enable=${enableval}
297
AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [enable compiling with debugging information]), [
298
debug_enable=${enableval}
301
AC_ARG_WITH(telephony, AC_HELP_STRING([--with-telephony=DRIVER], [select telephony driver]), [
302
telephony_driver=${withval}
305
AC_SUBST([TELEPHONY_DRIVER], [telephony-${telephony_driver}.c])
307
if (test "${fortify_enable}" = "yes"); then
308
CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=2"
311
if (test "${pie_enable}" = "yes" && test "${ac_cv_prog_cc_pie}" = "yes"); then
312
CFLAGS="$CFLAGS -fPIC"
313
LDFLAGS="$LDFLAGS -pie"
316
if (test "${debug_enable}" = "yes" && test "${ac_cv_prog_cc_g}" = "yes"); then
317
CFLAGS="$CFLAGS -g -O0"
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.])
324
AC_SUBST([BLUEZ_CFLAGS], ['-I$(top_builddir)/include'])
325
AC_SUBST([BLUEZ_LIBS], ['$(top_builddir)/lib/libbluetooth.la'])
327
AC_SUBST([GDBUS_CFLAGS], ['-I$(top_srcdir)/gdbus'])
328
AC_SUBST([GDBUS_LIBS], ['$(top_builddir)/gdbus/libgdbus.la'])
330
AC_SUBST([SBC_CFLAGS], ['-I$(top_srcdir)/sbc'])
331
AC_SUBST([SBC_LIBS], ['$(top_builddir)/sbc/libsbc.la'])
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")