plugins: Add initial code for diagnosis plugin
[bluez:vudentzs-clone.git] / configure.ac
1 AC_PREREQ(2.60)
2 AC_INIT(bluez, 5.10)
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 MISC_FLAGS
36
37 AC_ARG_ENABLE(threads, AC_HELP_STRING([--enable-threads],
38                 [enable threading support]), [enable_threads=${enableval}])
39
40 AC_CHECK_FUNC(signalfd, dummy=yes,
41                         AC_MSG_ERROR(signalfd support is required))
42
43 AC_CHECK_LIB(rt, clock_gettime, dummy=yes,
44                         AC_MSG_ERROR(realtime clock support is required))
45
46 AC_CHECK_LIB(pthread, pthread_create, dummy=yes,
47                         AC_MSG_ERROR(posix thread support is required))
48
49 AC_CHECK_LIB(dl, dlopen, dummy=yes,
50                         AC_MSG_ERROR(dynamic linking loader is required))
51
52 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.28, dummy=yes,
53                                 AC_MSG_ERROR(GLib >= 2.28 is required))
54 AC_SUBST(GLIB_CFLAGS)
55 AC_SUBST(GLIB_LIBS)
56
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"
63 fi
64
65 PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.4, dummy=yes,
66                                 AC_MSG_ERROR(D-Bus >= 1.4 is required))
67 AC_SUBST(DBUS_CFLAGS)
68 AC_SUBST(DBUS_LIBS)
69
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])
78         fi
79         AC_MSG_RESULT([${path_dbusconfdir}])
80 fi
81 AC_SUBST(DBUS_CONFDIR, [${path_dbusconfdir}])
82
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])
91         fi
92         AC_MSG_RESULT([${path_dbussystembusdir}])
93 fi
94 AC_SUBST(DBUS_SYSTEMBUSDIR, [${path_dbussystembusdir}])
95
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])
104         fi
105         AC_MSG_RESULT([${path_dbussessionbusdir}])
106 fi
107 AC_SUBST(DBUS_SESSIONBUSDIR, [${path_dbussessionbusdir}])
108
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")
112
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")
116
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")
120
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")
124
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)
131         AC_SUBST(UDEV_LIBS)
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.]))
135 fi
136 AM_CONDITIONAL(UDEV, test "${enable_udev}" != "no")
137
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])
145         fi
146         AC_MSG_RESULT([${path_udevdir}])
147 fi
148 AC_SUBST(UDEV_DIR, [${path_udevdir}])
149
150 AM_CONDITIONAL(HID2HCI, test "${enable_tools}" != "no" &&
151                                                 test "${enable_udev}" != "no")
152
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")
156
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)
163         AC_SUBST(ICAL_LIBS)
164 fi
165 AM_CONDITIONAL(OBEX, test "${enable_obex}" != "no")
166
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")
170
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))
174 fi
175 AM_CONDITIONAL(READLINE, test "${enable_readline}" = "yes")
176
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")
180
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])
190         fi
191         AC_MSG_RESULT([${path_systemunitdir}])
192 fi
193 AC_SUBST(SYSTEMD_SYSTEMUNITDIR, [${path_systemunitdir}])
194
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])
204         fi
205         AC_MSG_RESULT([${path_userunitdir}])
206 fi
207 AC_SUBST(SYSTEMD_USERUNITDIR, [${path_userunitdir}])
208
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")
213
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")
218
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'])
223         fi
224
225         prefix="${ac_default_prefix}"
226 fi
227
228 if (test "$localstatedir" = '${prefix}/var'); then
229         storagedir="${prefix}/var/lib/bluetooth"
230 else
231         storagedir="${localstatedir}/lib/bluetooth"
232 fi
233 AC_DEFINE_UNQUOTED(STORAGEDIR, "${storagedir}",
234                         [Directory for the storage files])
235
236 if (test "$sysconfdir" = '${prefix}/etc'); then
237         configdir="${prefix}/etc/bluetooth"
238 else
239         configdir="${sysconfdir}/bluetooth"
240 fi
241 AC_DEFINE_UNQUOTED(CONFIGDIR, "${configdir}",
242                         [Directory for the configuration files])
243 AC_SUBST(CONFIGDIR, "${configdir}")
244
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")
249
250 AC_OUTPUT(Makefile src/bluetoothd.8 lib/bluez.pc)