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.16, dummy=yes,
71 AC_MSG_ERROR(GLib >= 2.16 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(capng, AC_HELP_STRING([--enable-capng],
116 [enable capabilities support]), [enable_capng=${enableval}])
117 if (test "${enable_capng}" = "yes"); then
118 PKG_CHECK_MODULES(CAPNG, libcap-ng, dummy=yes,
119 AC_MSG_ERROR(Capabilities library is required))
120 AC_SUBST(CAPNG_CFLAGS)
122 AC_DEFINE(HAVE_CAPNG, 1, [Define to 1 if you have capabilities library.])
125 AC_ARG_ENABLE(udev, AC_HELP_STRING([--disable-udev],
126 [don't use udev support even if available]),
127 [enable_udev=${enableval}])
128 if (test "${enable_udev}" != "no"); then
129 PKG_CHECK_MODULES(UDEV, libudev >= 143, [enable_udev="yes"],
130 AC_MSG_ERROR(libudev >= 143 is required))
131 UDEV_DATADIR="`$PKG_CONFIG --variable=udevdir udev`"
132 if (test -z "${UDEV_DATADIR}"); then
133 UDEV_DATADIR="${sysconfdir}/udev/rules.d"
135 UDEV_DATADIR="${UDEV_DATADIR}/rules.d"
137 AC_SUBST(UDEV_DATADIR)
139 AC_SUBST(UDEV_CFLAGS)
141 AM_CONDITIONAL(UDEV, test "${enable_udev}" = "yes")
143 AC_ARG_ENABLE(isimodem, AC_HELP_STRING([--disable-isimodem],
144 [disable PhoNet/ISI modem support]),
145 [enable_isimodem=${enableval}])
146 AM_CONDITIONAL(ISIMODEM, test "${enable_isimodem}" != "no")
148 AC_ARG_ENABLE(atmodem, AC_HELP_STRING([--disable-atmodem],
149 [disable ETSI AT modem support]),
150 [enable_atmodem=${enableval}])
151 AM_CONDITIONAL(ATMODEM, test "${enable_atmodem}" != "no")
153 AC_ARG_ENABLE(datafiles, AC_HELP_STRING([--disable-datafiles],
154 [don't install configuration and data files]),
155 [enable_datafiles=${enableval}])
157 AM_CONDITIONAL(DATAFILES, test "${enable_datafiles}" != "no")
159 if (test "${prefix}" = "NONE"); then
160 dnl no prefix and no localstatedir, so default to /var
161 if (test "$localstatedir" = '${prefix}/var'); then
162 AC_SUBST([localstatedir], ['/var'])
165 prefix="${ac_default_prefix}"
168 if (test "$localstatedir" = '${prefix}/var'); then
169 storagedir="${prefix}/var/lib/ofono"
171 storagedir="${localstatedir}/lib/ofono"
173 AC_DEFINE_UNQUOTED(STORAGEDIR, "${storagedir}",
174 [Directory for the storage files])
176 if (test "$sysconfdir" = '${prefix}/etc'); then
177 configdir="${prefix}/etc/ofono"
179 configdir="${sysconfdir}/ofono"
181 AC_DEFINE_UNQUOTED(CONFIGDIR, "${configdir}",
182 [Directory for the configuration files])
184 AC_OUTPUT(Makefile include/version.h src/ofono.service)