OSDN Git Service

build: Remove left-overs from broken attempt in adding gtk-doc support
[android-x86/external-bluetooth-bluez.git] / configure.ac
1 AC_PREREQ(2.60)
2 AC_INIT(bluez, 5.x)
3
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
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(dl, dlopen, dummy=yes,
44                         AC_MSG_ERROR(dynamic linking loader is required))
45
46 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.28, dummy=yes,
47                                 AC_MSG_ERROR(GLib >= 2.28 is required))
48 AC_SUBST(GLIB_CFLAGS)
49 AC_SUBST(GLIB_LIBS)
50
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"
57 fi
58
59 PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.4, dummy=yes,
60                                 AC_MSG_ERROR(D-Bus >= 1.4 is required))
61 AC_SUBST(DBUS_CFLAGS)
62 AC_SUBST(DBUS_LIBS)
63
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])
72         fi
73         AC_MSG_RESULT([${path_dbusconfdir}])
74         AC_SUBST(DBUS_CONFDIR, [${path_dbusconfdir}])
75 fi
76
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])
85         fi
86         AC_MSG_RESULT([${path_dbussystembusdir}])
87         AC_SUBST(DBUS_SYSTEMBUSDIR, [${path_dbussystembusdir}])
88 fi
89
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])
98         fi
99         AC_MSG_RESULT([${path_dbussessionbusdir}])
100         AC_SUBST(DBUS_SESSIONBUSDIR, [${path_dbussessionbusdir}])
101 fi
102
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")
106
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")
110
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")
114
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")
118
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))
124         AC_SUBST(USB_CFLAGS)
125         AC_SUBST(USB_LIBS)
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.]
129 ))
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
133 on.]))
134         AC_DEFINE(HAVE_LIBUSB, 1, [Define to 1 if you have USB library.])
135 fi
136 AM_CONDITIONAL(USB, test "${enable_usb}" != "no")
137
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.]))
146 fi
147 AC_SUBST(UDEV_CFLAGS)
148 AC_SUBST(UDEV_LIBS)
149 AM_CONDITIONAL(UDEV, test "${enable_udev}" != "no")
150
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])
158         fi
159         AC_MSG_RESULT([${path_udevdir}])
160         AC_SUBST(UDEV_DIR, [${path_udevdir}])
161 fi
162
163 AM_CONDITIONAL(HID2HCI, test "${enable_tools}" != "no" &&
164                 test "${enable_udev}" != "no" && test "${enable_usb}" != "no")
165
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")
169
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))
175 fi
176 AC_SUBST(ICAL_CFLAGS)
177 AC_SUBST(ICAL_LIBS)
178 AM_CONDITIONAL(OBEX, test "${enable_obex}" != "no")
179
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")
183
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))
187 fi
188 AM_CONDITIONAL(READLINE, test "${enable_readline}" = "yes")
189
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")
193
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])
203         fi
204         AC_MSG_RESULT([${path_systemunitdir}])
205         AC_SUBST(SYSTEMD_SYSTEMUNITDIR, [${path_systemunitdir}])
206 fi
207
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])
217         fi
218         AC_MSG_RESULT([${path_userunitdir}])
219         AC_SUBST(SYSTEMD_USERUNITDIR, [${path_userunitdir}])
220 fi
221
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")
226
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")
231
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'])
236         fi
237
238         prefix="${ac_default_prefix}"
239 fi
240
241 if (test "$localstatedir" = '${prefix}/var'); then
242         storagedir="${prefix}/var/lib/bluetooth"
243 else
244         storagedir="${localstatedir}/lib/bluetooth"
245 fi
246 AC_DEFINE_UNQUOTED(STORAGEDIR, "${storagedir}",
247                         [Directory for the storage files])
248
249 if (test "$sysconfdir" = '${prefix}/etc'); then
250         configdir="${prefix}/etc/bluetooth"
251 else
252         configdir="${sysconfdir}/bluetooth"
253 fi
254 AC_DEFINE_UNQUOTED(CONFIGDIR, "${configdir}",
255                         [Directory for the configuration files])
256
257 AC_OUTPUT(Makefile src/bluetoothd.8 bluez.pc)