1 # SPDX-License-Identifier: GPL-2.0
5 AM_INIT_AUTOMAKE([foreign subdir-objects color-tests silent-rules
6 tar-pax no-dist-gzip dist-xz])
7 AC_CONFIG_HEADERS(config.h)
8 AC_USE_SYSTEM_EXTENSIONS
10 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
14 AC_PREFIX_DEFAULT(/usr/local)
33 m4_define([_LT_AC_TAGCONFIG], [])
34 m4_ifdef([AC_LIBTOOL_TAGS], [AC_LIBTOOL_TAGS([])])
39 if (test "$USE_MAINTAINER_MODE" = "yes"); then
40 AC_CHECK_PROG(enable_coverage, [lcov], [yes], [no])
41 AC_CHECK_PROG(enable_dbus_run_session, [dbus-run-session], [yes])
42 AC_CHECK_PROG(enable_valgrind, [valgrind], [yes])
43 AC_CHECK_HEADERS(valgrind/memcheck.h)
45 AM_CONDITIONAL(COVERAGE, test "${enable_coverage}" = "yes")
46 AM_CONDITIONAL(DBUS_RUN_SESSION, test "${enable_dbus_run_session}" = "yes")
50 AM_CONDITIONAL(VALGRIND, test "${enable_valgrind}" = "yes" &&
51 test "$ASAN_LIB" != "yes" && test "LSAN_LIB" != "yes")
53 AC_ARG_ENABLE(threads, AC_HELP_STRING([--enable-threads],
54 [enable threading support]), [enable_threads=${enableval}])
56 AC_CHECK_FUNCS(explicit_bzero)
58 AC_CHECK_FUNCS(rawmemchr)
60 AC_CHECK_FUNC(signalfd, dummy=yes,
61 AC_MSG_ERROR(signalfd support is required))
63 AC_CHECK_LIB(rt, clock_gettime, dummy=yes,
64 AC_MSG_ERROR(realtime clock support is required))
66 AC_CHECK_LIB(pthread, pthread_create, dummy=yes,
67 AC_MSG_ERROR(posix thread support is required))
69 AC_CHECK_LIB(dl, dlopen, dummy=yes,
70 AC_MSG_ERROR(dynamic linking loader is required))
72 AC_CHECK_HEADERS(linux/types.h linux/if_alg.h linux/uinput.h linux/uhid.h)
74 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.28, dummy=yes,
75 AC_MSG_ERROR(GLib >= 2.28 is required))
79 if (test "${enable_threads}" = "yes"); then
80 AC_DEFINE(NEED_THREADS, 1, [Define if threading support is required])
81 PKG_CHECK_MODULES(GTHREAD, gthread-2.0 >= 2.16, dummy=yes,
82 AC_MSG_ERROR(GThread >= 2.16 is required))
83 GLIB_CFLAGS="$GLIB_CFLAGS $GTHREAD_CFLAGS"
84 GLIB_LIBS="$GLIB_LIBS $GTHREAD_LIBS"
87 PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.6, dummy=yes,
88 AC_MSG_ERROR(D-Bus >= 1.6 is required))
92 PKG_CHECK_MODULES(LIBXML, libxml-2.0)
93 AC_SUBST(LIBXML_CFLAGS)
96 PKG_CHECK_MODULES(INIPARSER, iniparser)
97 AC_SUBST(INIPARSER_CFLAGS)
98 AC_SUBST(INIPARSER_LIBS)
100 AC_ARG_WITH([dbusconfdir], AC_HELP_STRING([--with-dbusconfdir=DIR],
101 [path to D-Bus configuration directory]),
102 [path_dbusconfdir=${withval}])
103 if (test -z "${path_dbusconfdir}"); then
104 AC_MSG_CHECKING([D-Bus configuration directory])
105 path_dbusconfdir="`$PKG_CONFIG --variable=sysconfdir dbus-1`"
106 if (test -z "${path_dbusconfdir}"); then
107 AC_MSG_ERROR([D-Bus configuration directory is required])
109 AC_MSG_RESULT([${path_dbusconfdir}])
111 AC_SUBST(DBUS_CONFDIR, [${path_dbusconfdir}])
113 AC_ARG_WITH([dbussystembusdir], AC_HELP_STRING([--with-dbussystembusdir=DIR],
114 [path to D-Bus system bus services directory]),
115 [path_dbussystembusdir=${withval}])
116 if (test -z "${path_dbussystembusdir}"); then
117 AC_MSG_CHECKING([D-Bus system bus services dir])
118 path_dbussystembusdir="`$PKG_CONFIG --variable=system_bus_services_dir dbus-1`"
119 if (test -z "${path_dbussystembusdir}"); then
120 AC_MSG_ERROR([D-Bus system bus services directory is required])
122 AC_MSG_RESULT([${path_dbussystembusdir}])
124 AC_SUBST(DBUS_SYSTEMBUSDIR, [${path_dbussystembusdir}])
126 AC_ARG_WITH([dbussessionbusdir], AC_HELP_STRING([--with-dbussessionbusdir=DIR],
127 [path to D-Bus session bus services directory]),
128 [path_dbussessionbusdir=${withval}])
129 if (test -z "${path_dbussessionbusdir}"); then
130 AC_MSG_CHECKING([D-Bus session bus services dir])
131 path_dbussessionbusdir="`$PKG_CONFIG --variable=session_bus_services_dir dbus-1`"
132 if (test -z "${path_dbussessionbusdir}"); then
133 AC_MSG_ERROR([D-Bus session bus services directory is required])
135 AC_MSG_RESULT([${path_dbussessionbusdir}])
137 AC_SUBST(DBUS_SESSIONBUSDIR, [${path_dbussessionbusdir}])
139 AC_ARG_ENABLE(backtrace, AC_HELP_STRING([--enable-backtrace],
140 [compile backtrace support]), [enable_backtrace=${enableval}])
142 if (test "${enable_backtrace}" = "yes"); then
143 AC_CHECK_HEADER(elfutils/libdwfl.h, dummy=yes,
144 AC_MSG_ERROR(elfutils support is required))
145 AC_DEFINE(HAVE_BACKTRACE_SUPPORT, 1,
146 [Define to 1 if you have the backtrace support.])
148 BACKTRACE_LIBS="-ldw"
149 AC_SUBST(BACKTRACE_CFLAGS)
150 AC_SUBST(BACKTRACE_LIBS)
153 AC_ARG_ENABLE(library, AC_HELP_STRING([--enable-library],
154 [install Bluetooth library]), [enable_library=${enableval}])
155 AM_CONDITIONAL(LIBRARY, test "${enable_library}" = "yes")
157 AC_ARG_ENABLE(test, AC_HELP_STRING([--enable-test],
158 [enable test/example scripts]), [enable_test=${enableval}])
159 AM_CONDITIONAL(TEST, test "${enable_test}" = "yes")
161 AC_ARG_ENABLE(nfc, AC_HELP_STRING([--enable-nfc],
162 [enable TIZEN_NFC_PLUGIN paring]), [enable_nfc=${enableval}])
163 AM_CONDITIONAL(TIZEN_NFC_PLUGIN, test "${enable_nfc}" = "yes")
165 AC_ARG_ENABLE(tools, AC_HELP_STRING([--disable-tools],
166 [disable Bluetooth tools]), [enable_tools=${enableval}])
167 AM_CONDITIONAL(TOOLS, test "${enable_tools}" != "no")
169 AC_ARG_ENABLE(monitor, AC_HELP_STRING([--disable-monitor],
170 [disable Bluetooth monitor]), [enable_monitor=${enableval}])
171 AM_CONDITIONAL(MONITOR, test "${enable_monitor}" != "no")
173 AC_ARG_ENABLE(udev, AC_HELP_STRING([--disable-udev],
174 [disable udev device support]), [enable_udev=${enableval}])
175 if (test "${enable_tools}" != "no" && test "${enable_udev}" != "no"); then
176 PKG_CHECK_MODULES(UDEV, libudev >= 172, dummy=yes,
177 AC_MSG_ERROR(libudev >= 172 is required))
178 AC_SUBST(UDEV_CFLAGS)
180 AC_CHECK_LIB(udev, udev_hwdb_new,
181 AC_DEFINE(HAVE_UDEV_HWDB_NEW, 1,
182 [Define to 1 if you have the udev_hwdb_new() function.]))
184 AM_CONDITIONAL(UDEV, test "${enable_udev}" != "no")
186 AC_ARG_WITH([udevdir], AC_HELP_STRING([--with-udevdir=DIR],
187 [path to udev directory]), [path_udevdir=${withval}])
188 if (test "${enable_udev}" != "no" && test -z "${path_udevdir}"); then
189 AC_MSG_CHECKING([udev directory])
190 path_udevdir="`$PKG_CONFIG --variable=udevdir udev`"
191 if (test -z "${path_udevdir}"); then
192 AC_MSG_ERROR([udev directory is required])
194 AC_MSG_RESULT([${path_udevdir}])
196 AC_SUBST(UDEV_DIR, [${path_udevdir}])
198 AC_ARG_ENABLE(cups, AC_HELP_STRING([--disable-cups],
199 [disable CUPS printer support]), [enable_cups=${enableval}])
200 AM_CONDITIONAL(CUPS, test "${enable_cups}" != "no")
202 AC_ARG_ENABLE(mesh, AC_HELP_STRING([--enable-mesh],
203 [enable Mesh profile support]), [enable_mesh=${enableval}])
204 AM_CONDITIONAL(MESH, test "${enable_mesh}" = "yes")
206 if (test "${enable_mesh}" == "yes"); then
207 PKG_CHECK_MODULES(JSONC, json-c >= 0.13, dummy=yes,
208 AC_MSG_ERROR(json-c >= 0.13 is required))
209 AC_SUBST(JSON_CFLAGS)
213 AC_ARG_ENABLE(midi, AC_HELP_STRING([--enable-midi],
214 [enable MIDI support]), [enable_midi=${enableval}])
215 AM_CONDITIONAL(MIDI, test "${enable_midi}" = "yes")
217 if (test "${enable_midi}" = "yes"); then
218 PKG_CHECK_MODULES(ALSA, alsa, dummy=yes,
219 AC_MSG_ERROR(ALSA lib is required for MIDI support))
220 AC_SUBST(ALSA_CFLAGS)
225 AC_ARG_ENABLE(obex, AC_HELP_STRING([--disable-obex],
226 [disable OBEX profile support]), [enable_obex=${enableval}])
228 AC_SUBST(ICAL_CFLAGS)
231 AM_CONDITIONAL(OBEX, test "${enable_obex}" != "no")
233 AC_ARG_ENABLE(btpclient, AC_HELP_STRING([--enable-btpclient],
234 [enable BTP client]), [enable_btpclient=${enableval}])
235 AM_CONDITIONAL(BTPCLIENT, test "${enable_btpclient}" = "yes")
237 AC_ARG_ENABLE([external_ell], AC_HELP_STRING([--enable-external-ell],
238 [enable external Embedded Linux library]),
239 [enable_external_ell=${enableval}])
240 if (test "${enable_external_ell}" = "yes"); then
241 PKG_CHECK_MODULES(ELL, ell >= 0.28, dummy=yes,
242 AC_MSG_ERROR(Embedded Linux library >= 0.28 is required))
246 AM_CONDITIONAL(EXTERNAL_ELL, test "${enable_external_ell}" = "yes" ||
247 (test "${enable_btpclient}" != "yes" &&
248 test "${enable_mesh}" != "yes"))
249 AM_CONDITIONAL(LIBSHARED_ELL, test "${enable_btpclient}" = "yes" ||
250 test "${enable_mesh}" = "yes")
252 AC_ARG_ENABLE(client, AC_HELP_STRING([--disable-client],
253 [disable command line client]), [enable_client=${enableval}])
254 AM_CONDITIONAL(CLIENT, test "${enable_client}" != "no")
256 if (test "${enable_client}" != "no" || test "${enable_mesh}" == "yes"); then
257 AC_CHECK_HEADERS(readline/readline.h, enable_readline=yes,
258 AC_MSG_ERROR(readline header files are required))
260 AM_CONDITIONAL(READLINE, test "${enable_readline}" = "yes")
262 AC_ARG_ENABLE(systemd, AC_HELP_STRING([--disable-systemd],
263 [disable systemd integration]), [enable_systemd=${enableval}])
264 AM_CONDITIONAL(SYSTEMD, test "${enable_systemd}" != "no")
266 AC_ARG_WITH([systemdsystemunitdir],
267 AC_HELP_STRING([--with-systemdsystemunitdir=DIR],
268 [path to systemd system unit directory]),
269 [path_systemunitdir=${withval}])
270 if (test "${enable_systemd}" != "no" && test -z "${path_systemunitdir}"); then
271 AC_MSG_CHECKING([systemd system unit dir])
272 path_systemunitdir="`$PKG_CONFIG --variable=systemdsystemunitdir systemd`"
273 if (test -z "${path_systemunitdir}"); then
274 AC_MSG_ERROR([systemd system unit directory is required])
276 AC_MSG_RESULT([${path_systemunitdir}])
278 AC_SUBST(SYSTEMD_SYSTEMUNITDIR, [${path_systemunitdir}])
280 AC_ARG_WITH([systemduserunitdir],
281 AC_HELP_STRING([--with-systemduserunitdir=DIR],
282 [path to systemd user unit directory]),
283 [path_userunitdir=${withval}])
284 if (test "${enable_systemd}" != "no" && test -z "${path_userunitdir}"); then
285 AC_MSG_CHECKING([systemd user unit dir])
286 path_userunitdir="`$PKG_CONFIG --variable=systemduserunitdir systemd`"
287 if (test -z "${path_userunitdir}"); then
288 AC_MSG_ERROR([systemd user unit directory is required])
290 AC_MSG_RESULT([${path_userunitdir}])
292 AC_SUBST(SYSTEMD_USERUNITDIR, [${path_userunitdir}])
294 AC_ARG_ENABLE(datafiles, AC_HELP_STRING([--disable-datafiles],
295 [do not install configuration and data files]),
296 [enable_datafiles=${enableval}])
297 AM_CONDITIONAL(DATAFILES, test "${enable_datafiles}" != "no")
299 AC_ARG_ENABLE(manpages, AC_HELP_STRING([--enable-manpages],
300 [enable building of manual pages]),
301 [enable_manpages=${enableval}])
302 if (test "${enable_manpages}" != "no"); then
303 AC_CHECK_PROGS(RST2MAN, [rst2man rst2man.py], "no")
305 AM_CONDITIONAL(MANPAGES, test "${enable_manpages}" = "yes")
306 AM_CONDITIONAL(RUN_RST2MAN, test "${enable_manpages}" = "yes" && test "${RST2MAN}" != "no")
308 AC_ARG_ENABLE(testing, AC_HELP_STRING([--enable-testing],
309 [enable testing tools]),
310 [enable_testing=${enableval}])
311 AM_CONDITIONAL(TESTING, test "${enable_testing}" = "yes")
313 AC_ARG_ENABLE(experimental, AC_HELP_STRING([--enable-experimental],
314 [enable experimental tools]),
315 [enable_experimental=${enableval}])
316 AM_CONDITIONAL(EXPERIMENTAL, test "${enable_experimental}" = "yes")
318 # Start of TIZEN_FEATURE_BLUEZ_MODIFY
319 AC_ARG_ENABLE(wearable, AC_HELP_STRING([--enable-wearable],
320 [enable wearable profile]), [enable_wearable=${enableval}])
321 AM_CONDITIONAL(WEARABLE, test "${enable_wearable}" = "yes")
323 AC_ARG_ENABLE(autopair, AC_HELP_STRING([--enable-autopair],
324 [Enable Autopair Plugin]), [enable_autopair=${enableval}])
325 AM_CONDITIONAL(AUTOPAIR, test "${enable_autopair}" = "yes")
327 AC_ARG_ENABLE(hid, AC_HELP_STRING([--disable-hid],
328 [disable HID Plugin]), [enable_hid=${enableval}])
329 AM_CONDITIONAL(TIZEN_HID_PLUGIN, test "${enable_hid}" != "no")
331 AC_ARG_ENABLE(hog, AC_HELP_STRING([--enable-hog],
332 [enable HOG Plugin]), [enable_hog=${enableval}])
333 AM_CONDITIONAL(TIZEN_HOG_PLUGIN, test "${enable_hid}" = "yes")
335 AC_ARG_ENABLE(health, AC_HELP_STRING([--enable-health],
336 [enable HEALTH profiles]), [enable_health=${enableval}])
337 AM_CONDITIONAL(TIZEN_HEALTH_PLUGIN, test "${enable_health}" = "yes")
339 AC_ARG_ENABLE(proximity, AC_HELP_STRING([--enable-proximity],
340 [Enable PROXIMITY Plugin]), [enable_proximity=${enableval}])
341 AM_CONDITIONAL(TIZEN_PROXIMITY_PLUGIN, test "${enable_proximity}" = "yes")
343 AC_ARG_ENABLE(tds, AC_HELP_STRING([--enable-tds],
344 [Enable TDS Plugin]), [enable_tds=${enableval}])
345 AM_CONDITIONAL(TIZEN_TDS_PLUGIN, test "${enable_tds}" = "yes")
347 AC_ARG_ENABLE(tizenunusedplugin, AC_HELP_STRING([--enable-tizenunusedplugin],
348 [Enable Unused Plugin]), [enable_tizenunusedplugin=${enableval}])
349 AM_CONDITIONAL(TIZEN_UNUSED_PLUGIN, test "${enable_tizenunusedplugin}" = "yes")
351 AC_ARG_ENABLE(sap, AC_HELP_STRING([--enable-sap],
352 [Enable SAP Plugin]), [enable_sap=${enableval}])
353 AM_CONDITIONAL(TIZEN_SAP_PLUGIN, test "${enable_sap}" = "yes")
355 AC_ARG_ENABLE(a2dp, AC_HELP_STRING([--disable-a2dp],
356 [disable A2DP profile]), [enable_a2dp=${enableval}])
357 AM_CONDITIONAL(TIZEN_A2DP_PLUGIN, test "${enable_a2dp}" != "no")
359 AC_ARG_ENABLE(avrcp, AC_HELP_STRING([--disable-avrcp],
360 [disable AVRCP profile]), [enable_avrcp=${enableval}])
361 AM_CONDITIONAL(TIZEN_AVRCP_PLUGIN, test "${enable_avrcp}" != "no")
363 AC_ARG_ENABLE(network, AC_HELP_STRING([--disable-network],
364 [disable NETWORK profile]), [enable_network=${enableval}])
365 AM_CONDITIONAL(TIZEN_NETWORK_PLUGIN, test "${enable_network}" != "no")
367 AC_ARG_ENABLE(bredr, AC_HELP_STRING([--enable-bredr],
368 [Enable BREDR Plugin]), [enable_bredr=${enableval}])
369 AM_CONDITIONAL(TIZEN_BREDR_PLUGIN, test "${enable_bredr}" = "yes")
371 AC_ARG_ENABLE(le, AC_HELP_STRING([--enable-le],
372 [Enable LE Plugin]), [enable_le=${enableval}])
373 AM_CONDITIONAL(TIZEN_LE_PLUGIN, test "${enable_le}" = "yes")
375 AC_ARG_ENABLE(crypto-tests, AC_HELP_STRING([--disable-crypto-tests],
376 [Disable CRYPTO testcases]), [enable_crypto_tests=${enableval}])
377 AM_CONDITIONAL(TIZEN_CRYPTO_TESTS, test "${enable_crypto_tests}" != "no")
379 # End of TIZEN_FEATURE_BLUEZ_MODIFY
381 AC_ARG_ENABLE(deprecated, AC_HELP_STRING([--enable-deprecated],
382 [enable deprecated tools]),
383 [enable_deprecated=${enableval}])
384 AM_CONDITIONAL(DEPRECATED, test "${enable_deprecated}" = "yes")
386 AC_ARG_ENABLE(sixaxis, AC_HELP_STRING([--enable-sixaxis],
387 [enable sixaxis plugin]), [enable_sixaxis=${enableval}])
388 AM_CONDITIONAL(SIXAXIS, test "${enable_sixaxis}" = "yes" &&
389 test "${enable_udev}" != "no")
391 AC_ARG_ENABLE(hid2hci, AC_HELP_STRING([--enable-hid2hci],
392 [enable hid2hci tool]), [enable_hid2hci=${enableval}])
393 AM_CONDITIONAL(HID2HCI, test "${enable_hid2hci}" = "yes" &&
394 test "${enable_udev}" != "no")
396 AC_ARG_ENABLE(logger, AC_HELP_STRING([--enable-logger],
397 [enable HCI logger service]), [enable_logger=${enableval}])
398 AM_CONDITIONAL(LOGGER, test "${enable_logger}" = "yes")
400 AC_ARG_ENABLE(admin, AC_HELP_STRING([--enable-admin],
401 [enable admin policy plugin]), [enable_admin=${enableval}])
402 AM_CONDITIONAL(ADMIN, test "${enable_admin}" = "yes")
404 if (test "${prefix}" = "NONE"); then
405 dnl no prefix and no localstatedir, so default to /var
406 if (test "$localstatedir" = '${prefix}/var'); then
407 AC_SUBST([localstatedir], ['/var'])
410 prefix="${ac_default_prefix}"
413 if (test "$localstatedir" = '${prefix}/var'); then
414 storagedir="${prefix}/var/lib/bluetooth"
416 storagedir="${localstatedir}/lib/bluetooth"
418 AC_DEFINE_UNQUOTED(STORAGEDIR, "${storagedir}",
419 [Directory for the storage files])
421 if (test "$sysconfdir" = '${prefix}/etc'); then
422 configdir="${prefix}/etc/bluetooth"
424 configdir="${sysconfdir}/bluetooth"
426 AC_DEFINE_UNQUOTED(CONFIGDIR, "${configdir}",
427 [Directory for the configuration files])
428 AC_SUBST(CONFIGDIR, "${configdir}")
431 AC_DEFINE_UNQUOTED(MESH_STORAGEDIR, "${storagedir}/mesh",
432 [Directory for the mesh daemon storage files])
433 AC_SUBST(MESH_STORAGEDIR, "${storagedir}/mesh")
435 AC_ARG_ENABLE(android, AC_HELP_STRING([--enable-android],
436 [enable BlueZ for Android]),
437 [enable_android=${enableval}])
438 AM_CONDITIONAL(ANDROID, test "${enable_android}" = "yes")
440 if (test "${enable_android}" = "yes"); then
441 PKG_CHECK_MODULES(SBC, sbc >= 1.2, dummy=yes,
442 AC_MSG_ERROR(SBC library >= 1.2 is required))
447 if (test "${enable_android}" = "yes"); then
448 PKG_CHECK_MODULES(SPEEXDSP, speexdsp >= 1.2, dummy=yes,
449 AC_MSG_ERROR(SPEEXDSP library >= 1.2 is required))
450 AC_SUBST(SPEEXDSP_CFLAGS)
451 AC_SUBST(SPEEXDSP_LIBS)
454 AC_DEFINE_UNQUOTED(ANDROID_STORAGEDIR, "${storagedir}/android",
455 [Directory for the Android daemon storage files])
457 AC_OUTPUT(Makefile src/bluetoothd.rst lib/bluez.pc mesh/bluetooth-meshd.rst)