OSDN Git Service

tools/obexctl: Fix not being able to PullAll
[android-x86/external-bluetooth-bluez.git] / configure.ac
1 AC_PREREQ(2.60)
2 AC_INIT(bluez, 5.44)
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_FUNC(signalfd, dummy=yes,
51                         AC_MSG_ERROR(signalfd support is required))
52
53 AC_CHECK_LIB(rt, clock_gettime, dummy=yes,
54                         AC_MSG_ERROR(realtime clock support is required))
55
56 AC_CHECK_LIB(pthread, pthread_create, dummy=yes,
57                         AC_MSG_ERROR(posix thread support is required))
58
59 AC_CHECK_LIB(dl, dlopen, dummy=yes,
60                         AC_MSG_ERROR(dynamic linking loader is required))
61
62 AC_CHECK_HEADERS(linux/types.h linux/if_alg.h)
63
64 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.28, dummy=yes,
65                                 AC_MSG_ERROR(GLib >= 2.28 is required))
66 AC_SUBST(GLIB_CFLAGS)
67 AC_SUBST(GLIB_LIBS)
68
69 if (test "${enable_threads}" = "yes"); then
70         AC_DEFINE(NEED_THREADS, 1, [Define if threading support is required])
71         PKG_CHECK_MODULES(GTHREAD, gthread-2.0 >= 2.16, dummy=yes,
72                                 AC_MSG_ERROR(GThread >= 2.16 is required))
73         GLIB_CFLAGS="$GLIB_CFLAGS $GTHREAD_CFLAGS"
74         GLIB_LIBS="$GLIB_LIBS $GTHREAD_LIBS"
75 fi
76
77 PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.6, dummy=yes,
78                                 AC_MSG_ERROR(D-Bus >= 1.6 is required))
79 AC_SUBST(DBUS_CFLAGS)
80 AC_SUBST(DBUS_LIBS)
81
82 AC_ARG_WITH([dbusconfdir], AC_HELP_STRING([--with-dbusconfdir=DIR],
83                                 [path to D-Bus configuration directory]),
84                                         [path_dbusconfdir=${withval}])
85 if (test -z "${path_dbusconfdir}"); then
86         AC_MSG_CHECKING([D-Bus configuration directory])
87         path_dbusconfdir="`$PKG_CONFIG --variable=sysconfdir dbus-1`"
88         if (test -z "${path_dbusconfdir}"); then
89                 AC_MSG_ERROR([D-Bus configuration directory is required])
90         fi
91         AC_MSG_RESULT([${path_dbusconfdir}])
92 fi
93 AC_SUBST(DBUS_CONFDIR, [${path_dbusconfdir}])
94
95 AC_ARG_WITH([dbussystembusdir], AC_HELP_STRING([--with-dbussystembusdir=DIR],
96                                 [path to D-Bus system bus services directory]),
97                                         [path_dbussystembusdir=${withval}])
98 if (test -z "${path_dbussystembusdir}"); then
99         AC_MSG_CHECKING([D-Bus system bus services dir])
100         path_dbussystembusdir="`$PKG_CONFIG --variable=system_bus_services_dir dbus-1`"
101         if (test -z "${path_dbussystembusdir}"); then
102                 AC_MSG_ERROR([D-Bus system bus services directory is required])
103         fi
104         AC_MSG_RESULT([${path_dbussystembusdir}])
105 fi
106 AC_SUBST(DBUS_SYSTEMBUSDIR, [${path_dbussystembusdir}])
107
108 AC_ARG_WITH([dbussessionbusdir], AC_HELP_STRING([--with-dbussessionbusdir=DIR],
109                                 [path to D-Bus session bus services directory]),
110                                         [path_dbussessionbusdir=${withval}])
111 if (test -z "${path_dbussessionbusdir}"); then
112         AC_MSG_CHECKING([D-Bus session bus services dir])
113         path_dbussessionbusdir="`$PKG_CONFIG --variable=session_bus_services_dir dbus-1`"
114         if (test -z "${path_dbussessionbusdir}"); then
115                 AC_MSG_ERROR([D-Bus session bus services directory is required])
116         fi
117         AC_MSG_RESULT([${path_dbussessionbusdir}])
118 fi
119 AC_SUBST(DBUS_SESSIONBUSDIR, [${path_dbussessionbusdir}])
120
121 AC_ARG_ENABLE(backtrace, AC_HELP_STRING([--enable-backtrace],
122                 [compile backtrace support]), [enable_backtrace=${enableval}])
123
124 if (test "${enable_backtrace}" = "yes"); then
125         AC_CHECK_HEADER(elfutils/libdwfl.h, dummy=yes,
126                         AC_MSG_ERROR(elfutils support is required))
127         AC_DEFINE(HAVE_BACKTRACE_SUPPORT, 1,
128                         [Define to 1 if you have the backtrace support.])
129         BACKTRACE_CFLAGS=""
130         BACKTRACE_LIBS="-ldw"
131         AC_SUBST(BACKTRACE_CFLAGS)
132         AC_SUBST(BACKTRACE_LIBS)
133 fi
134
135 AC_ARG_ENABLE(library, AC_HELP_STRING([--enable-library],
136                 [install Bluetooth library]), [enable_library=${enableval}])
137 AM_CONDITIONAL(LIBRARY, test "${enable_library}" = "yes")
138
139 AC_ARG_ENABLE(test, AC_HELP_STRING([--enable-test],
140                 [enable test/example scripts]), [enable_test=${enableval}])
141 AM_CONDITIONAL(TEST, test "${enable_test}" = "yes")
142
143 AC_ARG_ENABLE(nfc, AC_HELP_STRING([--enable-nfc],
144                 [enable NFC paring]), [enable_nfc=${enableval}])
145 AM_CONDITIONAL(NFC, test "${enable_nfc}" = "yes")
146
147 AC_ARG_ENABLE(sap, AC_HELP_STRING([--enable-sap],
148                 [enable SAP profile]), [enable_sap=${enableval}])
149 AM_CONDITIONAL(SAP, test "${enable_sap}" = "yes")
150
151 AC_ARG_ENABLE(a2dp, AC_HELP_STRING([--disable-a2dp],
152                 [disable A2DP profile]), [enable_a2dp=${enableval}])
153 AM_CONDITIONAL(A2DP, test "${enable_a2dp}" != "no")
154
155 AC_ARG_ENABLE(avrcp, AC_HELP_STRING([--disable-avrcp],
156                 [disable AVRCP profile]), [enable_avrcp=${enableval}])
157 AM_CONDITIONAL(AVRCP, test "${enable_avrcp}" != "no")
158
159 AC_ARG_ENABLE(network, AC_HELP_STRING([--disable-network],
160                 [disable network profiles]), [enable_network=${enableval}])
161 AM_CONDITIONAL(NETWORK, test "${enable_network}" != "no")
162
163 AC_ARG_ENABLE(hid, AC_HELP_STRING([--disable-hid],
164                 [disable HID profile]), [enable_hid=${enableval}])
165 AM_CONDITIONAL(HID, test "${enable_hid}" != "no")
166
167 AC_ARG_ENABLE(hog, AC_HELP_STRING([--disable-hog],
168                 [disable HoG profile]), [enable_hog=${enableval}])
169 AM_CONDITIONAL(HOG, test "${enable_hog}" != "no")
170
171 AC_ARG_ENABLE(health, AC_HELP_STRING([--enable-health],
172                 [enable health profiles]), [enable_health=${enableval}])
173 AM_CONDITIONAL(HEALTH, test "${enable_health}" = "yes")
174
175 AC_ARG_ENABLE(tools, AC_HELP_STRING([--disable-tools],
176                 [disable Bluetooth tools]), [enable_tools=${enableval}])
177 AM_CONDITIONAL(TOOLS, test "${enable_tools}" != "no")
178
179 AC_ARG_ENABLE(monitor, AC_HELP_STRING([--disable-monitor],
180                 [disable Bluetooth monitor]), [enable_monitor=${enableval}])
181 AM_CONDITIONAL(MONITOR, test "${enable_monitor}" != "no")
182
183 AC_ARG_ENABLE(udev, AC_HELP_STRING([--disable-udev],
184                 [disable udev device support]), [enable_udev=${enableval}])
185 if (test "${enable_tools}" != "no" && test "${enable_udev}" != "no"); then
186         PKG_CHECK_MODULES(UDEV, libudev >= 172, dummy=yes,
187                                 AC_MSG_ERROR(libudev >= 172 is required))
188         AC_SUBST(UDEV_CFLAGS)
189         AC_SUBST(UDEV_LIBS)
190         AC_CHECK_LIB(udev, udev_hwdb_new,
191                 AC_DEFINE(HAVE_UDEV_HWDB_NEW, 1,
192                         [Define to 1 if you have the udev_hwdb_new() function.]))
193 fi
194 AM_CONDITIONAL(UDEV, test "${enable_udev}" != "no")
195
196 AC_ARG_WITH([udevdir], AC_HELP_STRING([--with-udevdir=DIR],
197                         [path to udev directory]), [path_udevdir=${withval}])
198 if (test "${enable_udev}" != "no" && test -z "${path_udevdir}"); then
199         AC_MSG_CHECKING([udev directory])
200         path_udevdir="`$PKG_CONFIG --variable=udevdir udev`"
201         if (test -z "${path_udevdir}"); then
202                 AC_MSG_ERROR([udev directory is required])
203         fi
204         AC_MSG_RESULT([${path_udevdir}])
205 fi
206 AC_SUBST(UDEV_DIR, [${path_udevdir}])
207
208 AM_CONDITIONAL(HID2HCI, test "${enable_tools}" != "no" &&
209                                                 test "${enable_udev}" != "no")
210
211 AC_ARG_ENABLE(cups, AC_HELP_STRING([--disable-cups],
212                 [disable CUPS printer support]), [enable_cups=${enableval}])
213 AM_CONDITIONAL(CUPS, test "${enable_cups}" != "no")
214
215 AC_ARG_ENABLE(midi, AC_HELP_STRING([--enable-midi],
216                 [enable MIDI support]), [enable_midi=${enableval}])
217 AM_CONDITIONAL(MIDI, test "${enable_midi}" = "yes")
218
219 if (test "${enable_midi}" = "yes"); then
220         PKG_CHECK_MODULES(ALSA, alsa, dummy=yes,
221                                 AC_MSG_ERROR(ALSA lib is required for MIDI support))
222         AC_SUBST(ALSA_CFLAGS)
223         AC_SUBST(ALSA_LIBS)
224 fi
225
226 AC_ARG_ENABLE(obex, AC_HELP_STRING([--disable-obex],
227                 [disable OBEX profile support]), [enable_obex=${enableval}])
228 if (test "${enable_obex}" != "no"); then
229         PKG_CHECK_MODULES(ICAL, libical, dummy=yes,
230                                         AC_MSG_ERROR(libical is required))
231         AC_SUBST(ICAL_CFLAGS)
232         AC_SUBST(ICAL_LIBS)
233 fi
234 AM_CONDITIONAL(OBEX, test "${enable_obex}" != "no")
235
236 AC_ARG_ENABLE(client, AC_HELP_STRING([--disable-client],
237                 [disable command line client]), [enable_client=${enableval}])
238 AM_CONDITIONAL(CLIENT, test "${enable_client}" != "no")
239
240 if (test "${enable_client}" != "no"); then
241         AC_CHECK_HEADERS(readline/readline.h, enable_readline=yes,
242                 AC_MSG_ERROR(readline header files are required))
243 fi
244 AM_CONDITIONAL(READLINE, test "${enable_readline}" = "yes")
245
246 AC_ARG_ENABLE(systemd, AC_HELP_STRING([--disable-systemd],
247                 [disable systemd integration]), [enable_systemd=${enableval}])
248 AM_CONDITIONAL(SYSTEMD, test "${enable_systemd}" != "no")
249
250 AC_ARG_WITH([systemdsystemunitdir],
251                         AC_HELP_STRING([--with-systemdsystemunitdir=DIR],
252                         [path to systemd system unit directory]),
253                                         [path_systemunitdir=${withval}])
254 if (test "${enable_systemd}" != "no" && test -z "${path_systemunitdir}"); then
255         AC_MSG_CHECKING([systemd system unit dir])
256         path_systemunitdir="`$PKG_CONFIG --variable=systemdsystemunitdir systemd`"
257         if (test -z "${path_systemunitdir}"); then
258                 AC_MSG_ERROR([systemd system unit directory is required])
259         fi
260         AC_MSG_RESULT([${path_systemunitdir}])
261 fi
262 AC_SUBST(SYSTEMD_SYSTEMUNITDIR, [${path_systemunitdir}])
263
264 AC_ARG_WITH([systemduserunitdir],
265                         AC_HELP_STRING([--with-systemduserunitdir=DIR],
266                         [path to systemd user unit directory]),
267                                         [path_userunitdir=${withval}])
268 if (test "${enable_systemd}" != "no" && test -z "${path_userunitdir}"); then
269         AC_MSG_CHECKING([systemd user unit dir])
270         path_userunitdir="`$PKG_CONFIG --variable=systemduserunitdir systemd`"
271         if (test -z "${path_userunitdir}"); then
272                 AC_MSG_ERROR([systemd user unit directory is required])
273         fi
274         AC_MSG_RESULT([${path_userunitdir}])
275 fi
276 AC_SUBST(SYSTEMD_USERUNITDIR, [${path_userunitdir}])
277
278 AC_ARG_ENABLE(datafiles, AC_HELP_STRING([--disable-datafiles],
279                         [do not install configuration and data files]),
280                                         [enable_datafiles=${enableval}])
281 AM_CONDITIONAL(DATAFILES, test "${enable_datafiles}" != "no")
282
283 AC_ARG_ENABLE(manpages, AC_HELP_STRING([--enable-manpages],
284                         [enable building of manual pages]),
285                                         [enable_manpages=${enableval}])
286 AM_CONDITIONAL(MANPAGES, test "${enable_manpages}" = "yes")
287
288 AC_ARG_ENABLE(testing, AC_HELP_STRING([--enable-testing],
289                         [enable testing tools]),
290                                         [enable_testing=${enableval}])
291 AM_CONDITIONAL(TESTING, test "${enable_testing}" = "yes")
292
293 AC_ARG_ENABLE(experimental, AC_HELP_STRING([--enable-experimental],
294                         [enable experimental tools]),
295                                         [enable_experimental=${enableval}])
296 AM_CONDITIONAL(EXPERIMENTAL, test "${enable_experimental}" = "yes")
297
298 AC_ARG_ENABLE(deprecated, AC_HELP_STRING([--enable-deprecated],
299                         [enable deprecated tools]),
300                                         [enable_deprecated=${enableval}])
301 AM_CONDITIONAL(DEPRECATED, test "${enable_deprecated}" = "yes")
302
303 AC_ARG_ENABLE(sixaxis, AC_HELP_STRING([--enable-sixaxis],
304                 [enable sixaxis plugin]), [enable_sixaxis=${enableval}])
305 AM_CONDITIONAL(SIXAXIS, test "${enable_sixaxis}" = "yes" &&
306                                          test "${enable_udev}" != "no")
307
308 if (test "${prefix}" = "NONE"); then
309         dnl no prefix and no localstatedir, so default to /var
310         if (test "$localstatedir" = '${prefix}/var'); then
311                 AC_SUBST([localstatedir], ['/var'])
312         fi
313
314         prefix="${ac_default_prefix}"
315 fi
316
317 if (test "$localstatedir" = '${prefix}/var'); then
318         storagedir="${prefix}/var/lib/bluetooth"
319 else
320         storagedir="${localstatedir}/lib/bluetooth"
321 fi
322 AC_DEFINE_UNQUOTED(STORAGEDIR, "${storagedir}",
323                         [Directory for the storage files])
324
325 if (test "$sysconfdir" = '${prefix}/etc'); then
326         configdir="${prefix}/etc/bluetooth"
327 else
328         configdir="${sysconfdir}/bluetooth"
329 fi
330 AC_DEFINE_UNQUOTED(CONFIGDIR, "${configdir}",
331                         [Directory for the configuration files])
332 AC_SUBST(CONFIGDIR, "${configdir}")
333
334 AC_ARG_ENABLE(android, AC_HELP_STRING([--enable-android],
335                         [enable BlueZ for Android]),
336                                         [enable_android=${enableval}])
337 AM_CONDITIONAL(ANDROID, test "${enable_android}" = "yes")
338
339 if (test "${enable_android}" = "yes"); then
340         PKG_CHECK_MODULES(SBC, sbc >= 1.2, dummy=yes,
341                                         AC_MSG_ERROR(SBC library >= 1.2 is required))
342         AC_SUBST(SBC_CFLAGS)
343         AC_SUBST(SBC_LIBS)
344 fi
345
346 if (test "${enable_android}" = "yes"); then
347         PKG_CHECK_MODULES(SPEEXDSP, speexdsp >= 1.2, dummy=yes,
348                                         AC_MSG_ERROR(SPEEXDSP library >= 1.2 is required))
349         AC_SUBST(SPEEXDSP_CFLAGS)
350         AC_SUBST(SPEEXDSP_LIBS)
351 fi
352
353 AC_DEFINE_UNQUOTED(ANDROID_STORAGEDIR, "${storagedir}/android",
354                         [Directory for the Android daemon storage files])
355
356 AC_OUTPUT(Makefile src/bluetoothd.8 lib/bluez.pc)