Updated to release 1.7.1
[siplcs.git] / configure.ac
blob99904dbc8f33d712551b5b5659f05b3817c066e0
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, [AC_HELP_STRING([--with-krb5=PREFIX], [compile sipe plugin with Kerberos 5 support])], kerberos="$withval", kerberos="no")
72 dnl check for Kerberos
73 AC_SUBST(KRB5_CFLAGS)
74 AC_SUBST(KRB5_LDFLAGS)
75 AC_SUBST(KRB5_LIBS)
77 if test "$kerberos" != "no" ; then
78         if test "$kerberos" != "yes" ; then
79                 KRB5_CFLAGS="-I${kerberos}/include"
80                 KRB5_LDFLAGS="-L${kerberos}/lib"
81         fi
82         orig_LDFLAGS="$LDFLAGS"
83         LDFLAGS="$LDFLAGS $KRB5_LDFLAGS"
84         AC_CHECK_LIB(krb5, krb5_rd_req,
85                         [KRB5_LIBS="-lkrb5"],
86                         [AC_CHECK_LIB(krb5, krb5_rd_req,
87                                 [KRB5_LIBS="-lkrb5"],
88                                 [AC_ERROR(Kerberos 5 libraries not found)],
89                                 )],
90                         -lkrb5)
91         AC_CHECK_LIB(gssapi_krb5, gss_krb5_export_lucid_sec_context,
92                         [KRB5_LIBS="$KRB5_LIBS -lgssapi_krb5"],
93                         [AC_CHECK_LIB(gssapi, gss_krb5_export_lucid_sec_context,
94                                 [KRB5_LIBS="$KRB5_LIBS -lgssapi_krb5"],
95                                 [AC_ERROR(GSSAPI libraries not found)],
96                                 )],
97                         -lgssapi_krb5)
98         savedLIBS="$LIBS"
99         LIBS="$KRB5_LIBS $LIBS"
100         AC_CHECK_FUNCS([krb5_get_error_message])
101         LIBS="$savedLIBS"
102         AC_DEFINE(USE_KERBEROS, 1, [Define if kerberos should be used in sipe.])
104 AM_CONDITIONAL(SIP_SEC_KRB5, test "$kerberos" != "no")
106 dnl check for libpurple
107 PKG_CHECK_MODULES(PURPLE, [purple >= 2.3.1],
108         [AC_DEFINE(HAVE_PIDGIN, 1, [Define if we've found libpurple])])
109 dnl unfortunately PURPLE_MAJOR_VERSION is not exported by purple.m4
110 PURPLE_MAJOR_VERSION=`$PKG_CONFIG --modversion purple | cut -d. -f 1`
111 AC_SUBST(PURPLE_MAJOR_VERSION)
113 dnl let user now if he has a 32- and 64-bit header conflict...
114 AC_MSG_CHECKING([for 32- and 64-bit header conflicts])
115 ac_save_CFLAGS=$CFLAGS
116 CFLAGS="$PURPLE_CFLAGS -Werror -Wall -Wextra"
117 AC_COMPILE_IFELSE(
118         AC_LANG_PROGRAM(
119                 [
120 #include <glib.h>
121 #include <cipher.h>
123 /* Compile some code that has caused trouble in the past */
124 void testfunc(unsigned long len)
126   PurpleCipherContext *rc4 = NULL;
127   purple_cipher_context_set_option(rc4, "key_len", GUINT_TO_POINTER(len));
129                 ],
130                 [testfunc(16);]),
131         [AC_MSG_RESULT(none)],
132         [AC_MSG_RESULT(failed)
133          AC_ERROR(conflicts found.
135 Check that you have the correct glib/libpurple headers installed for
136 your architecture or set PURPLE_CFLAGS to override the system defaults. 
138 CFLAGS=$ac_save_CFLAGS
140 dnl check for inet_aton
141 AC_CHECK_FUNC(inet_aton,,
142         [AC_CHECK_LIB(resolv, inet_aton,, [AC_ERROR(inet_aton not found)])])
144 dnl static linking
145 SIPE_LIBA=`$PKG_CONFIG sipe --variable=libarchive`
146 AC_SUBST(SIPE_LIBA)
148 AC_ARG_ENABLE(static-sipe,
149         [AS_HELP_STRING([--enable-static-sipe],
150                         [statically linked plugin [default=no]])],
151         ,
152         sipe_static="no")
154 AM_CONDITIONAL(SIPE_STATIC, test $sipe_static = yes)
156 dnl i18n
157 AC_MSG_CHECKING([locale_CPPFLAGS])
158 LOCALE_CPPFLAGS='-DLOCALEDIR=\"$(prefix)/$(DATADIRNAME)/locale\"'
159 AC_SUBST([LOCALE_CPPFLAGS])
160 AC_MSG_RESULT([$LOCALE_CPPFLAGS])
162 GETTEXT_PACKAGE=$PACKAGE
163 AC_SUBST(GETTEXT_PACKAGE)
164 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Gettext Package])
165 AM_GLIB_GNU_GETTEXT
167 dnl codeset
168 AM_LANGINFO_CODESET
170 dnl substitutions and generated files
171 AC_CONFIG_FILES(
172         [src/config.h]
173         [Makefile 
174         pixmaps/Makefile 
175         m4macros/Makefile
176         po/Makefile.in
177         pixmaps/16/Makefile 
178         pixmaps/22/Makefile 
179         pixmaps/48/Makefile 
180         src/Makefile]
183 dnl generate files
184 AC_OUTPUT()
186 dnl additional info for the user
187 echo
188 echo -n "Simple SIPE linking mode : "
189 if test "$sipe_static" = "yes" ; then
190         echo "static"
191         echo "Simple SIPE library...      : $SIPE_LIBA"
192 else
193         echo "dynamic"
196 if test "$kerberos" != "no" ; then
197         echo
198         echo "Compiling with kerberos 5 support"
199         echo "KRB5_LDFLAGS   : $KRB5_LDFLAGS"
200         echo "KRB5_CFLAGS    : $KRB5_CFLAGS"
201         echo "KRB5_LIBS      : $KRB5_LIBS"
204 if test "$enable_debug" != "no"; then
205         echo
206         echo "Compiling with debugging enabled"
207         echo "DEBUG_CFLAGS   : $DEBUG_CFLAGS"
210 if test -n "${QUALITY_CFLAGS}"; then
211         echo
212         echo "Compiling with compiler checks enabled"
213         echo "QUALITY_CFLAGS : $QUALITY_CFLAGS"
216 echo
217 echo "configure complete, now run 'make'"
218 echo
220 dnl The End.