core cleanup: replace purple_url_decode()
[siplcs.git] / configure.ac
blobd2c7906eb2ef27cf70e578f452266c973befd842
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 homepage
13 m4_define([SIPE_HOMEPAGE], [http://sipe.sourceforge.net/])
15 dnl initialize package name, version, bugtracker & homepage
16 AC_INIT([pidgin-sipe], SIPE_VERSION,
17         [https://sourceforge.net/tracker/?atid=949931&group_id=194563], [],
18         SIPE_HOMEPAGE)
20 dnl setup automake and require recent enough version
21 AM_INIT_AUTOMAKE([1.9 dist-bzip2 no-define tar-ustar])
23 dnl set PACKAGE_URL for autoconf < 2.64
24 if test "x${PACKAGE_URL}" = "x"; then
25         AC_MSG_NOTICE([set PACKAGE_URL for autoconf < 2.64])
26         AC_DEFINE(PACKAGE_URL, "SIPE_HOMEPAGE",
27                   [Define to the home page for this package.])
30 dnl set programming language
31 AC_LANG(C)
32 AM_PROG_CC_C_O
33 AC_HEADER_STDC
35 dnl setup shared library generation
36 LT_INIT([disable-static])
38 dnl checks for tools
39 IT_PROG_INTLTOOL([0.35.0])
40 AC_PROG_INSTALL
41 AC_PROG_RANLIB
43 dnl checks for header files
44 AC_CHECK_HEADERS([sys/sockio.h])
46 dnl checks for library functions
47 AC_CHECK_FUNCS([setenv unsetenv])
49 dnl tell pkgconfig to look in the same prefix where we're installing this to,
50 dnl as that is likely where libpurple will be found if it is not in the default
51 dnl pkgconfig path
52 PREFIX=$ac_default_prefix
53 if test "$prefix" != "NONE"; then
54         PREFIX=$prefix
57 PKG_CONFIG_PATH="$PKG_CONFIG_PATH":"$PREFIX/lib/pkgconfig"
58 export PKG_CONFIG_PATH
60 dnl debug mode
61 AC_ARG_ENABLE(debug,
62         [AS_HELP_STRING([--enable-debug],
63                         [compile with debugging support [default=no]])],
64         ,
65         enable_debug="no")
67 if test "$enable_debug" = yes; then
68    AC_DEFINE(DEBUG, 1, [Define if debugging is enabled.])
71 DEBUG_CFLAGS="${DEBUG_CFLAGS}"
72 AC_SUBST(DEBUG_CFLAGS)
74 dnl quality check mode
75 dnl For people who are interested in finding bugs and not hiding them
76 AC_ARG_ENABLE(quality-check,
77         [AS_HELP_STRING([--enable-quality-check],
78                         [compile with compiler checks enabled [default=yes]])],
79         ,
80         enable_quality_check="yes")
83 if test "$enable_quality_check" = yes; then
84         QUALITY_CFLAGS="$QUALITY_CFLAGS -Werror -Wall"
85         ac_save_CFLAGS=$CFLAGS
87         dnl GCC >= 3.4
88         AC_MSG_CHECKING([if $CC supports -Wextra])
89         CFLAGS="$QUALITY_CFLAGS -Wextra"
90         AC_COMPILE_IFELSE(
91                 AC_LANG_PROGRAM(),
92                 [AC_MSG_RESULT(yes)
93                  QUALITY_CFLAGS="$QUALITY_CFLAGS -Wextra"],
94                 [AC_MSG_RESULT(no)]
95         )
97         dnl declaration-after-statement (ISO C90 behaviour, as on Windows & GCC < 3)
98         AC_MSG_CHECKING([if $CC supports -Werror=declaration-after-statement])
99         CFLAGS="$QUALITY_CFLAGS -Werror=declaration-after-statement"
100         AC_COMPILE_IFELSE(
101                 AC_LANG_PROGRAM(),
102                 [AC_MSG_RESULT(yes)
103                  QUALITY_CFLAGS="$QUALITY_CFLAGS -Werror=declaration-after-statement"],
104                 [AC_MSG_RESULT(no)]
105         )
106         CFLAGS=$ac_save_CFLAGS
107 else
108         QUALITY_CFLAGS="$QUALITY_CFLAGS"
110 AC_SUBST(QUALITY_CFLAGS)
112 dnl Check for pkg-config before using it
113 PKG_PROG_PKG_CONFIG
115 AC_ARG_WITH([krb5],
116         [AC_HELP_STRING([--with-krb5=PREFIX],
117                 [compile sipe plugin with Kerberos 5 support @<:@default=no@:>@])],
118         [test "$withval" = "no" || kerberos="$withval"],
119         [kerberos="no"])
121 dnl check for Kerberos
122 AC_SUBST(KRB5_CFLAGS)
123 AC_SUBST(KRB5_LDFLAGS)
124 AC_SUBST(KRB5_LIBS)
126 AM_CONDITIONAL(SIP_SEC_KRB5, test "$kerberos" != "no")
127 if test "$kerberos" != "no" ; then
128         if test "$kerberos" != "yes" ; then
129                 KRB5_CFLAGS="-I${kerberos}/include"
130                 KRB5_LDFLAGS="-L${kerberos}/lib"
131         fi
132         orig_LDFLAGS="$LDFLAGS"
133         LDFLAGS="$LDFLAGS $KRB5_LDFLAGS"
134         AC_CHECK_LIB(krb5, krb5_rd_req,
135                         [KRB5_LIBS="-lkrb5"],
136                         [AC_CHECK_LIB(krb5, krb5_rd_req,
137                                 [KRB5_LIBS="-lkrb5"],
138                                 [AC_ERROR(Kerberos 5 libraries not found)],
139                                 )],
140                         -lkrb5)
141         AC_CHECK_LIB(gssapi_krb5, gss_krb5_export_lucid_sec_context,
142                         [KRB5_LIBS="$KRB5_LIBS -lgssapi_krb5"],
143                         [AC_CHECK_LIB(gssapi, gss_krb5_export_lucid_sec_context,
144                                 [KRB5_LIBS="$KRB5_LIBS -lgssapi_krb5"],
145                                 [AC_ERROR(GSSAPI libraries not found)],
146                                 )],
147                         -lgssapi_krb5)
148         savedLIBS="$LIBS"
149         LIBS="$KRB5_LIBS $LIBS"
150         AC_CHECK_FUNCS([krb5_get_error_message])
151         LIBS="$savedLIBS"
152         AC_DEFINE(HAVE_KERBEROS, 1, [Define if kerberos should be used in sipe.])
155 dnl check for glib
156 PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.12.0])
158 dnl check for libxml2
159 PKG_CHECK_MODULES(LIBXML2, [libxml-2.0])
161 dnl assumption check: sizof(uuid_t) must be 16 (see uuid.c)
162 AC_MSG_CHECKING([that sizeof(uuid_t) is 16])
163 ac_save_CFLAGS=$CFLAGS
164 CFLAGS="$GLIB_CFLAGS $QUALITY_CFLAGS"
165 dnl note the [[[ quoting: our code contains []!
166 AC_RUN_IFELSE(
167         AC_LANG_PROGRAM(
168                 [[[
169 #include <glib.h>
170 #include <stdio.h>
172 /* Copied from uuid.c */
173 typedef struct {
174    guint32 time_low;
175    guint16 time_mid;
176    guint16 time_hi_and_version;
177    guint8  clock_seq_hi_and_reserved;
178    guint8  clock_seq_low;
179    guint8  node[6];
180 } uuid_t;
181                 ]]],
182                 [return(sizeof(uuid_t) == 16 ? 0 : 1);]),
183         [AC_MSG_RESULT(yes)],
184         [AC_MSG_RESULT(failed)
185          AC_ERROR(sizeof(uuid_t) is not 16
187 Please notify the SIPE developers and provide the following information:
189  host:     $host
190  build:    $build
191  compiler: $CC
193 CFLAGS=$ac_save_CFLAGS
195 dnl check for libpurple
196 purple="yes"
197 AC_ARG_WITH([purple],
198         [AC_HELP_STRING([--with-purple],
199                 [compile sipe plugin for libpurple clients @<:@default=autodetect@:>@])],
200         [test "$withval" = "yes" || purple="no"],
201         [])
202 if test "$purple" != "no"; then
203         PKG_CHECK_MODULES(PURPLE, [purple >= 2.4.0],
204                 [],
205                 [purple="no"])
208 dnl support for libpurple plugin
209 AM_CONDITIONAL(SIPE_INCLUDE_PURPLE, test "$purple" != "no")
210 if test "$purple" != "no"; then
212         dnl unfortunately PURPLE_MAJOR_VERSION is not exported by purple.m4
213         PURPLE_MAJOR_VERSION=`$PKG_CONFIG --modversion purple | cut -d. -f 1`
214         AC_SUBST(PURPLE_MAJOR_VERSION)
216         dnl let user now if he has a 32- and 64-bit header conflict...
217         AC_MSG_CHECKING([for 32- and 64-bit header conflicts])
218         ac_save_CFLAGS=$CFLAGS
219         CFLAGS="$PURPLE_CFLAGS $QUALITY_CFLAGS"
220         AC_COMPILE_IFELSE(
221                 AC_LANG_PROGRAM(
222                         [
223 #include <glib.h>
224 #include <cipher.h>
226 /* Compile some code that has caused trouble in the past */
227 void testfunc(unsigned long len)
229   PurpleCipherContext *rc4 = NULL;
230   purple_cipher_context_set_option(rc4, "key_len", GUINT_TO_POINTER(len));
232                         ],
233                         [testfunc(16);]),
234                 [AC_MSG_RESULT(none)],
235                 [AC_MSG_RESULT(failed)
236                  AC_ERROR(conflicts found.
238 Check that you have the correct glib/libpurple headers installed for
239 your architecture or set PURPLE_CFLAGS to override the system defaults.
241         CFLAGS=$ac_save_CFLAGS
244 dnl check for telepathy
245 telepathy="yes"
246 AC_ARG_WITH([telepathy],
247         [AC_HELP_STRING([--with-telepathy],
248                 [compile sipe plugin for telepathy clients @<:@default=autodetect@:>@])],
249         [test "$withval" = "yes" || telepathy="no"],
250         [])
251 if test "$telepathy" != "no"; then
252         PKG_CHECK_MODULES(TELEPATHY, [telepathy-glib],
253                 [],
254                 [telepathy="no"])
257 dnl support for telepathy plugin
258 AM_CONDITIONAL(SIPE_INCLUDE_TELEPATHY, test "$telepathy" != "no")
259 dnl NOTHING IMPLEMENTED YET!!!
260 dnl if test "$telepathy" != "no"; then
261 dnl fi
263 dnl sanity check
264 AS_IF([test "$purple" = "no" -a "$telepathy" = "no"],
265         [AC_ERROR(at least one plugin must be selected
267 If you didn't use a --without option then please check that you have
268 the headers for the packages "purple" or "telepathy-glib" installed.
270         [])
272 dnl i18n
273 AC_MSG_CHECKING([locale_CPPFLAGS])
274 LOCALE_CPPFLAGS='-DLOCALEDIR=\"$(prefix)/$(DATADIRNAME)/locale\"'
275 AC_SUBST([LOCALE_CPPFLAGS])
276 AC_MSG_RESULT([$LOCALE_CPPFLAGS])
277 AM_GLIB_GNU_GETTEXT
278 AC_SUBST(GETTEXT_PACKAGE, "${PACKAGE_NAME}")
280 dnl codeset
281 AM_LANGINFO_CODESET
283 dnl substitutions and generated files
284 AC_CONFIG_HEADERS([config.h])
285 AC_CONFIG_FILES([
286         Makefile
287         pixmaps/Makefile
288         m4macros/Makefile
289         po/Makefile.in
290         pixmaps/16/Makefile
291         pixmaps/22/Makefile
292         pixmaps/48/Makefile
293         src/Makefile
294         src/core/Makefile
295         src/api/Makefile
296         src/purple/Makefile
297         src/telepathy/Makefile
298         ])
300 dnl generate files
301 AC_OUTPUT()
303 dnl additional info for the user
304 echo
305 if test "$purple" != "no" ; then
306         echo "Compiling libpurple plugin"
307         echo "PURPLE_CFLAGS  : $PURPLE_CFLAGS"
308         echo "PURPLE_LIBS    : $PURPLE_LIBS"
309 else
310         echo "Skipping libpurple plugin"
313 echo
314 if test "$telepathy" != "no" ; then
315         echo "Compiling telepathy plugin"
316         echo
317         echo "NOTHING IMPLEMENTED YET!!!"
318         echo
319         echo "TELEPATHY_CFLAGS: $TELEPATHY_CFLAGS"
320         echo "TELEPATHY_LIBS  : $TELEPATHY_LIBS"
321 else
322         echo "Skipping telepathy plugin"
324 if test "$kerberos" != "no" ; then
325         echo
326         echo "Compiling with kerberos 5 support"
327         echo "KRB5_CFLAGS    : $KRB5_CFLAGS"
328         echo "KRB5_LDFLAGS   : $KRB5_LDFLAGS"
329         echo "KRB5_LIBS      : $KRB5_LIBS"
332 if test "$enable_debug" != "no"; then
333         echo
334         echo "Compiling with debugging enabled"
335         echo "DEBUG_CFLAGS   : $DEBUG_CFLAGS"
338 if test -n "$QUALITY_CFLAGS"; then
339         echo
340         echo "Compiling with compiler checks enabled"
341         echo "QUALITY_CFLAGS : $QUALITY_CFLAGS"
344 echo
345 echo "configure complete, now run 'make'"
346 echo
348 dnl The End.