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_LIB(c, 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_ENABLE(systemd, AC_HELP_STRING([--enable-systemd],
116 [enable systemd support]), [enable_systemd=${enableval}])
117 if (test "${enable_systemd}" = "yes"); then
118 PKG_CHECK_MODULES(SYSTEMD, systemd, dummy=yes,
119 AC_MSG_ERROR(systemd is required))
120 SYSTEMD_UNITDIR="`$PKG_CONFIG --variable=systemdsystemunitdir systemd`"
121 if (test -z "${SYSTEM_UNITDIR}"); then
122 SYSTEMD_UNITDIR="/lib/systemd/system"
124 AC_SUBST(SYSTEMD_UNITDIR)
126 AM_CONDITIONAL(SYSTEMD, test "${enable_systemd}" = "yes")
128 AC_ARG_ENABLE(capng, AC_HELP_STRING([--enable-capng],
129 [enable capabilities support]), [enable_capng=${enableval}])
130 if (test "${enable_capng}" = "yes"); then
131 PKG_CHECK_MODULES(CAPNG, libcap-ng, dummy=yes,
132 AC_MSG_ERROR(Capabilities library is required))
133 AC_SUBST(CAPNG_CFLAGS)
135 AC_DEFINE(HAVE_CAPNG, 1, [Define to 1 if you have capabilities library.])
138 AC_ARG_ENABLE(udev, AC_HELP_STRING([--disable-udev],
139 [don't use udev support even if available]),
140 [enable_udev=${enableval}])
141 if (test "${enable_udev}" != "no"); then
142 PKG_CHECK_MODULES(UDEV, libudev >= 143, [enable_udev="yes"],
143 AC_MSG_ERROR(libudev >= 143 is required))
144 UDEV_DATADIR="`$PKG_CONFIG --variable=udevdir udev`"
145 if (test -z "${UDEV_DATADIR}"); then
146 UDEV_DATADIR="${sysconfdir}/udev/rules.d"
148 UDEV_DATADIR="${UDEV_DATADIR}/rules.d"
150 AC_SUBST(UDEV_DATADIR)
152 AC_SUBST(UDEV_CFLAGS)
154 AM_CONDITIONAL(UDEV, test "${enable_udev}" = "yes")
156 AC_ARG_ENABLE(atmodem, AC_HELP_STRING([--disable-atmodem],
157 [disable ETSI AT modem support]),
158 [enable_atmodem=${enableval}])
159 AM_CONDITIONAL(ATMODEM, test "${enable_atmodem}" != "no")
161 AC_ARG_ENABLE(phonesim, AC_HELP_STRING([--disable-phonesim],
162 [disable Phone simulator support]),
163 [enable_phonesim=${enableval}])
164 AM_CONDITIONAL(PHONESIM, test "${enable_phonesim}" != "no" &&
165 test "${enable_atmodem}" != "no")
167 AC_ARG_ENABLE(isimodem, AC_HELP_STRING([--disable-isimodem],
168 [disable PhoNet/ISI modem support]),
169 [enable_isimodem=${enableval}])
170 AM_CONDITIONAL(ISIMODEM, test "${enable_isimodem}" != "no")
172 AC_ARG_ENABLE(datafiles, AC_HELP_STRING([--disable-datafiles],
173 [don't install configuration and data files]),
174 [enable_datafiles=${enableval}])
176 AM_CONDITIONAL(DATAFILES, test "${enable_datafiles}" != "no")
178 if (test "${prefix}" = "NONE"); then
179 dnl no prefix and no localstatedir, so default to /var
180 if (test "$localstatedir" = '${prefix}/var'); then
181 AC_SUBST([localstatedir], ['/var'])
184 prefix="${ac_default_prefix}"
187 if (test "$localstatedir" = '${prefix}/var'); then
188 storagedir="${prefix}/var/lib/ofono"
190 storagedir="${localstatedir}/lib/ofono"
192 AC_DEFINE_UNQUOTED(STORAGEDIR, "${storagedir}",
193 [Directory for the storage files])
195 if (test "$sysconfdir" = '${prefix}/etc'); then
196 configdir="${prefix}/etc/ofono"
198 configdir="${sysconfdir}/ofono"
200 AC_DEFINE_UNQUOTED(CONFIGDIR, "${configdir}",
201 [Directory for the configuration files])
203 AC_OUTPUT(Makefile include/version.h src/ofono.service)