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)
29 m4_define([_LT_AC_TAGCONFIG], [])
30 m4_ifdef([AC_LIBTOOL_TAGS], [AC_LIBTOOL_TAGS([])])
36 AC_ARG_ENABLE(optimization, AC_HELP_STRING([--disable-optimization],
37 [disable code optimization through compiler]), [
38 if (test "${enableval}" = "no"); then
43 AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug],
44 [enable compiling with debugging information]), [
45 if (test "${enableval}" = "yes" &&
46 test "${ac_cv_prog_cc_g}" = "yes"); then
51 AC_ARG_ENABLE(pie, AC_HELP_STRING([--enable-pie],
52 [enable position independent executables flag]), [
53 if (test "${enableval}" = "yes" &&
54 test "${ac_cv_prog_cc_pie}" = "yes"); then
55 CFLAGS="$CFLAGS -fPIE"
56 LDFLAGS="$LDFLAGS -pie"
60 AC_ARG_ENABLE(threads, AC_HELP_STRING([--enable-threads],
61 [enable threading support]), [enable_threads=${enableval}])
63 AC_CHECK_LIB(dl, dlopen, dummy=yes,
64 AC_MSG_ERROR(dynamic linking loader is required))
66 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.16, dummy=yes,
67 AC_MSG_ERROR(GLib >= 2.16 is required))
71 if (test "${enable_threads}" = "yes"); then
72 AC_DEFINE(NEED_THREADS, 1, [Define if threading support is required])
73 PKG_CHECK_MODULES(GTHREAD, gthread-2.0 >= 2.16, dummy=yes,
74 AC_MSG_ERROR(GThread >= 2.16 is required))
75 GLIB_CFLAGS="$GLIB_CFLAGS $GTHREAD_CFLAGS"
76 GLIB_LIBS="$GLIB_LIBS $GTHREAD_LIBS"
79 PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.0, dummy=yes,
80 AC_MSG_ERROR(D-Bus >= 1.0 is required))
81 AC_CHECK_LIB(dbus-1, dbus_watch_get_unix_fd, dummy=yes,
82 AC_DEFINE(NEED_DBUS_WATCH_GET_UNIX_FD, 1,
83 [Define to 1 if you need the dbus_watch_get_unix_fd() function.]))
87 AC_ARG_WITH(dbusconf, AC_HELP_STRING([--with-dbusconf=PATH],
88 [path to D-Bus config directory]), [path_dbusconf=${withval}],
89 [path_dbusconf="`$PKG_CONFIG --variable=sysconfdir dbus-1`"])
90 if (test -z "${path_dbusconf}"); then
91 DBUS_DATADIR="${sysconfdir}/dbus-1/system.d"
93 DBUS_DATADIR="${path_dbusconf}/dbus-1/system.d"
95 AC_SUBST(DBUS_DATADIR)
97 AC_ARG_ENABLE(udev, AC_HELP_STRING([--disable-udev],
98 [don't use udev support even if available]),
99 [enable_udev=${enableval}])
100 if (test "${enable_udev}" != "no"); then
101 PKG_CHECK_MODULES(UDEV, libudev >= 141,
102 [enable_udev="yes"], [enable_udev="no"])
104 if (test "${enable_udev}" = "yes"); then
105 AC_CHECK_LIB(udev, udev_monitor_filter_update, dummy=yes,
106 AC_DEFINE(NEED_UDEV_MONITOR_FILTER, 1,
107 [Define to 1 if you need the
108 udev_monitor_filter...() functions.]))
109 UDEV_DATADIR="`$PKG_CONFIG --variable=udevdir udev`"
110 if (test -z "${UDEV_DATADIR}"); then
111 UDEV_DATADIR="${sysconfdir}/udev/rules.d"
113 UDEV_DATADIR="${UDEV_DATADIR}/rules.d"
115 AC_SUBST(UDEV_DATADIR)
117 AC_SUBST(UDEV_CFLAGS)
119 AM_CONDITIONAL(UDEV, test "${enable_udev}" = "yes")
121 AC_ARG_ENABLE(isimodem, AC_HELP_STRING([--disable-isimodem],
122 [disable PhoNet/ISI modem support]),
123 [enable_isimodem=${enableval}])
124 AM_CONDITIONAL(ISIMODEM, test "${enable_isimodem}" != "no")
126 AC_ARG_ENABLE(atmodem, AC_HELP_STRING([--disable-atmodem],
127 [disable ETSI AT modem support]),
128 [enable_atmodem=${enableval}])
129 AM_CONDITIONAL(ATMODEM, test "${enable_atmodem}" != "no")
131 AC_ARG_ENABLE(datafiles, AC_HELP_STRING([--disable-datafiles],
132 [don't install configuration and data files]),
133 [enable_datafiles=${enableval}])
135 AM_CONDITIONAL(DATAFILES, test "${enable_datafiles}" != "no")
137 if (test "${prefix}" = "NONE"); then
138 dnl no prefix and no localstatedir, so default to /var
139 if (test "$localstatedir" = '${prefix}/var'); then
140 AC_SUBST([localstatedir], ['/var'])
143 prefix="${ac_default_prefix}"
146 if (test "$localstatedir" = '${prefix}/var'); then
147 storagedir="${prefix}/var/lib/ofono"
149 storagedir="${localstatedir}/lib/ofono"
152 AC_DEFINE_UNQUOTED(STORAGEDIR, "${storagedir}",
153 [Directory for the storage files])
155 if (test "$sysconfdir" = '${prefix}/etc'); then
156 configdir="${prefix}/etc/ofono"
158 configdir="${sysconfdir}/ofono"
161 AC_DEFINE_UNQUOTED(CONFIGDIR, "${configdir}",
162 [Directory for the configuration files])
164 AC_OUTPUT(Makefile include/version.h)