packaging: Bump to 1.17
[platform/upstream/ofono.git] / configure.ac
1 AC_PREREQ(2.60)
2 AC_INIT(ofono, 1.17)
3
4 AM_INIT_AUTOMAKE([foreign subdir-objects color-tests])
5 AC_CONFIG_HEADERS(config.h)
6
7 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
8
9 AM_MAINTAINER_MODE
10
11 AC_PREFIX_DEFAULT(/usr/local)
12
13 PKG_PROG_PKG_CONFIG
14
15 COMPILER_FLAGS
16
17 AC_LANG_C
18
19 AC_C_RESTRICT
20
21 AC_PROG_CC
22 AM_PROG_CC_C_O
23 AC_PROG_CC_PIE
24 AC_PROG_INSTALL
25 AC_PROG_MKDIR_P
26
27 m4_define([_LT_AC_TAGCONFIG], [])
28 m4_ifdef([AC_LIBTOOL_TAGS], [AC_LIBTOOL_TAGS([])])
29
30 AC_DISABLE_STATIC
31 AC_PROG_LIBTOOL
32
33 AC_ARG_ENABLE(optimization, AC_HELP_STRING([--disable-optimization],
34                         [disable code optimization through compiler]), [
35         if (test "${enableval}" = "no"); then
36                 CFLAGS="$CFLAGS -O0"
37         fi
38 ])
39
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
44                 CFLAGS="$CFLAGS -g"
45         fi
46 ])
47
48 AC_ARG_ENABLE(pie, AC_HELP_STRING([--enable-pie],
49                         [enable position independent executables flag]), [
50         if (test "${enableval}" = "yes" &&
51                                 test "${ac_cv_prog_cc_pie}" = "yes"); then
52                 CFLAGS="$CFLAGS -fPIE"
53                 LDFLAGS="$LDFLAGS -pie"
54         fi
55 ])
56
57 AC_ARG_ENABLE(threads, AC_HELP_STRING([--enable-threads],
58                 [enable threading support]), [enable_threads=${enableval}])
59
60 AC_CHECK_FUNC(signalfd, dummy=yes,
61                         AC_MSG_ERROR(signalfd support is required))
62
63 AC_CHECK_LIB(dl, dlopen, dummy=yes,
64                         AC_MSG_ERROR(dynamic linking loader is required))
65
66 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.28, dummy=yes,
67                                 AC_MSG_ERROR(GLib >= 2.28 is required))
68 AC_SUBST(GLIB_CFLAGS)
69 AC_SUBST(GLIB_LIBS)
70
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"
77 fi
78
79 PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.4, dummy=yes,
80                                 AC_MSG_ERROR(D-Bus >= 1.4 is required))
81 AC_SUBST(DBUS_CFLAGS)
82 AC_SUBST(DBUS_LIBS)
83
84 AC_ARG_WITH(dbusconfdir, AC_HELP_STRING([--with-dbusconfdir=PATH],
85         [path to D-Bus config directory]), [path_dbusconf=${withval}],
86                 [path_dbusconf="`$PKG_CONFIG --variable=sysconfdir dbus-1`"])
87 if (test -z "${path_dbusconf}"); then
88         DBUS_CONFDIR="${sysconfdir}/dbus-1/system.d"
89 else
90         DBUS_CONFDIR="${path_dbusconf}/dbus-1/system.d"
91 fi
92 AC_SUBST(DBUS_CONFDIR)
93
94 AC_ARG_WITH(dbusdatadir, AC_HELP_STRING([--with-dbusdatadir=PATH],
95         [path to D-Bus data directory]), [path_dbusdata=${withval}],
96                 [path_dbusdata="`$PKG_CONFIG --variable=datadir dbus-1`"])
97 if (test -z "${path_dbusdata}"); then
98         DBUS_DATADIR="${datadir}/dbus-1/system-services"
99 else
100         DBUS_DATADIR="${path_dbusdata}/dbus-1/system-services"
101 fi
102 AC_SUBST(DBUS_DATADIR)
103
104 AC_ARG_WITH([systemdunitdir], AC_HELP_STRING([--with-systemdunitdir=DIR],
105         [path to systemd service directory]), [path_systemdunit=${withval}],
106                 [path_systemdunit="`$PKG_CONFIG --variable=systemdsystemunitdir systemd`"])
107 if (test -n "${path_systemdunit}"); then
108         SYSTEMD_UNITDIR="${path_systemdunit}"
109         AC_SUBST(SYSTEMD_UNITDIR)
110 fi
111 AM_CONDITIONAL(SYSTEMD, test -n "${path_systemdunit}")
112
113 AC_ARG_ENABLE(test, AC_HELP_STRING([--enable-test],
114                 [enable test/example scripts]), [enable_test=${enableval}])
115 AM_CONDITIONAL(TEST, test "${enable_test}" = "yes")
116
117 AC_ARG_ENABLE(tools, AC_HELP_STRING([--enable-tools],
118                 [enable testing tools]), [enable_tools=${enableval}])
119 AM_CONDITIONAL(TOOLS, test "${enable_tools}" = "yes")
120
121 AC_ARG_ENABLE(dundee, AC_HELP_STRING([--enable-dundee],
122                 [enable dialup deamon support]), [enable_dundee=${enableval}])
123 AM_CONDITIONAL(DUNDEE, test "${enable_dundee}" = "yes")
124
125 AC_ARG_ENABLE(udev, AC_HELP_STRING([--disable-udev],
126                         [disable udev modem detection support]),
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"
134         else
135                 UDEV_DATADIR="${UDEV_DATADIR}/rules.d"
136         fi
137         AC_SUBST(UDEV_DATADIR)
138 fi
139 AC_SUBST(UDEV_CFLAGS)
140 AC_SUBST(UDEV_LIBS)
141 AM_CONDITIONAL(UDEV, test "${enable_udev}" = "yes")
142
143 AC_ARG_ENABLE(atmodem, AC_HELP_STRING([--disable-atmodem],
144                                 [disable ETSI AT modem support]),
145                                         [enable_atmodem=${enableval}])
146 AM_CONDITIONAL(ATMODEM, test "${enable_atmodem}" != "no")
147
148 AC_ARG_ENABLE(cdmamodem, AC_HELP_STRING([--disable-cdmamodem],
149                                 [disable CDMA AT modem support]),
150                                         [enable_cdmamodem=${enableval}])
151 AM_CONDITIONAL(CDMAMODEM, test "${enable_cdmamodem}" != "no")
152
153 AC_ARG_ENABLE(phonesim, AC_HELP_STRING([--disable-phonesim],
154                                 [disable Phone simulator support]),
155                                         [enable_phonesim=${enableval}])
156 AM_CONDITIONAL(PHONESIM, test "${enable_phonesim}" != "no" &&
157                                         test "${enable_atmodem}" != "no")
158
159 AC_ARG_ENABLE(isimodem, AC_HELP_STRING([--disable-isimodem],
160                                 [disable PhoNet/ISI modem support]),
161                                         [enable_isimodem=${enableval}])
162 AM_CONDITIONAL(ISIMODEM, test "${enable_isimodem}" != "no")
163
164 AC_ARG_ENABLE(qmimodem, AC_HELP_STRING([--disable-qmimodem],
165                                 [disable Qualcomm QMI modem support]),
166                                         [enable_qmimodem=${enableval}])
167 AM_CONDITIONAL(QMIMODEM, test "${enable_qmimodem}" != "no")
168
169 AC_ARG_ENABLE(bluetooth, AC_HELP_STRING([--disable-bluetooth],
170                                 [disable BlueZ 4 and BlueZ 5 plugins support]),
171                                         [enable_bluetooth=${enableval}])
172
173 AC_ARG_ENABLE(bluez4, AC_HELP_STRING([--enable-bluez4],
174                                 [enable BlueZ 4 plugins support prior to BlueZ 5]),
175                                         [enable_bluez4=${enableval}])
176
177 if (test "${enable_bluez4}" = "yes"); then
178         PKG_CHECK_MODULES(BLUEZ, bluez >= 4.99 bluez < 5, dummy=yes,
179                           AC_MSG_ERROR(Bluetooth library >= 4.99 and < 5 is required))
180         AC_SUBST(BLUEZ_CFLAGS)
181         AC_SUBST(BLUEZ_LIBS)
182 fi
183
184 AM_CONDITIONAL(BLUEZ4, test "${enable_bluetooth}" != "no" && test "${enable_bluez4}" = "yes")
185 AM_CONDITIONAL(BLUETOOTH, test "${enable_bluetooth}" != "no")
186
187 AC_ARG_WITH([provisiondb], AC_HELP_STRING([--with-provisiondb=FILE],
188         [location of provision database]), [path_provisiondb=${withval}])
189
190 AC_ARG_ENABLE(provision, AC_HELP_STRING([--disable-provision],
191                                 [disable provisioning support]),
192                                         [enable_provision=${enableval}])
193 if (test "${enable_provision}" != "no"); then
194         if (test -n "${path_provisiondb}"); then
195                 AC_DEFINE_UNQUOTED(PROVIDER_DATABASE, "${path_provisiondb}",
196                                                 [Mobile provider database])
197         else
198                 AC_MSG_CHECKING([for mobile-broadband-provider-info])
199                 PKG_CHECK_EXISTS(mobile-broadband-provider-info,
200                         _PKG_CONFIG(PROVIDER_DATABASE, [variable=database],
201                                         [mobile-broadband-provider-info])
202                         AC_DEFINE_UNQUOTED(PROVIDER_DATABASE,
203                                                 "$pkg_cv_PROVIDER_DATABASE",
204                                                 [Mobile provider database])
205                         AC_MSG_RESULT([yes]),
206                         AC_MSG_ERROR(Mobile broadband provider database is required))
207         fi
208 fi
209 AM_CONDITIONAL(PROVISION, test "${enable_provision}" != "no")
210
211 AC_ARG_ENABLE(datafiles, AC_HELP_STRING([--disable-datafiles],
212                         [do not install configuration and data files]),
213                                         [enable_datafiles=${enableval}])
214 AM_CONDITIONAL(DATAFILES, test "${enable_datafiles}" != "no")
215
216 if (test "${prefix}" = "NONE"); then
217         dnl no prefix and no localstatedir, so default to /var
218         if (test "$localstatedir" = '${prefix}/var'); then
219                 AC_SUBST([localstatedir], ['/var'])
220         fi
221
222         prefix="${ac_default_prefix}"
223 fi
224
225 if (test "$localstatedir" = '${prefix}/var'); then
226         storagedir="${prefix}/var/lib/ofono"
227 else
228         storagedir="${localstatedir}/lib/ofono"
229 fi
230 AC_DEFINE_UNQUOTED(STORAGEDIR, "${storagedir}",
231                         [Directory for the storage files])
232
233 if (test "$sysconfdir" = '${prefix}/etc'); then
234         configdir="${prefix}/etc/ofono"
235 else
236         configdir="${sysconfdir}/ofono"
237 fi
238 AC_DEFINE_UNQUOTED(CONFIGDIR, "${configdir}",
239                         [Directory for the configuration files])
240
241 AC_OUTPUT(Makefile include/version.h src/ofono.service ofono.pc \
242                 dundee/dundee.service)