4 AM_INIT_AUTOMAKE([foreign subdir-objects])
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.22, dummy=yes,
71 AC_MSG_ERROR(GLib >= 2.22 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 AC_CHECK_LIB(dbus-1, dbus_watch_get_unix_fd, dummy=yes,
86 AC_DEFINE(NEED_DBUS_WATCH_GET_UNIX_FD, 1,
87 [Define to 1 if you need the dbus_watch_get_unix_fd() function.]))
88 AC_CHECK_LIB(dbus-1, dbus_connection_can_send_type, dummy=yes,
89 AC_DEFINE(NEED_DBUS_CONNECTION_CAN_SEND_TYPE, 1,
90 [Define to 1 if you need the dbus_connection_can_send_type() function.]
95 AC_ARG_WITH(dbusconfdir, AC_HELP_STRING([--with-dbusconfdir=PATH],
96 [path to D-Bus config directory]), [path_dbusconf=${withval}],
97 [path_dbusconf="`$PKG_CONFIG --variable=sysconfdir dbus-1`"])
98 if (test -z "${path_dbusconf}"); then
99 DBUS_CONFDIR="${sysconfdir}/dbus-1/system.d"
101 DBUS_CONFDIR="${path_dbusconf}/dbus-1/system.d"
103 AC_SUBST(DBUS_CONFDIR)
105 AC_ARG_WITH(dbusdatadir, AC_HELP_STRING([--with-dbusdatadir=PATH],
106 [path to D-Bus data directory]), [path_dbusdata=${withval}],
107 [path_dbusdata="`$PKG_CONFIG --variable=datadir dbus-1`"])
108 if (test -z "${path_dbusdata}"); then
109 DBUS_DATADIR="${datadir}/dbus-1/system-services"
111 DBUS_DATADIR="${path_dbusdata}/dbus-1/system-services"
113 AC_SUBST(DBUS_DATADIR)
115 AC_ARG_WITH([systemdunitdir], AC_HELP_STRING([--with-systemdunitdir=DIR],
116 [path to systemd service directory]), [path_systemdunit=${withval}],
117 [path_systemdunit="`$PKG_CONFIG --variable=systemdsystemunitdir systemd`"])
118 if (test -n "${path_systemdunit}"); then
119 SYSTEMD_UNITDIR="${path_systemdunit}"
120 AC_SUBST(SYSTEMD_UNITDIR)
122 AM_CONDITIONAL(SYSTEMD, test -n "${path_systemdunit}")
124 AC_ARG_ENABLE(capng, AC_HELP_STRING([--enable-capng],
125 [enable capabilities support]), [enable_capng=${enableval}])
126 if (test "${enable_capng}" = "yes"); then
127 PKG_CHECK_MODULES(CAPNG, libcap-ng, dummy=yes,
128 AC_MSG_ERROR(Capabilities library is required))
129 AC_SUBST(CAPNG_CFLAGS)
131 AC_DEFINE(HAVE_CAPNG, 1, [Define to 1 if you have capabilities library.])
134 AC_ARG_ENABLE(udev, AC_HELP_STRING([--disable-udev],
135 [don't use udev support even if available]),
136 [enable_udev=${enableval}])
137 if (test "${enable_udev}" != "no"); then
138 PKG_CHECK_MODULES(UDEV, libudev >= 143, [enable_udev="yes"],
139 AC_MSG_ERROR(libudev >= 143 is required))
140 UDEV_DATADIR="`$PKG_CONFIG --variable=udevdir udev`"
141 if (test -z "${UDEV_DATADIR}"); then
142 UDEV_DATADIR="${sysconfdir}/udev/rules.d"
144 UDEV_DATADIR="${UDEV_DATADIR}/rules.d"
146 AC_SUBST(UDEV_DATADIR)
148 AC_SUBST(UDEV_CFLAGS)
150 AM_CONDITIONAL(UDEV, test "${enable_udev}" = "yes")
152 AC_ARG_ENABLE(tools, AC_HELP_STRING([--enable-tools],
153 [enable testing tools]), [enable_tools=${enableval}])
154 if (test "${enable_tools}" = "yes"); then
155 PKG_CHECK_MODULES(USB, libusb-1.0, dummy=yes,
156 AC_MSG_ERROR(USB library is required))
160 AM_CONDITIONAL(TOOLS, test "${enable_tools}" = "yes")
162 AC_ARG_ENABLE(atmodem, AC_HELP_STRING([--disable-atmodem],
163 [disable ETSI AT modem support]),
164 [enable_atmodem=${enableval}])
165 AM_CONDITIONAL(ATMODEM, test "${enable_atmodem}" != "no")
167 AC_ARG_ENABLE(cdmamodem, AC_HELP_STRING([--disable-cdmamodem],
168 [disable CDMA AT modem support]),
169 [enable_cdmamodem=${enableval}])
170 AM_CONDITIONAL(CDMAMODEM, test "${enable_cdmamodem}" != "no")
172 AC_ARG_ENABLE(phonesim, AC_HELP_STRING([--disable-phonesim],
173 [disable Phone simulator support]),
174 [enable_phonesim=${enableval}])
175 AM_CONDITIONAL(PHONESIM, test "${enable_phonesim}" != "no" &&
176 test "${enable_atmodem}" != "no")
178 AC_ARG_ENABLE(isimodem, AC_HELP_STRING([--disable-isimodem],
179 [disable PhoNet/ISI modem support]),
180 [enable_isimodem=${enableval}])
181 AM_CONDITIONAL(ISIMODEM, test "${enable_isimodem}" != "no")
183 AC_ARG_ENABLE(bluetooth, AC_HELP_STRING([--disable-bluetooth],
184 [disable Bluetooth modem support]),
185 [enable_bluetooth=${enableval}])
186 if (test "${enable_bluetooth}" != "no"); then
187 PKG_CHECK_MODULES(BLUEZ, bluez, dummy=yes,
188 AC_MSG_ERROR(Bluetooth library is required))
190 AC_SUBST(BLUEZ_CFLAGS)
192 AM_CONDITIONAL(BLUETOOTH, test "${enable_bluetooth}" != "no")
194 AC_ARG_ENABLE(datafiles, AC_HELP_STRING([--disable-datafiles],
195 [don't install configuration and data files]),
196 [enable_datafiles=${enableval}])
198 AM_CONDITIONAL(DATAFILES, test "${enable_datafiles}" != "no")
200 if (test "${prefix}" = "NONE"); then
201 dnl no prefix and no localstatedir, so default to /var
202 if (test "$localstatedir" = '${prefix}/var'); then
203 AC_SUBST([localstatedir], ['/var'])
206 prefix="${ac_default_prefix}"
209 if (test "$localstatedir" = '${prefix}/var'); then
210 storagedir="${prefix}/var/lib/ofono"
212 storagedir="${localstatedir}/lib/ofono"
214 AC_DEFINE_UNQUOTED(STORAGEDIR, "${storagedir}",
215 [Directory for the storage files])
217 if (test "$sysconfdir" = '${prefix}/etc'); then
218 configdir="${prefix}/etc/ofono"
220 configdir="${sysconfdir}/ofono"
222 AC_DEFINE_UNQUOTED(CONFIGDIR, "${configdir}",
223 [Directory for the configuration files])
225 AC_OUTPUT(Makefile include/version.h src/ofono.service ofono.pc)