OSDN Git Service

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