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([])])
37 LT_INIT([disable-static])
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, AS_HELP_STRING([--enable-threads],
54 [enable threading support]), [enable_threads=${enableval}])
56 AC_CHECK_FUNCS(explicit_bzero)
58 AC_CHECK_FUNCS(getrandom)
60 AC_CHECK_FUNCS(rawmemchr)
62 AC_CHECK_FUNC(signalfd, dummy=yes,
63 AC_MSG_ERROR(signalfd support is required))
65 AC_CHECK_LIB(rt, clock_gettime, dummy=yes,
66 AC_MSG_ERROR(realtime clock support is required))
68 AC_CHECK_LIB(pthread, pthread_create, dummy=yes,
69 AC_MSG_ERROR(posix thread support is required))
71 AC_CHECK_LIB(dl, dlopen, dummy=yes,
72 AC_MSG_ERROR(dynamic linking loader is required))
74 AC_CHECK_HEADERS(linux/types.h linux/if_alg.h linux/uinput.h linux/uhid.h sys/random.h)
76 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.28, dummy=yes,
77 AC_MSG_ERROR(GLib >= 2.28 is required))
81 if (test "${enable_threads}" = "yes"); then
82 AC_DEFINE(NEED_THREADS, 1, [Define if threading support is required])
83 PKG_CHECK_MODULES(GTHREAD, gthread-2.0 >= 2.16, dummy=yes,
84 AC_MSG_ERROR(GThread >= 2.16 is required))
85 GLIB_CFLAGS="$GLIB_CFLAGS $GTHREAD_CFLAGS"
86 GLIB_LIBS="$GLIB_LIBS $GTHREAD_LIBS"
89 PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.10, dummy=yes,
90 AC_MSG_ERROR(D-Bus >= 1.10 is required))
94 PKG_CHECK_MODULES(LIBXML, libxml-2.0)
95 AC_SUBST(LIBXML_CFLAGS)
98 PKG_CHECK_MODULES(INIPARSER, iniparser)
99 AC_SUBST(INIPARSER_CFLAGS)
100 AC_SUBST(INIPARSER_LIBS)
102 AC_ARG_WITH([dbusconfdir], AS_HELP_STRING([--with-dbusconfdir=DIR],
103 [path to D-Bus configuration directory]),
104 [path_dbusconfdir=${withval}])
105 if (test -z "${path_dbusconfdir}"); then
106 AC_MSG_CHECKING([D-Bus configuration directory])
107 path_dbusconfdir="`$PKG_CONFIG --variable=sysconfdir dbus-1`"
108 if (test -z "${path_dbusconfdir}"); then
109 AC_MSG_ERROR([D-Bus configuration directory is required])
111 AC_MSG_RESULT([${path_dbusconfdir}])
113 AC_SUBST(DBUS_CONFDIR, [${path_dbusconfdir}])
115 AC_ARG_WITH([dbussystembusdir], AS_HELP_STRING([--with-dbussystembusdir=DIR],
116 [path to D-Bus system bus services directory]),
117 [path_dbussystembusdir=${withval}])
118 if (test -z "${path_dbussystembusdir}"); then
119 AC_MSG_CHECKING([D-Bus system bus services dir])
120 path_dbussystembusdir="`$PKG_CONFIG --variable=system_bus_services_dir dbus-1`"
121 if (test -z "${path_dbussystembusdir}"); then
122 AC_MSG_ERROR([D-Bus system bus services directory is required])
124 AC_MSG_RESULT([${path_dbussystembusdir}])
126 AC_SUBST(DBUS_SYSTEMBUSDIR, [${path_dbussystembusdir}])
128 AC_ARG_WITH([dbussessionbusdir], AS_HELP_STRING([--with-dbussessionbusdir=DIR],
129 [path to D-Bus session bus services directory]),
130 [path_dbussessionbusdir=${withval}])
131 if (test -z "${path_dbussessionbusdir}"); then
132 AC_MSG_CHECKING([D-Bus session bus services dir])
133 path_dbussessionbusdir="`$PKG_CONFIG --variable=session_bus_services_dir dbus-1`"
134 if (test -z "${path_dbussessionbusdir}"); then
135 AC_MSG_ERROR([D-Bus session bus services directory is required])
137 AC_MSG_RESULT([${path_dbussessionbusdir}])
139 AC_SUBST(DBUS_SESSIONBUSDIR, [${path_dbussessionbusdir}])
141 AC_ARG_ENABLE(backtrace, AS_HELP_STRING([--enable-backtrace],
142 [compile backtrace support]), [enable_backtrace=${enableval}])
144 if (test "${enable_backtrace}" = "yes"); then
145 AC_CHECK_HEADER(elfutils/libdwfl.h, dummy=yes,
146 AC_MSG_ERROR(elfutils support is required))
147 AC_DEFINE(HAVE_BACKTRACE_SUPPORT, 1,
148 [Define to 1 if you have the backtrace support.])
150 BACKTRACE_LIBS="-ldw"
151 AC_SUBST(BACKTRACE_CFLAGS)
152 AC_SUBST(BACKTRACE_LIBS)
155 AC_ARG_ENABLE(library, AS_HELP_STRING([--enable-library],
156 [install Bluetooth library]), [enable_library=${enableval}])
157 AM_CONDITIONAL(LIBRARY, test "${enable_library}" = "yes")
159 AC_ARG_ENABLE(test, AS_HELP_STRING([--enable-test],
160 [enable test/example scripts]), [enable_test=${enableval}])
161 AM_CONDITIONAL(TEST, test "${enable_test}" = "yes")
163 AC_ARG_ENABLE(nfc, AS_HELP_STRING([--enable-nfc],
164 [enable TIZEN_NFC_PLUGIN paring]), [enable_nfc=${enableval}])
165 AM_CONDITIONAL(TIZEN_NFC_PLUGIN, test "${enable_nfc}" = "yes")
167 AC_ARG_ENABLE(bap, AS_HELP_STRING([--disable-bap],
168 [disable BAP profile]), [enable_bap=${enableval}])
169 AM_CONDITIONAL(BAP, test "${enable_bap}" != "no")
171 AC_ARG_ENABLE(bass, AS_HELP_STRING([--disable-bass],
172 [disable BASS service]), [enable_bass=${enableval}])
173 AM_CONDITIONAL(BASS, test "${enable_bass}" != "no")
175 AC_ARG_ENABLE(vcp, AS_HELP_STRING([--disable-vcp],
176 [disable VCP profile]), [enable_vcp=${enableval}])
177 AM_CONDITIONAL(VCP, test "${enable_vcp}" != "no")
179 AC_ARG_ENABLE(csip, AS_HELP_STRING([--disable-csip],
180 [disable CSIP profile]), [enable_csip=${enableval}])
181 AM_CONDITIONAL(CSIP, test "${enable_csip}" != "no")
183 AC_ARG_ENABLE(tools, AS_HELP_STRING([--disable-tools],
184 [disable Bluetooth tools]), [enable_tools=${enableval}])
185 AM_CONDITIONAL(TOOLS, test "${enable_tools}" != "no")
187 AC_ARG_ENABLE(monitor, AS_HELP_STRING([--disable-monitor],
188 [disable Bluetooth monitor]), [enable_monitor=${enableval}])
189 AM_CONDITIONAL(MONITOR, test "${enable_monitor}" != "no")
191 AC_ARG_ENABLE(udev, AS_HELP_STRING([--disable-udev],
192 [disable udev device support]), [enable_udev=${enableval}])
193 if (test "${enable_tools}" != "no" && test "${enable_udev}" != "no"); then
194 PKG_CHECK_MODULES(UDEV, libudev >= 172, dummy=yes,
195 AC_MSG_ERROR(libudev >= 172 is required))
196 AC_SUBST(UDEV_CFLAGS)
198 AC_CHECK_LIB(udev, udev_hwdb_new,
199 AC_DEFINE(HAVE_UDEV_HWDB_NEW, 1,
200 [Define to 1 if you have the udev_hwdb_new() function.]))
202 AM_CONDITIONAL(UDEV, test "${enable_udev}" != "no")
204 AC_ARG_WITH([udevdir], AS_HELP_STRING([--with-udevdir=DIR],
205 [path to udev directory]), [path_udevdir=${withval}])
206 if (test "${enable_udev}" != "no" && test -z "${path_udevdir}"); then
207 AC_MSG_CHECKING([udev directory])
208 path_udevdir="`$PKG_CONFIG --variable=udevdir udev`"
209 if (test -z "${path_udevdir}"); then
210 AC_MSG_ERROR([udev directory is required])
212 AC_MSG_RESULT([${path_udevdir}])
214 AC_SUBST(UDEV_DIR, [${path_udevdir}])
216 AC_ARG_ENABLE(cups, AS_HELP_STRING([--disable-cups],
217 [disable CUPS printer support]), [enable_cups=${enableval}])
218 AM_CONDITIONAL(CUPS, test "${enable_cups}" != "no")
220 AC_ARG_ENABLE(mesh, AS_HELP_STRING([--enable-mesh],
221 [enable Mesh profile support]), [enable_mesh=${enableval}])
222 AM_CONDITIONAL(MESH, test "${enable_mesh}" = "yes")
224 if (test "${enable_mesh}" == "yes"); then
225 PKG_CHECK_MODULES(JSONC, json-c >= 0.13, dummy=yes,
226 AC_MSG_ERROR(json-c >= 0.13 is required))
227 AC_SUBST(JSON_CFLAGS)
231 AC_ARG_ENABLE(midi, AS_HELP_STRING([--enable-midi],
232 [enable MIDI support]), [enable_midi=${enableval}])
233 AM_CONDITIONAL(MIDI, test "${enable_midi}" = "yes")
235 if (test "${enable_midi}" = "yes"); then
236 PKG_CHECK_MODULES(ALSA, alsa, dummy=yes,
237 AC_MSG_ERROR(ALSA lib is required for MIDI support))
238 AC_SUBST(ALSA_CFLAGS)
243 AC_ARG_ENABLE(obex, AS_HELP_STRING([--disable-obex],
244 [disable OBEX profile support]), [enable_obex=${enableval}])
246 AC_SUBST(ICAL_CFLAGS)
249 AM_CONDITIONAL(OBEX, test "${enable_obex}" != "no")
251 AC_ARG_ENABLE(btpclient, AS_HELP_STRING([--enable-btpclient],
252 [enable BTP client]), [enable_btpclient=${enableval}])
253 AM_CONDITIONAL(BTPCLIENT, test "${enable_btpclient}" = "yes")
255 AC_ARG_ENABLE([external_ell], AS_HELP_STRING([--enable-external-ell],
256 [enable external Embedded Linux library]),
257 [enable_external_ell=${enableval}])
258 if (test "${enable_external_ell}" = "yes"); then
259 PKG_CHECK_MODULES(ELL, ell >= 0.28, dummy=yes,
260 AC_MSG_ERROR(Embedded Linux library >= 0.28 is required))
264 if (test "${enable_external_ell}" != "yes"); then
265 if (test ! -f ${srcdir}/ell/ell.h) &&
266 (test ! -f ${srcdir}/../ell/ell/ell.h); then
267 AC_MSG_ERROR(ELL source is required or use --enable-external-ell)
270 AM_CONDITIONAL(EXTERNAL_ELL, test "${enable_external_ell}" = "yes" ||
271 (test "${enable_btpclient}" != "yes" &&
272 test "${enable_mesh}" != "yes"))
273 AM_CONDITIONAL(LIBSHARED_ELL, test "${enable_btpclient}" = "yes" ||
274 test "${enable_mesh}" = "yes")
276 AC_ARG_ENABLE(client, AS_HELP_STRING([--disable-client],
277 [disable command line client]), [enable_client=${enableval}])
278 AM_CONDITIONAL(CLIENT, test "${enable_client}" != "no")
280 if (test "${enable_client}" != "no" || test "${enable_mesh}" == "yes"); then
281 AC_CHECK_HEADERS(readline/readline.h, enable_readline=yes,
282 AC_MSG_ERROR(readline header files are required))
284 AM_CONDITIONAL(READLINE, test "${enable_readline}" = "yes")
286 AC_ARG_ENABLE(systemd, AS_HELP_STRING([--disable-systemd],
287 [disable systemd integration]), [enable_systemd=${enableval}])
288 AM_CONDITIONAL(SYSTEMD, test "${enable_systemd}" != "no")
290 AC_ARG_WITH([systemdsystemunitdir],
291 AS_HELP_STRING([--with-systemdsystemunitdir=DIR],
292 [path to systemd system unit directory]),
293 [path_systemunitdir=${withval}])
294 if (test "${enable_systemd}" != "no" && test -z "${path_systemunitdir}"); then
295 AC_MSG_CHECKING([systemd system unit dir])
296 path_systemunitdir="`$PKG_CONFIG --variable=systemdsystemunitdir systemd`"
297 if (test -z "${path_systemunitdir}"); then
298 AC_MSG_ERROR([systemd system unit directory is required])
300 AC_MSG_RESULT([${path_systemunitdir}])
302 AC_SUBST(SYSTEMD_SYSTEMUNITDIR, [${path_systemunitdir}])
304 AC_ARG_WITH([systemduserunitdir],
305 AS_HELP_STRING([--with-systemduserunitdir=DIR],
306 [path to systemd user unit directory]),
307 [path_userunitdir=${withval}])
308 if (test "${enable_systemd}" != "no" && test -z "${path_userunitdir}"); then
309 AC_MSG_CHECKING([systemd user unit dir])
310 path_userunitdir="`$PKG_CONFIG --variable=systemduserunitdir systemd`"
311 if (test -z "${path_userunitdir}"); then
312 AC_MSG_ERROR([systemd user unit directory is required])
314 AC_MSG_RESULT([${path_userunitdir}])
316 AC_SUBST(SYSTEMD_USERUNITDIR, [${path_userunitdir}])
318 AC_ARG_ENABLE(datafiles, AS_HELP_STRING([--disable-datafiles],
319 [do not install configuration and data files]),
320 [enable_datafiles=${enableval}])
321 AM_CONDITIONAL(DATAFILES, test "${enable_datafiles}" != "no")
323 AC_ARG_ENABLE(manpages, AS_HELP_STRING([--enable-manpages],
324 [enable building of manual pages]),
325 [enable_manpages=${enableval}])
326 if (test "${enable_manpages}" != "no"); then
327 AC_CHECK_PROGS(RST2MAN, [rst2man rst2man.py], "no")
329 AM_CONDITIONAL(MANPAGES, test "${enable_manpages}" = "yes")
330 AM_CONDITIONAL(RUN_RST2MAN, test "${enable_manpages}" = "yes" && test "${RST2MAN}" != "no")
332 AC_ARG_ENABLE(testing, AS_HELP_STRING([--enable-testing],
333 [enable testing tools]),
334 [enable_testing=${enableval}])
335 AM_CONDITIONAL(TESTING, test "${enable_testing}" = "yes")
337 AC_ARG_ENABLE(experimental, AS_HELP_STRING([--enable-experimental],
338 [enable experimental tools]),
339 [enable_experimental=${enableval}])
340 AM_CONDITIONAL(EXPERIMENTAL, test "${enable_experimental}" = "yes")
342 # Start of TIZEN_FEATURE_BLUEZ_MODIFY
343 AC_ARG_ENABLE(wearable, AS_HELP_STRING([--enable-wearable],
344 [enable wearable profile]), [enable_wearable=${enableval}])
345 AM_CONDITIONAL(WEARABLE, test "${enable_wearable}" = "yes")
347 AC_ARG_ENABLE(autopair, AS_HELP_STRING([--enable-autopair],
348 [Enable Autopair Plugin]), [enable_autopair=${enableval}])
349 AM_CONDITIONAL(AUTOPAIR, test "${enable_autopair}" = "yes")
351 AC_ARG_ENABLE(hid, AS_HELP_STRING([--disable-hid],
352 [disable HID Plugin]), [enable_hid=${enableval}])
353 AM_CONDITIONAL(TIZEN_HID_PLUGIN, test "${enable_hid}" != "no")
355 AC_ARG_ENABLE(health, AS_HELP_STRING([--enable-health],
356 [enable HEALTH profiles]), [enable_health=${enableval}])
357 AM_CONDITIONAL(TIZEN_HEALTH_PLUGIN, test "${enable_health}" = "yes")
359 AC_ARG_ENABLE(proximity, AS_HELP_STRING([--enable-proximity],
360 [Enable PROXIMITY Plugin]), [enable_proximity=${enableval}])
361 AM_CONDITIONAL(TIZEN_PROXIMITY_PLUGIN, test "${enable_proximity}" = "yes")
363 AC_ARG_ENABLE(tds, AS_HELP_STRING([--enable-tds],
364 [Enable TDS Plugin]), [enable_tds=${enableval}])
365 AM_CONDITIONAL(TIZEN_TDS_PLUGIN, test "${enable_tds}" = "yes")
367 AC_ARG_ENABLE(tizenunusedplugin, AS_HELP_STRING([--enable-tizenunusedplugin],
368 [Enable Unused Plugin]), [enable_tizenunusedplugin=${enableval}])
369 AM_CONDITIONAL(TIZEN_UNUSED_PLUGIN, test "${enable_tizenunusedplugin}" = "yes")
371 AC_ARG_ENABLE(sap, AS_HELP_STRING([--enable-sap],
372 [Enable SAP Plugin]), [enable_sap=${enableval}])
373 AM_CONDITIONAL(TIZEN_SAP_PLUGIN, test "${enable_sap}" = "yes")
375 AC_ARG_ENABLE(a2dp, AS_HELP_STRING([--disable-a2dp],
376 [disable A2DP profile]), [enable_a2dp=${enableval}])
377 AM_CONDITIONAL(TIZEN_A2DP_PLUGIN, test "${enable_a2dp}" != "no")
379 AC_ARG_ENABLE(avrcp, AS_HELP_STRING([--disable-avrcp],
380 [disable AVRCP profile]), [enable_avrcp=${enableval}])
381 AM_CONDITIONAL(TIZEN_AVRCP_PLUGIN, test "${enable_avrcp}" != "no")
383 AC_ARG_ENABLE(network, AS--disable-hid_HELP_STRING([--disable-network],
384 [disable NETWORK profile]), [enable_network=${enableval}])
385 AM_CONDITIONAL(TIZEN_NETWORK_PLUGIN, test "${enable_network}" != "no")
387 AC_ARG_ENABLE(bredr, AS_HELP_STRING([--enable-bredr],
388 [Enable BREDR Plugin]), [enable_bredr=${enableval}])
389 AM_CONDITIONAL(TIZEN_BREDR_PLUGIN, test "${enable_bredr}" = "yes")
391 AC_ARG_ENABLE(le, AS_HELP_STRING([--enable-le],
392 [Enable LE Plugin]), [enable_le=${enableval}])
393 AM_CONDITIONAL(TIZEN_LE_PLUGIN, test "${enable_le}" = "yes")
395 AC_ARG_ENABLE(crypto-tests, AS_HELP_STRING([--disable-crypto-tests],
396 [Disable CRYPTO testcases]), [enable_crypto_tests=${enableval}])
397 AM_CONDITIONAL(TIZEN_CRYPTO_TESTS, test "${enable_crypto_tests}" != "no")
399 # End of TIZEN_FEATURE_BLUEZ_MODIFY
401 AC_ARG_ENABLE(deprecated, AS_HELP_STRING([--enable-deprecated],
402 [enable deprecated tools]),
403 [enable_deprecated=${enableval}])
404 AM_CONDITIONAL(DEPRECATED, test "${enable_deprecated}" = "yes")
406 AC_ARG_ENABLE(sixaxis, AS_HELP_STRING([--enable-sixaxis],
407 [enable sixaxis plugin]), [enable_sixaxis=${enableval}])
408 AM_CONDITIONAL(SIXAXIS, test "${enable_sixaxis}" = "yes" &&
409 test "${enable_udev}" != "no")
411 AC_ARG_ENABLE(hid2hci, AS_HELP_STRING([--enable-hid2hci],
412 [enable hid2hci tool]), [enable_hid2hci=${enableval}])
413 AM_CONDITIONAL(HID2HCI, test "${enable_hid2hci}" = "yes" &&
414 test "${enable_udev}" != "no")
416 AC_ARG_ENABLE(logger, AS_HELP_STRING([--enable-logger],
417 [enable HCI logger service]), [enable_logger=${enableval}])
418 AM_CONDITIONAL(LOGGER, test "${enable_logger}" = "yes")
420 AC_ARG_ENABLE(admin, AS_HELP_STRING([--enable-admin],
421 [enable admin policy plugin]), [enable_admin=${enableval}])
422 AM_CONDITIONAL(ADMIN, test "${enable_admin}" = "yes")
424 if (test "${prefix}" = "NONE"); then
425 dnl no prefix and no localstatedir, so default to /var
426 if (test "$localstatedir" = '${prefix}/var'); then
427 AC_SUBST([localstatedir], ['/var'])
430 prefix="${ac_default_prefix}"
433 if (test "$localstatedir" = '${prefix}/var'); then
434 storagedir="${prefix}/var/lib/bluetooth"
436 storagedir="${localstatedir}/lib/bluetooth"
438 AC_DEFINE_UNQUOTED(STORAGEDIR, "${storagedir}",
439 [Directory for the storage files])
441 if (test "$sysconfdir" = '${prefix}/etc'); then
442 configdir="${prefix}/etc/bluetooth"
444 configdir="${sysconfdir}/bluetooth"
446 AC_DEFINE_UNQUOTED(CONFIGDIR, "${configdir}",
447 [Directory for the configuration files])
448 AC_SUBST(CONFIGDIR, "${configdir}")
451 AC_DEFINE_UNQUOTED(MESH_STORAGEDIR, "${storagedir}/mesh",
452 [Directory for the mesh daemon storage files])
453 AC_SUBST(MESH_STORAGEDIR, "${storagedir}/mesh")
455 AC_ARG_ENABLE(android, AS_HELP_STRING([--enable-android],
456 [enable BlueZ for Android]),
457 [enable_android=${enableval}])
458 AM_CONDITIONAL(ANDROID, test "${enable_android}" = "yes")
460 if (test "${enable_android}" = "yes"); then
461 PKG_CHECK_MODULES(SBC, sbc >= 1.2, dummy=yes,
462 AC_MSG_ERROR(SBC library >= 1.2 is required))
467 if (test "${enable_android}" = "yes"); then
468 PKG_CHECK_MODULES(SPEEXDSP, speexdsp >= 1.2, dummy=yes,
469 AC_MSG_ERROR(SPEEXDSP library >= 1.2 is required))
470 AC_SUBST(SPEEXDSP_CFLAGS)
471 AC_SUBST(SPEEXDSP_LIBS)
474 AC_DEFINE_UNQUOTED(ANDROID_STORAGEDIR, "${storagedir}/android",
475 [Directory for the Android daemon storage files])
477 AC_CONFIG_FILES(Makefile src/bluetoothd.rst lib/bluez.pc mesh/bluetooth-meshd.rst)