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
9 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
13 AC_PREFIX_DEFAULT(/usr/local)
29 m4_define([_LT_AC_TAGCONFIG], [])
30 m4_ifdef([AC_LIBTOOL_TAGS], [AC_LIBTOOL_TAGS([])])
37 AC_ARG_ENABLE(threads, AC_HELP_STRING([--enable-threads],
38 [enable threading support]), [enable_threads=${enableval}])
40 AC_CHECK_FUNC(signalfd, dummy=yes,
41 AC_MSG_ERROR(signalfd support is required))
43 AC_CHECK_LIB(rt, clock_gettime, dummy=yes,
44 AC_MSG_ERROR(realtime clock support is required))
46 AC_CHECK_LIB(pthread, pthread_create, dummy=yes,
47 AC_MSG_ERROR(posix thread support is required))
49 AC_CHECK_LIB(dl, dlopen, dummy=yes,
50 AC_MSG_ERROR(dynamic linking loader is required))
52 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.28, dummy=yes,
53 AC_MSG_ERROR(GLib >= 2.28 is required))
57 if (test "${enable_threads}" = "yes"); then
58 AC_DEFINE(NEED_THREADS, 1, [Define if threading support is required])
59 PKG_CHECK_MODULES(GTHREAD, gthread-2.0 >= 2.16, dummy=yes,
60 AC_MSG_ERROR(GThread >= 2.16 is required))
61 GLIB_CFLAGS="$GLIB_CFLAGS $GTHREAD_CFLAGS"
62 GLIB_LIBS="$GLIB_LIBS $GTHREAD_LIBS"
65 PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.4, dummy=yes,
66 AC_MSG_ERROR(D-Bus >= 1.4 is required))
70 AC_ARG_WITH([dbusconfdir], AC_HELP_STRING([--with-dbusconfdir=DIR],
71 [path to D-Bus configuration directory]),
72 [path_dbusconfdir=${withval}])
73 if (test -z "${path_dbusconfdir}"); then
74 AC_MSG_CHECKING([D-Bus configuration directory])
75 path_dbusconfdir="`$PKG_CONFIG --variable=sysconfdir dbus-1`"
76 if (test -z "${path_dbusconfdir}"); then
77 AC_MSG_ERROR([D-Bus configuration directory is required])
79 AC_MSG_RESULT([${path_dbusconfdir}])
81 AC_SUBST(DBUS_CONFDIR, [${path_dbusconfdir}])
83 AC_ARG_WITH([dbussystembusdir], AC_HELP_STRING([--with-dbussystembusdir=DIR],
84 [path to D-Bus system bus services directory]),
85 [path_dbussystembusdir=${withval}])
86 if (test -z "${path_dbussystembusdir}"); then
87 AC_MSG_CHECKING([D-Bus system bus services dir])
88 path_dbussystembusdir="`$PKG_CONFIG --variable=system_bus_services_dir dbus-1`"
89 if (test -z "${path_dbussystembusdir}"); then
90 AC_MSG_ERROR([D-Bus system bus services directory is required])
92 AC_MSG_RESULT([${path_dbussystembusdir}])
94 AC_SUBST(DBUS_SYSTEMBUSDIR, [${path_dbussystembusdir}])
96 AC_ARG_WITH([dbussessionbusdir], AC_HELP_STRING([--with-dbussessionbusdir=DIR],
97 [path to D-Bus session bus services directory]),
98 [path_dbussessionbusdir=${withval}])
99 if (test -z "${path_dbussessionbusdir}"); then
100 AC_MSG_CHECKING([D-Bus session bus services dir])
101 path_dbussessionbusdir="`$PKG_CONFIG --variable=session_bus_services_dir dbus-1`"
102 if (test -z "${path_dbussessionbusdir}"); then
103 AC_MSG_ERROR([D-Bus session bus services directory is required])
105 AC_MSG_RESULT([${path_dbussessionbusdir}])
107 AC_SUBST(DBUS_SESSIONBUSDIR, [${path_dbussessionbusdir}])
109 AC_ARG_ENABLE(library, AC_HELP_STRING([--enable-library],
110 [install Bluetooth library]), [enable_library=${enableval}])
111 AM_CONDITIONAL(LIBRARY, test "${enable_library}" = "yes")
113 AC_ARG_ENABLE(test, AC_HELP_STRING([--enable-test],
114 [enable test/example scripts]), [enable_test=${enableval}])
115 AM_CONDITIONAL(TEST, test "${enable_test}" = "yes")
117 AC_ARG_ENABLE(tools, AC_HELP_STRING([--disable-tools],
118 [disable Bluetooth tools]), [enable_tools=${enableval}])
119 AM_CONDITIONAL(TOOLS, test "${enable_tools}" != "no")
121 AC_ARG_ENABLE(monitor, AC_HELP_STRING([--disable-monitor],
122 [disable Bluetooth monitor]), [enable_monitor=${enableval}])
123 AM_CONDITIONAL(MONITOR, test "${enable_monitor}" != "no")
125 AC_ARG_ENABLE(udev, AC_HELP_STRING([--disable-udev],
126 [disable udev device support]), [enable_udev=${enableval}])
127 if (test "${enable_tools}" != "no" && test "${enable_udev}" != "no"); then
128 PKG_CHECK_MODULES(UDEV, libudev >= 143, dummy=yes,
129 AC_MSG_ERROR(libudev >= 143 is required))
130 AC_SUBST(UDEV_CFLAGS)
132 AC_CHECK_LIB(udev, udev_hwdb_new,
133 AC_DEFINE(HAVE_UDEV_HWDB_NEW, 1,
134 [Define to 1 if you have the udev_hwdb_new() function.]))
136 AM_CONDITIONAL(UDEV, test "${enable_udev}" != "no")
138 AC_ARG_WITH([udevdir], AC_HELP_STRING([--with-udevdir=DIR],
139 [path to udev directory]), [path_udevdir=${withval}])
140 if (test "${enable_udev}" != "no" && test -z "${path_udevdir}"); then
141 AC_MSG_CHECKING([udev directory])
142 path_udevdir="`$PKG_CONFIG --variable=udevdir udev`"
143 if (test -z "${path_udevdir}"); then
144 AC_MSG_ERROR([udev directory is required])
146 AC_MSG_RESULT([${path_udevdir}])
148 AC_SUBST(UDEV_DIR, [${path_udevdir}])
150 AM_CONDITIONAL(HID2HCI, test "${enable_tools}" != "no" &&
151 test "${enable_udev}" != "no")
153 AC_ARG_ENABLE(cups, AC_HELP_STRING([--disable-cups],
154 [disable CUPS printer support]), [enable_cups=${enableval}])
155 AM_CONDITIONAL(CUPS, test "${enable_cups}" != "no")
157 AC_ARG_ENABLE(obex, AC_HELP_STRING([--disable-obex],
158 [disable OBEX profile support]), [enable_obex=${enableval}])
159 if (test "${enable_obex}" != "no"); then
160 PKG_CHECK_MODULES(ICAL, libical, dummy=yes,
161 AC_MSG_ERROR(libical is required))
162 AC_SUBST(ICAL_CFLAGS)
165 AM_CONDITIONAL(OBEX, test "${enable_obex}" != "no")
167 AC_ARG_ENABLE(client, AC_HELP_STRING([--disable-client],
168 [disable command line client]), [enable_client=${enableval}])
169 AM_CONDITIONAL(CLIENT, test "${enable_client}" != "no")
171 if (test "${enable_client}" != "no"); then
172 AC_CHECK_HEADERS(readline/readline.h, enable_readline=yes,
173 AC_MSG_ERROR(readline header files are required))
175 AM_CONDITIONAL(READLINE, test "${enable_readline}" = "yes")
177 AC_ARG_ENABLE(systemd, AC_HELP_STRING([--disable-systemd],
178 [disable systemd integration]), [enable_systemd=${enableval}])
179 AM_CONDITIONAL(SYSTEMD, test "${enable_systemd}" != "no")
181 AC_ARG_WITH([systemdsystemunitdir],
182 AC_HELP_STRING([--with-systemdsystemunitdir=DIR],
183 [path to systemd system unit directory]),
184 [path_systemunitdir=${withval}])
185 if (test "${enable_systemd}" != "no" && test -z "${path_systemunitdir}"); then
186 AC_MSG_CHECKING([systemd system unit dir])
187 path_systemunitdir="`$PKG_CONFIG --variable=systemdsystemunitdir systemd`"
188 if (test -z "${path_systemunitdir}"); then
189 AC_MSG_ERROR([systemd system unit directory is required])
191 AC_MSG_RESULT([${path_systemunitdir}])
193 AC_SUBST(SYSTEMD_SYSTEMUNITDIR, [${path_systemunitdir}])
195 AC_ARG_WITH([systemduserunitdir],
196 AC_HELP_STRING([--with-systemduserunitdir=DIR],
197 [path to systemd user unit directory]),
198 [path_userunitdir=${withval}])
199 if (test "${enable_systemd}" != "no" && test -z "${path_userunitdir}"); then
200 AC_MSG_CHECKING([systemd user unit dir])
201 path_userunitdir="`$PKG_CONFIG --variable=systemduserunitdir systemd`"
202 if (test -z "${path_userunitdir}"); then
203 AC_MSG_ERROR([systemd user unit directory is required])
205 AC_MSG_RESULT([${path_userunitdir}])
207 AC_SUBST(SYSTEMD_USERUNITDIR, [${path_userunitdir}])
209 AC_ARG_ENABLE(datafiles, AC_HELP_STRING([--disable-datafiles],
210 [do not install configuration and data files]),
211 [enable_datafiles=${enableval}])
212 AM_CONDITIONAL(DATAFILES, test "${enable_datafiles}" != "no")
214 AC_ARG_ENABLE(experimental, AC_HELP_STRING([--enable-experimental],
215 [enable experimental plugins (SAP, NFC, ...)]),
216 [enable_experimental=${enableval}])
217 AM_CONDITIONAL(EXPERIMENTAL, test "${enable_experimental}" = "yes")
219 if (test "${prefix}" = "NONE"); then
220 dnl no prefix and no localstatedir, so default to /var
221 if (test "$localstatedir" = '${prefix}/var'); then
222 AC_SUBST([localstatedir], ['/var'])
225 prefix="${ac_default_prefix}"
228 if (test "$localstatedir" = '${prefix}/var'); then
229 storagedir="${prefix}/var/lib/bluetooth"
231 storagedir="${localstatedir}/lib/bluetooth"
233 AC_DEFINE_UNQUOTED(STORAGEDIR, "${storagedir}",
234 [Directory for the storage files])
236 if (test "$sysconfdir" = '${prefix}/etc'); then
237 configdir="${prefix}/etc/bluetooth"
239 configdir="${sysconfdir}/bluetooth"
241 AC_DEFINE_UNQUOTED(CONFIGDIR, "${configdir}",
242 [Directory for the configuration files])
243 AC_SUBST(CONFIGDIR, "${configdir}")
245 AC_ARG_ENABLE(android, AC_HELP_STRING([--enable-android],
246 [enable BlueZ for Android]),
247 [enable_android=${enableval}])
248 AM_CONDITIONAL(ANDROID, test "${enable_android}" = "yes")
250 AC_OUTPUT(Makefile src/bluetoothd.8 lib/bluez.pc)