Release 0.10
[platform/upstream/ofono.git] / configure.ac
1 AC_PREREQ(2.60)
2 AC_INIT(ofono, 0.10)
3
4 AM_INIT_AUTOMAKE([foreign subdir-objects])
5 AM_CONFIG_HEADER(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_SED
26 AC_PROG_AWK
27 AM_PROG_MKDIR_P
28
29 m4_define([_LT_AC_TAGCONFIG], [])
30 m4_ifdef([AC_LIBTOOL_TAGS], [AC_LIBTOOL_TAGS([])])
31
32 AC_DISABLE_STATIC
33 AC_PROG_LIBTOOL
34 AC_PROG_NM
35
36 AC_ARG_ENABLE(optimization, AC_HELP_STRING([--disable-optimization],
37                         [disable code optimization through compiler]), [
38         if (test "${enableval}" = "no"); then
39                 CFLAGS="$CFLAGS -O0"
40         fi
41 ])
42
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
47                 CFLAGS="$CFLAGS -g"
48         fi
49 ])
50
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"
57         fi
58 ])
59
60 AC_ARG_ENABLE(threads, AC_HELP_STRING([--enable-threads],
61                 [enable threading support]), [enable_threads=${enableval}])
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.16, dummy=yes,
67                                 AC_MSG_ERROR(GLib >= 2.16 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.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.]))
84 AC_SUBST(DBUS_CFLAGS)
85 AC_SUBST(DBUS_LIBS)
86
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"
92 else
93         DBUS_DATADIR="${path_dbusconf}/dbus-1/system.d"
94 fi
95 AC_SUBST(DBUS_DATADIR)
96
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"])
103 fi
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"
112         else
113                 UDEV_DATADIR="${UDEV_DATADIR}/rules.d"
114         fi
115         AC_SUBST(UDEV_DATADIR)
116 fi
117 AC_SUBST(UDEV_CFLAGS)
118 AC_SUBST(UDEV_LIBS)
119 AM_CONDITIONAL(UDEV, test "${enable_udev}" = "yes")
120
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")
125
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")
130
131 AC_ARG_ENABLE(datafiles, AC_HELP_STRING([--disable-datafiles],
132                         [don't install configuration and data files]),
133                                         [enable_datafiles=${enableval}])
134
135 AM_CONDITIONAL(DATAFILES, test "${enable_datafiles}" != "no")
136
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'])
141         fi
142
143         prefix="${ac_default_prefix}"
144 fi
145
146 if (test "$localstatedir" = '${prefix}/var'); then
147         storagedir="${prefix}/var/lib/ofono"
148 else
149         storagedir="${localstatedir}/lib/ofono"
150 fi
151
152 AC_DEFINE_UNQUOTED(STORAGEDIR, "${storagedir}",
153                         [Directory for the storage files])
154
155 if (test "$sysconfdir" = '${prefix}/etc'); then
156         configdir="${prefix}/etc/ofono"
157 else
158         configdir="${sysconfdir}/ofono"
159 fi
160
161 AC_DEFINE_UNQUOTED(CONFIGDIR, "${configdir}",
162                         [Directory for the configuration files])
163
164 AC_OUTPUT(Makefile include/version.h)