upload tizen1.0 source
[profile/ivi/obexd.git] / configure.ac
1 AC_PREREQ(2.60)
2 AC_INIT(obexd, 0.44)
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.16, dummy=yes,
73                                 AC_MSG_ERROR(libglib 2.16 or later is required))
74 AC_CHECK_LIB(glib-2.0, g_slist_free_full, dummy=yes,
75                 AC_DEFINE(NEED_G_SLIST_FREE_FULL, 1,
76                         [Define to 1 if you need g_slist_free_full()
77                         function.]))
78 AC_SUBST(GLIB_CFLAGS)
79 AC_SUBST(GLIB_LIBS)
80
81 PKG_CHECK_MODULES(DBUS, dbus-1, dummy=yes,
82                                 AC_MSG_ERROR(libdbus-1 is required))
83 AC_CHECK_LIB(dbus-1, dbus_watch_get_unix_fd, dummy=yes,
84         AC_DEFINE(NEED_DBUS_WATCH_GET_UNIX_FD, 1,
85                 [Define to 1 if you need the dbus_watch_get_unix_fd() function.]))
86 AC_CHECK_LIB(dbus-1, dbus_connection_can_send_type, dummy=yes,
87         AC_DEFINE(NEED_DBUS_CONNECTION_CAN_SEND_TYPE, 1,
88                 [Define to 1 if you need the dbus_connection_can_send_type() funnction.]))
89 AC_SUBST(DBUS_CFLAGS)
90 AC_SUBST(DBUS_LIBS)
91
92 PKG_CHECK_MODULES(BLUEZ, bluez, dummy=yes,
93                                 AC_MSG_ERROR(libbluetooth is required))
94 AC_SUBST(BLUEZ_CFLAGS)
95 AC_SUBST(BLUEZ_LIBS)
96
97 AC_ARG_ENABLE(optimization, AC_HELP_STRING([--disable-optimization],
98                         [disable code optimization through compiler]), [
99         if (test "${enableval}" = "no"); then
100                 CFLAGS="$CFLAGS -O0"
101         fi
102 ])
103
104 AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug],
105                         [enable compiling with debugging information]), [
106         if (test "${enableval}" = "yes" && test "${ac_cv_prog_cc_g}" = "yes"); then
107                 CFLAGS="$CFLAGS -g"
108         fi
109 ])
110
111 messages_driver=dummy
112 AC_ARG_WITH(messages, AC_HELP_STRING([--with-messages=DRIVER], [select messages driver]), [
113         if (test "${withval}" = "no"); then
114                 messages_driver=dummy;
115         else
116                 messages_driver=${withval};
117         fi
118 ])
119
120 AC_SUBST([MESSAGES_DRIVER], [messages-${messages_driver}.c])
121
122 phonebook_driver=dummy
123 AC_ARG_WITH(phonebook, AC_HELP_STRING([--with-phonebook=DRIVER], [select phonebook driver]), [
124         if (test "${withval}" = "no"); then
125                 phonebook_driver=dummy;
126         else
127                 phonebook_driver=${withval};
128         fi
129 ])
130
131 if (test "${phonebook_driver}" = "dummy"); then
132         PKG_CHECK_MODULES(LIBICAL, libical, dummy=yes,
133                                         AC_MSG_ERROR(libical is required))
134         AC_SUBST(LIBICAL_CFLAGS)
135         AC_SUBST(LIBICAL_LIBS)
136 fi
137
138 if (test "${phonebook_driver}" = "ebook"); then
139         AC_DEFINE(NEED_THREADS, 1, [Define if threading support is required])
140
141         PKG_CHECK_MODULES(EBOOK, libebook-1.2, dummy=yes,
142                                         AC_MSG_ERROR(libebook is required))
143         AC_SUBST(EBOOK_CFLAGS)
144         AC_SUBST(EBOOK_LIBS)
145
146         PKG_CHECK_MODULES(GTHREAD, gthread-2.0, dummy=yes,
147                                         AC_MSG_ERROR(libgthread is required))
148         AC_SUBST(GTHREAD_CFLAGS)
149         AC_SUBST(GTHREAD_LIBS)
150 fi
151
152 if (test "${phonebook_driver}" = "tracker"); then
153         PKG_CHECK_MODULES(TRACKER_09, tracker-sparql-0.9, [
154                         TRACKER_CFLAGS=${TRACKER_09_CFLAGS}
155                         TRACKER_LIBS=${TRACKER_09_LIBS}
156                 ], [
157                         PKG_CHECK_MODULES(TRACKER_10, tracker-sparql-0.10, [
158                                         TRACKER_CFLAGS=${TRACKER_10_CFLAGS}
159                                         TRACKER_LIBS=${TRACKER_10_LIBS}
160                         ], AC_MSG_ERROR(libtracker-sparql is required))])
161         AC_SUBST(TRACKER_CFLAGS)
162         AC_SUBST(TRACKER_LIBS)
163 fi
164
165 AC_SUBST([PHONEBOOK_DRIVER], [phonebook-${phonebook_driver}.c])
166
167 AC_ARG_ENABLE(usb, AC_HELP_STRING([--enable-usb],
168                                 [enable USB plugin]), [
169         enable_usb=${enableval}
170 ])
171 AM_CONDITIONAL(USB, test "${enable_usb}" = "yes")
172
173 AC_ARG_ENABLE(pcsuite, AC_HELP_STRING([--enable-pcsuite],
174                                 [enable Nokia PcSuite plugin]), [
175         enable_pcsuite=${enableval}
176 ])
177 AM_CONDITIONAL(NOKIA_PCSUITE, test "${enable_pcsuite}" = "yes")
178
179 AC_ARG_ENABLE(server, AC_HELP_STRING([--disable-server],
180                                 [disable compilation of OBEX server]), [
181         enable_server=${enableval}
182 ])
183 AM_CONDITIONAL(SERVER, test "${enable_server}" != "no")
184
185 AC_ARG_ENABLE(client, AC_HELP_STRING([--disable-client],
186                                 [disable compilation of OBEX client]), [
187         enable_client=${enableval}
188 ])
189 AM_CONDITIONAL(CLIENT, test "${enable_client}" != "no")
190
191 AM_CONDITIONAL(READLINE, test "${readline_found}" = "yes")
192
193 AC_OUTPUT(Makefile)