Removed extra-license-file due to lintian warning.
[siplcs.git] / configure.ac
blob7eb516d6d729eba98cd043a6cd7ffe743950540b
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 checks for library functions
28 AC_CHECK_FUNCS([setenv unsetenv])
30 dnl tell pkgconfig to look in the same prefix we're installing this to,
31 dnl as that's likely where libpurple will be found if it's not in the default
32 dnl pkgconfig path
33 PREFIX=$ac_default_prefix
34 if test "$prefix" != "NONE"; then
35         PREFIX=$prefix
38 PKG_CONFIG_PATH="$PKG_CONFIG_PATH":"$PREFIX/lib/pkgconfig"
39 export PKG_CONFIG_PATH
41 dnl debug mode
42 AC_ARG_ENABLE(debug,
43         [AS_HELP_STRING([--enable-debug],
44                         [compile with debugging support [default=no]])],
45         ,
46         enable_debug="no")
48 if test "$enable_debug" = yes; then
49    AC_DEFINE(DEBUG, 1, [Define if debugging is enabled.])
52 DEBUG_CFLAGS="${DEBUG_CFLAGS}"
53 AC_SUBST(DEBUG_CFLAGS)
55 dnl quality check mode
56 dnl For people who are interested in finding bugs and not hiding them
57 AC_ARG_ENABLE(quality-check,
58         [AS_HELP_STRING([--enable-quality-check],
59                         [compile with compiler checks enabled [default=yes]])],
60         ,
61         enable_quality_check="yes")
63 if test "$enable_quality_check" = yes; then
64         QUALITY_CFLAGS="${QUALITY_CFLAGS} -Werror -Wall -Wextra"
65 else
66         QUALITY_CFLAGS="${QUALITY_CFLAGS}"
68 AC_SUBST(QUALITY_CFLAGS)
70 dnl Check for pkg-config before using it
71 PKG_PROG_PKG_CONFIG
73 AC_ARG_WITH([krb5],
74         [AC_HELP_STRING([--with-krb5=PREFIX],
75                 [compile sipe plugin with Kerberos 5 support @<:@default=no@:>@])],
76         [test "$withval" = "no" || kerberos="$withval"],
77         [kerberos="no"])
79 dnl check for Kerberos
80 AC_SUBST(KRB5_CFLAGS)
81 AC_SUBST(KRB5_LDFLAGS)
82 AC_SUBST(KRB5_LIBS)
84 AM_CONDITIONAL(SIP_SEC_KRB5, test "$kerberos" != "no")
85 if test "$kerberos" != "no" ; then
86         if test "$kerberos" != "yes" ; then
87                 KRB5_CFLAGS="-I${kerberos}/include"
88                 KRB5_LDFLAGS="-L${kerberos}/lib"
89         fi
90         orig_LDFLAGS="$LDFLAGS"
91         LDFLAGS="$LDFLAGS $KRB5_LDFLAGS"
92         AC_CHECK_LIB(krb5, krb5_rd_req,
93                         [KRB5_LIBS="-lkrb5"],
94                         [AC_CHECK_LIB(krb5, krb5_rd_req,
95                                 [KRB5_LIBS="-lkrb5"],
96                                 [AC_ERROR(Kerberos 5 libraries not found)],
97                                 )],
98                         -lkrb5)
99         AC_CHECK_LIB(gssapi_krb5, gss_krb5_export_lucid_sec_context,
100                         [KRB5_LIBS="$KRB5_LIBS -lgssapi_krb5"],
101                         [AC_CHECK_LIB(gssapi, gss_krb5_export_lucid_sec_context,
102                                 [KRB5_LIBS="$KRB5_LIBS -lgssapi_krb5"],
103                                 [AC_ERROR(GSSAPI libraries not found)],
104                                 )],
105                         -lgssapi_krb5)
106         savedLIBS="$LIBS"
107         LIBS="$KRB5_LIBS $LIBS"
108         AC_CHECK_FUNCS([krb5_get_error_message])
109         LIBS="$savedLIBS"
110         AC_DEFINE(USE_KERBEROS, 1, [Define if kerberos should be used in sipe.])
113 dnl check for glib
114 PKG_CHECK_MODULES(GLIB, [glib-2.0])
116 dnl assumption check: sizof(uuid_t) must be 16 (see uuid.c)
117 AC_MSG_CHECKING([that sizeof(uuid_t) is 16])
118 ac_save_CFLAGS=$CFLAGS
119 CFLAGS="$GLIB_CFLAGS -Werror -Wall -Wextra"
120 dnl note the [[[ quoting: our code contains []!
121 AC_RUN_IFELSE(
122         AC_LANG_PROGRAM(
123                 [[[
124 #include <glib.h>
125 #include <stdio.h>
127 /* Copied from uuid.c */
128 typedef struct {
129    guint32 time_low;
130    guint16 time_mid;
131    guint16 time_hi_and_version;
132    guint8  clock_seq_hi_and_reserved;
133    guint8  clock_seq_low;
134    guint8  node[6];
135 } uuid_t;
136                 ]]],
137                 [return(sizeof(uuid_t) == 16 ? 0 : 1);]),
138         [AC_MSG_RESULT(yes)],
139         [AC_MSG_RESULT(failed)
140          AC_ERROR(sizeof(uuid_t) is not 16
142 Please notify the SIPE developers and provide the following information:
144  host:     $host
145  build:    $build
146  compiler: $CC
148 CFLAGS=$ac_save_CFLAGS
150 dnl check for libpurple
151 purple="yes"
152 AC_ARG_WITH([purple],
153         [AC_HELP_STRING([--with-purple],
154                 [compile sipe plugin for libpurple clients @<:@default=autodetect@:>@])],
155         [test "$withval" = "yes" || purple="no"],
156         [])
157 if test "$purple" != "no"; then
158         PKG_CHECK_MODULES(PURPLE, [purple >= 2.4.0],
159                 [],
160                 [purple="no"])
163 dnl support for libpurple plugin
164 AM_CONDITIONAL(SIPE_INCLUDE_PURPLE, test "$purple" != "no")
165 if test "$purple" != "no"; then
167         dnl unfortunately PURPLE_MAJOR_VERSION is not exported by purple.m4
168         PURPLE_MAJOR_VERSION=`$PKG_CONFIG --modversion purple | cut -d. -f 1`
169         AC_SUBST(PURPLE_MAJOR_VERSION)
171         dnl let user now if he has a 32- and 64-bit header conflict...
172         AC_MSG_CHECKING([for 32- and 64-bit header conflicts])
173         ac_save_CFLAGS=$CFLAGS
174         CFLAGS="$PURPLE_CFLAGS -Werror -Wall -Wextra"
175         AC_COMPILE_IFELSE(
176                 AC_LANG_PROGRAM(
177                         [
178 #include <glib.h>
179 #include <cipher.h>
181 /* Compile some code that has caused trouble in the past */
182 void testfunc(unsigned long len)
184   PurpleCipherContext *rc4 = NULL;
185   purple_cipher_context_set_option(rc4, "key_len", GUINT_TO_POINTER(len));
187                         ],
188                         [testfunc(16);]),
189                 [AC_MSG_RESULT(none)],
190                 [AC_MSG_RESULT(failed)
191                  AC_ERROR(conflicts found.
193 Check that you have the correct glib/libpurple headers installed for
194 your architecture or set PURPLE_CFLAGS to override the system defaults.
196         CFLAGS=$ac_save_CFLAGS
199 dnl check for telepathy
200 telepathy="yes"
201 AC_ARG_WITH([telepathy],
202         [AC_HELP_STRING([--with-telepathy],
203                 [compile sipe plugin for telepathy clients @<:@default=autodetect@:>@])],
204         [test "$withval" = "yes" || telepathy="no"],
205         [])
206 if test "$telepathy" != "no"; then
207         PKG_CHECK_MODULES(TELEPATHY, [telepathy-glib],
208                 [],
209                 [telepathy="no"])
212 dnl support for telepathy plugin
213 AM_CONDITIONAL(SIPE_INCLUDE_TELEPATHY, test "$telepathy" != "no")
214 dnl NOTHING IMPLEMENTED YET!!!
215 dnl if test "$telepathy" != "no"; then
216 dnl fi
218 dnl sanity check
219 AS_IF([test "$purple" = "no" -a "$telepathy" = "no"],
220         [AC_ERROR(at least one plugin must be selected
222 If you didn't use a --without option then please check that you have
223 the headers for the packages "purple" or "telepathy-glib" installed.
225         [])
227 dnl i18n
228 AC_MSG_CHECKING([locale_CPPFLAGS])
229 LOCALE_CPPFLAGS='-DLOCALEDIR=\"$(prefix)/$(DATADIRNAME)/locale\"'
230 AC_SUBST([LOCALE_CPPFLAGS])
231 AC_MSG_RESULT([$LOCALE_CPPFLAGS])
233 GETTEXT_PACKAGE=$PACKAGE
234 AC_SUBST(GETTEXT_PACKAGE)
235 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Gettext Package])
236 AM_GLIB_GNU_GETTEXT
238 dnl codeset
239 AM_LANGINFO_CODESET
241 dnl substitutions and generated files
242 AC_CONFIG_HEADERS([config.h])
243 AC_CONFIG_FILES([
244         Makefile
245         pixmaps/Makefile
246         m4macros/Makefile
247         po/Makefile.in
248         pixmaps/16/Makefile
249         pixmaps/22/Makefile
250         pixmaps/48/Makefile
251         src/Makefile
252         src/core/Makefile
253         src/api/Makefile
254         src/purple/Makefile
255         src/telepathy/Makefile
256         ])
258 dnl generate files
259 AC_OUTPUT()
261 dnl additional info for the user
262 echo
263 if test "$purple" != "no" ; then
264         echo "Compiling libpurple plugin"
265         echo "PURPLE_CFLAGS  : $PURPLE_CFLAGS"
266         echo "PURPLE_LIBS    : $PURPLE_LIBS"
267 else
268         echo "Skipping libpurple plugin"
271 echo
272 if test "$telepathy" != "no" ; then
273         echo "Compiling telepathy plugin"
274         echo
275         echo "NOTHING IMPLEMENTED YET!!!"
276         echo
277         echo "TELEPATHY_CFLAGS: $TELEPATHY_CFLAGS"
278         echo "TELEPATHY_LIBS  : $TELEPATHY_LIBS"
279 else
280         echo "Skipping telepathy plugin"
282 if test "$kerberos" != "no" ; then
283         echo
284         echo "Compiling with kerberos 5 support"
285         echo "KRB5_CFLAGS    : $KRB5_CFLAGS"
286         echo "KRB5_LDFLAGS   : $KRB5_LDFLAGS"
287         echo "KRB5_LIBS      : $KRB5_LIBS"
290 if test "$enable_debug" != "no"; then
291         echo
292         echo "Compiling with debugging enabled"
293         echo "DEBUG_CFLAGS   : $DEBUG_CFLAGS"
296 if test -n "${QUALITY_CFLAGS}"; then
297         echo
298         echo "Compiling with compiler checks enabled"
299         echo "QUALITY_CFLAGS : $QUALITY_CFLAGS"
302 echo
303 echo "configure complete, now run 'make'"
304 echo
306 dnl The End.