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