4 AM_INIT_AUTOMAKE([foreign subdir-objects color-tests])
5 AM_CONFIG_HEADER(config.h)
7 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
11 AC_PREFIX_DEFAULT(/usr/local)
27 m4_define([_LT_AC_TAGCONFIG], [])
28 m4_ifdef([AC_LIBTOOL_TAGS], [AC_LIBTOOL_TAGS([])])
33 AC_ARG_ENABLE(optimization, AC_HELP_STRING([--disable-optimization],
34 [disable code optimization through compiler]), [
35 if (test "${enableval}" = "no"); then
40 AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug],
41 [enable compiling with debugging information]), [
42 if (test "${enableval}" = "yes" &&
43 test "${ac_cv_prog_cc_g}" = "yes"); then
48 AC_ARG_ENABLE(test, AC_HELP_STRING([--enable-test],
49 [enable test/example scripts]), [enable_test=${enableval}])
50 AM_CONDITIONAL(TEST, test "${enable_test}" = "yes")
52 AC_ARG_ENABLE(pie, AC_HELP_STRING([--enable-pie],
53 [enable position independent executables flag]), [
54 if (test "${enableval}" = "yes" &&
55 test "${ac_cv_prog_cc_pie}" = "yes"); then
56 CFLAGS="$CFLAGS -fPIE"
57 LDFLAGS="$LDFLAGS -pie"
61 AC_ARG_ENABLE(threads, AC_HELP_STRING([--enable-threads],
62 [enable threading support]), [enable_threads=${enableval}])
64 AC_CHECK_FUNC(signalfd, dummy=yes,
65 AC_MSG_ERROR(signalfd support is required))
67 AC_CHECK_LIB(dl, dlopen, dummy=yes,
68 AC_MSG_ERROR(dynamic linking loader is required))
70 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.28, dummy=yes,
71 AC_MSG_ERROR(GLib >= 2.28 is required))
75 if (test "${enable_threads}" = "yes"); then
76 AC_DEFINE(NEED_THREADS, 1, [Define if threading support is required])
77 PKG_CHECK_MODULES(GTHREAD, gthread-2.0 >= 2.16, dummy=yes,
78 AC_MSG_ERROR(GThread >= 2.16 is required))
79 GLIB_CFLAGS="$GLIB_CFLAGS $GTHREAD_CFLAGS"
80 GLIB_LIBS="$GLIB_LIBS $GTHREAD_LIBS"
83 PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.0, dummy=yes,
84 AC_MSG_ERROR(D-Bus >= 1.0 is required))
85 saved_CFLAGS="$CFLAGS"
87 CFLAGS="$CFLAGS $DBUS_CFLAGS"
88 LIBS="$LIBS $DBUS_LIBS"
89 AC_CHECK_LIB(dbus-1, dbus_watch_get_unix_fd, dummy=yes,
90 AC_DEFINE(NEED_DBUS_WATCH_GET_UNIX_FD, 1,
91 [Define to 1 if you need the dbus_watch_get_unix_fd() function.]))
92 AC_CHECK_LIB(dbus-1, dbus_connection_can_send_type, dummy=yes,
93 AC_DEFINE(NEED_DBUS_CONNECTION_CAN_SEND_TYPE, 1,
94 [Define to 1 if you need the dbus_connection_can_send_type() function.]
96 CFLAGS="$saved_CFLAGS"
101 AC_ARG_WITH(dbusconfdir, AC_HELP_STRING([--with-dbusconfdir=PATH],
102 [path to D-Bus config directory]), [path_dbusconf=${withval}],
103 [path_dbusconf="`$PKG_CONFIG --variable=sysconfdir dbus-1`"])
104 if (test -z "${path_dbusconf}"); then
105 DBUS_CONFDIR="${sysconfdir}/dbus-1/system.d"
107 DBUS_CONFDIR="${path_dbusconf}/dbus-1/system.d"
109 AC_SUBST(DBUS_CONFDIR)
111 AC_ARG_WITH(dbusdatadir, AC_HELP_STRING([--with-dbusdatadir=PATH],
112 [path to D-Bus data directory]), [path_dbusdata=${withval}],
113 [path_dbusdata="`$PKG_CONFIG --variable=datadir dbus-1`"])
114 if (test -z "${path_dbusdata}"); then
115 DBUS_DATADIR="${datadir}/dbus-1/system-services"
117 DBUS_DATADIR="${path_dbusdata}/dbus-1/system-services"
119 AC_SUBST(DBUS_DATADIR)
121 AC_ARG_WITH([systemdunitdir], AC_HELP_STRING([--with-systemdunitdir=DIR],
122 [path to systemd service directory]), [path_systemdunit=${withval}],
123 [path_systemdunit="`$PKG_CONFIG --variable=systemdsystemunitdir systemd`"])
124 if (test -n "${path_systemdunit}"); then
125 SYSTEMD_UNITDIR="${path_systemdunit}"
126 AC_SUBST(SYSTEMD_UNITDIR)
128 AM_CONDITIONAL(SYSTEMD, test -n "${path_systemdunit}")
130 AC_ARG_ENABLE(capng, AC_HELP_STRING([--enable-capng],
131 [enable capabilities support]), [enable_capng=${enableval}])
132 if (test "${enable_capng}" = "yes"); then
133 PKG_CHECK_MODULES(CAPNG, libcap-ng, dummy=yes,
134 AC_MSG_ERROR(Capabilities library is required))
135 AC_SUBST(CAPNG_CFLAGS)
137 AC_DEFINE(HAVE_CAPNG, 1, [Define to 1 if you have capabilities library.])
140 AC_ARG_ENABLE(udev, AC_HELP_STRING([--disable-udev],
141 [don't use udev support even if available]),
142 [enable_udev=${enableval}])
143 if (test "${enable_udev}" != "no"); then
144 PKG_CHECK_MODULES(UDEV, libudev >= 143, [enable_udev="yes"],
145 AC_MSG_ERROR(libudev >= 143 is required))
146 UDEV_DATADIR="`$PKG_CONFIG --variable=udevdir udev`"
147 if (test -z "${UDEV_DATADIR}"); then
148 UDEV_DATADIR="${sysconfdir}/udev/rules.d"
150 UDEV_DATADIR="${UDEV_DATADIR}/rules.d"
152 AC_SUBST(UDEV_DATADIR)
154 AC_SUBST(UDEV_CFLAGS)
156 AM_CONDITIONAL(UDEV, test "${enable_udev}" = "yes")
158 AC_ARG_ENABLE(tools, AC_HELP_STRING([--enable-tools],
159 [enable testing tools]), [enable_tools=${enableval}])
160 if (test "${enable_tools}" = "yes"); then
161 PKG_CHECK_MODULES(USB, libusb-1.0, dummy=yes,
162 AC_MSG_ERROR(USB library is required))
166 AM_CONDITIONAL(TOOLS, test "${enable_tools}" = "yes")
168 AC_ARG_ENABLE(atmodem, AC_HELP_STRING([--disable-atmodem],
169 [disable ETSI AT modem support]),
170 [enable_atmodem=${enableval}])
171 AM_CONDITIONAL(ATMODEM, test "${enable_atmodem}" != "no")
173 AC_ARG_ENABLE(cdmamodem, AC_HELP_STRING([--disable-cdmamodem],
174 [disable CDMA AT modem support]),
175 [enable_cdmamodem=${enableval}])
176 AM_CONDITIONAL(CDMAMODEM, test "${enable_cdmamodem}" != "no")
178 AC_ARG_ENABLE(phonesim, AC_HELP_STRING([--disable-phonesim],
179 [disable Phone simulator support]),
180 [enable_phonesim=${enableval}])
181 AM_CONDITIONAL(PHONESIM, test "${enable_phonesim}" != "no" &&
182 test "${enable_atmodem}" != "no")
184 AC_ARG_ENABLE(isimodem, AC_HELP_STRING([--disable-isimodem],
185 [disable PhoNet/ISI modem support]),
186 [enable_isimodem=${enableval}])
187 AM_CONDITIONAL(ISIMODEM, test "${enable_isimodem}" != "no")
189 AC_ARG_ENABLE(bluetooth, AC_HELP_STRING([--disable-bluetooth],
190 [disable Bluetooth modem support]),
191 [enable_bluetooth=${enableval}])
192 if (test "${enable_bluetooth}" != "no"); then
193 PKG_CHECK_MODULES(BLUEZ, bluez >= 4.30, dummy=yes,
194 AC_MSG_ERROR(Bluetooth library >= 4.30 is required))
196 AC_SUBST(BLUEZ_CFLAGS)
198 AM_CONDITIONAL(BLUETOOTH, test "${enable_bluetooth}" != "no")
200 AC_ARG_WITH([provisiondb], AC_HELP_STRING([--with-provisiondb=FILE],
201 [location of provision database]), [path_provisiondb=${withval}])
203 AC_ARG_ENABLE(provision, AC_HELP_STRING([--disable-provision],
204 [disable provisioning suport]),
205 [enable_provision=${enableval}])
206 if (test "${enable_provision}" != "no"); then
207 if (test -n "${path_provisiondb}"); then
208 AC_DEFINE_UNQUOTED(PROVIDER_DATABASE, "${path_provisiondb}",
209 [Mobile provider database])
211 AC_MSG_CHECKING([for mobile-broadband-provider-info])
212 PKG_CHECK_EXISTS(mobile-broadband-provider-info,
213 _PKG_CONFIG(PROVIDER_DATABASE, [variable=database],
214 [mobile-broadband-provider-info])
215 AC_DEFINE_UNQUOTED(PROVIDER_DATABASE,
216 "$pkg_cv_PROVIDER_DATABASE",
217 [Mobile provider database])
218 AC_MSG_RESULT([yes]),
219 AC_MSG_ERROR(Mobile broadband provider database is required))
222 AM_CONDITIONAL(PROVISION, test "${enable_provision}" != "no")
224 AC_ARG_ENABLE(datafiles, AC_HELP_STRING([--disable-datafiles],
225 [don't install configuration and data files]),
226 [enable_datafiles=${enableval}])
227 AM_CONDITIONAL(DATAFILES, test "${enable_datafiles}" != "no")
229 if (test "${prefix}" = "NONE"); then
230 dnl no prefix and no localstatedir, so default to /var
231 if (test "$localstatedir" = '${prefix}/var'); then
232 AC_SUBST([localstatedir], ['/var'])
235 prefix="${ac_default_prefix}"
238 if (test "$localstatedir" = '${prefix}/var'); then
239 storagedir="${prefix}/var/lib/ofono"
241 storagedir="${localstatedir}/lib/ofono"
243 AC_DEFINE_UNQUOTED(STORAGEDIR, "${storagedir}",
244 [Directory for the storage files])
246 if (test "$sysconfdir" = '${prefix}/etc'); then
247 configdir="${prefix}/etc/ofono"
249 configdir="${sysconfdir}/ofono"
251 AC_DEFINE_UNQUOTED(CONFIGDIR, "${configdir}",
252 [Directory for the configuration files])
254 AC_OUTPUT(Makefile include/version.h src/ofono.service ofono.pc)