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(test, AC_HELP_STRING([--enable-test],
52 [enable test/example scripts]), [enable_test=${enableval}])
53 AM_CONDITIONAL(TEST, test "${enable_test}" = "yes")
55 AC_ARG_ENABLE(pie, AC_HELP_STRING([--enable-pie],
56 [enable position independent executables flag]), [
57 if (test "${enableval}" = "yes" &&
58 test "${ac_cv_prog_cc_pie}" = "yes"); then
59 CFLAGS="$CFLAGS -fPIE"
60 LDFLAGS="$LDFLAGS -pie"
64 AC_ARG_ENABLE(threads, AC_HELP_STRING([--enable-threads],
65 [enable threading support]), [enable_threads=${enableval}])
67 AC_CHECK_LIB(c, signalfd, dummy=yes,
68 AC_MSG_ERROR(signalfd support is required))
70 AC_CHECK_LIB(dl, dlopen, dummy=yes,
71 AC_MSG_ERROR(dynamic linking loader is required))
73 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.16, dummy=yes,
74 AC_MSG_ERROR(GLib >= 2.16 is required))
78 if (test "${enable_threads}" = "yes"); then
79 AC_DEFINE(NEED_THREADS, 1, [Define if threading support is required])
80 PKG_CHECK_MODULES(GTHREAD, gthread-2.0 >= 2.16, dummy=yes,
81 AC_MSG_ERROR(GThread >= 2.16 is required))
82 GLIB_CFLAGS="$GLIB_CFLAGS $GTHREAD_CFLAGS"
83 GLIB_LIBS="$GLIB_LIBS $GTHREAD_LIBS"
86 PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.0, dummy=yes,
87 AC_MSG_ERROR(D-Bus >= 1.0 is required))
88 AC_CHECK_LIB(dbus-1, dbus_watch_get_unix_fd, dummy=yes,
89 AC_DEFINE(NEED_DBUS_WATCH_GET_UNIX_FD, 1,
90 [Define to 1 if you need the dbus_watch_get_unix_fd() function.]))
94 AC_ARG_WITH(dbusconf, AC_HELP_STRING([--with-dbusconf=PATH],
95 [path to D-Bus config directory]), [path_dbusconf=${withval}],
96 [path_dbusconf="`$PKG_CONFIG --variable=sysconfdir dbus-1`"])
97 if (test -z "${path_dbusconf}"); then
98 DBUS_DATADIR="${sysconfdir}/dbus-1/system.d"
100 DBUS_DATADIR="${path_dbusconf}/dbus-1/system.d"
102 AC_SUBST(DBUS_DATADIR)
104 AC_ARG_ENABLE(udev, AC_HELP_STRING([--disable-udev],
105 [don't use udev support even if available]),
106 [enable_udev=${enableval}])
107 if (test "${enable_udev}" != "no"); then
108 PKG_CHECK_MODULES(UDEV, libudev >= 143,
109 [enable_udev="yes"], [enable_udev="no"])
111 if (test "${enable_udev}" = "yes"); then
112 UDEV_DATADIR="`$PKG_CONFIG --variable=udevdir udev`"
113 if (test -z "${UDEV_DATADIR}"); then
114 UDEV_DATADIR="${sysconfdir}/udev/rules.d"
116 UDEV_DATADIR="${UDEV_DATADIR}/rules.d"
118 AC_SUBST(UDEV_DATADIR)
120 AC_SUBST(UDEV_CFLAGS)
122 AM_CONDITIONAL(UDEV, test "${enable_udev}" = "yes")
124 AC_ARG_ENABLE(isimodem, AC_HELP_STRING([--disable-isimodem],
125 [disable PhoNet/ISI modem support]),
126 [enable_isimodem=${enableval}])
127 AM_CONDITIONAL(ISIMODEM, test "${enable_isimodem}" != "no")
129 AC_ARG_ENABLE(atmodem, AC_HELP_STRING([--disable-atmodem],
130 [disable ETSI AT modem support]),
131 [enable_atmodem=${enableval}])
132 AM_CONDITIONAL(ATMODEM, test "${enable_atmodem}" != "no")
134 AC_ARG_ENABLE(datafiles, AC_HELP_STRING([--disable-datafiles],
135 [don't install configuration and data files]),
136 [enable_datafiles=${enableval}])
138 AM_CONDITIONAL(DATAFILES, test "${enable_datafiles}" != "no")
140 if (test "${prefix}" = "NONE"); then
141 dnl no prefix and no localstatedir, so default to /var
142 if (test "$localstatedir" = '${prefix}/var'); then
143 AC_SUBST([localstatedir], ['/var'])
146 prefix="${ac_default_prefix}"
149 if (test "$localstatedir" = '${prefix}/var'); then
150 storagedir="${prefix}/var/lib/ofono"
152 storagedir="${localstatedir}/lib/ofono"
155 AC_DEFINE_UNQUOTED(STORAGEDIR, "${storagedir}",
156 [Directory for the storage files])
158 if (test "$sysconfdir" = '${prefix}/etc'); then
159 configdir="${prefix}/etc/ofono"
161 configdir="${sysconfdir}/ofono"
164 AC_DEFINE_UNQUOTED(CONFIGDIR, "${configdir}",
165 [Directory for the configuration files])
167 AC_OUTPUT(Makefile include/version.h)