core cleanup: added backend API for debug output
[siplcs.git] / configure.ac
blob5a9bef735583fc43fa4514ef5d012e1f0d7e7309
1 dnl ensure recent enough version of Autoconf
2 AC_PREREQ([2.50])
4 dnl Use `VERSION' files to get version.
5 m4_define([SIPE_VERSION_DATA], m4_include([VERSION]))
7 dnl Strip off newline characters.
8 m4_define([SIPE_VERSION],
9           m4_substr(SIPE_VERSION_DATA,
10                     [0], m4_decr(m4_len(SIPE_VERSION_DATA))))
12 dnl initialize package name, version, bugtracker & homepage
13 AC_INIT([pidgin-sipe], SIPE_VERSION,
14         [https://sourceforge.net/tracker/?atid=949931&group_id=194563], [],
15         [http://sipe.sourceforge.net/])
17 dnl setup automake and require recent enough version
18 AM_INIT_AUTOMAKE([1.9 dist-bzip2 no-define tar-ustar])
20 dnl set programming language
21 AC_LANG(C)
22 AC_HEADER_STDC
24 dnl setup shared library generation
25 LT_INIT([disable-static])
27 dnl checks for tools
28 IT_PROG_INTLTOOL([0.35.0])
29 AC_PROG_INSTALL
30 AC_PROG_RANLIB
32 dnl checks for library functions
33 AC_CHECK_FUNCS([setenv unsetenv])
35 dnl tell pkgconfig to look in the same prefix where we're installing this to,
36 dnl as that is likely where libpurple will be found if it is not in the default
37 dnl pkgconfig path
38 PREFIX=$ac_default_prefix
39 if test "$prefix" != "NONE"; then
40         PREFIX=$prefix
43 PKG_CONFIG_PATH="$PKG_CONFIG_PATH":"$PREFIX/lib/pkgconfig"
44 export PKG_CONFIG_PATH
46 dnl debug mode
47 AC_ARG_ENABLE(debug,
48         [AS_HELP_STRING([--enable-debug],
49                         [compile with debugging support [default=no]])],
50         ,
51         enable_debug="no")
53 if test "$enable_debug" = yes; then
54    AC_DEFINE(DEBUG, 1, [Define if debugging is enabled.])
57 DEBUG_CFLAGS="${DEBUG_CFLAGS}"
58 AC_SUBST(DEBUG_CFLAGS)
60 dnl quality check mode
61 dnl For people who are interested in finding bugs and not hiding them
62 AC_ARG_ENABLE(quality-check,
63         [AS_HELP_STRING([--enable-quality-check],
64                         [compile with compiler checks enabled [default=yes]])],
65         ,
66         enable_quality_check="yes")
68 if test "$enable_quality_check" = yes; then
69         QUALITY_CFLAGS="${QUALITY_CFLAGS} -Werror -Wall -Wextra"
70 else
71         QUALITY_CFLAGS="${QUALITY_CFLAGS}"
73 AC_SUBST(QUALITY_CFLAGS)
75 dnl Check for pkg-config before using it
76 PKG_PROG_PKG_CONFIG
78 AC_ARG_WITH([krb5],
79         [AC_HELP_STRING([--with-krb5=PREFIX],
80                 [compile sipe plugin with Kerberos 5 support @<:@default=no@:>@])],
81         [test "$withval" = "no" || kerberos="$withval"],
82         [kerberos="no"])
84 dnl check for Kerberos
85 AC_SUBST(KRB5_CFLAGS)
86 AC_SUBST(KRB5_LDFLAGS)
87 AC_SUBST(KRB5_LIBS)
89 AM_CONDITIONAL(SIP_SEC_KRB5, test "$kerberos" != "no")
90 if test "$kerberos" != "no" ; then
91         if test "$kerberos" != "yes" ; then
92                 KRB5_CFLAGS="-I${kerberos}/include"
93                 KRB5_LDFLAGS="-L${kerberos}/lib"
94         fi
95         orig_LDFLAGS="$LDFLAGS"
96         LDFLAGS="$LDFLAGS $KRB5_LDFLAGS"
97         AC_CHECK_LIB(krb5, krb5_rd_req,
98                         [KRB5_LIBS="-lkrb5"],
99                         [AC_CHECK_LIB(krb5, krb5_rd_req,
100                                 [KRB5_LIBS="-lkrb5"],
101                                 [AC_ERROR(Kerberos 5 libraries not found)],
102                                 )],
103                         -lkrb5)
104         AC_CHECK_LIB(gssapi_krb5, gss_krb5_export_lucid_sec_context,
105                         [KRB5_LIBS="$KRB5_LIBS -lgssapi_krb5"],
106                         [AC_CHECK_LIB(gssapi, gss_krb5_export_lucid_sec_context,
107                                 [KRB5_LIBS="$KRB5_LIBS -lgssapi_krb5"],
108                                 [AC_ERROR(GSSAPI libraries not found)],
109                                 )],
110                         -lgssapi_krb5)
111         savedLIBS="$LIBS"
112         LIBS="$KRB5_LIBS $LIBS"
113         AC_CHECK_FUNCS([krb5_get_error_message])
114         LIBS="$savedLIBS"
115         AC_DEFINE(HAVE_KERBEROS, 1, [Define if kerberos should be used in sipe.])
118 dnl check for glib
119 PKG_CHECK_MODULES(GLIB, [glib-2.0])
121 dnl check for libxml2
122 PKG_CHECK_MODULES(LIBXML2, [libxml-2.0])
124 dnl assumption check: sizof(uuid_t) must be 16 (see uuid.c)
125 AC_MSG_CHECKING([that sizeof(uuid_t) is 16])
126 ac_save_CFLAGS=$CFLAGS
127 CFLAGS="$GLIB_CFLAGS -Werror -Wall -Wextra"
128 dnl note the [[[ quoting: our code contains []!
129 AC_RUN_IFELSE(
130         AC_LANG_PROGRAM(
131                 [[[
132 #include <glib.h>
133 #include <stdio.h>
135 /* Copied from uuid.c */
136 typedef struct {
137    guint32 time_low;
138    guint16 time_mid;
139    guint16 time_hi_and_version;
140    guint8  clock_seq_hi_and_reserved;
141    guint8  clock_seq_low;
142    guint8  node[6];
143 } uuid_t;
144                 ]]],
145                 [return(sizeof(uuid_t) == 16 ? 0 : 1);]),
146         [AC_MSG_RESULT(yes)],
147         [AC_MSG_RESULT(failed)
148          AC_ERROR(sizeof(uuid_t) is not 16
150 Please notify the SIPE developers and provide the following information:
152  host:     $host
153  build:    $build
154  compiler: $CC
156 CFLAGS=$ac_save_CFLAGS
158 dnl check for libpurple
159 purple="yes"
160 AC_ARG_WITH([purple],
161         [AC_HELP_STRING([--with-purple],
162                 [compile sipe plugin for libpurple clients @<:@default=autodetect@:>@])],
163         [test "$withval" = "yes" || purple="no"],
164         [])
165 if test "$purple" != "no"; then
166         PKG_CHECK_MODULES(PURPLE, [purple >= 2.4.0],
167                 [],
168                 [purple="no"])
171 dnl support for libpurple plugin
172 AM_CONDITIONAL(SIPE_INCLUDE_PURPLE, test "$purple" != "no")
173 if test "$purple" != "no"; then
175         dnl unfortunately PURPLE_MAJOR_VERSION is not exported by purple.m4
176         PURPLE_MAJOR_VERSION=`$PKG_CONFIG --modversion purple | cut -d. -f 1`
177         AC_SUBST(PURPLE_MAJOR_VERSION)
179         dnl let user now if he has a 32- and 64-bit header conflict...
180         AC_MSG_CHECKING([for 32- and 64-bit header conflicts])
181         ac_save_CFLAGS=$CFLAGS
182         CFLAGS="$PURPLE_CFLAGS -Werror -Wall -Wextra"
183         AC_COMPILE_IFELSE(
184                 AC_LANG_PROGRAM(
185                         [
186 #include <glib.h>
187 #include <cipher.h>
189 /* Compile some code that has caused trouble in the past */
190 void testfunc(unsigned long len)
192   PurpleCipherContext *rc4 = NULL;
193   purple_cipher_context_set_option(rc4, "key_len", GUINT_TO_POINTER(len));
195                         ],
196                         [testfunc(16);]),
197                 [AC_MSG_RESULT(none)],
198                 [AC_MSG_RESULT(failed)
199                  AC_ERROR(conflicts found.
201 Check that you have the correct glib/libpurple headers installed for
202 your architecture or set PURPLE_CFLAGS to override the system defaults.
204         CFLAGS=$ac_save_CFLAGS
207 dnl check for telepathy
208 telepathy="yes"
209 AC_ARG_WITH([telepathy],
210         [AC_HELP_STRING([--with-telepathy],
211                 [compile sipe plugin for telepathy clients @<:@default=autodetect@:>@])],
212         [test "$withval" = "yes" || telepathy="no"],
213         [])
214 if test "$telepathy" != "no"; then
215         PKG_CHECK_MODULES(TELEPATHY, [telepathy-glib],
216                 [],
217                 [telepathy="no"])
220 dnl support for telepathy plugin
221 AM_CONDITIONAL(SIPE_INCLUDE_TELEPATHY, test "$telepathy" != "no")
222 dnl NOTHING IMPLEMENTED YET!!!
223 dnl if test "$telepathy" != "no"; then
224 dnl fi
226 dnl sanity check
227 AS_IF([test "$purple" = "no" -a "$telepathy" = "no"],
228         [AC_ERROR(at least one plugin must be selected
230 If you didn't use a --without option then please check that you have
231 the headers for the packages "purple" or "telepathy-glib" installed.
233         [])
235 dnl i18n
236 AC_MSG_CHECKING([locale_CPPFLAGS])
237 LOCALE_CPPFLAGS='-DLOCALEDIR=\"$(prefix)/$(DATADIRNAME)/locale\"'
238 AC_SUBST([LOCALE_CPPFLAGS])
239 AC_MSG_RESULT([$LOCALE_CPPFLAGS])
240 AM_GLIB_GNU_GETTEXT
241 AC_SUBST(GETTEXT_PACKAGE, "${PACKAGE_NAME}")
243 dnl codeset
244 AM_LANGINFO_CODESET
246 dnl substitutions and generated files
247 AC_CONFIG_HEADERS([config.h])
248 AC_CONFIG_FILES([
249         Makefile
250         pixmaps/Makefile
251         m4macros/Makefile
252         po/Makefile.in
253         pixmaps/16/Makefile
254         pixmaps/22/Makefile
255         pixmaps/48/Makefile
256         src/Makefile
257         src/core/Makefile
258         src/api/Makefile
259         src/purple/Makefile
260         src/telepathy/Makefile
261         ])
263 dnl generate files
264 AC_OUTPUT()
266 dnl additional info for the user
267 echo
268 if test "$purple" != "no" ; then
269         echo "Compiling libpurple plugin"
270         echo "PURPLE_CFLAGS  : $PURPLE_CFLAGS"
271         echo "PURPLE_LIBS    : $PURPLE_LIBS"
272 else
273         echo "Skipping libpurple plugin"
276 echo
277 if test "$telepathy" != "no" ; then
278         echo "Compiling telepathy plugin"
279         echo
280         echo "NOTHING IMPLEMENTED YET!!!"
281         echo
282         echo "TELEPATHY_CFLAGS: $TELEPATHY_CFLAGS"
283         echo "TELEPATHY_LIBS  : $TELEPATHY_LIBS"
284 else
285         echo "Skipping telepathy plugin"
287 if test "$kerberos" != "no" ; then
288         echo
289         echo "Compiling with kerberos 5 support"
290         echo "KRB5_CFLAGS    : $KRB5_CFLAGS"
291         echo "KRB5_LDFLAGS   : $KRB5_LDFLAGS"
292         echo "KRB5_LIBS      : $KRB5_LIBS"
295 if test "$enable_debug" != "no"; then
296         echo
297         echo "Compiling with debugging enabled"
298         echo "DEBUG_CFLAGS   : $DEBUG_CFLAGS"
301 if test -n "${QUALITY_CFLAGS}"; then
302         echo
303         echo "Compiling with compiler checks enabled"
304         echo "QUALITY_CFLAGS : $QUALITY_CFLAGS"
307 echo
308 echo "configure complete, now run 'make'"
309 echo
311 dnl The End.