mingw: build change
[siplcs.git] / configure.ac
blobfd6ff8a11b030bcfaea40c8cd5048e718be0875d
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 AC_HEADER_STDC
34 dnl setup shared library generation
35 LT_INIT([disable-static])
37 dnl checks for tools
38 IT_PROG_INTLTOOL([0.35.0])
39 AC_PROG_INSTALL
40 AC_PROG_RANLIB
42 dnl checks for library functions
43 AC_CHECK_FUNCS([setenv unsetenv])
45 dnl tell pkgconfig to look in the same prefix where we're installing this to,
46 dnl as that is likely where libpurple will be found if it is not in the default
47 dnl pkgconfig path
48 PREFIX=$ac_default_prefix
49 if test "$prefix" != "NONE"; then
50         PREFIX=$prefix
53 PKG_CONFIG_PATH="$PKG_CONFIG_PATH":"$PREFIX/lib/pkgconfig"
54 export PKG_CONFIG_PATH
56 dnl debug mode
57 AC_ARG_ENABLE(debug,
58         [AS_HELP_STRING([--enable-debug],
59                         [compile with debugging support [default=no]])],
60         ,
61         enable_debug="no")
63 if test "$enable_debug" = yes; then
64    AC_DEFINE(DEBUG, 1, [Define if debugging is enabled.])
67 DEBUG_CFLAGS="${DEBUG_CFLAGS}"
68 AC_SUBST(DEBUG_CFLAGS)
70 dnl quality check mode
71 dnl For people who are interested in finding bugs and not hiding them
72 AC_ARG_ENABLE(quality-check,
73         [AS_HELP_STRING([--enable-quality-check],
74                         [compile with compiler checks enabled [default=yes]])],
75         ,
76         enable_quality_check="yes")
78 if test "$enable_quality_check" = yes; then
79         QUALITY_CFLAGS="${QUALITY_CFLAGS} -Werror -Wall -Wextra"
80 else
81         QUALITY_CFLAGS="${QUALITY_CFLAGS}"
83 AC_SUBST(QUALITY_CFLAGS)
85 dnl Check for pkg-config before using it
86 PKG_PROG_PKG_CONFIG
88 AC_ARG_WITH([krb5],
89         [AC_HELP_STRING([--with-krb5=PREFIX],
90                 [compile sipe plugin with Kerberos 5 support @<:@default=no@:>@])],
91         [test "$withval" = "no" || kerberos="$withval"],
92         [kerberos="no"])
94 dnl check for Kerberos
95 AC_SUBST(KRB5_CFLAGS)
96 AC_SUBST(KRB5_LDFLAGS)
97 AC_SUBST(KRB5_LIBS)
99 AM_CONDITIONAL(SIP_SEC_KRB5, test "$kerberos" != "no")
100 if test "$kerberos" != "no" ; then
101         if test "$kerberos" != "yes" ; then
102                 KRB5_CFLAGS="-I${kerberos}/include"
103                 KRB5_LDFLAGS="-L${kerberos}/lib"
104         fi
105         orig_LDFLAGS="$LDFLAGS"
106         LDFLAGS="$LDFLAGS $KRB5_LDFLAGS"
107         AC_CHECK_LIB(krb5, krb5_rd_req,
108                         [KRB5_LIBS="-lkrb5"],
109                         [AC_CHECK_LIB(krb5, krb5_rd_req,
110                                 [KRB5_LIBS="-lkrb5"],
111                                 [AC_ERROR(Kerberos 5 libraries not found)],
112                                 )],
113                         -lkrb5)
114         AC_CHECK_LIB(gssapi_krb5, gss_krb5_export_lucid_sec_context,
115                         [KRB5_LIBS="$KRB5_LIBS -lgssapi_krb5"],
116                         [AC_CHECK_LIB(gssapi, gss_krb5_export_lucid_sec_context,
117                                 [KRB5_LIBS="$KRB5_LIBS -lgssapi_krb5"],
118                                 [AC_ERROR(GSSAPI libraries not found)],
119                                 )],
120                         -lgssapi_krb5)
121         savedLIBS="$LIBS"
122         LIBS="$KRB5_LIBS $LIBS"
123         AC_CHECK_FUNCS([krb5_get_error_message])
124         LIBS="$savedLIBS"
125         AC_DEFINE(HAVE_KERBEROS, 1, [Define if kerberos should be used in sipe.])
128 dnl check for glib
129 PKG_CHECK_MODULES(GLIB, [glib-2.0])
131 dnl check for libxml2
132 PKG_CHECK_MODULES(LIBXML2, [libxml-2.0])
134 dnl assumption check: sizof(uuid_t) must be 16 (see uuid.c)
135 AC_MSG_CHECKING([that sizeof(uuid_t) is 16])
136 ac_save_CFLAGS=$CFLAGS
137 CFLAGS="$GLIB_CFLAGS -Werror -Wall -Wextra"
138 dnl note the [[[ quoting: our code contains []!
139 AC_RUN_IFELSE(
140         AC_LANG_PROGRAM(
141                 [[[
142 #include <glib.h>
143 #include <stdio.h>
145 /* Copied from uuid.c */
146 typedef struct {
147    guint32 time_low;
148    guint16 time_mid;
149    guint16 time_hi_and_version;
150    guint8  clock_seq_hi_and_reserved;
151    guint8  clock_seq_low;
152    guint8  node[6];
153 } uuid_t;
154                 ]]],
155                 [return(sizeof(uuid_t) == 16 ? 0 : 1);]),
156         [AC_MSG_RESULT(yes)],
157         [AC_MSG_RESULT(failed)
158          AC_ERROR(sizeof(uuid_t) is not 16
160 Please notify the SIPE developers and provide the following information:
162  host:     $host
163  build:    $build
164  compiler: $CC
166 CFLAGS=$ac_save_CFLAGS
168 dnl check for libpurple
169 purple="yes"
170 AC_ARG_WITH([purple],
171         [AC_HELP_STRING([--with-purple],
172                 [compile sipe plugin for libpurple clients @<:@default=autodetect@:>@])],
173         [test "$withval" = "yes" || purple="no"],
174         [])
175 if test "$purple" != "no"; then
176         PKG_CHECK_MODULES(PURPLE, [purple >= 2.4.0],
177                 [],
178                 [purple="no"])
181 dnl support for libpurple plugin
182 AM_CONDITIONAL(SIPE_INCLUDE_PURPLE, test "$purple" != "no")
183 if test "$purple" != "no"; then
185         dnl unfortunately PURPLE_MAJOR_VERSION is not exported by purple.m4
186         PURPLE_MAJOR_VERSION=`$PKG_CONFIG --modversion purple | cut -d. -f 1`
187         AC_SUBST(PURPLE_MAJOR_VERSION)
189         dnl let user now if he has a 32- and 64-bit header conflict...
190         AC_MSG_CHECKING([for 32- and 64-bit header conflicts])
191         ac_save_CFLAGS=$CFLAGS
192         CFLAGS="$PURPLE_CFLAGS -Werror -Wall -Wextra"
193         AC_COMPILE_IFELSE(
194                 AC_LANG_PROGRAM(
195                         [
196 #include <glib.h>
197 #include <cipher.h>
199 /* Compile some code that has caused trouble in the past */
200 void testfunc(unsigned long len)
202   PurpleCipherContext *rc4 = NULL;
203   purple_cipher_context_set_option(rc4, "key_len", GUINT_TO_POINTER(len));
205                         ],
206                         [testfunc(16);]),
207                 [AC_MSG_RESULT(none)],
208                 [AC_MSG_RESULT(failed)
209                  AC_ERROR(conflicts found.
211 Check that you have the correct glib/libpurple headers installed for
212 your architecture or set PURPLE_CFLAGS to override the system defaults.
214         CFLAGS=$ac_save_CFLAGS
217 dnl check for telepathy
218 telepathy="yes"
219 AC_ARG_WITH([telepathy],
220         [AC_HELP_STRING([--with-telepathy],
221                 [compile sipe plugin for telepathy clients @<:@default=autodetect@:>@])],
222         [test "$withval" = "yes" || telepathy="no"],
223         [])
224 if test "$telepathy" != "no"; then
225         PKG_CHECK_MODULES(TELEPATHY, [telepathy-glib],
226                 [],
227                 [telepathy="no"])
230 dnl support for telepathy plugin
231 AM_CONDITIONAL(SIPE_INCLUDE_TELEPATHY, test "$telepathy" != "no")
232 dnl NOTHING IMPLEMENTED YET!!!
233 dnl if test "$telepathy" != "no"; then
234 dnl fi
236 dnl sanity check
237 AS_IF([test "$purple" = "no" -a "$telepathy" = "no"],
238         [AC_ERROR(at least one plugin must be selected
240 If you didn't use a --without option then please check that you have
241 the headers for the packages "purple" or "telepathy-glib" installed.
243         [])
245 dnl i18n
246 AC_MSG_CHECKING([locale_CPPFLAGS])
247 LOCALE_CPPFLAGS='-DLOCALEDIR=\"$(prefix)/$(DATADIRNAME)/locale\"'
248 AC_SUBST([LOCALE_CPPFLAGS])
249 AC_MSG_RESULT([$LOCALE_CPPFLAGS])
250 AM_GLIB_GNU_GETTEXT
251 AC_SUBST(GETTEXT_PACKAGE, "${PACKAGE_NAME}")
253 dnl codeset
254 AM_LANGINFO_CODESET
256 dnl substitutions and generated files
257 AC_CONFIG_HEADERS([config.h])
258 AC_CONFIG_FILES([
259         Makefile
260         pixmaps/Makefile
261         m4macros/Makefile
262         po/Makefile.in
263         pixmaps/16/Makefile
264         pixmaps/22/Makefile
265         pixmaps/48/Makefile
266         src/Makefile
267         src/core/Makefile
268         src/api/Makefile
269         src/purple/Makefile
270         src/telepathy/Makefile
271         ])
273 dnl generate files
274 AC_OUTPUT()
276 dnl additional info for the user
277 echo
278 if test "$purple" != "no" ; then
279         echo "Compiling libpurple plugin"
280         echo "PURPLE_CFLAGS  : $PURPLE_CFLAGS"
281         echo "PURPLE_LIBS    : $PURPLE_LIBS"
282 else
283         echo "Skipping libpurple plugin"
286 echo
287 if test "$telepathy" != "no" ; then
288         echo "Compiling telepathy plugin"
289         echo
290         echo "NOTHING IMPLEMENTED YET!!!"
291         echo
292         echo "TELEPATHY_CFLAGS: $TELEPATHY_CFLAGS"
293         echo "TELEPATHY_LIBS  : $TELEPATHY_LIBS"
294 else
295         echo "Skipping telepathy plugin"
297 if test "$kerberos" != "no" ; then
298         echo
299         echo "Compiling with kerberos 5 support"
300         echo "KRB5_CFLAGS    : $KRB5_CFLAGS"
301         echo "KRB5_LDFLAGS   : $KRB5_LDFLAGS"
302         echo "KRB5_LIBS      : $KRB5_LIBS"
305 if test "$enable_debug" != "no"; then
306         echo
307         echo "Compiling with debugging enabled"
308         echo "DEBUG_CFLAGS   : $DEBUG_CFLAGS"
311 if test -n "${QUALITY_CFLAGS}"; then
312         echo
313         echo "Compiling with compiler checks enabled"
314         echo "QUALITY_CFLAGS : $QUALITY_CFLAGS"
317 echo
318 echo "configure complete, now run 'make'"
319 echo
321 dnl The End.