blob: afcf678ad67d45eaf36fd7c7bbe5e2a5f7949a50 [file] [log] [blame]
Marcel Holtmanncf7a6432008-12-21 22:26:32 +01001AC_PREREQ(2.60)
Marcel Holtmannab8a80b2020-03-15 07:35:59 +01002AC_INIT(bluez, 5.54)
Max Krasnyansky8e9ea9b2002-05-17 01:09:28 +00003
Marcel Holtmann7ef17a92012-12-11 17:31:58 +01004AM_INIT_AUTOMAKE([foreign subdir-objects color-tests silent-rules
5 tar-pax no-dist-gzip dist-xz])
Lucas De Marchi5a1ec002013-01-03 23:21:03 -02006AC_CONFIG_HEADERS(config.h)
Max Krasnyanskya48d8b42002-03-08 21:10:06 +00007
Marcel Holtmann658d2c32009-06-30 18:39:45 -07008m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
9
Marcel Holtmann4e43f482004-04-01 23:28:53 +000010AM_MAINTAINER_MODE
11
Marcel Holtmanncc9e4e72012-12-10 21:31:55 +010012AC_PREFIX_DEFAULT(/usr/local)
Stefan Seyfrieda3af5cd2009-07-07 10:28:07 +020013
Marcel Holtmanncc9e4e72012-12-10 21:31:55 +010014PKG_PROG_PKG_CONFIG
Max Krasnyansky0a6472f2002-03-22 19:45:46 +000015
Marcel Holtmann82e9ab52008-12-23 06:04:54 +010016COMPILER_FLAGS
17
Marcel Holtmann4e43f482004-04-01 23:28:53 +000018AC_LANG_C
19
Marcel Holtmanncc9e4e72012-12-10 21:31:55 +010020AC_C_RESTRICT
21
Max Krasnyanskya48d8b42002-03-08 21:10:06 +000022AC_PROG_CC
Marcel Holtmanna5b1e3d2009-08-23 00:40:59 -070023AM_PROG_CC_C_O
Marcel Holtmann70ee4012008-06-16 00:49:28 +000024AC_PROG_CC_PIE
Manish Mandlikba781562020-12-09 10:13:09 -080025AC_PROG_CXX
Max Krasnyanskya48d8b42002-03-08 21:10:06 +000026AC_PROG_INSTALL
Marcel Holtmann33468512012-12-11 17:16:59 +010027AC_PROG_MKDIR_P
Marcel Holtmannc2052eb2003-03-31 10:05:12 +000028
Marcel Holtmann989349a2004-07-07 15:56:21 +000029m4_define([_LT_AC_TAGCONFIG], [])
Marcel Holtmann4e43f482004-04-01 23:28:53 +000030m4_ifdef([AC_LIBTOOL_TAGS], [AC_LIBTOOL_TAGS([])])
Marcel Holtmanne24ad392004-03-03 03:56:18 +000031
Marcel Holtmann93070a12005-02-10 00:21:01 +000032AC_DISABLE_STATIC
Marcel Holtmanne24ad392004-03-03 03:56:18 +000033AC_PROG_LIBTOOL
Max Krasnyanskya48d8b42002-03-08 21:10:06 +000034
Luiz Augusto von Dentz71441642014-12-15 10:28:54 -020035if (test "$USE_MAINTAINER_MODE" = "yes"); then
36 AC_CHECK_PROG(enable_coverage, [lcov], [yes], [no])
Luiz Augusto von Dentz65f10c82015-05-05 12:27:09 +030037 AC_CHECK_PROG(enable_dbus_run_session, [dbus-run-session], [yes])
Luiz Augusto von Dentza21b6612015-08-21 16:40:48 +030038 AC_CHECK_PROG(enable_valgrind, [valgrind], [yes])
39 AC_CHECK_HEADERS(valgrind/memcheck.h)
Luiz Augusto von Dentz71441642014-12-15 10:28:54 -020040fi
41AM_CONDITIONAL(COVERAGE, test "${enable_coverage}" = "yes")
Luiz Augusto von Dentz65f10c82015-05-05 12:27:09 +030042AM_CONDITIONAL(DBUS_RUN_SESSION, test "${enable_dbus_run_session}" = "yes")
Luiz Augusto von Dentza21b6612015-08-21 16:40:48 +030043AM_CONDITIONAL(VALGRIND, test "${enable_valgrind}" = "yes")
Luiz Augusto von Dentz71441642014-12-15 10:28:54 -020044
Marcel Holtmanncc9e4e72012-12-10 21:31:55 +010045MISC_FLAGS
46
47AC_ARG_ENABLE(threads, AC_HELP_STRING([--enable-threads],
48 [enable threading support]), [enable_threads=${enableval}])
49
Brian Gix713f1932019-04-01 11:45:18 -070050AC_CHECK_FUNCS(explicit_bzero)
51
Marcel Holtmanncc9e4e72012-12-10 21:31:55 +010052AC_CHECK_FUNC(signalfd, dummy=yes,
53 AC_MSG_ERROR(signalfd support is required))
54
Marcel Holtmanncfb34d22013-09-09 14:21:49 -070055AC_CHECK_LIB(rt, clock_gettime, dummy=yes,
Marcel Holtmann12c5f192013-09-02 11:25:54 -070056 AC_MSG_ERROR(realtime clock support is required))
57
58AC_CHECK_LIB(pthread, pthread_create, dummy=yes,
59 AC_MSG_ERROR(posix thread support is required))
60
Marcel Holtmann53df62e2008-10-18 19:03:30 +020061AC_CHECK_LIB(dl, dlopen, dummy=yes,
62 AC_MSG_ERROR(dynamic linking loader is required))
63
Marcel Holtmann2bc2cd62015-02-27 11:27:38 -080064AC_CHECK_HEADERS(linux/types.h linux/if_alg.h)
65
Marcel Holtmanncc9e4e72012-12-10 21:31:55 +010066PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.28, dummy=yes,
67 AC_MSG_ERROR(GLib >= 2.28 is required))
68AC_SUBST(GLIB_CFLAGS)
69AC_SUBST(GLIB_LIBS)
Marcel Holtmannde58f632004-08-12 16:03:09 +000070
Marcel Holtmanncc9e4e72012-12-10 21:31:55 +010071if (test "${enable_threads}" = "yes"); then
72 AC_DEFINE(NEED_THREADS, 1, [Define if threading support is required])
73 PKG_CHECK_MODULES(GTHREAD, gthread-2.0 >= 2.16, dummy=yes,
74 AC_MSG_ERROR(GThread >= 2.16 is required))
75 GLIB_CFLAGS="$GLIB_CFLAGS $GTHREAD_CFLAGS"
76 GLIB_LIBS="$GLIB_LIBS $GTHREAD_LIBS"
77fi
78
Szymon Janc325c0a32014-01-20 14:54:47 +010079PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.6, dummy=yes,
80 AC_MSG_ERROR(D-Bus >= 1.6 is required))
Marcel Holtmanncc9e4e72012-12-10 21:31:55 +010081AC_SUBST(DBUS_CFLAGS)
82AC_SUBST(DBUS_LIBS)
83
Marcel Holtmann68c3d4c2012-12-11 15:24:18 +010084AC_ARG_WITH([dbusconfdir], AC_HELP_STRING([--with-dbusconfdir=DIR],
85 [path to D-Bus configuration directory]),
86 [path_dbusconfdir=${withval}])
87if (test -z "${path_dbusconfdir}"); then
88 AC_MSG_CHECKING([D-Bus configuration directory])
89 path_dbusconfdir="`$PKG_CONFIG --variable=sysconfdir dbus-1`"
90 if (test -z "${path_dbusconfdir}"); then
91 AC_MSG_ERROR([D-Bus configuration directory is required])
92 fi
93 AC_MSG_RESULT([${path_dbusconfdir}])
Marcel Holtmanncc9e4e72012-12-10 21:31:55 +010094fi
Antonio Ospite5ce3ca82013-02-10 22:20:50 +010095AC_SUBST(DBUS_CONFDIR, [${path_dbusconfdir}])
Marcel Holtmannbb42dcd2004-08-12 16:00:35 +000096
Marcel Holtmanne57efd62012-12-11 17:55:24 +010097AC_ARG_WITH([dbussystembusdir], AC_HELP_STRING([--with-dbussystembusdir=DIR],
98 [path to D-Bus system bus services directory]),
99 [path_dbussystembusdir=${withval}])
100if (test -z "${path_dbussystembusdir}"); then
101 AC_MSG_CHECKING([D-Bus system bus services dir])
102 path_dbussystembusdir="`$PKG_CONFIG --variable=system_bus_services_dir dbus-1`"
Marcel Holtmannc5a7b6c2012-12-18 21:54:25 +0100103 if (test -z "${path_dbussystembusdir}"); then
Marcel Holtmanne57efd62012-12-11 17:55:24 +0100104 AC_MSG_ERROR([D-Bus system bus services directory is required])
105 fi
106 AC_MSG_RESULT([${path_dbussystembusdir}])
Marcel Holtmanne57efd62012-12-11 17:55:24 +0100107fi
Antonio Ospite5ce3ca82013-02-10 22:20:50 +0100108AC_SUBST(DBUS_SYSTEMBUSDIR, [${path_dbussystembusdir}])
Marcel Holtmanne57efd62012-12-11 17:55:24 +0100109
Marcel Holtmann2d9190d2012-12-18 21:53:30 +0100110AC_ARG_WITH([dbussessionbusdir], AC_HELP_STRING([--with-dbussessionbusdir=DIR],
111 [path to D-Bus session bus services directory]),
112 [path_dbussessionbusdir=${withval}])
113if (test -z "${path_dbussessionbusdir}"); then
114 AC_MSG_CHECKING([D-Bus session bus services dir])
115 path_dbussessionbusdir="`$PKG_CONFIG --variable=session_bus_services_dir dbus-1`"
116 if (test -z "${path_dbussessionbusdir}"); then
117 AC_MSG_ERROR([D-Bus session bus services directory is required])
118 fi
119 AC_MSG_RESULT([${path_dbussessionbusdir}])
Marcel Holtmann2d9190d2012-12-18 21:53:30 +0100120fi
Antonio Ospite5ce3ca82013-02-10 22:20:50 +0100121AC_SUBST(DBUS_SESSIONBUSDIR, [${path_dbussessionbusdir}])
Marcel Holtmann2d9190d2012-12-18 21:53:30 +0100122
Ronan Pigott3825bc72019-08-16 23:34:52 -0700123AC_ARG_WITH([zsh-completion-dir], AC_HELP_STRING([--with-zsh-completion-dir=DIR],
124 [path to install zsh completions]),
125 [path_zshcompletiondir=${withval}],
126 [path_zshcompletiondir="yes"])
127
128if (test "${path_zshcompletiondir}" = "yes"); then
129 path_zshcompletiondir="$datarootdir/zsh/site-functions"
130 AC_MSG_RESULT([${path_zshcompletiondir}])
131fi
132AC_SUBST(ZSH_COMPLETIONDIR, [${path_zshcompletiondir}])
133AM_CONDITIONAL(ZSH_COMPLETIONS, test "${path_zshcompletiondir}" != "no")
134
Marcel Holtmann16669132015-11-08 14:44:24 +0100135AC_ARG_ENABLE(backtrace, AC_HELP_STRING([--enable-backtrace],
136 [compile backtrace support]), [enable_backtrace=${enableval}])
137
138if (test "${enable_backtrace}" = "yes"); then
139 AC_CHECK_HEADER(elfutils/libdwfl.h, dummy=yes,
140 AC_MSG_ERROR(elfutils support is required))
141 AC_DEFINE(HAVE_BACKTRACE_SUPPORT, 1,
142 [Define to 1 if you have the backtrace support.])
143 BACKTRACE_CFLAGS=""
144 BACKTRACE_LIBS="-ldw"
145 AC_SUBST(BACKTRACE_CFLAGS)
146 AC_SUBST(BACKTRACE_LIBS)
147fi
148
Marcel Holtmanna66050d2012-12-10 22:34:47 +0100149AC_ARG_ENABLE(library, AC_HELP_STRING([--enable-library],
150 [install Bluetooth library]), [enable_library=${enableval}])
151AM_CONDITIONAL(LIBRARY, test "${enable_library}" = "yes")
152
Marcel Holtmanncc9e4e72012-12-10 21:31:55 +0100153AC_ARG_ENABLE(test, AC_HELP_STRING([--enable-test],
154 [enable test/example scripts]), [enable_test=${enableval}])
155AM_CONDITIONAL(TEST, test "${enable_test}" = "yes")
156
Luiz Augusto von Dentzfc0cb8a2016-11-21 11:49:31 +0200157AC_ARG_ENABLE(nfc, AC_HELP_STRING([--enable-nfc],
Luiz Augusto von Dentz26e38bb2016-11-11 16:17:18 +0200158 [enable NFC paring]), [enable_nfc=${enableval}])
159AM_CONDITIONAL(NFC, test "${enable_nfc}" = "yes")
160
Luiz Augusto von Dentzfc0cb8a2016-11-21 11:49:31 +0200161AC_ARG_ENABLE(sap, AC_HELP_STRING([--enable-sap],
Luiz Augusto von Dentz1d76b2e2016-11-11 16:25:39 +0200162 [enable SAP profile]), [enable_sap=${enableval}])
163AM_CONDITIONAL(SAP, test "${enable_sap}" = "yes")
164
Luiz Augusto von Dentzfc0cb8a2016-11-21 11:49:31 +0200165AC_ARG_ENABLE(a2dp, AC_HELP_STRING([--disable-a2dp],
Luiz Augusto von Dentz1e9ab1d2016-11-11 15:40:54 +0200166 [disable A2DP profile]), [enable_a2dp=${enableval}])
167AM_CONDITIONAL(A2DP, test "${enable_a2dp}" != "no")
168
Luiz Augusto von Dentzfc0cb8a2016-11-21 11:49:31 +0200169AC_ARG_ENABLE(avrcp, AC_HELP_STRING([--disable-avrcp],
Luiz Augusto von Dentzb5bab5e2016-11-11 15:47:25 +0200170 [disable AVRCP profile]), [enable_avrcp=${enableval}])
171AM_CONDITIONAL(AVRCP, test "${enable_avrcp}" != "no")
172
Luiz Augusto von Dentzfc0cb8a2016-11-21 11:49:31 +0200173AC_ARG_ENABLE(network, AC_HELP_STRING([--disable-network],
Luiz Augusto von Dentza9643f62016-11-11 15:52:55 +0200174 [disable network profiles]), [enable_network=${enableval}])
175AM_CONDITIONAL(NETWORK, test "${enable_network}" != "no")
176
Luiz Augusto von Dentzfc0cb8a2016-11-21 11:49:31 +0200177AC_ARG_ENABLE(hid, AC_HELP_STRING([--disable-hid],
Luiz Augusto von Dentz435b3be2016-11-11 16:02:06 +0200178 [disable HID profile]), [enable_hid=${enableval}])
179AM_CONDITIONAL(HID, test "${enable_hid}" != "no")
180
Luiz Augusto von Dentzfc0cb8a2016-11-21 11:49:31 +0200181AC_ARG_ENABLE(hog, AC_HELP_STRING([--disable-hog],
Luiz Augusto von Dentz523b6fb2016-11-11 16:05:40 +0200182 [disable HoG profile]), [enable_hog=${enableval}])
183AM_CONDITIONAL(HOG, test "${enable_hog}" != "no")
184
Luiz Augusto von Dentzfc0cb8a2016-11-21 11:49:31 +0200185AC_ARG_ENABLE(health, AC_HELP_STRING([--enable-health],
Luiz Augusto von Dentz00af1512016-11-11 16:10:10 +0200186 [enable health profiles]), [enable_health=${enableval}])
187AM_CONDITIONAL(HEALTH, test "${enable_health}" = "yes")
188
Marcel Holtmannd5553012012-12-11 01:37:52 +0100189AC_ARG_ENABLE(tools, AC_HELP_STRING([--disable-tools],
190 [disable Bluetooth tools]), [enable_tools=${enableval}])
191AM_CONDITIONAL(TOOLS, test "${enable_tools}" != "no")
Marcel Holtmanncc9e4e72012-12-10 21:31:55 +0100192
Marcel Holtmann71048982012-12-12 23:19:43 +0100193AC_ARG_ENABLE(monitor, AC_HELP_STRING([--disable-monitor],
194 [disable Bluetooth monitor]), [enable_monitor=${enableval}])
195AM_CONDITIONAL(MONITOR, test "${enable_monitor}" != "no")
196
Manish Mandlikba781562020-12-09 10:13:09 -0800197AC_ARG_ENABLE(fuzzer, AC_HELP_STRING([--enable-fuzzer],
198 [enable fuzzer]), [enable_fuzzer=${enableval}])
199AM_CONDITIONAL(FUZZER, test "${enable_fuzzer}" = "yes")
200
Marcel Holtmanncc9e4e72012-12-10 21:31:55 +0100201AC_ARG_ENABLE(udev, AC_HELP_STRING([--disable-udev],
Marcel Holtmann93a2c452012-12-10 21:56:07 +0100202 [disable udev device support]), [enable_udev=${enableval}])
Marcel Holtmannd5553012012-12-11 01:37:52 +0100203if (test "${enable_tools}" != "no" && test "${enable_udev}" != "no"); then
Antonio Ospitefbe7d522014-05-27 13:25:15 +0200204 PKG_CHECK_MODULES(UDEV, libudev >= 172, dummy=yes,
205 AC_MSG_ERROR(libudev >= 172 is required))
Antonio Ospited2aad022013-02-10 22:20:51 +0100206 AC_SUBST(UDEV_CFLAGS)
207 AC_SUBST(UDEV_LIBS)
Marcel Holtmanncc9e4e72012-12-10 21:31:55 +0100208 AC_CHECK_LIB(udev, udev_hwdb_new,
209 AC_DEFINE(HAVE_UDEV_HWDB_NEW, 1,
210 [Define to 1 if you have the udev_hwdb_new() function.]))
Marcel Holtmanncc9e4e72012-12-10 21:31:55 +0100211fi
Marcel Holtmanncc9e4e72012-12-10 21:31:55 +0100212AM_CONDITIONAL(UDEV, test "${enable_udev}" != "no")
213
Marcel Holtmanna7d4c222012-12-11 15:05:24 +0100214AC_ARG_WITH([udevdir], AC_HELP_STRING([--with-udevdir=DIR],
215 [path to udev directory]), [path_udevdir=${withval}])
216if (test "${enable_udev}" != "no" && test -z "${path_udevdir}"); then
217 AC_MSG_CHECKING([udev directory])
218 path_udevdir="`$PKG_CONFIG --variable=udevdir udev`"
219 if (test -z "${path_udevdir}"); then
Marcel Holtmannfab8ebd2012-12-11 15:26:09 +0100220 AC_MSG_ERROR([udev directory is required])
Marcel Holtmanna7d4c222012-12-11 15:05:24 +0100221 fi
222 AC_MSG_RESULT([${path_udevdir}])
Marcel Holtmanna7d4c222012-12-11 15:05:24 +0100223fi
Antonio Ospite5ce3ca82013-02-10 22:20:50 +0100224AC_SUBST(UDEV_DIR, [${path_udevdir}])
Marcel Holtmanna7d4c222012-12-11 15:05:24 +0100225
Sonny Sasaka52ef8422020-05-13 14:38:12 -0700226AC_ARG_ENABLE(hid2hci, AC_HELP_STRING([--enable-hid2hci],
227 [enable hid2hci tool]), [enable_hid2hci=${enableval}])
228AM_CONDITIONAL(HID2HCI, test "${enable_hid2hci}" = "yes" &&
Marcel Holtmann6c1dfe92013-08-28 14:15:22 -0700229 test "${enable_udev}" != "no")
Marcel Holtmann0819e1a2012-12-11 11:49:45 +0100230
231AC_ARG_ENABLE(cups, AC_HELP_STRING([--disable-cups],
232 [disable CUPS printer support]), [enable_cups=${enableval}])
233AM_CONDITIONAL(CUPS, test "${enable_cups}" != "no")
Marcel Holtmanncc9e4e72012-12-10 21:31:55 +0100234
Brian Gix2cbd0d62017-08-14 11:24:41 -0700235AC_ARG_ENABLE(mesh, AC_HELP_STRING([--enable-mesh],
236 [enable Mesh profile support]), [enable_mesh=${enableval}])
237AM_CONDITIONAL(MESH, test "${enable_mesh}" = "yes")
238
Inga Stotland0fd4b272018-08-01 11:10:58 -0700239if (test "${enable_mesh}" = "yes"); then
Inga Stotland11d7fe82019-12-20 11:13:29 -0800240 PKG_CHECK_MODULES(JSONC, json-c >= 0.13, dummy=yes,
241 AC_MSG_ERROR(json-c >= 0.13 is required))
Brian Gix2cbd0d62017-08-14 11:24:41 -0700242 AC_SUBST(JSON_CFLAGS)
243 AC_SUBST(JSON_LIBS)
244fi
245
Felipe F. Tonello5b8353e2017-01-03 17:30:06 +0000246AC_ARG_ENABLE(midi, AC_HELP_STRING([--enable-midi],
247 [enable MIDI support]), [enable_midi=${enableval}])
248AM_CONDITIONAL(MIDI, test "${enable_midi}" = "yes")
249
250if (test "${enable_midi}" = "yes"); then
251 PKG_CHECK_MODULES(ALSA, alsa, dummy=yes,
252 AC_MSG_ERROR(ALSA lib is required for MIDI support))
253 AC_SUBST(ALSA_CFLAGS)
254 AC_SUBST(ALSA_LIBS)
255fi
256
Marcel Holtmann70045972012-12-10 21:56:44 +0100257AC_ARG_ENABLE(obex, AC_HELP_STRING([--disable-obex],
258 [disable OBEX profile support]), [enable_obex=${enableval}])
259if (test "${enable_obex}" != "no"); then
260 PKG_CHECK_MODULES(ICAL, libical, dummy=yes,
261 AC_MSG_ERROR(libical is required))
Antonio Ospited2aad022013-02-10 22:20:51 +0100262 AC_SUBST(ICAL_CFLAGS)
263 AC_SUBST(ICAL_LIBS)
Marcel Holtmann70045972012-12-10 21:56:44 +0100264fi
Marcel Holtmann70045972012-12-10 21:56:44 +0100265AM_CONDITIONAL(OBEX, test "${enable_obex}" != "no")
266
Szymon Jancf68235b2017-12-07 12:43:44 +0100267AC_ARG_ENABLE(btpclient, AC_HELP_STRING([--enable-btpclient],
268 [enable BTP client]), [enable_btpclient=${enableval}])
269AM_CONDITIONAL(BTPCLIENT, test "${enable_btpclient}" = "yes")
270
Marcel Holtmann0093cd62018-12-04 16:59:01 +0100271AC_ARG_ENABLE([external_ell], AC_HELP_STRING([--enable-external-ell],
272 [enable external Embedded Linux library]),
273 [enable_external_ell=${enableval}])
274if (test "${enable_external_ell}" = "yes"); then
Marcel Holtmannab215e32020-02-14 23:24:03 +0100275 PKG_CHECK_MODULES(ELL, ell >= 0.28, dummy=yes,
276 AC_MSG_ERROR(Embedded Linux library >= 0.28 is required))
Szymon Jancf68235b2017-12-07 12:43:44 +0100277 AC_SUBST(ELL_CFLAGS)
278 AC_SUBST(ELL_LIBS)
279fi
Marcel Holtmann0093cd62018-12-04 16:59:01 +0100280AM_CONDITIONAL(EXTERNAL_ELL, test "${enable_external_ell}" = "yes" ||
281 (test "${enable_btpclient}" != "yes" &&
282 test "${enable_mesh}" != "yes"))
283AM_CONDITIONAL(LIBSHARED_ELL, test "${enable_btpclient}" = "yes" ||
284 test "${enable_mesh}" = "yes")
Szymon Jancf68235b2017-12-07 12:43:44 +0100285
Marcel Holtmann9de5c522012-12-11 01:33:53 +0100286AC_ARG_ENABLE(client, AC_HELP_STRING([--disable-client],
287 [disable command line client]), [enable_client=${enableval}])
Marcel Holtmannd4a93ca2012-12-11 22:19:13 +0100288AM_CONDITIONAL(CLIENT, test "${enable_client}" != "no")
289
Inga Stotland0fd4b272018-08-01 11:10:58 -0700290if (test "${enable_client}" != "no" || test "${enable_mesh}" = "yes"); then
Marcel Holtmannd4a93ca2012-12-11 22:19:13 +0100291 AC_CHECK_HEADERS(readline/readline.h, enable_readline=yes,
292 AC_MSG_ERROR(readline header files are required))
293fi
294AM_CONDITIONAL(READLINE, test "${enable_readline}" = "yes")
Marcel Holtmann9de5c522012-12-11 01:33:53 +0100295
Marcel Holtmannc7476c42012-12-11 14:52:23 +0100296AC_ARG_ENABLE(systemd, AC_HELP_STRING([--disable-systemd],
297 [disable systemd integration]), [enable_systemd=${enableval}])
Marcel Holtmann89e2de32012-12-11 15:09:31 +0100298AM_CONDITIONAL(SYSTEMD, test "${enable_systemd}" != "no")
299
Marcel Holtmannc7476c42012-12-11 14:52:23 +0100300AC_ARG_WITH([systemdsystemunitdir],
301 AC_HELP_STRING([--with-systemdsystemunitdir=DIR],
Marcel Holtmann89e2de32012-12-11 15:09:31 +0100302 [path to systemd system unit directory]),
Marcel Holtmannc7476c42012-12-11 14:52:23 +0100303 [path_systemunitdir=${withval}])
304if (test "${enable_systemd}" != "no" && test -z "${path_systemunitdir}"); then
Szymon Janc15c84df2013-06-01 14:49:19 +0200305 AC_MSG_CHECKING([systemd system unit dir])
Marcel Holtmannc7476c42012-12-11 14:52:23 +0100306 path_systemunitdir="`$PKG_CONFIG --variable=systemdsystemunitdir systemd`"
307 if (test -z "${path_systemunitdir}"); then
Marcel Holtmannfab8ebd2012-12-11 15:26:09 +0100308 AC_MSG_ERROR([systemd system unit directory is required])
Marcel Holtmannc7476c42012-12-11 14:52:23 +0100309 fi
310 AC_MSG_RESULT([${path_systemunitdir}])
Marcel Holtmannc7476c42012-12-11 14:52:23 +0100311fi
Antonio Ospite5ce3ca82013-02-10 22:20:50 +0100312AC_SUBST(SYSTEMD_SYSTEMUNITDIR, [${path_systemunitdir}])
Marcel Holtmann89e2de32012-12-11 15:09:31 +0100313
Marcel Holtmannc7476c42012-12-11 14:52:23 +0100314AC_ARG_WITH([systemduserunitdir],
315 AC_HELP_STRING([--with-systemduserunitdir=DIR],
Marcel Holtmann89e2de32012-12-11 15:09:31 +0100316 [path to systemd user unit directory]),
Marcel Holtmannc7476c42012-12-11 14:52:23 +0100317 [path_userunitdir=${withval}])
318if (test "${enable_systemd}" != "no" && test -z "${path_userunitdir}"); then
Szymon Janc15c84df2013-06-01 14:49:19 +0200319 AC_MSG_CHECKING([systemd user unit dir])
Marcel Holtmannc7476c42012-12-11 14:52:23 +0100320 path_userunitdir="`$PKG_CONFIG --variable=systemduserunitdir systemd`"
321 if (test -z "${path_userunitdir}"); then
Marcel Holtmannfab8ebd2012-12-11 15:26:09 +0100322 AC_MSG_ERROR([systemd user unit directory is required])
Marcel Holtmannc7476c42012-12-11 14:52:23 +0100323 fi
Marcel Holtmannc7476c42012-12-11 14:52:23 +0100324 AC_MSG_RESULT([${path_userunitdir}])
Marcel Holtmannc7476c42012-12-11 14:52:23 +0100325fi
Antonio Ospite5ce3ca82013-02-10 22:20:50 +0100326AC_SUBST(SYSTEMD_USERUNITDIR, [${path_userunitdir}])
Marcel Holtmannc7476c42012-12-11 14:52:23 +0100327
Marcel Holtmanncc9e4e72012-12-10 21:31:55 +0100328AC_ARG_ENABLE(datafiles, AC_HELP_STRING([--disable-datafiles],
329 [do not install configuration and data files]),
330 [enable_datafiles=${enableval}])
331AM_CONDITIONAL(DATAFILES, test "${enable_datafiles}" != "no")
332
Marcel Holtmann3672e432014-07-12 23:44:22 +0200333AC_ARG_ENABLE(manpages, AC_HELP_STRING([--enable-manpages],
334 [enable building of manual pages]),
335 [enable_manpages=${enableval}])
336AM_CONDITIONAL(MANPAGES, test "${enable_manpages}" = "yes")
337
Luiz Augusto von Dentzdf43b3d2017-01-04 15:24:45 +0200338AC_ARG_ENABLE(testing, AC_HELP_STRING([--enable-testing],
339 [enable testing tools]),
340 [enable_testing=${enableval}])
341AM_CONDITIONAL(TESTING, test "${enable_testing}" = "yes")
342
Marcel Holtmanncc9e4e72012-12-10 21:31:55 +0100343AC_ARG_ENABLE(experimental, AC_HELP_STRING([--enable-experimental],
Luiz Augusto von Dentz791f1812016-11-11 16:28:34 +0200344 [enable experimental tools]),
Marcel Holtmanncc9e4e72012-12-10 21:31:55 +0100345 [enable_experimental=${enableval}])
346AM_CONDITIONAL(EXPERIMENTAL, test "${enable_experimental}" = "yes")
347
Luiz Augusto von Dentz25bce132016-03-24 11:15:43 +0200348AC_ARG_ENABLE(deprecated, AC_HELP_STRING([--enable-deprecated],
Luiz Augusto von Dentzb1eb2c42017-01-04 14:23:58 +0200349 [enable deprecated tools]),
Luiz Augusto von Dentz25bce132016-03-24 11:15:43 +0200350 [enable_deprecated=${enableval}])
351AM_CONDITIONAL(DEPRECATED, test "${enable_deprecated}" = "yes")
352
Szymon Jancf52aa872013-11-25 22:15:48 +0000353AC_ARG_ENABLE(sixaxis, AC_HELP_STRING([--enable-sixaxis],
354 [enable sixaxis plugin]), [enable_sixaxis=${enableval}])
355AM_CONDITIONAL(SIXAXIS, test "${enable_sixaxis}" = "yes" &&
356 test "${enable_udev}" != "no")
357
Szymon Janc07384fa2018-01-19 16:23:20 +0100358AC_ARG_ENABLE(logger, AC_HELP_STRING([--enable-logger],
359 [enable HCI logger service]), [enable_logger=${enableval}])
360AM_CONDITIONAL(LOGGER, test "${enable_logger}" = "yes")
361
Marcel Holtmanncc9e4e72012-12-10 21:31:55 +0100362if (test "${prefix}" = "NONE"); then
363 dnl no prefix and no localstatedir, so default to /var
364 if (test "$localstatedir" = '${prefix}/var'); then
365 AC_SUBST([localstatedir], ['/var'])
366 fi
367
368 prefix="${ac_default_prefix}"
369fi
370
371if (test "$localstatedir" = '${prefix}/var'); then
372 storagedir="${prefix}/var/lib/bluetooth"
373else
374 storagedir="${localstatedir}/lib/bluetooth"
375fi
376AC_DEFINE_UNQUOTED(STORAGEDIR, "${storagedir}",
377 [Directory for the storage files])
378
379if (test "$sysconfdir" = '${prefix}/etc'); then
380 configdir="${prefix}/etc/bluetooth"
381else
382 configdir="${sysconfdir}/bluetooth"
383fi
384AC_DEFINE_UNQUOTED(CONFIGDIR, "${configdir}",
385 [Directory for the configuration files])
Szymon Jancc8e79a72013-05-31 00:01:55 +0200386AC_SUBST(CONFIGDIR, "${configdir}")
Marcel Holtmanncc9e4e72012-12-10 21:31:55 +0100387
Inga Stotlanda90b6412018-12-14 14:09:20 -0800388AC_DEFINE_UNQUOTED(MESH_STORAGEDIR, "${storagedir}/mesh",
389 [Directory for the mesh daemon storage files])
390
Frederic Daniscd402b02013-10-04 14:48:43 +0300391AC_ARG_ENABLE(android, AC_HELP_STRING([--enable-android],
392 [enable BlueZ for Android]),
393 [enable_android=${enableval}])
394AM_CONDITIONAL(ANDROID, test "${enable_android}" = "yes")
395
Andrzej Kaczmarek68141f02014-01-22 11:34:45 +0100396if (test "${enable_android}" = "yes"); then
397 PKG_CHECK_MODULES(SBC, sbc >= 1.2, dummy=yes,
398 AC_MSG_ERROR(SBC library >= 1.2 is required))
399 AC_SUBST(SBC_CFLAGS)
400 AC_SUBST(SBC_LIBS)
401fi
402
Andrei Emeltchenkof5ae98b2014-05-12 11:57:05 +0300403if (test "${enable_android}" = "yes"); then
404 PKG_CHECK_MODULES(SPEEXDSP, speexdsp >= 1.2, dummy=yes,
405 AC_MSG_ERROR(SPEEXDSP library >= 1.2 is required))
406 AC_SUBST(SPEEXDSP_CFLAGS)
407 AC_SUBST(SPEEXDSP_LIBS)
408fi
409
Szymon Janc316d0ee2013-12-19 13:38:29 +0100410AC_DEFINE_UNQUOTED(ANDROID_STORAGEDIR, "${storagedir}/android",
411 [Directory for the Android daemon storage files])
412
Marcel Holtmann55bf3402012-12-19 18:24:43 +0100413AC_OUTPUT(Makefile src/bluetoothd.8 lib/bluez.pc)