NTLM: added time to computations
[siplcs.git] / configure.ac
blob77eadeb3af3812c1462af43b7d0e557464b54b2f
1 dnl Use `VERSION' files to get version.
2 m4_define([SIPE_VERSION_DATA], m4_include([VERSION]))
4 dnl Strip off newline characters.
5 m4_define([_SIPE_VERSION],
6           m4_substr(SIPE_VERSION_DATA,
7                     [0], m4_decr(m4_len(SIPE_VERSION_DATA))))
9 dnl version of this package
10 m4_define(pidgin_sipe_version, _SIPE_VERSION)
12 AC_INIT([pidgin-sipe], _SIPE_VERSION)
13 AC_DEFINE(SIPE_VERSION, "_SIPE_VERSION", [Define sipe version.])
15 AC_PREREQ([2.50])
16 AM_INIT_AUTOMAKE([1.9 dist-bzip2 tar-ustar])
18 AC_DISABLE_STATIC
20 AC_PROG_CC
21 IT_PROG_INTLTOOL([0.35.0])
22 AC_PROG_LIBTOOL
23 AC_PROG_INSTALL
25 AC_HEADER_STDC
27 dnl tell pkgconfig to look in the same prefix we're installing this to,
28 dnl as that's likely where libpurple will be found if it's not in the default
29 dnl pkgconfig path
30 PREFIX=$ac_default_prefix
31 if test "$prefix" != "NONE"; then
32         PREFIX=$prefix
35 PKG_CONFIG_PATH="$PKG_CONFIG_PATH":"$PREFIX/lib/pkgconfig"
36 export PKG_CONFIG_PATH
38 dnl debug mode
39 AC_ARG_ENABLE(debug,
40         [AS_HELP_STRING([--enable-debug],
41                         [compile with debugging support [default=no]])],
42         ,
43         enable_debug="no")
45 if test "$enable_debug" = yes; then
46    AC_DEFINE(DEBUG, 1, [Define if debugging is enabled.])
49 DEBUG_CFLAGS="${DEBUG_CFLAGS}"
50 AC_SUBST(DEBUG_CFLAGS)
52 dnl quality check mode
53 dnl For people who are interested in finding bugs and not hiding them
54 AC_ARG_ENABLE(quality-check,
55         [AS_HELP_STRING([--enable-quality-check],
56                         [compile with compiler checks enabled [default=yes]])],
57         ,
58         enable_quality_check="yes")
60 if test "$enable_quality_check" = yes; then
61         QUALITY_CFLAGS="${QUALITY_CFLAGS} -Werror -Wall -Wextra"
62 else
63         QUALITY_CFLAGS="${QUALITY_CFLAGS}"
65 AC_SUBST(QUALITY_CFLAGS)
67 dnl Check for pkg-config before using it
68 PKG_PROG_PKG_CONFIG
70 AC_ARG_WITH([krb5],
71         [AC_HELP_STRING([--with-krb5=PREFIX],
72                 [compile sipe plugin with Kerberos 5 support @<:@default=no@:>@])],
73         [test "$withval" = no || kerberos="$withval"],
74         [kerberos="no"])
76 dnl check for Kerberos
77 AC_SUBST(KRB5_CFLAGS)
78 AC_SUBST(KRB5_LDFLAGS)
79 AC_SUBST(KRB5_LIBS)
81 AM_CONDITIONAL(SIP_SEC_KRB5, test "$kerberos" != "no")
82 if test "$kerberos" != "no" ; then
83         if test "$kerberos" != "yes" ; then
84                 KRB5_CFLAGS="-I${kerberos}/include"
85                 KRB5_LDFLAGS="-L${kerberos}/lib"
86         fi
87         orig_LDFLAGS="$LDFLAGS"
88         LDFLAGS="$LDFLAGS $KRB5_LDFLAGS"
89         AC_CHECK_LIB(krb5, krb5_rd_req,
90                         [KRB5_LIBS="-lkrb5"],
91                         [AC_CHECK_LIB(krb5, krb5_rd_req,
92                                 [KRB5_LIBS="-lkrb5"],
93                                 [AC_ERROR(Kerberos 5 libraries not found)],
94                                 )],
95                         -lkrb5)
96         AC_CHECK_LIB(gssapi_krb5, gss_krb5_export_lucid_sec_context,
97                         [KRB5_LIBS="$KRB5_LIBS -lgssapi_krb5"],
98                         [AC_CHECK_LIB(gssapi, gss_krb5_export_lucid_sec_context,
99                                 [KRB5_LIBS="$KRB5_LIBS -lgssapi_krb5"],
100                                 [AC_ERROR(GSSAPI libraries not found)],
101                                 )],
102                         -lgssapi_krb5)
103         savedLIBS="$LIBS"
104         LIBS="$KRB5_LIBS $LIBS"
105         AC_CHECK_FUNCS([krb5_get_error_message])
106         LIBS="$savedLIBS"
107         AC_DEFINE(USE_KERBEROS, 1, [Define if kerberos should be used in sipe.])
110 dnl check for glib
111 PKG_CHECK_MODULES(GLIB, [glib-2.0])
113 dnl assumption check: sizof(uuid_t) must be 16 (see uuid.c)
114 AC_MSG_CHECKING([that sizeof(uuid_t) is 16])
115 ac_save_CFLAGS=$CFLAGS
116 CFLAGS="$GLIB_CFLAGS -Werror -Wall -Wextra"
117 dnl note the [[[ quoting: our code contains []!
118 AC_RUN_IFELSE(
119         AC_LANG_PROGRAM(
120                 [[[
121 #include <glib.h>
122 #include <stdio.h>
124 /* Copied from uuid.c */
125 typedef struct {
126    guint32 time_low;
127    guint16 time_mid;
128    guint16 time_hi_and_version;
129    guint8  clock_seq_hi_and_reserved;
130    guint8  clock_seq_low;
131    guint8  node[6];
132 } uuid_t;
133                 ]]],
134                 [return(sizeof(uuid_t) == 16 ? 0 : 1);]),
135         [AC_MSG_RESULT(yes)],
136         [AC_MSG_RESULT(failed)
137          AC_ERROR(sizeof(uuid_t) is not 16
139 Please notify the SIPE developers and provide the following information:
141  host:     $host
142  build:    $build
143  compiler: $CC
145 CFLAGS=$ac_save_CFLAGS
147 dnl check for libpurple
148 purple="yes"
149 AC_ARG_WITH([purple],
150         [AC_HELP_STRING([--with-purple],
151                 [compile sipe plugin for libpurple clients @<:@default=autodetect@:>@])],
152         [test "$withval" = yes || purple="no"],
153         [test "$withval" = no  && purple="no"])
154 if test "$purple" != "no"; then
155         PKG_CHECK_MODULES(PURPLE, [purple >= 2.3.1],
156                 [],
157                 [purple="no"])
160 dnl support for libpurple plugin
161 AM_CONDITIONAL(SIPE_INCLUDE_PURPLE, test "$purple" != "no")
162 if test "$purple" != "no"; then
164         dnl unfortunately PURPLE_MAJOR_VERSION is not exported by purple.m4
165         PURPLE_MAJOR_VERSION=`$PKG_CONFIG --modversion purple | cut -d. -f 1`
166         AC_SUBST(PURPLE_MAJOR_VERSION)
168         dnl let user now if he has a 32- and 64-bit header conflict...
169         AC_MSG_CHECKING([for 32- and 64-bit header conflicts])
170         ac_save_CFLAGS=$CFLAGS
171         CFLAGS="$PURPLE_CFLAGS -Werror -Wall -Wextra"
172         AC_COMPILE_IFELSE(
173                 AC_LANG_PROGRAM(
174                         [
175 #include <glib.h>
176 #include <cipher.h>
178 /* Compile some code that has caused trouble in the past */
179 void testfunc(unsigned long len)
181   PurpleCipherContext *rc4 = NULL;
182   purple_cipher_context_set_option(rc4, "key_len", GUINT_TO_POINTER(len));
184                         ],
185                         [testfunc(16);]),
186                 [AC_MSG_RESULT(none)],
187                 [AC_MSG_RESULT(failed)
188                  AC_ERROR(conflicts found.
190 Check that you have the correct glib/libpurple headers installed for
191 your architecture or set PURPLE_CFLAGS to override the system defaults.
193         CFLAGS=$ac_save_CFLAGS
196 dnl check for telepathy
197 telepathy="yes"
198 AC_ARG_WITH([telepathy],
199         [AC_HELP_STRING([--with-telepathy],
200                 [compile sipe plugin for telepathy clients @<:@default=autodetect@:>@])],
201         [test "$withval" = yes || telepathy="no"],
202         [test "$withval" = no  && telepathy="no"])
203 if test "$telepathy" != "no"; then
204         PKG_CHECK_MODULES(TELEPATHY, [telepathy-glib],
205                 [],
206                 [telepathy="no"])
209 dnl support for telepathy plugin
210 AM_CONDITIONAL(SIPE_INCLUDE_TELEPATHY, test "$telepathy" != "no")
211 dnl NOTHING IMPLEMENTED YET!!!
212 dnl if test "$telepathy" != "no"; then
213 dnl fi
215 dnl check for inet_aton
216 AC_CHECK_FUNC(inet_aton,,
217         [AC_CHECK_LIB(resolv, inet_aton,, [AC_ERROR(inet_aton not found)])])
219 dnl i18n
220 AC_MSG_CHECKING([locale_CPPFLAGS])
221 LOCALE_CPPFLAGS='-DLOCALEDIR=\"$(prefix)/$(DATADIRNAME)/locale\"'
222 AC_SUBST([LOCALE_CPPFLAGS])
223 AC_MSG_RESULT([$LOCALE_CPPFLAGS])
225 GETTEXT_PACKAGE=$PACKAGE
226 AC_SUBST(GETTEXT_PACKAGE)
227 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Gettext Package])
228 AM_GLIB_GNU_GETTEXT
230 dnl codeset
231 AM_LANGINFO_CODESET
233 dnl substitutions and generated files
234 AC_CONFIG_FILES(
235         []
236         [Makefile
237         pixmaps/Makefile
238         m4macros/Makefile
239         po/Makefile.in
240         pixmaps/16/Makefile
241         pixmaps/22/Makefile
242         pixmaps/48/Makefile
243         src/Makefile
244         src/core/Makefile
245         src/api/Makefile
246         src/purple/Makefile
247         src/telepathy/Makefile]
250 dnl generate files
251 AC_OUTPUT()
253 dnl additional info for the user
254 echo
255 if test "$purple" != "no" ; then
256         echo "Compiling libpurple plugin"
257         echo "PURPLE_CFLAGS  : $PURPLE_CFLAGS"
258         echo "PURPLE_LIBS    : $PURPLE_LIBS"
259 else
260         echo "Skipping libpurple plugin"
263 echo
264 if test "$telepathy" != "no" ; then
265         echo "Compiling telepathy plugin"
266         echo
267         echo "NOTHING IMPLEMENTED YET!!!"
268         echo
269         echo "TELEPATHY_CFLAGS: $TELEPATHY_CFLAGS"
270         echo "TELEPATHY_LIBS  : $TELEPATHY_LIBS"
271 else
272         echo "Skipping telepathy plugin"
274 if test "$kerberos" != "no" ; then
275         echo
276         echo "Compiling with kerberos 5 support"
277         echo "KRB5_CFLAGS    : $KRB5_CFLAGS"
278         echo "KRB5_LDFLAGS   : $KRB5_LDFLAGS"
279         echo "KRB5_LIBS      : $KRB5_LIBS"
282 if test "$enable_debug" != "no"; then
283         echo
284         echo "Compiling with debugging enabled"
285         echo "DEBUG_CFLAGS   : $DEBUG_CFLAGS"
288 if test -n "${QUALITY_CFLAGS}"; then
289         echo
290         echo "Compiling with compiler checks enabled"
291         echo "QUALITY_CFLAGS : $QUALITY_CFLAGS"
294 echo
295 echo "configure complete, now run 'make'"
296 echo
298 dnl The End.