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.4, dummy=yes,
84 AC_MSG_ERROR(D-Bus >= 1.4 is required))
88 AC_ARG_WITH(dbusconfdir, AC_HELP_STRING([--with-dbusconfdir=PATH],
89 [path to D-Bus config directory]), [path_dbusconf=${withval}],
90 [path_dbusconf="`$PKG_CONFIG --variable=sysconfdir dbus-1`"])
91 if (test -z "${path_dbusconf}"); then
92 DBUS_CONFDIR="${sysconfdir}/dbus-1/system.d"
94 DBUS_CONFDIR="${path_dbusconf}/dbus-1/system.d"
96 AC_SUBST(DBUS_CONFDIR)
98 AC_ARG_WITH(dbusdatadir, AC_HELP_STRING([--with-dbusdatadir=PATH],
99 [path to D-Bus data directory]), [path_dbusdata=${withval}],
100 [path_dbusdata="`$PKG_CONFIG --variable=datadir dbus-1`"])
101 if (test -z "${path_dbusdata}"); then
102 DBUS_DATADIR="${datadir}/dbus-1/system-services"
104 DBUS_DATADIR="${path_dbusdata}/dbus-1/system-services"
106 AC_SUBST(DBUS_DATADIR)
108 AC_ARG_WITH([systemdunitdir], AC_HELP_STRING([--with-systemdunitdir=DIR],
109 [path to systemd service directory]), [path_systemdunit=${withval}],
110 [path_systemdunit="`$PKG_CONFIG --variable=systemdsystemunitdir systemd`"])
111 if (test -n "${path_systemdunit}"); then
112 SYSTEMD_UNITDIR="${path_systemdunit}"
113 AC_SUBST(SYSTEMD_UNITDIR)
115 AM_CONDITIONAL(SYSTEMD, test -n "${path_systemdunit}")
117 AC_ARG_ENABLE(capng, AC_HELP_STRING([--enable-capng],
118 [enable capabilities support]), [enable_capng=${enableval}])
119 if (test "${enable_capng}" = "yes"); then
120 PKG_CHECK_MODULES(CAPNG, libcap-ng, dummy=yes,
121 AC_MSG_ERROR(Capabilities library is required))
122 AC_SUBST(CAPNG_CFLAGS)
124 AC_DEFINE(HAVE_CAPNG, 1, [Define to 1 if you have capabilities library.])
127 AC_ARG_ENABLE(udev, AC_HELP_STRING([--disable-udev],
128 [don't use udev support even if available]),
129 [enable_udev=${enableval}])
130 if (test "${enable_udev}" != "no"); then
131 PKG_CHECK_MODULES(UDEV, libudev >= 143, [enable_udev="yes"],
132 AC_MSG_ERROR(libudev >= 143 is required))
133 UDEV_DATADIR="`$PKG_CONFIG --variable=udevdir udev`"
134 if (test -z "${UDEV_DATADIR}"); then
135 UDEV_DATADIR="${sysconfdir}/udev/rules.d"
137 UDEV_DATADIR="${UDEV_DATADIR}/rules.d"
139 AC_SUBST(UDEV_DATADIR)
141 AC_SUBST(UDEV_CFLAGS)
143 AM_CONDITIONAL(UDEV, test "${enable_udev}" = "yes")
145 AC_ARG_ENABLE(tools, AC_HELP_STRING([--enable-tools],
146 [enable testing tools]), [enable_tools=${enableval}])
147 if (test "${enable_tools}" = "yes"); then
148 PKG_CHECK_MODULES(USB, libusb-1.0, dummy=yes,
149 AC_MSG_ERROR(USB library is required))
153 AM_CONDITIONAL(TOOLS, test "${enable_tools}" = "yes")
155 AC_ARG_ENABLE(atmodem, AC_HELP_STRING([--disable-atmodem],
156 [disable ETSI AT modem support]),
157 [enable_atmodem=${enableval}])
158 AM_CONDITIONAL(ATMODEM, test "${enable_atmodem}" != "no")
160 AC_ARG_ENABLE(cdmamodem, AC_HELP_STRING([--disable-cdmamodem],
161 [disable CDMA AT modem support]),
162 [enable_cdmamodem=${enableval}])
163 AM_CONDITIONAL(CDMAMODEM, test "${enable_cdmamodem}" != "no")
165 AC_ARG_ENABLE(phonesim, AC_HELP_STRING([--disable-phonesim],
166 [disable Phone simulator support]),
167 [enable_phonesim=${enableval}])
168 AM_CONDITIONAL(PHONESIM, test "${enable_phonesim}" != "no" &&
169 test "${enable_atmodem}" != "no")
171 AC_ARG_ENABLE(isimodem, AC_HELP_STRING([--disable-isimodem],
172 [disable PhoNet/ISI modem support]),
173 [enable_isimodem=${enableval}])
174 AM_CONDITIONAL(ISIMODEM, test "${enable_isimodem}" != "no")
176 AC_ARG_ENABLE(bluetooth, AC_HELP_STRING([--disable-bluetooth],
177 [disable Bluetooth modem support]),
178 [enable_bluetooth=${enableval}])
179 if (test "${enable_bluetooth}" != "no"); then
180 PKG_CHECK_MODULES(BLUEZ, bluez >= 4.30, dummy=yes,
181 AC_MSG_ERROR(Bluetooth library >= 4.30 is required))
183 AC_SUBST(BLUEZ_CFLAGS)
185 AM_CONDITIONAL(BLUETOOTH, test "${enable_bluetooth}" != "no")
187 AC_ARG_WITH([provisiondb], AC_HELP_STRING([--with-provisiondb=FILE],
188 [location of provision database]), [path_provisiondb=${withval}])
190 AC_ARG_ENABLE(provision, AC_HELP_STRING([--disable-provision],
191 [disable provisioning suport]),
192 [enable_provision=${enableval}])
193 if (test "${enable_provision}" != "no"); then
194 if (test -n "${path_provisiondb}"); then
195 AC_DEFINE_UNQUOTED(PROVIDER_DATABASE, "${path_provisiondb}",
196 [Mobile provider database])
198 AC_MSG_CHECKING([for mobile-broadband-provider-info])
199 PKG_CHECK_EXISTS(mobile-broadband-provider-info,
200 _PKG_CONFIG(PROVIDER_DATABASE, [variable=database],
201 [mobile-broadband-provider-info])
202 AC_DEFINE_UNQUOTED(PROVIDER_DATABASE,
203 "$pkg_cv_PROVIDER_DATABASE",
204 [Mobile provider database])
205 AC_MSG_RESULT([yes]),
206 AC_MSG_ERROR(Mobile broadband provider database is required))
209 AM_CONDITIONAL(PROVISION, test "${enable_provision}" != "no")
211 AC_ARG_ENABLE(datafiles, AC_HELP_STRING([--disable-datafiles],
212 [don't install configuration and data files]),
213 [enable_datafiles=${enableval}])
214 AM_CONDITIONAL(DATAFILES, test "${enable_datafiles}" != "no")
216 if (test "${prefix}" = "NONE"); then
217 dnl no prefix and no localstatedir, so default to /var
218 if (test "$localstatedir" = '${prefix}/var'); then
219 AC_SUBST([localstatedir], ['/var'])
222 prefix="${ac_default_prefix}"
225 if (test "$localstatedir" = '${prefix}/var'); then
226 storagedir="${prefix}/var/lib/ofono"
228 storagedir="${localstatedir}/lib/ofono"
230 AC_DEFINE_UNQUOTED(STORAGEDIR, "${storagedir}",
231 [Directory for the storage files])
233 if (test "$sysconfdir" = '${prefix}/etc'); then
234 configdir="${prefix}/etc/ofono"
236 configdir="${sysconfdir}/ofono"
238 AC_DEFINE_UNQUOTED(CONFIGDIR, "${configdir}",
239 [Directory for the configuration files])
241 AC_OUTPUT(Makefile include/version.h src/ofono.service ofono.pc)