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(dundee, AC_HELP_STRING([--enable-dundee],
156 [enable DUN deamon support]), [enable_dundee=${enableval}])
157 AM_CONDITIONAL(DUNDEE, test "${enable_dundee}" = "yes")
159 AC_ARG_ENABLE(atmodem, AC_HELP_STRING([--disable-atmodem],
160 [disable ETSI AT modem support]),
161 [enable_atmodem=${enableval}])
162 AM_CONDITIONAL(ATMODEM, test "${enable_atmodem}" != "no")
164 AC_ARG_ENABLE(cdmamodem, AC_HELP_STRING([--disable-cdmamodem],
165 [disable CDMA AT modem support]),
166 [enable_cdmamodem=${enableval}])
167 AM_CONDITIONAL(CDMAMODEM, test "${enable_cdmamodem}" != "no")
169 AC_ARG_ENABLE(phonesim, AC_HELP_STRING([--disable-phonesim],
170 [disable Phone simulator support]),
171 [enable_phonesim=${enableval}])
172 AM_CONDITIONAL(PHONESIM, test "${enable_phonesim}" != "no" &&
173 test "${enable_atmodem}" != "no")
175 AC_ARG_ENABLE(isimodem, AC_HELP_STRING([--disable-isimodem],
176 [disable PhoNet/ISI modem support]),
177 [enable_isimodem=${enableval}])
178 AM_CONDITIONAL(ISIMODEM, test "${enable_isimodem}" != "no")
180 AC_ARG_ENABLE(bluetooth, AC_HELP_STRING([--disable-bluetooth],
181 [disable Bluetooth modem support]),
182 [enable_bluetooth=${enableval}])
183 if (test "${enable_bluetooth}" != "no"); then
184 PKG_CHECK_MODULES(BLUEZ, bluez >= 4.99, dummy=yes,
185 AC_MSG_ERROR(Bluetooth library >= 4.99 is required))
187 AC_SUBST(BLUEZ_CFLAGS)
189 AM_CONDITIONAL(BLUETOOTH, test "${enable_bluetooth}" != "no")
191 AC_ARG_WITH([provisiondb], AC_HELP_STRING([--with-provisiondb=FILE],
192 [location of provision database]), [path_provisiondb=${withval}])
194 AC_ARG_ENABLE(provision, AC_HELP_STRING([--disable-provision],
195 [disable provisioning suport]),
196 [enable_provision=${enableval}])
197 if (test "${enable_provision}" != "no"); then
198 if (test -n "${path_provisiondb}"); then
199 AC_DEFINE_UNQUOTED(PROVIDER_DATABASE, "${path_provisiondb}",
200 [Mobile provider database])
202 AC_MSG_CHECKING([for mobile-broadband-provider-info])
203 PKG_CHECK_EXISTS(mobile-broadband-provider-info,
204 _PKG_CONFIG(PROVIDER_DATABASE, [variable=database],
205 [mobile-broadband-provider-info])
206 AC_DEFINE_UNQUOTED(PROVIDER_DATABASE,
207 "$pkg_cv_PROVIDER_DATABASE",
208 [Mobile provider database])
209 AC_MSG_RESULT([yes]),
210 AC_MSG_ERROR(Mobile broadband provider database is required))
213 AM_CONDITIONAL(PROVISION, test "${enable_provision}" != "no")
215 AC_ARG_ENABLE(datafiles, AC_HELP_STRING([--disable-datafiles],
216 [do not install configuration and data files]),
217 [enable_datafiles=${enableval}])
218 AM_CONDITIONAL(DATAFILES, test "${enable_datafiles}" != "no")
220 if (test "${prefix}" = "NONE"); then
221 dnl no prefix and no localstatedir, so default to /var
222 if (test "$localstatedir" = '${prefix}/var'); then
223 AC_SUBST([localstatedir], ['/var'])
226 prefix="${ac_default_prefix}"
229 if (test "$localstatedir" = '${prefix}/var'); then
230 storagedir="${prefix}/var/lib/ofono"
232 storagedir="${localstatedir}/lib/ofono"
234 AC_DEFINE_UNQUOTED(STORAGEDIR, "${storagedir}",
235 [Directory for the storage files])
237 if (test "$sysconfdir" = '${prefix}/etc'); then
238 configdir="${prefix}/etc/ofono"
240 configdir="${sysconfdir}/ofono"
242 AC_DEFINE_UNQUOTED(CONFIGDIR, "${configdir}",
243 [Directory for the configuration files])
245 AC_OUTPUT(Makefile include/version.h src/ofono.service ofono.pc \
246 dundee/dundee.service)