4 AM_INIT_AUTOMAKE([foreign subdir-objects color-tests silent-rules
5 tar-pax no-dist-gzip dist-xz])
6 AM_CONFIG_HEADER(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(dl, dlopen, dummy=yes,
44 AC_MSG_ERROR(dynamic linking loader is required))
46 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.28, dummy=yes,
47 AC_MSG_ERROR(GLib >= 2.28 is required))
51 if (test "${enable_threads}" = "yes"); then
52 AC_DEFINE(NEED_THREADS, 1, [Define if threading support is required])
53 PKG_CHECK_MODULES(GTHREAD, gthread-2.0 >= 2.16, dummy=yes,
54 AC_MSG_ERROR(GThread >= 2.16 is required))
55 GLIB_CFLAGS="$GLIB_CFLAGS $GTHREAD_CFLAGS"
56 GLIB_LIBS="$GLIB_LIBS $GTHREAD_LIBS"
59 PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.4, dummy=yes,
60 AC_MSG_ERROR(D-Bus >= 1.4 is required))
64 AC_ARG_WITH([dbusconfdir], AC_HELP_STRING([--with-dbusconfdir=DIR],
65 [path to D-Bus configuration directory]),
66 [path_dbusconfdir=${withval}])
67 if (test -z "${path_dbusconfdir}"); then
68 AC_MSG_CHECKING([D-Bus configuration directory])
69 path_dbusconfdir="`$PKG_CONFIG --variable=sysconfdir dbus-1`"
70 if (test -z "${path_dbusconfdir}"); then
71 AC_MSG_ERROR([D-Bus configuration directory is required])
73 AC_MSG_RESULT([${path_dbusconfdir}])
74 AC_SUBST(DBUS_CONFDIR, [${path_dbusconfdir}])
77 AC_ARG_WITH([dbussystembusdir], AC_HELP_STRING([--with-dbussystembusdir=DIR],
78 [path to D-Bus system bus services directory]),
79 [path_dbussystembusdir=${withval}])
80 if (test -z "${path_dbussystembusdir}"); then
81 AC_MSG_CHECKING([D-Bus system bus services dir])
82 path_dbussystembusdir="`$PKG_CONFIG --variable=system_bus_services_dir dbus-1`"
83 if (test -z "${path_dbussystembusdir}"); then
84 AC_MSG_ERROR([D-Bus system bus services directory is required])
86 AC_MSG_RESULT([${path_dbussystembusdir}])
87 AC_SUBST(DBUS_SYSTEMBUSDIR, [${path_dbussystembusdir}])
90 AC_ARG_WITH([dbussessionbusdir], AC_HELP_STRING([--with-dbussessionbusdir=DIR],
91 [path to D-Bus session bus services directory]),
92 [path_dbussessionbusdir=${withval}])
93 if (test -z "${path_dbussessionbusdir}"); then
94 AC_MSG_CHECKING([D-Bus session bus services dir])
95 path_dbussessionbusdir="`$PKG_CONFIG --variable=session_bus_services_dir dbus-1`"
96 if (test -z "${path_dbussessionbusdir}"); then
97 AC_MSG_ERROR([D-Bus session bus services directory is required])
99 AC_MSG_RESULT([${path_dbussessionbusdir}])
100 AC_SUBST(DBUS_SESSIONBUSDIR, [${path_dbussessionbusdir}])
103 AC_ARG_ENABLE(library, AC_HELP_STRING([--enable-library],
104 [install Bluetooth library]), [enable_library=${enableval}])
105 AM_CONDITIONAL(LIBRARY, test "${enable_library}" = "yes")
107 AC_ARG_ENABLE(test, AC_HELP_STRING([--enable-test],
108 [enable test/example scripts]), [enable_test=${enableval}])
109 AM_CONDITIONAL(TEST, test "${enable_test}" = "yes")
111 AC_ARG_ENABLE(tools, AC_HELP_STRING([--disable-tools],
112 [disable Bluetooth tools]), [enable_tools=${enableval}])
113 AM_CONDITIONAL(TOOLS, test "${enable_tools}" != "no")
115 AC_ARG_ENABLE(monitor, AC_HELP_STRING([--disable-monitor],
116 [disable Bluetooth monitor]), [enable_monitor=${enableval}])
117 AM_CONDITIONAL(MONITOR, test "${enable_monitor}" != "no")
119 AC_ARG_ENABLE(usb, AC_HELP_STRING([--disable-usb],
120 [disable USB support]), [enable_usb=${enableval}])
121 if (test "${enable_tools}" != "no" && test "${enable_usb}" != "no" ); then
122 PKG_CHECK_MODULES(USB, libusb, dummy=yes,
123 AC_MSG_ERROR(USB library support is required))
126 AC_CHECK_LIB(usb, usb_get_busses, dummy=yes,
127 AC_DEFINE(NEED_USB_GET_BUSSES, 1,
128 [Define to 1 if you need the usb_get_busses() function.]
130 AC_CHECK_LIB(usb, usb_interrupt_read, dummy=yes,
131 AC_DEFINE(NEED_USB_INTERRUPT_READ, 1,
132 [Define to 1 if you need the usb_interrupt_read() functi
134 AC_DEFINE(HAVE_LIBUSB, 1, [Define to 1 if you have USB library.])
136 AM_CONDITIONAL(USB, test "${enable_usb}" != "no")
138 AC_ARG_ENABLE(udev, AC_HELP_STRING([--disable-udev],
139 [disable udev device support]), [enable_udev=${enableval}])
140 if (test "${enable_tools}" != "no" && test "${enable_udev}" != "no"); then
141 PKG_CHECK_MODULES(UDEV, libudev >= 143, dummy=yes,
142 AC_MSG_ERROR(libudev >= 143 is required))
143 AC_CHECK_LIB(udev, udev_hwdb_new,
144 AC_DEFINE(HAVE_UDEV_HWDB_NEW, 1,
145 [Define to 1 if you have the udev_hwdb_new() function.]))
147 AC_SUBST(UDEV_CFLAGS)
149 AM_CONDITIONAL(UDEV, test "${enable_udev}" != "no")
151 AC_ARG_WITH([udevdir], AC_HELP_STRING([--with-udevdir=DIR],
152 [path to udev directory]), [path_udevdir=${withval}])
153 if (test "${enable_udev}" != "no" && test -z "${path_udevdir}"); then
154 AC_MSG_CHECKING([udev directory])
155 path_udevdir="`$PKG_CONFIG --variable=udevdir udev`"
156 if (test -z "${path_udevdir}"); then
157 AC_MSG_ERROR([udev directory is required])
159 AC_MSG_RESULT([${path_udevdir}])
160 AC_SUBST(UDEV_DIR, [${path_udevdir}])
163 AM_CONDITIONAL(HID2HCI, test "${enable_tools}" != "no" &&
164 test "${enable_udev}" != "no" && test "${enable_usb}" != "no")
166 AC_ARG_ENABLE(cups, AC_HELP_STRING([--disable-cups],
167 [disable CUPS printer support]), [enable_cups=${enableval}])
168 AM_CONDITIONAL(CUPS, test "${enable_cups}" != "no")
170 AC_ARG_ENABLE(obex, AC_HELP_STRING([--disable-obex],
171 [disable OBEX profile support]), [enable_obex=${enableval}])
172 if (test "${enable_obex}" != "no"); then
173 PKG_CHECK_MODULES(ICAL, libical, dummy=yes,
174 AC_MSG_ERROR(libical is required))
176 AC_SUBST(ICAL_CFLAGS)
178 AM_CONDITIONAL(OBEX, test "${enable_obex}" != "no")
180 AC_ARG_ENABLE(client, AC_HELP_STRING([--disable-client],
181 [disable command line client]), [enable_client=${enableval}])
182 AM_CONDITIONAL(CLIENT, test "${enable_client}" != "no")
184 if (test "${enable_client}" != "no"); then
185 AC_CHECK_HEADERS(readline/readline.h, enable_readline=yes,
186 AC_MSG_ERROR(readline header files are required))
188 AM_CONDITIONAL(READLINE, test "${enable_readline}" = "yes")
190 AC_ARG_ENABLE(systemd, AC_HELP_STRING([--disable-systemd],
191 [disable systemd integration]), [enable_systemd=${enableval}])
192 AM_CONDITIONAL(SYSTEMD, test "${enable_systemd}" != "no")
194 AC_ARG_WITH([systemdsystemunitdir],
195 AC_HELP_STRING([--with-systemdsystemunitdir=DIR],
196 [path to systemd system unit directory]),
197 [path_systemunitdir=${withval}])
198 if (test "${enable_systemd}" != "no" && test -z "${path_systemunitdir}"); then
199 AC_MSG_CHECKING([sytemd system unit dir])
200 path_systemunitdir="`$PKG_CONFIG --variable=systemdsystemunitdir systemd`"
201 if (test -z "${path_systemunitdir}"); then
202 AC_MSG_ERROR([systemd system unit directory is required])
204 AC_MSG_RESULT([${path_systemunitdir}])
205 AC_SUBST(SYSTEMD_SYSTEMUNITDIR, [${path_systemunitdir}])
208 AC_ARG_WITH([systemduserunitdir],
209 AC_HELP_STRING([--with-systemduserunitdir=DIR],
210 [path to systemd user unit directory]),
211 [path_userunitdir=${withval}])
212 if (test "${enable_systemd}" != "no" && test -z "${path_userunitdir}"); then
213 AC_MSG_CHECKING([sytemd user unit dir])
214 path_userunitdir="`$PKG_CONFIG --variable=systemduserunitdir systemd`"
215 if (test -z "${path_userunitdir}"); then
216 AC_MSG_ERROR([systemd user unit directory is required])
218 AC_MSG_RESULT([${path_userunitdir}])
219 AC_SUBST(SYSTEMD_USERUNITDIR, [${path_userunitdir}])
222 AC_ARG_ENABLE(datafiles, AC_HELP_STRING([--disable-datafiles],
223 [do not install configuration and data files]),
224 [enable_datafiles=${enableval}])
225 AM_CONDITIONAL(DATAFILES, test "${enable_datafiles}" != "no")
227 AC_ARG_ENABLE(experimental, AC_HELP_STRING([--enable-experimental],
228 [enable experimental plugins (SAP, NFC, ...)]),
229 [enable_experimental=${enableval}])
230 AM_CONDITIONAL(EXPERIMENTAL, test "${enable_experimental}" = "yes")
232 if (test "${prefix}" = "NONE"); then
233 dnl no prefix and no localstatedir, so default to /var
234 if (test "$localstatedir" = '${prefix}/var'); then
235 AC_SUBST([localstatedir], ['/var'])
238 prefix="${ac_default_prefix}"
241 if (test "$localstatedir" = '${prefix}/var'); then
242 storagedir="${prefix}/var/lib/bluetooth"
244 storagedir="${localstatedir}/lib/bluetooth"
246 AC_DEFINE_UNQUOTED(STORAGEDIR, "${storagedir}",
247 [Directory for the storage files])
249 if (test "$sysconfdir" = '${prefix}/etc'); then
250 configdir="${prefix}/etc/bluetooth"
252 configdir="${sysconfdir}/bluetooth"
254 AC_DEFINE_UNQUOTED(CONFIGDIR, "${configdir}",
255 [Directory for the configuration files])
257 AC_OUTPUT(Makefile src/bluetoothd.8 bluez.pc)