mesh: Move SEQ_MASK define in mesh-defs.h
[platform/upstream/bluez.git] / configure.ac
1 AC_PREREQ(2.60)
2 AC_INIT(bluez, 5.52)
3
4 AM_INIT_AUTOMAKE([foreign subdir-objects color-tests silent-rules
5                                         tar-pax no-dist-gzip dist-xz])
6 AC_CONFIG_HEADERS(config.h)
7 AC_USE_SYSTEM_EXTENSIONS
8
9 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
10
11 AM_MAINTAINER_MODE
12
13 AC_PREFIX_DEFAULT(/usr/local)
14
15 PKG_PROG_PKG_CONFIG
16
17 COMPILER_FLAGS
18
19 AC_LANG_C
20
21 AC_C_RESTRICT
22
23 AC_PROG_CC
24 AM_PROG_CC_C_O
25 AC_PROG_CC_PIE
26 AC_PROG_INSTALL
27 AC_PROG_MKDIR_P
28
29 m4_define([_LT_AC_TAGCONFIG], [])
30 m4_ifdef([AC_LIBTOOL_TAGS], [AC_LIBTOOL_TAGS([])])
31
32 AC_DISABLE_STATIC
33 AC_PROG_LIBTOOL
34
35 if (test "$USE_MAINTAINER_MODE" = "yes"); then
36         AC_CHECK_PROG(enable_coverage, [lcov], [yes], [no])
37         AC_CHECK_PROG(enable_dbus_run_session, [dbus-run-session], [yes])
38         AC_CHECK_PROG(enable_valgrind, [valgrind], [yes])
39         AC_CHECK_HEADERS(valgrind/memcheck.h)
40 fi
41 AM_CONDITIONAL(COVERAGE, test "${enable_coverage}" = "yes")
42 AM_CONDITIONAL(DBUS_RUN_SESSION, test "${enable_dbus_run_session}" = "yes")
43 AM_CONDITIONAL(VALGRIND, test "${enable_valgrind}" = "yes")
44
45 MISC_FLAGS
46
47 AC_ARG_ENABLE(threads, AC_HELP_STRING([--enable-threads],
48                 [enable threading support]), [enable_threads=${enableval}])
49
50 AC_CHECK_FUNCS(explicit_bzero)
51
52 AC_CHECK_FUNC(signalfd, dummy=yes,
53                         AC_MSG_ERROR(signalfd support is required))
54
55 AC_CHECK_LIB(rt, clock_gettime, dummy=yes,
56                         AC_MSG_ERROR(realtime clock support is required))
57
58 AC_CHECK_LIB(pthread, pthread_create, dummy=yes,
59                         AC_MSG_ERROR(posix thread support is required))
60
61 AC_CHECK_LIB(dl, dlopen, dummy=yes,
62                         AC_MSG_ERROR(dynamic linking loader is required))
63
64 AC_CHECK_HEADERS(linux/types.h linux/if_alg.h)
65
66 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.28, dummy=yes,
67                                 AC_MSG_ERROR(GLib >= 2.28 is required))
68 AC_SUBST(GLIB_CFLAGS)
69 AC_SUBST(GLIB_LIBS)
70
71 if (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"
77 fi
78
79 PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.6, dummy=yes,
80                                 AC_MSG_ERROR(D-Bus >= 1.6 is required))
81 AC_SUBST(DBUS_CFLAGS)
82 AC_SUBST(DBUS_LIBS)
83
84 PKG_CHECK_MODULES(LIBXML, libxml-2.0)
85 AC_SUBST(LIBXML_CFLAGS)
86 AC_SUBST(LIBXML_LIBS)
87
88 PKG_CHECK_MODULES(INIPARSER, iniparser)
89 AC_SUBST(INIPARSER_CFLAGS)
90 AC_SUBST(INIPARSER_LIBS)
91
92 AC_ARG_WITH([dbusconfdir], AC_HELP_STRING([--with-dbusconfdir=DIR],
93                                 [path to D-Bus configuration directory]),
94                                         [path_dbusconfdir=${withval}])
95 if (test -z "${path_dbusconfdir}"); then
96         AC_MSG_CHECKING([D-Bus configuration directory])
97         path_dbusconfdir="`$PKG_CONFIG --variable=sysconfdir dbus-1`"
98         if (test -z "${path_dbusconfdir}"); then
99                 AC_MSG_ERROR([D-Bus configuration directory is required])
100         fi
101         AC_MSG_RESULT([${path_dbusconfdir}])
102 fi
103 AC_SUBST(DBUS_CONFDIR, [${path_dbusconfdir}])
104
105 AC_ARG_WITH([dbussystembusdir], AC_HELP_STRING([--with-dbussystembusdir=DIR],
106                                 [path to D-Bus system bus services directory]),
107                                         [path_dbussystembusdir=${withval}])
108 if (test -z "${path_dbussystembusdir}"); then
109         AC_MSG_CHECKING([D-Bus system bus services dir])
110         path_dbussystembusdir="`$PKG_CONFIG --variable=system_bus_services_dir dbus-1`"
111         if (test -z "${path_dbussystembusdir}"); then
112                 AC_MSG_ERROR([D-Bus system bus services directory is required])
113         fi
114         AC_MSG_RESULT([${path_dbussystembusdir}])
115 fi
116 AC_SUBST(DBUS_SYSTEMBUSDIR, [${path_dbussystembusdir}])
117
118 AC_ARG_WITH([dbussessionbusdir], AC_HELP_STRING([--with-dbussessionbusdir=DIR],
119                                 [path to D-Bus session bus services directory]),
120                                         [path_dbussessionbusdir=${withval}])
121 if (test -z "${path_dbussessionbusdir}"); then
122         AC_MSG_CHECKING([D-Bus session bus services dir])
123         path_dbussessionbusdir="`$PKG_CONFIG --variable=session_bus_services_dir dbus-1`"
124         if (test -z "${path_dbussessionbusdir}"); then
125                 AC_MSG_ERROR([D-Bus session bus services directory is required])
126         fi
127         AC_MSG_RESULT([${path_dbussessionbusdir}])
128 fi
129 AC_SUBST(DBUS_SESSIONBUSDIR, [${path_dbussessionbusdir}])
130
131 AC_ARG_ENABLE(backtrace, AC_HELP_STRING([--enable-backtrace],
132                 [compile backtrace support]), [enable_backtrace=${enableval}])
133
134 if (test "${enable_backtrace}" = "yes"); then
135         AC_CHECK_HEADER(elfutils/libdwfl.h, dummy=yes,
136                         AC_MSG_ERROR(elfutils support is required))
137         AC_DEFINE(HAVE_BACKTRACE_SUPPORT, 1,
138                         [Define to 1 if you have the backtrace support.])
139         BACKTRACE_CFLAGS=""
140         BACKTRACE_LIBS="-ldw"
141         AC_SUBST(BACKTRACE_CFLAGS)
142         AC_SUBST(BACKTRACE_LIBS)
143 fi
144
145 AC_ARG_ENABLE(library, AC_HELP_STRING([--enable-library],
146                 [install Bluetooth library]), [enable_library=${enableval}])
147 AM_CONDITIONAL(LIBRARY, test "${enable_library}" = "yes")
148
149 AC_ARG_ENABLE(test, AC_HELP_STRING([--enable-test],
150                 [enable test/example scripts]), [enable_test=${enableval}])
151 AM_CONDITIONAL(TEST, test "${enable_test}" = "yes")
152
153 AC_ARG_ENABLE(nfc, AC_HELP_STRING([--enable-nfc],
154                 [enable TIZEN_NFC_PLUGIN paring]), [enable_nfc=${enableval}])
155 AM_CONDITIONAL(TIZEN_NFC_PLUGIN, test "${enable_nfc}" = "yes")
156
157 AC_ARG_ENABLE(tools, AC_HELP_STRING([--disable-tools],
158                 [disable Bluetooth tools]), [enable_tools=${enableval}])
159 AM_CONDITIONAL(TOOLS, test "${enable_tools}" != "no")
160
161 AC_ARG_ENABLE(monitor, AC_HELP_STRING([--disable-monitor],
162                 [disable Bluetooth monitor]), [enable_monitor=${enableval}])
163 AM_CONDITIONAL(MONITOR, test "${enable_monitor}" != "no")
164
165 AC_ARG_ENABLE(udev, AC_HELP_STRING([--disable-udev],
166                 [disable udev device support]), [enable_udev=${enableval}])
167 if (test "${enable_tools}" != "no" && test "${enable_udev}" != "no"); then
168         PKG_CHECK_MODULES(UDEV, libudev >= 172, dummy=yes,
169                                 AC_MSG_ERROR(libudev >= 172 is required))
170         AC_SUBST(UDEV_CFLAGS)
171         AC_SUBST(UDEV_LIBS)
172         AC_CHECK_LIB(udev, udev_hwdb_new,
173                 AC_DEFINE(HAVE_UDEV_HWDB_NEW, 1,
174                         [Define to 1 if you have the udev_hwdb_new() function.]))
175 fi
176 AM_CONDITIONAL(UDEV, test "${enable_udev}" != "no")
177
178 AC_ARG_WITH([udevdir], AC_HELP_STRING([--with-udevdir=DIR],
179                         [path to udev directory]), [path_udevdir=${withval}])
180 if (test "${enable_udev}" != "no" && test -z "${path_udevdir}"); then
181         AC_MSG_CHECKING([udev directory])
182         path_udevdir="`$PKG_CONFIG --variable=udevdir udev`"
183         if (test -z "${path_udevdir}"); then
184                 AC_MSG_ERROR([udev directory is required])
185         fi
186         AC_MSG_RESULT([${path_udevdir}])
187 fi
188 AC_SUBST(UDEV_DIR, [${path_udevdir}])
189
190 AM_CONDITIONAL(HID2HCI, test "${enable_tools}" != "no" &&
191                                                 test "${enable_udev}" != "no")
192
193 AC_ARG_ENABLE(cups, AC_HELP_STRING([--disable-cups],
194                 [disable CUPS printer support]), [enable_cups=${enableval}])
195 AM_CONDITIONAL(CUPS, test "${enable_cups}" != "no")
196
197 AC_ARG_ENABLE(mesh, AC_HELP_STRING([--enable-mesh],
198                 [enable Mesh profile support]), [enable_mesh=${enableval}])
199 AM_CONDITIONAL(MESH, test "${enable_mesh}" = "yes")
200
201 if (test "${enable_mesh}" == "yes"); then
202         PKG_CHECK_MODULES(JSONC, json-c >= 0.13, dummy=yes,
203                                 AC_MSG_ERROR(json-c >= 0.13 is required))
204         AC_SUBST(JSON_CFLAGS)
205         AC_SUBST(JSON_LIBS)
206 fi
207
208 AC_ARG_ENABLE(midi, AC_HELP_STRING([--enable-midi],
209                 [enable MIDI support]), [enable_midi=${enableval}])
210 AM_CONDITIONAL(MIDI, test "${enable_midi}" = "yes")
211
212 if (test "${enable_midi}" = "yes"); then
213         PKG_CHECK_MODULES(ALSA, alsa, dummy=yes,
214                                 AC_MSG_ERROR(ALSA lib is required for MIDI support))
215         AC_SUBST(ALSA_CFLAGS)
216         AC_SUBST(ALSA_LIBS)
217 fi
218
219
220 AC_ARG_ENABLE(obex, AC_HELP_STRING([--disable-obex],
221                 [disable OBEX profile support]), [enable_obex=${enableval}])
222
223 AC_SUBST(ICAL_CFLAGS)
224 AC_SUBST(ICAL_LIBS)
225
226 AM_CONDITIONAL(OBEX, test "${enable_obex}" != "no")
227
228 AC_ARG_ENABLE(btpclient, AC_HELP_STRING([--enable-btpclient],
229                 [enable BTP client]), [enable_btpclient=${enableval}])
230 AM_CONDITIONAL(BTPCLIENT, test "${enable_btpclient}" = "yes")
231
232 AC_ARG_ENABLE([external_ell], AC_HELP_STRING([--enable-external-ell],
233                                 [enable external Embedded Linux library]),
234                                         [enable_external_ell=${enableval}])
235 if (test "${enable_external_ell}" = "yes"); then
236         PKG_CHECK_MODULES(ELL, ell >= 0.26, dummy=yes,
237                 AC_MSG_ERROR(Embedded Linux library >= 0.26 is required))
238         AC_SUBST(ELL_CFLAGS)
239         AC_SUBST(ELL_LIBS)
240 fi
241 AM_CONDITIONAL(EXTERNAL_ELL, test "${enable_external_ell}" = "yes" ||
242                                 (test "${enable_btpclient}" != "yes" &&
243                                                 test "${enable_mesh}" != "yes"))
244 AM_CONDITIONAL(LIBSHARED_ELL, test "${enable_btpclient}" = "yes" ||
245                                                 test "${enable_mesh}" = "yes")
246
247 AC_ARG_ENABLE(client, AC_HELP_STRING([--disable-client],
248                 [disable command line client]), [enable_client=${enableval}])
249 AM_CONDITIONAL(CLIENT, test "${enable_client}" != "no")
250
251 if (test "${enable_client}" != "no" || test "${enable_mesh}" == "yes"); then
252         AC_CHECK_HEADERS(readline/readline.h, enable_readline=yes,
253                 AC_MSG_ERROR(readline header files are required))
254 fi
255 AM_CONDITIONAL(READLINE, test "${enable_readline}" = "yes")
256
257 AC_ARG_ENABLE(systemd, AC_HELP_STRING([--disable-systemd],
258                 [disable systemd integration]), [enable_systemd=${enableval}])
259 AM_CONDITIONAL(SYSTEMD, test "${enable_systemd}" != "no")
260
261 AC_ARG_WITH([systemdsystemunitdir],
262                         AC_HELP_STRING([--with-systemdsystemunitdir=DIR],
263                         [path to systemd system unit directory]),
264                                         [path_systemunitdir=${withval}])
265 if (test "${enable_systemd}" != "no" && test -z "${path_systemunitdir}"); then
266         AC_MSG_CHECKING([systemd system unit dir])
267         path_systemunitdir="`$PKG_CONFIG --variable=systemdsystemunitdir systemd`"
268         if (test -z "${path_systemunitdir}"); then
269                 AC_MSG_ERROR([systemd system unit directory is required])
270         fi
271         AC_MSG_RESULT([${path_systemunitdir}])
272 fi
273 AC_SUBST(SYSTEMD_SYSTEMUNITDIR, [${path_systemunitdir}])
274
275 AC_ARG_WITH([systemduserunitdir],
276                         AC_HELP_STRING([--with-systemduserunitdir=DIR],
277                         [path to systemd user unit directory]),
278                                         [path_userunitdir=${withval}])
279 if (test "${enable_systemd}" != "no" && test -z "${path_userunitdir}"); then
280         AC_MSG_CHECKING([systemd user unit dir])
281         path_userunitdir="`$PKG_CONFIG --variable=systemduserunitdir systemd`"
282         if (test -z "${path_userunitdir}"); then
283                 AC_MSG_ERROR([systemd user unit directory is required])
284         fi
285         AC_MSG_RESULT([${path_userunitdir}])
286 fi
287 AC_SUBST(SYSTEMD_USERUNITDIR, [${path_userunitdir}])
288
289 AC_ARG_ENABLE(datafiles, AC_HELP_STRING([--disable-datafiles],
290                         [do not install configuration and data files]),
291                                         [enable_datafiles=${enableval}])
292 AM_CONDITIONAL(DATAFILES, test "${enable_datafiles}" != "no")
293
294 AC_ARG_ENABLE(manpages, AC_HELP_STRING([--enable-manpages],
295                         [enable building of manual pages]),
296                                         [enable_manpages=${enableval}])
297 AM_CONDITIONAL(MANPAGES, test "${enable_manpages}" = "yes")
298
299 AC_ARG_ENABLE(testing, AC_HELP_STRING([--enable-testing],
300                         [enable testing tools]),
301                                         [enable_testing=${enableval}])
302 AM_CONDITIONAL(TESTING, test "${enable_testing}" = "yes")
303
304 AC_ARG_ENABLE(experimental, AC_HELP_STRING([--enable-experimental],
305                         [enable experimental tools]),
306                                         [enable_experimental=${enableval}])
307 AM_CONDITIONAL(EXPERIMENTAL, test "${enable_experimental}" = "yes")
308
309 # Start of TIZEN_FEATURE_BLUEZ_MODIFY
310 AC_ARG_ENABLE(wearable, AC_HELP_STRING([--enable-wearable],
311                         [enable wearable profile]), [enable_wearable=${enableval}])
312 AM_CONDITIONAL(WEARABLE, test "${enable_wearable}" = "yes")
313
314 AC_ARG_ENABLE(autopair, AC_HELP_STRING([--enable-autopair],
315                         [Enable Autopair Plugin]), [enable_autopair=${enableval}])
316 AM_CONDITIONAL(AUTOPAIR, test "${enable_autopair}" = "yes")
317
318 AC_ARG_ENABLE(hid, AC_HELP_STRING([--disable-hid],
319                         [disable HID Plugin]), [enable_hid=${enableval}])
320 AM_CONDITIONAL(TIZEN_HID_PLUGIN, test "${enable_hid}" != "no")
321
322 AC_ARG_ENABLE(health, AC_HELP_STRING([--enable-health],
323                 [enable HEALTH profiles]), [enable_health=${enableval}])
324 AM_CONDITIONAL(TIZEN_HEALTH_PLUGIN, test "${enable_health}" = "yes")
325
326 AC_ARG_ENABLE(proximity, AC_HELP_STRING([--enable-proximity],
327                   [Enable PROXIMITY Plugin]), [enable_proximity=${enableval}])
328 AM_CONDITIONAL(TIZEN_PROXIMITY_PLUGIN, test "${enable_proximity}" = "yes")
329
330 AC_ARG_ENABLE(tds, AC_HELP_STRING([--enable-tds],
331                   [Enable TDS Plugin]), [enable_tds=${enableval}])
332 AM_CONDITIONAL(TIZEN_TDS_PLUGIN, test "${enable_tds}" = "yes")
333
334 AC_ARG_ENABLE(tizenunusedplugin, AC_HELP_STRING([--enable-tizenunusedplugin],
335                 [Enable Unused Plugin]), [enable_tizenunusedplugin=${enableval}])
336 AM_CONDITIONAL(TIZEN_UNUSED_PLUGIN, test "${enable_tizenunusedplugin}" = "yes")
337
338 AC_ARG_ENABLE(sap, AC_HELP_STRING([--enable-sap],
339                         [Enable SAP Plugin]), [enable_sap=${enableval}])
340 AM_CONDITIONAL(TIZEN_SAP_PLUGIN, test "${enable_sap}" = "yes")
341
342 AC_ARG_ENABLE(a2dp, AC_HELP_STRING([--disable-a2dp],
343                 [disable A2DP profile]), [enable_a2dp=${enableval}])
344 AM_CONDITIONAL(TIZEN_A2DP_PLUGIN, test "${enable_a2dp}" != "no")
345
346 AC_ARG_ENABLE(avrcp, AC_HELP_STRING([--disable-avrcp],
347                 [disable AVRCP profile]), [enable_avrcp=${enableval}])
348 AM_CONDITIONAL(TIZEN_AVRCP_PLUGIN, test "${enable_avrcp}" != "no")
349
350 AC_ARG_ENABLE(network, AC_HELP_STRING([--disable-network],
351                 [disable NETWORK profile]), [enable_network=${enableval}])
352 AM_CONDITIONAL(TIZEN_NETWORK_PLUGIN, test "${enable_network}" != "no")
353
354 AC_ARG_ENABLE(bredr, AC_HELP_STRING([--enable-bredr],
355                         [Enable BREDR Plugin]), [enable_bredr=${enableval}])
356 AM_CONDITIONAL(TIZEN_BREDR_PLUGIN, test "${enable_bredr}" = "yes")
357
358 AC_ARG_ENABLE(le, AC_HELP_STRING([--enable-le],
359                         [Enable LE Plugin]), [enable_le=${enableval}])
360 AM_CONDITIONAL(TIZEN_LE_PLUGIN, test "${enable_le}" = "yes")
361
362 AC_ARG_ENABLE(crypto-tests, AC_HELP_STRING([--disable-crypto-tests],
363                 [Disable CRYPTO testcases]), [enable_crypto_tests=${enableval}])
364 AM_CONDITIONAL(TIZEN_CRYPTO_TESTS, test "${enable_crypto_tests}" != "no")
365
366 # End of TIZEN_FEATURE_BLUEZ_MODIFY
367
368 AC_ARG_ENABLE(deprecated, AC_HELP_STRING([--enable-deprecated],
369                         [enable deprecated tools]),
370                                         [enable_deprecated=${enableval}])
371 AM_CONDITIONAL(DEPRECATED, test "${enable_deprecated}" = "yes")
372
373 AC_ARG_ENABLE(sixaxis, AC_HELP_STRING([--enable-sixaxis],
374                 [enable sixaxis plugin]), [enable_sixaxis=${enableval}])
375 AM_CONDITIONAL(SIXAXIS, test "${enable_sixaxis}" = "yes" &&
376                                          test "${enable_udev}" != "no")
377
378 AC_ARG_ENABLE(logger, AC_HELP_STRING([--enable-logger],
379                 [enable HCI logger service]), [enable_logger=${enableval}])
380 AM_CONDITIONAL(LOGGER, test "${enable_logger}" = "yes")
381
382 if (test "${prefix}" = "NONE"); then
383         dnl no prefix and no localstatedir, so default to /var
384         if (test "$localstatedir" = '${prefix}/var'); then
385                 AC_SUBST([localstatedir], ['/var'])
386         fi
387
388         prefix="${ac_default_prefix}"
389 fi
390
391 if (test "$localstatedir" = '${prefix}/var'); then
392         storagedir="${prefix}/var/lib/bluetooth"
393 else
394         storagedir="${localstatedir}/lib/bluetooth"
395 fi
396 AC_DEFINE_UNQUOTED(STORAGEDIR, "${storagedir}",
397                         [Directory for the storage files])
398
399 if (test "$sysconfdir" = '${prefix}/etc'); then
400         configdir="${prefix}/etc/bluetooth"
401 else
402         configdir="${sysconfdir}/bluetooth"
403 fi
404 AC_DEFINE_UNQUOTED(CONFIGDIR, "${configdir}",
405                         [Directory for the configuration files])
406 AC_SUBST(CONFIGDIR, "${configdir}")
407
408
409 AC_DEFINE_UNQUOTED(MESH_STORAGEDIR, "${storagedir}/mesh",
410                         [Directory for the mesh daemon storage files])
411
412 AC_ARG_ENABLE(android, AC_HELP_STRING([--enable-android],
413                         [enable BlueZ for Android]),
414                                         [enable_android=${enableval}])
415 AM_CONDITIONAL(ANDROID, test "${enable_android}" = "yes")
416
417 if (test "${enable_android}" = "yes"); then
418         PKG_CHECK_MODULES(SBC, sbc >= 1.2, dummy=yes,
419                                         AC_MSG_ERROR(SBC library >= 1.2 is required))
420         AC_SUBST(SBC_CFLAGS)
421         AC_SUBST(SBC_LIBS)
422 fi
423
424 if (test "${enable_android}" = "yes"); then
425         PKG_CHECK_MODULES(SPEEXDSP, speexdsp >= 1.2, dummy=yes,
426                                         AC_MSG_ERROR(SPEEXDSP library >= 1.2 is required))
427         AC_SUBST(SPEEXDSP_CFLAGS)
428         AC_SUBST(SPEEXDSP_LIBS)
429 fi
430
431 AC_DEFINE_UNQUOTED(ANDROID_STORAGEDIR, "${storagedir}/android",
432                         [Directory for the Android daemon storage files])
433
434 AC_OUTPUT(Makefile src/bluetoothd.8 lib/bluez.pc)