configure: fix --with-krb5 without value
[siplcs.git] / configure.ac
blob35b3b880d54756799a1544c75e79f885c06138de
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 AM_PROG_CC_C_O
33 AC_HEADER_STDC
35 dnl setup shared library generation
36 LT_INIT([disable-static])
38 dnl checks for tools
39 IT_PROG_INTLTOOL([0.35.0])
40 AC_PROG_INSTALL
41 AC_PROG_RANLIB
43 dnl checks for header files
44 AC_CHECK_HEADERS([sys/sockio.h])
46 dnl checks for library functions
47 AC_CHECK_FUNCS([])
49 dnl tell pkgconfig to look in the same prefix where we're installing this to,
50 dnl as that is likely where libpurple will be found if it is not in the default
51 dnl pkgconfig path
52 PREFIX=$ac_default_prefix
53 if test "$prefix" != "NONE"; then
54         PREFIX=$prefix
57 PKG_CONFIG_PATH="$PKG_CONFIG_PATH":"$PREFIX/lib/pkgconfig"
58 export PKG_CONFIG_PATH
60 dnl debug mode
61 AC_ARG_ENABLE(debug,
62         [AS_HELP_STRING([--enable-debug],
63                         [compile with debugging support [default=no]])],
64         ,
65         enable_debug="no")
67 if test "$enable_debug" = yes; then
68    AC_DEFINE(DEBUG, 1, [Define if debugging is enabled.])
71 DEBUG_CFLAGS="${DEBUG_CFLAGS}"
72 AC_SUBST(DEBUG_CFLAGS)
74 dnl quality check mode
75 dnl For people who are interested in finding bugs and not hiding them
76 AC_ARG_ENABLE(quality-check,
77         [AS_HELP_STRING([--enable-quality-check],
78                         [compile with compiler checks enabled [default=yes]])],
79         ,
80         enable_quality_check="yes")
83 if test "$enable_quality_check" = yes; then
84         QUALITY_CFLAGS="$QUALITY_CFLAGS -Werror -Wall"
85         ac_save_CFLAGS=$CFLAGS
87         dnl GCC >= 3.4
88         AC_MSG_CHECKING([if $CC supports -Wextra])
89         CFLAGS="$QUALITY_CFLAGS -Wextra"
90         AC_COMPILE_IFELSE(
91                 AC_LANG_PROGRAM(),
92                 [AC_MSG_RESULT(yes)
93                  QUALITY_CFLAGS="$QUALITY_CFLAGS -Wextra"],
94                 [AC_MSG_RESULT(no)]
95         )
97         dnl declaration-after-statement (ISO C90 behaviour, as on Windows & GCC < 3)
98         AC_MSG_CHECKING([if $CC supports -Werror=declaration-after-statement])
99         CFLAGS="$QUALITY_CFLAGS -Werror=declaration-after-statement"
100         AC_COMPILE_IFELSE(
101                 AC_LANG_PROGRAM(),
102                 [AC_MSG_RESULT(yes)
103                  QUALITY_CFLAGS="$QUALITY_CFLAGS -Werror=declaration-after-statement"],
104                 [AC_MSG_RESULT(no)]
105         )
106         CFLAGS=$ac_save_CFLAGS
107 else
108         QUALITY_CFLAGS="$QUALITY_CFLAGS"
110 AC_SUBST(QUALITY_CFLAGS)
112 dnl Check for pkg-config before using it
113 PKG_PROG_PKG_CONFIG
115 dnl check for Kerberos 5 support
116 AC_ARG_WITH([krb5],
117         [AC_HELP_STRING([--with-krb5],
118                 [compile with Kerberos 5 support @<:@default=check@:>@])],
119         [AS_IF([test "x$withval" = xyes], [with_krb5=check])],
120         [with_krb5=check])
122 AS_IF([test "x$with_krb5" = xno], [], dnl disabled by user
123       [test "x$with_krb5" = xcheck],  dnl autodetect with krb5-config
124         [AC_MSG_CHECKING(if Kerberos 5 is available)
125          AS_IF([AC_RUN_LOG([krb5-config --version])],
126                 [KRB5_CFLAGS=`krb5-config --cflags 2>/dev/null`
127                  KRB5_LDFLAGS=""
128                  LIBS="$LIBS `krb5-config --libs gssapi 2>/dev/null`"],
129                 [AC_MSG_RESULT(no)
130                  with_krb5=no])],
131       [                               dnl path specified by user
132         KRB5_CFLAGS="-I${with_krb5}/include"
133         KRB5_LDFLAGS="-L${with_krb5}/lib"
134         ac_save_LDFLAGS="$LDLAGS"
135         LDFLAGS="$LDFLAGS $KRB5_LDFLAGS"
136         AC_CHECK_LIB(krb5, krb5_rd_req,          [],
137                 [AC_CHECK_LIB(krb5, krb5_rd_req, [],
138                         [AC_ERROR(Kerberos 5 libraries not found)])])
139         AC_CHECK_LIB(gssapi_krb5, gss_krb5_export_lucid_sec_context, [],
140                         [AC_ERROR(GSSAPI Kerberos 5libraries not found)])
141         LDFLAGS="$ac_save_LDFLAGS"])
142 AM_CONDITIONAL(SIP_SEC_KRB5, test "x$with_krb5" != xno)
143 AC_SUBST(KRB5_CFLAGS)
144 AC_SUBST(KRB5_LDFLAGS)
146 dnl check for glib
147 PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.12.0])
149 dnl check for gmime
150 dnl See also: https://bugzilla.gnome.org/show_bug.cgi?id=613653#c8
151 PKG_CHECK_MODULES(GMIME, [gmime-2.6 >= 2.5.2],
152         [ac_have_gmime=yes],
153         [PKG_CHECK_MODULES(GMIME, [gmime-2.4 >= 2.4.16],
154                 [ac_have_gmime=yes],
155                 [ac_have_gmime=no])
157 AM_CONDITIONAL(SIPE_MIME_GMIME, [test x$ac_have_gmime = xyes])
158 AM_COND_IF(SIPE_MIME_GMIME,
159         [AC_DEFINE(HAVE_GMIME, 1, [Define if gmime should be used in sipe.])])
161 dnl check for libxml2
162 PKG_CHECK_MODULES(LIBXML2, [libxml-2.0])
164 dnl assumption check: sizof(uuid_t) must be 16 (see uuid.c)
165 AC_MSG_CHECKING([that sizeof(uuid_t) is 16])
166 ac_save_CFLAGS=$CFLAGS
167 CFLAGS="$GLIB_CFLAGS $QUALITY_CFLAGS"
168 dnl note the [[[ quoting: our code contains []!
169 AC_RUN_IFELSE(
170         AC_LANG_PROGRAM(
171                 [[[
172 #include <glib.h>
173 #include <stdio.h>
175 /* Copied from uuid.c */
176 typedef struct {
177    guint32 time_low;
178    guint16 time_mid;
179    guint16 time_hi_and_version;
180    guint8  clock_seq_hi_and_reserved;
181    guint8  clock_seq_low;
182    guint8  node[6];
183 } uuid_t;
184                 ]]],
185                 [return(sizeof(uuid_t) == 16 ? 0 : 1);]),
186         [AC_MSG_RESULT(yes)],
187         [AC_MSG_RESULT(failed)
188          AC_ERROR(sizeof(uuid_t) is not 16
190 Please notify the SIPE developers and provide the following information:
192  host:     $host
193  build:    $build
194  compiler: $CC
196 CFLAGS=$ac_save_CFLAGS
198 dnl check for libpurple
199 purple="yes"
200 AC_ARG_WITH([purple],
201         [AC_HELP_STRING([--with-purple],
202                 [compile sipe plugin for libpurple clients @<:@default=autodetect@:>@])],
203         [test "$withval" = "yes" || purple="no"],
204         [])
205 if test "$purple" != "no"; then
206         PKG_CHECK_MODULES(PURPLE, [purple >= 2.4.0],
207                 [],
208                 [purple="no"])
211 dnl support for libpurple plugin
212 AM_CONDITIONAL(SIPE_INCLUDE_PURPLE, test "$purple" != "no")
213 if test "$purple" != "no"; then
215         dnl unfortunately PURPLE_MAJOR_VERSION is not exported by purple.m4
216         PURPLE_MAJOR_VERSION=`$PKG_CONFIG --modversion purple | cut -d. -f 1`
217         AC_SUBST(PURPLE_MAJOR_VERSION)
219         dnl let user now if he has a 32- and 64-bit header conflict...
220         AC_MSG_CHECKING([for 32- and 64-bit header conflicts])
221         ac_save_CFLAGS=$CFLAGS
222         CFLAGS="$PURPLE_CFLAGS $QUALITY_CFLAGS"
223         AC_COMPILE_IFELSE(
224                 AC_LANG_PROGRAM(
225                         [
226 #include <glib.h>
227 #include <cipher.h>
229 /* Compile some code that has caused trouble in the past */
230 void testfunc(unsigned long len)
232   PurpleCipherContext *rc4 = NULL;
233   purple_cipher_context_set_option(rc4, "key_len", GUINT_TO_POINTER(len));
235                         ],
236                         [testfunc(16);]),
237                 [AC_MSG_RESULT(none)],
238                 [AC_MSG_RESULT(failed)
239                  AC_ERROR(conflicts found.
241 Check that you have the correct glib/libpurple headers installed for
242 your architecture or set PURPLE_CFLAGS to override the system defaults.
244         CFLAGS=$ac_save_CFLAGS
247 dnl check for telepathy
248 telepathy="yes"
249 AC_ARG_WITH([telepathy],
250         [AC_HELP_STRING([--with-telepathy],
251                 [compile sipe plugin for telepathy clients @<:@default=autodetect@:>@])],
252         [test "$withval" = "yes" || telepathy="no"],
253         [])
254 if test "$telepathy" != "no"; then
255         PKG_CHECK_MODULES(TELEPATHY, [telepathy-glib],
256                 [],
257                 [telepathy="no"])
260 dnl support for telepathy plugin
261 AM_CONDITIONAL(SIPE_INCLUDE_TELEPATHY, test "$telepathy" != "no")
262 if test "$telepathy" != "no"; then
263         AM_COND_IF(SIPE_MIME_GMIME, [],
264                 [AC_ERROR(GMIME package is required for telepathy plugin)])
265         dnl NOTHING IMPLEMENTED YET!!!
268 dnl sanity check
269 AS_IF([test "$purple" = "no" -a "$telepathy" = "no"],
270         [AC_ERROR(at least one plugin must be selected
272 If you didn't use a --without option then please check that you have
273 the headers for the packages "purple" or "telepathy-glib" installed.
275         [])
277 dnl i18n
278 AC_MSG_CHECKING([locale_CPPFLAGS])
279 LOCALE_CPPFLAGS='-DLOCALEDIR=\"$(prefix)/$(DATADIRNAME)/locale\"'
280 AC_SUBST([LOCALE_CPPFLAGS])
281 AC_MSG_RESULT([$LOCALE_CPPFLAGS])
282 AM_GLIB_GNU_GETTEXT
283 AC_SUBST(GETTEXT_PACKAGE, "${PACKAGE_NAME}")
285 dnl codeset
286 AM_LANGINFO_CODESET
288 dnl substitutions and generated files
289 AC_CONFIG_HEADERS([config.h])
290 AC_CONFIG_FILES([
291         Makefile
292         pixmaps/Makefile
293         m4macros/Makefile
294         po/Makefile.in
295         pixmaps/16/Makefile
296         pixmaps/22/Makefile
297         pixmaps/48/Makefile
298         pixmaps/scalable/Makefile
299         src/Makefile
300         src/core/Makefile
301         src/api/Makefile
302         src/purple/Makefile
303         src/telepathy/Makefile
304         ])
306 dnl generate files
307 AC_OUTPUT()
309 dnl additional info for the user
310 echo
311 if test "$purple" != "no" ; then
312         echo "Compiling libpurple plugin"
313         echo "PURPLE_CFLAGS  : $PURPLE_CFLAGS"
314         echo "PURPLE_LIBS    : $PURPLE_LIBS"
315 else
316         echo "Skipping libpurple plugin"
319 echo
320 if test "$telepathy" != "no" ; then
321         echo "Compiling telepathy plugin"
322         echo
323         echo "NOTHING IMPLEMENTED YET!!!"
324         echo
325         echo "TELEPATHY_CFLAGS: $TELEPATHY_CFLAGS"
326         echo "TELEPATHY_LIBS  : $TELEPATHY_LIBS"
327 else
328         echo "Skipping telepathy plugin"
330 if test "$with_krb5" != "no" ; then
331         echo
332         echo "Compiling with Kerberos 5 support"
333         echo "KRB5_CFLAGS    : $KRB5_CFLAGS"
334         echo "KRB5_LDFLAGS   : $KRB5_LDFLAGS"
337 if test "$enable_debug" != "no"; then
338         echo
339         echo "Compiling with debugging enabled"
340         echo "DEBUG_CFLAGS   : $DEBUG_CFLAGS"
343 if test -n "$QUALITY_CFLAGS"; then
344         echo
345         echo "Compiling with compiler checks enabled"
346         echo "QUALITY_CFLAGS : $QUALITY_CFLAGS"
349 echo
350 echo "configure complete, now run 'make'"
351 echo
353 dnl The End.