Fixed a segfault when trans->msg is null due to sip->transactions is empty.
[siplcs.git] / configure.ac
blob74f6b6a2db5ff88239171c127aa85106dbf153f1
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 libpurple
111 purple="yes"
112 AC_ARG_WITH([purple],
113         [AC_HELP_STRING([--with-purple],
114                 [compile sipe plugin for libpurple clients @<:@default=autodetect@:>@])],
115         [test "$withval" = yes || purple="no"],
116         [test "$withval" = no  && purple="no"])
117 if test "$purple" != "no"; then
118         PKG_CHECK_MODULES(PURPLE, [purple >= 2.3.1],
119                 [],
120                 [purple="no"])
123 dnl support for libpurple plugin
124 AM_CONDITIONAL(SIPE_INCLUDE_PURPLE, test "$purple" != "no")
125 if test "$purple" != "no"; then
127         dnl unfortunately PURPLE_MAJOR_VERSION is not exported by purple.m4
128         PURPLE_MAJOR_VERSION=`$PKG_CONFIG --modversion purple | cut -d. -f 1`
129         AC_SUBST(PURPLE_MAJOR_VERSION)
131         dnl let user now if he has a 32- and 64-bit header conflict...
132         AC_MSG_CHECKING([for 32- and 64-bit header conflicts])
133         ac_save_CFLAGS=$CFLAGS
134         CFLAGS="$PURPLE_CFLAGS -Werror -Wall -Wextra"
135         AC_COMPILE_IFELSE(
136                 AC_LANG_PROGRAM(
137                         [
138 #include <glib.h>
139 #include <cipher.h>
141 /* Compile some code that has caused trouble in the past */
142 void testfunc(unsigned long len)
144   PurpleCipherContext *rc4 = NULL;
145   purple_cipher_context_set_option(rc4, "key_len", GUINT_TO_POINTER(len));
147                         ],
148                         [testfunc(16);]),
149                 [AC_MSG_RESULT(none)],
150                 [AC_MSG_RESULT(failed)
151                  AC_ERROR(conflicts found.
153 Check that you have the correct glib/libpurple headers installed for
154 your architecture or set PURPLE_CFLAGS to override the system defaults. 
156         CFLAGS=$ac_save_CFLAGS
159 dnl check for telepathy
160 telepathy="yes"
161 AC_ARG_WITH([telepathy],
162         [AC_HELP_STRING([--with-telepathy],
163                 [compile sipe plugin for telepathy clients @<:@default=autodetect@:>@])],
164         [test "$withval" = yes || telepathy="no"],
165         [test "$withval" = no  && telepathy="no"])
166 if test "$telepathy" != "no"; then
167         PKG_CHECK_MODULES(TELEPATHY, [telepathy-glib],
168                 [],
169                 [telepathy="no"])
172 dnl support for libpurple plugin
173 AM_CONDITIONAL(SIPE_INCLUDE_TELEPATHY, test "$telepathy" != "no")
174 dnl NOTHING IMPLEMENTED YET!!!
175 dnl if test "$telepathy" != "no"; then
176 dnl fi
178 dnl check for inet_aton
179 AC_CHECK_FUNC(inet_aton,,
180         [AC_CHECK_LIB(resolv, inet_aton,, [AC_ERROR(inet_aton not found)])])
182 dnl i18n
183 AC_MSG_CHECKING([locale_CPPFLAGS])
184 LOCALE_CPPFLAGS='-DLOCALEDIR=\"$(prefix)/$(DATADIRNAME)/locale\"'
185 AC_SUBST([LOCALE_CPPFLAGS])
186 AC_MSG_RESULT([$LOCALE_CPPFLAGS])
188 GETTEXT_PACKAGE=$PACKAGE
189 AC_SUBST(GETTEXT_PACKAGE)
190 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Gettext Package])
191 AM_GLIB_GNU_GETTEXT
193 dnl codeset
194 AM_LANGINFO_CODESET
196 dnl substitutions and generated files
197 AC_CONFIG_FILES(
198         []
199         [Makefile 
200         pixmaps/Makefile 
201         m4macros/Makefile
202         po/Makefile.in
203         pixmaps/16/Makefile 
204         pixmaps/22/Makefile 
205         pixmaps/48/Makefile 
206         src/Makefile
207         src/core/Makefile
208         src/api/Makefile
209         src/purple/Makefile
210         src/telepathy/Makefile]
213 dnl generate files
214 AC_OUTPUT()
216 dnl additional info for the user
217 echo
218 if test "$purple" != "no" ; then
219         echo "Compiling libpurple plugin"
220         echo "PURPLE_CFLAGS  : $PURPLE_CFLAGS"
221         echo "PURPLE_LIBS    : $PURPLE_LIBS"
222 else
223         echo "Skipping libpurple plugin"
226 echo
227 if test "$telepathy" != "no" ; then
228         echo "Compiling telepathy plugin"
229         echo
230         echo "NOTHING IMPLEMENTED YET!!!"
231         echo
232         echo "TELEPATHY_CFLAGS: $TELEPATHY_CFLAGS"
233         echo "TELEPATHY_LIBS  : $TELEPATHY_LIBS"
234 else
235         echo "Skipping telepathy plugin"
237 if test "$kerberos" != "no" ; then
238         echo
239         echo "Compiling with kerberos 5 support"
240         echo "KRB5_CFLAGS    : $KRB5_CFLAGS"
241         echo "KRB5_LDFLAGS   : $KRB5_LDFLAGS"
242         echo "KRB5_LIBS      : $KRB5_LIBS"
245 if test "$enable_debug" != "no"; then
246         echo
247         echo "Compiling with debugging enabled"
248         echo "DEBUG_CFLAGS   : $DEBUG_CFLAGS"
251 if test -n "${QUALITY_CFLAGS}"; then
252         echo
253         echo "Compiling with compiler checks enabled"
254         echo "QUALITY_CFLAGS : $QUALITY_CFLAGS"
257 echo
258 echo "configure complete, now run 'make'"
259 echo
261 dnl The End.