obexd-test package is needed for testing
[profile/ivi/obexd.git] / configure.ac
1 AC_PREREQ(2.60)
2 AC_INIT(obexd, 0.46)
3
4 AM_INIT_AUTOMAKE([foreign subdir-objects color-tests])
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 if (test "${libdir}" = '${exec_prefix}/lib'); then
14         libdir="${prefix}/lib"
15 fi
16
17 plugindir="${libdir}/obex/plugins"
18
19 if (test "$sysconfdir" = '${prefix}/etc'); then
20         configdir="${prefix}/etc/obex"
21 else
22         configdir="${sysconfdir}/obex"
23 fi
24
25 AC_DEFINE_UNQUOTED(CONFIGDIR, "${configdir}",
26                                 [Directory for the configuration files])
27
28 COMPILER_FLAGS
29
30 AC_LANG_C
31
32 AC_PROG_CC
33 AM_PROG_CC_C_O
34 AC_PROG_CC_PIE
35 AC_PROG_INSTALL
36 AC_PROG_SED
37
38 AC_PATH_READLINE
39
40 m4_define([_LT_AC_TAGCONFIG], [])
41 m4_ifdef([AC_LIBTOOL_TAGS], [AC_LIBTOOL_TAGS([])])
42
43 AC_DISABLE_STATIC
44 AC_PROG_LIBTOOL
45
46 AC_CACHE_CHECK(for tm_gmtoff in struct tm, ac_cv_struct_tm_gmtoff,
47         AC_TRY_COMPILE([
48                 #include <time.h>
49         ], [
50                 struct tm tm;
51                 tm.tm_gmtoff = 1;
52         ], ac_cv_struct_tm_gmtoff=yes, ac_cv_struct_tm_gmtoff=no))
53
54 if (test "$ac_cv_struct_tm_gmtoff" = "yes"); then
55         AC_DEFINE(HAVE_TM_GMTOFF, 1, [Define if struct tm has a tm_gmtoff member])
56 fi
57
58 AC_CACHE_CHECK(for timezone variable, ac_cv_var_timezone,
59         AC_TRY_COMPILE([
60                 #include <time.h>
61         ], [
62                 timezone = 1;
63         ], ac_cv_var_timezone=yes, ac_cv_var_timezone=no))
64
65 if (test "$ac_cv_var_timezone" = "yes"); then
66         AC_DEFINE(HAVE_TIMEZONE, 1, [Define if libc defines a timezone variable])
67 fi
68
69 AC_CHECK_LIB(dl, dlopen, dummy=yes,
70                         AC_MSG_ERROR(dynamic linking loader is required))
71
72 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.28, dummy=yes,
73                                 AC_MSG_ERROR(GLib >= 2.28 is required))
74 AC_SUBST(GLIB_CFLAGS)
75 AC_SUBST(GLIB_LIBS)
76
77 PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.4, dummy=yes,
78                                 AC_MSG_ERROR(D-Bus >= 1.4 is required))
79 AC_SUBST(DBUS_CFLAGS)
80 AC_SUBST(DBUS_LIBS)
81
82 PKG_CHECK_MODULES(BLUEZ, bluez >= 4.99, dummy=yes,
83                                 AC_MSG_ERROR(BlueZ >= 4.99 is required))
84 AC_SUBST(BLUEZ_CFLAGS)
85 AC_SUBST(BLUEZ_LIBS)
86
87 AC_ARG_ENABLE(optimization, AC_HELP_STRING([--disable-optimization],
88                         [disable code optimization through compiler]), [
89         if (test "${enableval}" = "no"); then
90                 CFLAGS="$CFLAGS -O0"
91         fi
92 ])
93
94 AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug],
95                         [enable compiling with debugging information]), [
96         if (test "${enableval}" = "yes" && test "${ac_cv_prog_cc_g}" = "yes"); then
97                 CFLAGS="$CFLAGS -g"
98         fi
99 ])
100
101 messages_driver=dummy
102 AC_ARG_WITH(messages, AC_HELP_STRING([--with-messages=DRIVER], [select messages driver]), [
103         if (test "${withval}" = "no"); then
104                 messages_driver=dummy;
105         else
106                 messages_driver=${withval};
107         fi
108 ])
109
110 AC_SUBST([MESSAGES_DRIVER], [messages-${messages_driver}.c])
111
112 phonebook_driver=dummy
113 AC_ARG_WITH(phonebook, AC_HELP_STRING([--with-phonebook=DRIVER], [select phonebook driver]), [
114         if (test "${withval}" = "no"); then
115                 phonebook_driver=dummy;
116         else
117                 phonebook_driver=${withval};
118         fi
119 ])
120
121 if (test "${phonebook_driver}" = "dummy"); then
122         PKG_CHECK_MODULES(LIBICAL, libical, dummy=yes,
123                                         AC_MSG_ERROR(libical is required))
124         AC_SUBST(LIBICAL_CFLAGS)
125         AC_SUBST(LIBICAL_LIBS)
126 fi
127
128 if (test "${phonebook_driver}" = "ebook"); then
129         AC_DEFINE(NEED_THREADS, 1, [Define if threading support is required])
130
131         PKG_CHECK_MODULES(EBOOK, libebook-1.2, dummy=yes,
132                                         AC_MSG_ERROR(libebook is required))
133         AC_SUBST(EBOOK_CFLAGS)
134         AC_SUBST(EBOOK_LIBS)
135
136         PKG_CHECK_MODULES(GTHREAD, gthread-2.0, dummy=yes,
137                                         AC_MSG_ERROR(libgthread is required))
138         AC_SUBST(GTHREAD_CFLAGS)
139         AC_SUBST(GTHREAD_LIBS)
140 fi
141
142 if (test "${phonebook_driver}" = "tracker"); then
143         PKG_CHECK_MODULES(TRACKER_09, tracker-sparql-0.9, [
144                         TRACKER_CFLAGS=${TRACKER_09_CFLAGS}
145                         TRACKER_LIBS=${TRACKER_09_LIBS}
146                 ], [
147                         PKG_CHECK_MODULES(TRACKER_10, tracker-sparql-0.10, [
148                                         TRACKER_CFLAGS=${TRACKER_10_CFLAGS}
149                                         TRACKER_LIBS=${TRACKER_10_LIBS}
150                         ], AC_MSG_ERROR(libtracker-sparql is required))])
151         AC_SUBST(TRACKER_CFLAGS)
152         AC_SUBST(TRACKER_LIBS)
153 fi
154
155 AC_SUBST([PHONEBOOK_DRIVER], [phonebook-${phonebook_driver}.c])
156
157 AC_ARG_ENABLE(usb, AC_HELP_STRING([--enable-usb],
158                                 [enable USB plugin]), [
159         enable_usb=${enableval}
160 ])
161 AM_CONDITIONAL(USB, test "${enable_usb}" = "yes")
162
163 AC_ARG_ENABLE(pcsuite, AC_HELP_STRING([--enable-pcsuite],
164                                 [enable Nokia PcSuite plugin]), [
165         enable_pcsuite=${enableval}
166 ])
167 AM_CONDITIONAL(NOKIA_PCSUITE, test "${enable_pcsuite}" = "yes")
168
169 AC_ARG_ENABLE(server, AC_HELP_STRING([--disable-server],
170                                 [disable compilation of OBEX server]), [
171         enable_server=${enableval}
172 ])
173 AM_CONDITIONAL(SERVER, test "${enable_server}" != "no")
174
175 AC_ARG_ENABLE(client, AC_HELP_STRING([--disable-client],
176                                 [disable compilation of OBEX client]), [
177         enable_client=${enableval}
178 ])
179 AM_CONDITIONAL(CLIENT, test "${enable_client}" != "no")
180
181 AM_CONDITIONAL(READLINE, test "${readline_found}" = "yes")
182
183 AC_OUTPUT(Makefile)