Remove fallback for glib version
[pidgin-git.git] / configure.ac
blobe81eda95724e705429aeacd7955294bd9f3bcb78
1 dnl Process this file with autoconf to produce a configure script.
2 AC_PREREQ([2.50])
4 # UPDATING VERSION NUMBERS FOR RELEASES
6 # purple_micro_version += 1
8 # If any functions have been added to libpurple, Pidgin, or Finch:
9 #   purple_micro_version = 0
10 #   purple_minor_version += 1
11 #   purple_lt_current += 1
13 # If backwards compatibility has been broken in libpurple, Pidgin, or Finch:
14 #   purple_micro_version = 0
15 #   purple_minor_version = 0
16 #   purple_major_version += 1;
17 #   purple_lt_current += 1
19 # purple_version_suffix should be similar to one of the following:
20 #   For beta releases:          [beta2]
21 #   For code under development: [devel]
22 #   For production releases:    []
25 # If any code has changed in libgnt:
26 #   gnt_micro_version += 1
28 # If any functions have been added to libgnt:
29 #   gnt_micro_version = 0
30 #   gnt_minor_version += 1
31 #   gnt_lt_current += 1
33 # If backwards compatibility has been broken in libgnt:
34 #   gnt_micro_version = 0
35 #   gnt_minor_version = 0
36 #   gnt_major_version += 1;
37 #   gnt_lt_current += 1
39 # gnt_version_suffix should be similar to one of the following:
40 #   For beta releases:          [beta2]
41 #   For code under development: [devel]
42 #   For production releases:    []
44 # Make sure to update finch/libgnt/configure.ac with libgnt version changes.
46 m4_define([purple_lt_current], [12])
47 m4_define([purple_major_version], [2])
48 m4_define([purple_minor_version], [12])
49 m4_define([purple_micro_version], [1])
50 m4_define([purple_version_suffix], [devel])
51 m4_define([purple_version],
52           [purple_major_version.purple_minor_version.purple_micro_version])
53 m4_define([purple_display_version], purple_version[]m4_ifdef([purple_version_suffix],[purple_version_suffix]))
55 m4_define([gnt_lt_current], [8])
56 m4_define([gnt_major_version], [2])
57 m4_define([gnt_minor_version], [8])
58 m4_define([gnt_micro_version], [10])
59 m4_define([gnt_version_suffix], [devel])
60 m4_define([gnt_version],
61           [gnt_major_version.gnt_minor_version.gnt_micro_version])
62 m4_define([gnt_display_version], gnt_version[]m4_ifdef([gnt_version_suffix],[gnt_version_suffix]))
65 AC_INIT([pidgin], [purple_display_version], [devel@pidgin.im])
67 if test `pwd | wc -w` -ne 1; then
68         AC_MSG_ERROR([
69 You are attempting to build in a path that contains spaces.  This
70 will fail.  Relocate this source tree to a path that does not contain
71 spaces and run configure again.
75 AC_CANONICAL_HOST
76 AC_CONFIG_HEADERS([config.h])
77 AM_INIT_AUTOMAKE([1.9 -Wno-portability dist-bzip2])
78 dnl TODO: Always use AM_SILENT_RULES when we depend on automake >= 1.11
79 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
81 PURPLE_MAJOR_VERSION=purple_major_version
82 PURPLE_MINOR_VERSION=purple_minor_version
83 PURPLE_MICRO_VERSION=purple_micro_version
84 PURPLE_VERSION=[purple_display_version]
85 AC_SUBST(PURPLE_MAJOR_VERSION)
86 AC_SUBST(PURPLE_MINOR_VERSION)
87 AC_SUBST(PURPLE_MICRO_VERSION)
88 AC_SUBST(PURPLE_VERSION)
90 PURPLE_LT_VERSION_INFO="purple_lt_current:purple_micro_version:purple_minor_version"
91 AC_SUBST(PURPLE_LT_VERSION_INFO)
93 GNT_MAJOR_VERSION=gnt_major_version
94 GNT_MINOR_VERSION=gnt_minor_version
95 GNT_MICRO_VERSION=gnt_micro_version
96 GNT_VERSION=[gnt_display_version]
97 AC_SUBST(GNT_MAJOR_VERSION)
98 AC_SUBST(GNT_MINOR_VERSION)
99 AC_SUBST(GNT_MICRO_VERSION)
100 AC_SUBST(GNT_VERSION)
102 GNT_LT_VERSION_INFO="gnt_lt_current:gnt_micro_version:gnt_minor_version"
103 AC_SUBST(GNT_LT_VERSION_INFO)
105 AC_PATH_PROG(sedpath, sed)
107 dnl Storing configure arguments
108 AC_DEFINE_UNQUOTED(CONFIG_ARGS, "$ac_configure_args", [configure arguments])
110 dnl Checks for programs.
111 AC_PROG_CC
112 AM_PROG_CC_C_O
113 AC_DISABLE_STATIC
114 AC_PROG_LIBTOOL
115 LIBTOOL="$LIBTOOL --silent"
116 AC_PROG_INSTALL
117 PKG_PROG_PKG_CONFIG
118 AC_FUNC_ALLOCA
120 dnl Check for Sun compiler
121 AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
123 dnl Checks for header files.
124 AC_HEADER_STDC
125 AC_HEADER_SYS_WAIT
126 AC_CHECK_HEADERS(arpa/nameser_compat.h fcntl.h sys/time.h unistd.h locale.h signal.h stdint.h regex.h)
128 dnl Checks for typedefs, structures, and compiler characteristics.
129 AC_C_CONST
130 AC_STRUCT_TM
131 AC_CHECK_SIZEOF(time_t, ,[
132 #include <stdio.h>
133 #include <time.h>])
135 AC_C_BIGENDIAN
137 dnl Checks for library functions.
138 AC_TYPE_SIGNAL
139 AC_FUNC_STRFTIME
140 AC_CHECK_FUNCS(strdup strstr atexit setlocale)
141 dnl Checks for getopt in standard library
142 AC_CHECK_FUNCS(getopt_long,,
144         AC_LIBOBJ(getopt)
145         AC_LIBOBJ(getopt1)
148 dnl Check for inet_aton
149 AC_CHECK_FUNC(inet_aton, , [AC_CHECK_LIB(resolv, inet_aton, ,
150                                          [AC_MSG_ERROR([inet_aton not found])])])
151 AC_CHECK_LIB(resolv, __res_query)
152 AC_CHECK_LIB(nsl, gethostent)
153 AC_CHECK_FUNC(socket, ,
154         [AC_CHECK_LIB(socket, socket, , [AC_MSG_ERROR([socket not found])])])
155 dnl If all goes well, by this point the previous two checks will have
156 dnl pulled in -lsocket and -lnsl if we need them.
157 AC_CHECK_FUNC(getaddrinfo,
158         [AC_DEFINE([HAVE_GETADDRINFO], [1],
159                 [Define to 1 if you have the getaddrinfo function.])],
160         [AC_CHECK_LIB(socket, getaddrinfo,
161                 [AC_DEFINE([HAVE_GETADDRINFO]) LIBS="-lsocket -lsnl $LIBS"], , , -lnsl)])
162 AC_CHECK_FUNCS(inet_ntop)
163 AC_CHECK_FUNCS(getifaddrs)
164 dnl Check for socklen_t (in Unix98)
165 AC_MSG_CHECKING(for socklen_t)
166 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
167         #include <sys/types.h>
168         #include <sys/socket.h>
169         socklen_t x;
170 ]], [[]])], [
171         AC_MSG_RESULT(yes)
172 ], [
173         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
174                 #include <sys/types.h>
175                 #include <sys/socket.h>
176                 int accept(int, struct sockaddr *, size_t *);
177         ]], [[]])], [
178                 AC_MSG_RESULT(size_t)
179                 AC_DEFINE(socklen_t, size_t, [socklen_t size])
180         ], [
181                 AC_MSG_RESULT(int)
182                 AC_DEFINE(socklen_t, int, [socklen_t size])
183         ])
186 dnl Some systems do not have sa_len field for struct sockaddr.
187 AC_CHECK_MEMBER([struct sockaddr.sa_len],
188         [AC_DEFINE([HAVE_STRUCT_SOCKADDR_SA_LEN],[1],
189         [Define if struct sockaddr has an sa_len member])],[:],
190         [#include <sys/socket.h>])
192 dnl Check for v6-only sockets
193 AC_CHECK_DECL([IPV6_V6ONLY],
194         [AC_DEFINE([HAVE_IPV6_V6ONLY],[1],
195         [Define if the IPV6_V6ONLY setsockopt option exists])],
196         [], [#include <netinet/in.h>])
198 dnl to prevent the g_stat()/g_unlink() crash,
199 dnl (09:50:07) Robot101: LSchiere2: it's easy. +LC_SYS_LARGEFILE somewhere in configure.ac
200 AC_SYS_LARGEFILE
202 dnl FreeBSD doesn't have libdl, dlopen is provided by libc
203 AC_CHECK_FUNC(dlopen, LIBDL="", [AC_CHECK_LIB(dl, dlopen, LIBDL="-ldl")])
205 dnl Haiku does not use libm for the math functions, they are part
206 dnl of the C library
207 AC_SEARCH_LIBS([ceil], [m], [], [
208   AC_MSG_ERROR([unable to find the floor() function])
211 AC_MSG_CHECKING(for fileno())
212 AC_RUN_IFELSE([AC_LANG_SOURCE([[
213 #include <stdio.h>
215 int main(int argc, char *argv[])
217         int fd;
219         fd = fileno(stdout);
221         return !(fd > 0);
223 ]])], [
224         AC_MSG_RESULT(yes)
225         AC_DEFINE([HAVE_FILENO], [1],
226                   [Define to 1 if your stdio has int fileno(FILE *).])
227 ], [
228         AC_MSG_RESULT(no)
229 ], [
230         # Fallback for Cross Compiling...
231         # This will enable the compatibility code.
232         AC_MSG_RESULT(no)
235 AC_MSG_CHECKING(for the %z format string in strftime())
236 AC_RUN_IFELSE([AC_LANG_SOURCE([[
237 #ifdef HAVE_SYS_TIME_H
238 #include <sys/time.h>
239 #endif
240 #include <time.h>
241 #include <stdio.h>
243 int main()
245         char buf[6];
246         time_t t = time(NULL);
248         if (strftime(buf, sizeof(buf), "%z", localtime(&t)) != 5)
249                 return 1;
251         fprintf(stderr, "strftime(\"%%z\") yields: \"%s\"\n", buf);
253         return !((buf[0] == '-' || buf[0] == '+') &&
254                  (buf[1] >= '0' && buf[1] <= '9') &&
255                  (buf[2] >= '0' && buf[2] <= '9') &&
256                  (buf[3] >= '0' && buf[3] <= '9') &&
257                  (buf[4] >= '0' && buf[4] <= '9')
258                 );
260 ]])], [
261         AC_MSG_RESULT(yes)
262         AC_DEFINE([HAVE_STRFTIME_Z_FORMAT], [1],
263                 [Define to 1 if you have a strftime() that supports the %z format string.])
264 ], [
265         AC_MSG_RESULT(no)
266 ], [
267         # Fallback for Cross Compiling...
268         # This will enable the compatibility code.
269         AC_MSG_RESULT(no)
272 # before gettexting, in case iconv matters
273 case "$host_os" in
274 darwin*)
275         AC_CHECK_LIB(resolv, res_query)
277         AC_CHECK_HEADER(CoreFoundation/CoreFoundation.h, [
278                 AC_CHECK_HEADER(IOKit/IOKitLib.h, [
279                         AC_DEFINE(HAVE_IOKIT, 1, [Define if we have IOKit])
280                         LIBS="$LIBS -framework IOKit -framework CoreFoundation"
281                 ], [])
282         ], [])
284         AC_MSG_CHECKING([for fink])
285         if test -d /sw; then
286                 AC_MSG_RESULT([found, adding /sw to search paths])
287                 CPPFLAGS="$CPPFLAGS -I/sw/include"
288                 LDFLAGS="$LDFLAGS -L/sw/lib"
289         else
290                 AC_MSG_RESULT([not found])
291         fi
292         ;;
294         ;;
295 esac
297 dnl #######################################################################
298 dnl # Disable creation and installation of translation files
299 dnl #######################################################################
300 AC_ARG_ENABLE(nls, AC_HELP_STRING([--disable-nls], [disable installation of translation files]), enable_i18n="$enableval", enable_i18n=yes)
302 if test x$enable_i18n = xyes; then
303         AC_PROG_INTLTOOL
304         GETTEXT_PACKAGE=pidgin
305         AC_SUBST(GETTEXT_PACKAGE)
307         ALL_LINGUAS="af am ar as ast az be@latin bg bn_IN bn br brx bs ca ca@valencia cs da de dz el en_AU en_CA en_GB eo es_AR es et eu fa fi fr ga gl gu he hi hr hu id it ja ka kk km kn ko ks ku_IQ ku lt lv mai mhr mk ml mn mr ms_MY my_MM nb ne nl nn oc or pa pl ps pt_BR pt ro ru sd si sk sl sq sr@latin sr sv sw ta te th tr tt uk ur uz vi xh zh_CN zh_HK zh_TW"
308         AM_GLIB_GNU_GETTEXT
310         dnl If we don't have msgfmt, then po/ is going to fail -- ensure that
311         dnl AM_GLIB_GNU_GETTEXT found it.
313         if test x$MSGFMT = xno -o x$MSGFMT$GMSGFMT$INTLTOOL_MSGFMT = x
314         then
315                 AC_MSG_ERROR([
317 The msgfmt command is required to build libpurple.  If it is installed
318 on your system, ensure that it is in your path.  If it is not, install
319 GNU gettext to continue.
321 If you have msgfmt installed, but for some reason this error message
322 is still displayed, you have encountered what appears to be a bug in
323 third-party configure macros.  Try setting the MSGFMT environment
324 variable to the absolute path to your msgfmt binary and trying
325 configure again, like this:
327 MSGFMT=/path/to/msgfmt ./configure ...
328         ])
329         fi
330 fi #enable_i18n
332 AM_CONDITIONAL(INSTALL_I18N, test "x$enable_i18n" = "xyes")
334 dnl #######################################################################
335 dnl # Check for GLib 2.16 (required)
336 dnl #######################################################################
337 PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.16.0 gobject-2.0 gmodule-2.0 gthread-2.0], , [
338         AC_MSG_RESULT(no)
339         AC_MSG_ERROR([
341 You must have GLib 2.16.0 or newer development headers installed to build.
343 If you have these installed already you may need to install pkg-config so
344 I can find them.
345 ])])
346 AC_SUBST(GLIB_CFLAGS)
347 AC_SUBST(GLIB_LIBS)
349 GLIB_GENMARSHAL=`pkg-config --variable=glib_genmarshal glib-2.0`
350 AC_SUBST(GLIB_GENMARSHAL)
352 AC_ARG_WITH([extraversion],
353                         AC_HELP_STRING([--with-extraversion=STRING],
354                                                    [extra version number to be displayed in Help->About and --help (for packagers)]),
355                                                    EXTRA_VERSION=$withval)
357 if test x"$EXTRA_VERSION" != "x" ; then
358         AC_DEFINE_UNQUOTED(DISPLAY_VERSION, "$VERSION-$EXTRA_VERSION", [display version info])
359 else
360         AC_DEFINE_UNQUOTED(DISPLAY_VERSION, "$VERSION", [display version info])
363 AC_ARG_ENABLE(missing-dependencies, [AC_HELP_STRING([--disable-missing-dependencies],
364                 [skip missing dependencies instead of aborting configure])],
365         force_deps="$enableval", force_deps="yes")
367 AC_ARG_WITH(x, [],
368         with_x="$withval", with_x="yes")
369 AC_ARG_ENABLE(gtkui, [AC_HELP_STRING([--disable-gtkui],
370                 [compile without GTK+ user interface])],
371         enable_gtkui="$enableval", enable_gtkui="yes")
372 AC_ARG_ENABLE(consoleui, [AC_HELP_STRING([--disable-consoleui],
373                 [compile without console user interface])],
374         [enable_consoleui=$enableval force_finch=$enableval], [enable_consoleui=yes force_finch=no])
376 dnl #######################################################################
377 dnl # Check for GTK+ 2.10 and other things used by the GTK UI
378 dnl #######################################################################
379 AC_ARG_ENABLE(screensaver,
380         [AC_HELP_STRING([--disable-screensaver],
381                 [compile without X screensaver extension (used to detect idleness)])],
382         enable_screensaver="$enableval", enable_screensaver="yes")
383 AC_ARG_ENABLE(sm,
384         [AC_HELP_STRING([--disable-sm],
385                 [compile without X session management support])],
386         enable_sm="$enableval", enable_sm="yes")
387 AC_ARG_ENABLE(startup-notification,
388         [AC_HELP_STRING([--disable-startup-notification],
389                 [compile without startup notification support])],
390         enable_startup_notification="$enableval", enable_startup_notification="yes")
391 AC_ARG_ENABLE(gtkspell,
392         [AC_HELP_STRING([--disable-gtkspell],
393                 [compile without GtkSpell automatic spell checking])],
394         enable_gtkspell="$enableval", enable_gtkspell="yes")
395 AC_ARG_ENABLE(gevolution,
396         [AC_HELP_STRING([--enable-gevolution],
397                 [compile with the Evolution plugin])],
398         enable_gevolution="$enableval", enable_gevolution="no")
399 AC_ARG_ENABLE(cap,
400         [AC_HELP_STRING([--enable-cap],
401                 [compile with Contact Availability Prediction plugin])],
402         enable_cap="$enableval", enable_cap="no")
403 AC_ARG_ENABLE(gestures,
404         [AC_HELP_STRING([--disable-gestures],
405                 [compile without the gestures plugin])],
406         enable_gestures="$enableval", enable_gestures="yes")
408 AC_PATH_XTRA
409 # We can't assume that $x_libraries will be set, because autoconf does not
410 # set it in the case when the X libraries are in a standard place.
411 # Ditto for $x_includes
412 if test X"$x_libraries" = X"" || test X"$x_libraries" = XNONE; then
413     x_libpath_add=
414 else
415     x_libpath_add="-L$x_libraries"
417 if test X"$x_includes" = X"" || test X"$x_includes" = XNONE; then
418     x_incpath_add=
419 else
420     x_incpath_add="-I$x_includes"
423 if test "x$enable_gtkui" = "xyes" ; then
424         PKG_CHECK_MODULES(GTK, [gtk+-2.0 >= 2.10.0], , [
425                 AC_MSG_RESULT(no)
426                 AC_MSG_ERROR([
428 You must have GTK+ 2.10.0 or newer development headers installed to compile
429 Pidgin.  If you want to build only Finch then specify --disable-gtkui when
430 running configure.
431 ])])
433         AC_SUBST(GTK_CFLAGS)
434         AC_SUBST(GTK_LIBS)
436         dnl We only really need Pango >= 1.4 for decent RTL support
437         PKG_CHECK_MODULES(PANGO, [pango >= 1.4.0],
438                         AC_DEFINE(HAVE_PANGO14, 1, [Define if we have Pango 1.4 or newer.]),:)
440         dnl #######################################################################
441         dnl # Check if we should compile with X support
442         dnl #######################################################################
443         if test "x$with_x" = "xyes" ; then
444                 PKG_CHECK_MODULES(X11, x11,
445                         [AC_DEFINE(HAVE_X11, 1, [Define to 1 if you have X11])],
446                         [AC_MSG_RESULT(no)
447                                 if test "x$x_incpath_add" != "x" -a "x$x_libpath_add" != "x"; then
448                                         X11_LIBS="$x_libpath_add"
449                                         X11_CFLAGS="$x_incpath_add"
450                                 else
451                                         with_x="no"
452                                         if test "x$force_deps" = "xyes" ; then
453                                                 AC_MSG_ERROR([
454 X11 development headers not found.
455 Use --without-x if you do not need X11 support.
457                                         fi
458                                 fi
459                         ])
460                 AC_SUBST(X11_LIBS)
461                 AC_SUBST(X11_CFLAGS)
462         else
463                 enable_screensaver=no
464                 enable_sm=no
465                 enable_gestures=no
466         fi
468         dnl #######################################################################
469         dnl # Check for XScreenSaver
470         dnl #######################################################################
471         if test "x$enable_screensaver" = "xyes" ; then
472                 if test "x$with_x" = "xyes" ; then
473                         old_LIBS="$LIBS"
474                         LIBS="$LIBS $GTK_LIBS $x_libpath_add"
475                         XSS_LIBS=""
476                         XSS_HEADERS=""
477                         AC_CHECK_LIB(Xext, XScreenSaverRegister,[XSS_LIBS="$X_LIBS $X_PRE_LIBS -lX11 -lXext $X_EXTRA_LIBS"],[],[-lX11 -lXext -lm])
478                         AC_CHECK_LIB(Xss, XScreenSaverRegister,[XSS_LIBS="$X_LIBS $X_PRE_LIBS -lX11 -lXext $X_LIBS $X_EXTRA_LIBS -lXss"],[],[-lX11 -lXext -lm])
479                         if test "x$XSS_LIBS" != "x"; then
480                                 oldCPPFLAGS="$CPPFLAGS"
481                                 CPPFLAGS="$CPPFLAGS $x_incpath_add"
482                                 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
483                                         #include <X11/Xlib.h>
484                                         #include <X11/extensions/scrnsaver.h>
485                                         ]], [[]])], [], [enable_screensaver=no])
486                                 CPPFLAGS="$oldCPPFLAGS"
487                         else
488                                 enable_screensaver=no
489                         fi
490                         LIBS="$old_LIBS"
492                         if test "x$enable_screensaver" = "xyes" ; then
493                                 AC_DEFINE(USE_SCREENSAVER, 1, [Define if we're using XScreenSaver.])
494                                 AC_SUBST(XSS_LIBS)
495                         else
496                                 if test "x$force_deps" = "xyes" ; then
497                                         AC_MSG_ERROR([
498 XScreenSaver extension development headers not found.
499 Use --disable-screensaver if you do not need XScreenSaver extension support,
500 this is required for detecting idle time by mouse and keyboard usage.
502                                 fi
503                         fi
504                 else
505                         AC_MSG_ERROR([X support is required to build with XScreenSaver extensions])
506                 fi
507         fi
509         dnl #######################################################################
510         dnl # Check for X session management libs
511         dnl #######################################################################
512         if test "x$enable_sm" = "xyes"; then
513                 if test "x$with_x" = "xyes" ; then
514                         enable_sm=no
515                         AC_CHECK_LIB(SM, SmcSaveYourselfDone, found_sm_lib=true, , [$x_libpath_add -lICE])
516                         if test "x$found_sm_lib" = "xtrue"; then
517                                 oldCPPFLAGS="$CPPFLAGS"
518                                 CPPFLAGS="$CPPFLAGS $x_incpath_add"
519                                 AC_CHECK_HEADERS(X11/SM/SMlib.h, SM_LIBS="$x_libpath_add -lSM -lICE" enable_sm=yes)
520                                 CPPFLAGS="$oldCPPFLAGS"
521                         fi
523                         if test "x$enable_sm" = "xyes"; then
524                                 AC_DEFINE(USE_SM, 1, [Define if we're using X Session Management.])
525                                 AC_SUBST(SM_LIBS)
526                         else
527                                 if test "x$force_deps" = "xyes" ; then
528                                         AC_MSG_ERROR([
529 X session management development headers not found.
530 Use --disable-sm if you do not need session management support.
532                                 fi
533                         fi
534                 else
535                         AC_MSG_ERROR([X support is required to build with X session management support])
536                 fi
537         fi
539         dnl #######################################################################
540         dnl # Check for X11 to allow the gestures plugin
541         dnl #######################################################################
542         if test "x$enable_gestures" = "xyes"; then
543                 if test "x$with_x" = "xno" ; then
544                         enable_gestures=no
545                 fi
546         fi
548         dnl #######################################################################
549         dnl # Check for GtkSpell
550         dnl #######################################################################
551         if test "x$enable_gtkspell" = "xyes" ; then
552                 PKG_CHECK_MODULES(GTKSPELL, gtkspell-2.0 >= 2.0.2, , [
553                         AC_MSG_RESULT(no)
554                         enable_gtkspell="no"
555                         if test "x$force_deps" = "xyes" ; then
556                                 AC_MSG_ERROR([
557 GtkSpell development headers not found.
558 Use --disable-gtkspell if you do not need it.
560                         fi])
561                 if test "x$enable_gtkspell" = "xyes" ; then
562                         AC_DEFINE(USE_GTKSPELL, 1, [Define if we're using GtkSpell])
563                         AC_SUBST(GTKSPELL_CFLAGS)
564                         AC_SUBST(GTKSPELL_LIBS)
565                 fi
566         fi
568         dnl #######################################################################
569         dnl # Check for stuff needed by the Evolution integration plugin.
570         dnl #######################################################################
571         if test "x$enable_gevolution" = "xyes"; then
572                 evo_deps="libebook-1.2 libedata-book-1.2 evolution-data-server-1.2 < 3.6"
573                 PKG_CHECK_MODULES(EVOLUTION_ADDRESSBOOK, $evo_deps, , [
574                         enable_gevolution="no"
575                 ])
576                 if test "x$enable_gevolution" = "xno"; then
577                         evo_deps="libebook-1.0 libedata-book-1.0"
578                         PKG_CHECK_MODULES(EVOLUTION_ADDRESSBOOK, $evo_deps, [
579                                 enable_gevolution="yes"
580                         ], [
581                                 enable_gevolution="no"
582                         ])
583                 fi
584                 if test "x$enable_gevolution" = "xyes"; then
585                         AC_DEFINE(HAVE_EVOLUTION_ADDRESSBOOK, 1, [Define if we're using evolution addressbook.])
586                         AC_SUBST(EVOLUTION_ADDRESSBOOK_CFLAGS)
587                         AC_SUBST(EVOLUTION_ADDRESSBOOK_LIBS)
588                 else
589                         if test "x$force_deps" = "xyes" ; then
590                                 AC_MSG_ERROR([
591 Evolution development headers not found (libebook, libedata-book, evolution-data-server < 3.6).
592 Use --disable-gevolution if you do not need it.
594                         fi
595                 fi
596         fi
598         dnl #######################################################################
599         dnl # Check for libsqlite3 (for the Contact Availability Prediction plugin)
600         dnl #######################################################################
601         if test "x$enable_cap" = "xyes"; then
602                 PKG_CHECK_MODULES(SQLITE3, sqlite3 >= 3.3,,[
603                         AC_MSG_RESULT(no)
604                         enable_cap="no"
605                         if test "x$force_deps" = "xyes" ; then
606                                 AC_MSG_ERROR([
607 sqlite3 development headers not found.
608 Use --disable-cap if you do not need the Contact Availability Prediction plugin.
610                         fi])
611         fi
612         
614 else # GTK
615         enable_cap=no
616         enable_gevolution=no
617         enable_gtkspell=no
618         enable_screensaver=no
619         enable_sm=no
620         enable_startup_notification=no
621 fi      # GTK
623 AM_CONDITIONAL(ENABLE_GTK, test "x$enable_gtkui" = "xyes")
624 AM_CONDITIONAL(BUILD_GEVOLUTION, test "x$enable_gevolution" = "xyes")
625 AM_CONDITIONAL(ENABLE_CAP, test "x$enable_cap" = "xyes")
626 AM_CONDITIONAL(ENABLE_GESTURES, test "x$enable_gestures" = "xyes")
629 dnl #######################################################################
630 dnl # Check for ncurses and other things used by the console UI
631 dnl #######################################################################
632 GNT_LIBS=""
633 GNT_CFLAGS=""
634 AC_ARG_WITH(ncurses-headers, [AC_HELP_STRING([--with-ncurses-headers=DIR],
635                 [compile finch against the ncurses includes in DIR])],
636                 [ac_ncurses_includes="$withval"], [ac_ncurses_includes=""])
637 if test "x$enable_consoleui" = "xyes"; then
638         AC_CHECK_LIB(ncursesw, initscr, [GNT_LIBS="-lncursesw"], [enable_consoleui=no])
639         AC_CHECK_LIB(panelw, update_panels, [GNT_LIBS="$GNT_LIBS -lpanelw"],
640             [enable_consoleui=no], [$GNT_LIBS])
642         if test "x$enable_consoleui" = "xyes"; then
643                 dnl # Some distros put the headers in ncursesw/, some don't
644                 found_ncurses_h=no
645                 for location in $ac_ncurses_includes $NCURSES_HEADERS /usr/include/ncursesw /usr/include
646                 do
647                         f="$location/ncurses.h"
648                         orig_CFLAGS="$CFLAGS"
649                         orig_CPPFLAGS="$CPPFLAGS"
650                         CFLAGS="$CFLAGS -I$location"
651                         CPPFLAGS="$CPPFLAGS -I$location"
652                         AC_CHECK_HEADER($f,[
653                                 AC_MSG_CHECKING([if $f supports wide characters])
654                                 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
655                                         #define _XOPEN_SOURCE_EXTENDED
656                                         #include <$f>
657                                 ]], [[
658                                         #ifndef get_wch
659                                         # error get_wch not found!
660                                         #endif
661                                 ]])], [
662                                         dir=$location
663                                         if test x"$dir" != x"." ; then
664                                                 GNT_CFLAGS="-I$dir/"
665                                         else
666                                                 GNT_CFLAGS=""
667                                         fi
669                                         found_ncurses_h=yes
670                                         CFLAGS="$orig_CFLAGS"
671                                         CPPFLAGS="$orig_CPPFLAGS"
672                                         AC_MSG_RESULT([yes])
673                                         break
674                                 ], [
675                                         CFLAGS="$orig_CFLAGS"
676                                         CPPFLAGS="$orig_CPPFLAGS"
677                                         AC_MSG_RESULT([no])
678                                 ])
679                         ])
680                 done
682                 if test x"$found_ncurses_h" = x"no" ; then
683                         GNT_LIBS=""
684                         GNT_CFLAGS=""
685                         enable_consoleui=no
686                 fi
687         else
688                 # ncursesw was not found. Look for plain old ncurses
689                 enable_consoleui=yes
690                 AC_CHECK_LIB(ncurses, initscr, [GNT_LIBS="-lncurses"], [enable_consoleui=no])
691                 AC_CHECK_LIB(panel, update_panels, [GNT_LIBS="$GNT_LIBS -lpanel"],
692                     [enable_consoleui=no], [$GNT_LIBS])
693                 AC_DEFINE(NO_WIDECHAR, 1, [Define to 1 if you don't have wide-character support.])
694                 if test x"$ac_ncurses_includes" != "x"; then
695                         GNT_CFLAGS="-I$ac_ncurses_includes"
696                 else
697                         if test x"$NCURSES_HEADERS" != "x"; then
698                                 GNT_CFLAGS="-I$NCURSES_HEADERS"
699                         fi
700                 fi
701         fi
704 if test "x$force_finch" = "xyes" -a "x$enable_consoleui" != "xyes"; then
705         AC_MSG_ERROR([
707 Finch will not be built. You need to install ncursesw (or ncurses) and its development headers.
712 AC_SUBST(GNT_LIBS)
713 AC_SUBST(GNT_CFLAGS)
714 AM_CONDITIONAL(ENABLE_GNT, test "x$enable_consoleui" = "xyes")
716 #AC_CHECK_FUNC(wcwidth, [AC_DEFINE([HAVE_WCWIDTH], [1], [Define to 1 if you have wcwidth function.])])
718 dnl #######################################################################
719 dnl # Check for LibXML2 (required)
720 dnl #######################################################################
721 PKG_CHECK_MODULES(LIBXML, [libxml-2.0 >= 2.6.0], , [
722         AC_MSG_RESULT(no)
723         AC_MSG_ERROR([
724 You must have libxml2 >= 2.6.0 development headers installed to build.
725 ])])
726 PKG_CHECK_EXISTS([libxml-2.0 >= 2.6.18], , [
727         AC_MSG_WARN([
728 Versions of libxml2 < 2.6.18 may contain bugs that could cause XMPP messages to be discarded.
729 ])])
731 AC_SUBST(LIBXML_CFLAGS)
732 AC_SUBST(LIBXML_LIBS)
734 dnl #######################################################################
735 dnl # GConf schemas
736 dnl #######################################################################
737 AC_PATH_PROG(GCONFTOOL, gconftool-2, no)
738 AM_CONDITIONAL(USE_GCONFTOOL, test "x$GCONFTOOL" != "xno")
739 AM_GCONF_SOURCE_2
741 dnl #######################################################################
742 dnl # Check for GStreamer
743 dnl #######################################################################
744 AC_ARG_ENABLE(gstreamer,
745         [AS_HELP_STRING([--disable-gstreamer], [compile without GStreamer audio support])],
746         enable_gst="$enableval", enable_gst="yes")
747 AC_ARG_WITH(gstreamer, [AS_HELP_STRING([--with-gstreamer=<version>],
748                 [compile with GStreamer 0.10 or 1.0 interface (default: auto)])],
749         with_gstreamer="$withval", with_gstreamer="auto")
750 if test "x$enable_gst" != "xno"; then
751         if test "x$with_gstreamer" == "xauto"; then
752                 PKG_CHECK_MODULES(GSTREAMER, [gstreamer-1.0], [
753                         AC_DEFINE(USE_GSTREAMER, 1, [Use GStreamer for playing sounds])
754                         with_gstreamer="1.0"
755                         AC_SUBST(GSTREAMER_CFLAGS)
756                         AC_SUBST(GSTREAMER_LIBS)
757                         dnl Check whether forking stuff is required for this version.
758                 ], [
759                         PKG_CHECK_MODULES(GSTREAMER, [gstreamer-0.10], [
760                                 AC_DEFINE(USE_GSTREAMER, 1, [Use GStreamer for playing sounds])
761                                 with_gstreamer="0.10"
762                                 AC_SUBST(GSTREAMER_CFLAGS)
763                                 AC_SUBST(GSTREAMER_LIBS)
764                         ], [
765                                 AC_MSG_RESULT(no)
766                                 enable_gst="no"
767                                 if test "x$force_deps" = "xyes" ; then
768                                         AC_MSG_ERROR([
769 GStreamer development headers not found.
770 Use --disable-gstreamer if you do not need GStreamer (sound) support.
772                                 fi
773                         ])
774                 ])
775         elif test "x$with_gstreamer" == "x1.0"; then
776                 PKG_CHECK_MODULES(GSTREAMER, [gstreamer-1.0], [
777                         AC_DEFINE(USE_GSTREAMER, 1, [Use GStreamer 1.0 for playing sounds])
778                         AC_SUBST(GSTREAMER_CFLAGS)
779                         AC_SUBST(GSTREAMER_LIBS)
780                 ], [
781                         AC_MSG_RESULT(no)
782                         enable_gst="no"
783                         if test "x$force_deps" = "xyes" ; then
784                                 AC_MSG_ERROR([
785 GStreamer development headers not found.
786 Use --disable-gstreamer if you do not need GStreamer (sound) support.
788                         fi
789                 ])
790         elif test "x$with_gstreamer" == "x0.10"; then
791                 PKG_CHECK_MODULES(GSTREAMER, [gstreamer-0.10], [
792                         AC_DEFINE(USE_GSTREAMER, 1, [Use GStreamer 0.10 for playing sounds])
793                         AC_SUBST(GSTREAMER_CFLAGS)
794                         AC_SUBST(GSTREAMER_LIBS)
795                 ], [
796                         AC_MSG_RESULT(no)
797                         enable_gst="no"
798                         if test "x$force_deps" = "xyes" ; then
799                                 AC_MSG_ERROR([
800 GStreamer development headers not found.
801 Use --disable-gstreamer if you do not need GStreamer (sound) support.
803                         fi
804                 ])
805         else
806                 AC_MSG_ERROR([--with-gstreamer must specify one of 0.10, 1.0 or auto.])
807         fi
810 if test "x$with_gtk" == "x3" -a "x$with_gstreamer" == "x0.10"; then
811         AC_MSG_ERROR([WebKitGTK+ 3.0 cannot be mixed with GStreamer 0.10.
812 Please switch to WebKitGTK+ 2.0 or GStreamer 1.0.])
813 elif test "x$with_gtk" == "x2" -a "x$with_gstreamer" == "x1.0"; then
814         AC_MSG_ERROR([WebKitGTK+ 2.0 cannot be mixed with GStreamer 1.0.
815 Please switch to WebKitGTK+ 3.0 or GStreamer 0.10.])
817 if test "x$with_gstreamer" == "x0.10" -o "x$with_gstreamer" == "x1.0"; then
818         AC_SUBST(GSTREAMER_VER, [$with_gstreamer])
819 else
820         AC_SUBST(GSTREAMER_VER, "")
823 dnl #######################################################################
824 dnl # Check for GStreamer Video
825 dnl #######################################################################
826 if test "x$enable_gst" != "xno" -a "x$with_gstreamer" == "x1.0"; then
827         AC_ARG_ENABLE(gstreamer-video,
828                 [AS_HELP_STRING([--disable-gstreamer-video], [compile without GStreamer 1.0 Video Overlay support])],
829                         enable_gstvideo="$enableval", enable_gstvideo="yes")
830         if test "x$enable_gstvideo" != "xno"; then
831                 PKG_CHECK_MODULES(GSTVIDEO, [gstreamer-video-1.0], [
832                         AC_DEFINE(USE_GSTVIDEO, 1, [Use GStreamer Video Overlay support])
833                         AC_SUBST(GSTVIDEO_CFLAGS)
834                         AC_SUBST(GSTVIDEO_LIBS)
835                 ], [
836                         enable_gstvideo="no"
837                 ])
838         fi
839 else
840         enable_gstvideo="no"
843 dnl #######################################################################
844 dnl # Check for GStreamer Interfaces
845 dnl #######################################################################
846 if test "x$enable_gst" != "xno" -a "x$with_gstreamer" == "x0.10"; then
847         AC_ARG_ENABLE(gstreamer-interfaces,
848                 [AS_HELP_STRING([--disable-gstreamer-interfaces], [compile without GStreamer 0.10 interface support])],
849                         enable_gstinterfaces="$enableval", enable_gstinterfaces="yes")
850         if test "x$enable_gstinterfaces" != "xno"; then
851                 PKG_CHECK_MODULES(GSTINTERFACES, [gstreamer-interfaces-0.10], [
852                         AC_DEFINE(USE_GSTINTERFACES, 1, [Use GStreamer 0.10 interfaces for X overlay support])
853                         AC_SUBST(GSTINTERFACES_CFLAGS)
854                         AC_SUBST(GSTINTERFACES_LIBS)
855                 ], [
856                         enable_gstinterfaces="no"
857                 ])
858         fi
859 else
860         enable_gstinterfaces="no"
863 dnl #######################################################################
864 dnl # Check for Farstream
865 dnl #######################################################################
866 AC_ARG_ENABLE(farstream,
867         [AS_HELP_STRING([--disable-farstream], [compile without farstream support])],
868         enable_farstream="$enableval", enable_farstream="yes")
869 if test "x$enable_farstream" != "xno"; then
870         if test "x$with_gstreamer" == "x1.0"; then
871                 PKG_CHECK_MODULES(FARSTREAM, [farstream-0.2 >= 0.2.7], [
872                         AC_SUBST(FARSTREAM_CFLAGS)
873                         AC_SUBST(FARSTREAM_LIBS)
874                 ], [
875                         enable_farstream="no"
876                 ])
877         else
878                 PKG_CHECK_MODULES(FARSTREAM, [farstream-0.1], [
879                         AC_SUBST(FARSTREAM_CFLAGS)
880                         AC_SUBST(FARSTREAM_LIBS)
881                 ], [
882                         # Try farsight.
883                         PKG_CHECK_MODULES(FARSTREAM, [farsight2-0.10 >= 0.0.9], [
884                                 AC_DEFINE(HAVE_FARSIGHT, 1, [Use Farsight instead of Farstream])
885                                 AC_SUBST(FARSTREAM_CFLAGS)
886                                 AC_SUBST(FARSTREAM_LIBS)
887                         ], [
888                                 enable_farstream="no"
889                         ])
890                 ])
891         fi
894 dnl #######################################################################
895 dnl # Check for Voice and Video support
896 dnl #######################################################################
897 AC_ARG_ENABLE(vv,
898         [AS_HELP_STRING([--disable-vv], [compile without voice and video support])],
899         enable_vv="$enableval", enable_vv="yes")
900 if test "x$enable_vv" != "xno"; then
901         if test "x$enable_gst" != "xno" -a "x$with_gstreamer" == "x1.0" -a "x$enable_gstvideo" != "xno" -a "x$enable_farstream" != "xno"; then
902                 AC_DEFINE(USE_VV, 1, [Use voice and video])
903         elif test "x$enable_gst" != "xno" -a "x$with_gstreamer" == "x0.10" -a "x$enable_gstinterfaces" != "xno" -a "x$enable_farstream" != "xno"; then
904                 AC_DEFINE(USE_VV, 1, [Use voice and video])
905         else
906                 enable_vv="no"
907                 if test "x$force_deps" = "xyes"; then
908                         AC_MSG_ERROR([
909 Dependencies for voice/video were not met.
910 Install the necessary gstreamer and farstream packages first.
911 Or use --disable-vv if you do not need voice/video support.
912                         ])
913                 fi
914         fi
916 AM_CONDITIONAL(USE_VV, test "x$enable_vv" != "xno")
918 dnl #######################################################################
919 dnl # Check for Raw data streams support in Farstream 
920 dnl #######################################################################
921 if test "x$enable_vv" != "xno" -a "x$with_gstreamer" == "x1.0"; then
922         AC_MSG_CHECKING(for raw data support in Farstream)
923         PKG_CHECK_MODULES(GSTAPP, [gstreamer-app-1.0], [
924                 AC_DEFINE(USE_GSTAPP, 1, [Use GStreamer Video Overlay support])
925                 AC_SUBST(GSTAPP_CFLAGS)
926                 AC_SUBST(GSTAPP_LIBS)
927                 AC_DEFINE(HAVE_MEDIA_APPLICATION, 1, [Define if we have support for application media type.])
928                 AC_MSG_RESULT(yes)
929                 ], [AC_MSG_RESULT(no)])
932 dnl #######################################################################
933 dnl # Check for Internationalized Domain Name support
934 dnl #######################################################################
936 AC_ARG_ENABLE(idn,
937         [AC_HELP_STRING([--disable-idn], [compile without IDN support])],
938         [enable_idn="$enableval" force_idn=$enableval], [enable_idn="yes" force_idn=no])
939 if test "x$enable_idn" != "xno"; then
940         PKG_CHECK_MODULES(IDN, libidn >= 0.0.0, [
941                 AC_DEFINE(USE_IDN, 1, [Use GNU Libidn for stringprep and IDN])
942                 AC_SUBST(IDN_CFLAGS)
943                 AC_SUBST(IDN_LIBS)
944         ], [
945                 AC_MSG_RESULT(no)
946                 enable_idn="no"
947                 if test "x$force_deps" = "xyes" ; then
948                         AC_MSG_ERROR([
949 GNU Libidn development headers not found.
950 Use --disable-idn if you do not need it.
952                 fi
953         ])
956 dnl #######################################################################
957 dnl # Check for Meanwhile headers (for Sametime)
958 dnl #######################################################################
959 AC_ARG_ENABLE(meanwhile,
960         [AC_HELP_STRING([--disable-meanwhile],
961                 [compile without meanwhile (required for Sametime support)])],
962         enable_meanwhile="$enableval", enable_meanwhile="yes")
963 if test "x$enable_meanwhile" = "xyes"; then
964         PKG_CHECK_MODULES(MEANWHILE, [meanwhile >= 1.0.0 meanwhile < 2.0.0], [
965                 have_meanwhile="yes"
966         ], [
967                 have_meanwhile="no"
968                 if test "x$force_deps" = "xyes" ; then
969                         AC_MSG_ERROR([
970 Meanwhile development headers not found.
971 Use --disable-meanwhile if you do not need meanwhile (Sametime) support.
973                 fi])
975 AC_SUBST(MEANWHILE_CFLAGS)
976 AC_SUBST(MEANWHILE_LIBS)
978 dnl #######################################################################
979 dnl # Check for Native Avahi headers (for Bonjour)
980 dnl #######################################################################
981 AC_ARG_ENABLE(avahi,
982         [AC_HELP_STRING([--disable-avahi],
983                 [compile without avahi (required for Bonjour support)])],
984         enable_avahi="$enableval", enable_avahi="yes")
986 if test "x$enable_avahi" = "xyes"; then
987         AC_ARG_WITH(avahi-client-includes, [AC_HELP_STRING([--with-avahi-client-includes=DIR], [compile the Bonjour plugin against the Avahi Client includes in DIR])], [ac_avahi_client_includes="$withval"], [ac_avahi_client_includes="no"])
988         AC_ARG_WITH(avahi-client-libs, [AC_HELP_STRING([--with-avahi-client-libs=DIR], [compile the Bonjour plugin against the Avahi Client libs in DIR])], [ac_avahi_client_libs="$withval"], [ac_avahi_client_libs="no"])
989         AVAHI_CFLAGS=""
990         AVAHI_LIBS=""
992         dnl Attempt to autodetect Avahi
993         PKG_CHECK_MODULES(AVAHI, [avahi-client avahi-glib], [
994                 avahiincludes="yes"
995                 avahilibs="yes"
996         ], [
997                 avahiincludes="no"
998                 avahilibs="no"
999         ])
1001         dnl Override AVAHI_CFLAGS if the user specified an include dir
1002         if test "$ac_avahi_client_includes" != "no"; then
1003                 AVAHI_CFLAGS="-I$ac_avahi_client_includes"
1004         fi
1005         CPPFLAGS_save="$CPPFLAGS"
1006         CPPFLAGS="$CPPFLAGS $AVAHI_CFLAGS"
1007         AC_CHECK_HEADER(avahi-client/client.h, [avahiincludes=yes], [avahiincludes=no])
1008         CPPFLAGS="$CPPFLAGS $AVAHI_CFLAGS $GLIB_CFLAGS"
1009         AC_CHECK_HEADER(avahi-glib/glib-malloc.h, [avahiincludes=yes], [avahiincludes=no])
1010         CPPFLAGS="$CPPFLAGS_save"
1012         dnl Override AVAHI_LIBS if the user specified a libs dir
1013         if test "$ac_avahi_client_libs" != "no"; then
1014                 AVAHI_LIBS="-L$ac_avahi_client_libs -lavahi-common -lavahi-client -lavahi-glib "
1015         fi
1016         AC_CHECK_LIB(avahi-client, avahi_client_new, [avahilibs=yes], [avahilibs=no], $AVAHI_LIBS)
1019 if test "x$enable_avahi" = "xyes" -a \( "x$avahiincludes" = "xno" -o "x$avahilibs" = "xno" \); then
1020         enable_avahi="no"
1021         if test "x$force_deps" = "xyes"; then
1022                 AC_MSG_ERROR([
1023 avahi development headers not found.
1024 Use --disable-avahi if you do not need avahi (Bonjour) support.
1026         fi
1028 AC_SUBST(AVAHI_CFLAGS)
1029 AC_SUBST(AVAHI_LIBS)
1032 dnl #######################################################################
1033 dnl # Check for SILC client includes and libraries
1034 dnl #######################################################################
1035 AC_ARG_WITH(silc-includes, [AC_HELP_STRING([--with-silc-includes=DIR], [compile the SILC plugin against includes in DIR])], [ac_silc_includes="$withval"], [ac_silc_includes="no"])
1036 AC_ARG_WITH(silc-libs, [AC_HELP_STRING([--with-silc-libs=DIR], [compile the SILC plugin against the SILC libs in DIR])], [ac_silc_libs="$withval"], [ac_silc_libs="no"])
1037 SILC_CFLAGS=""
1038 SILC_LIBS=""
1039 have_silc="no"
1040 if test -n "$with_silc_includes" || test -n "$with_silc_libs"; then
1041         silc_manual_check="yes"
1042 else
1043         silc_manual_check="no"
1045 if test "x$silc_manual_check" = "xno"; then
1046         PKG_CHECK_MODULES(SILC, [silcclient >= 1.1], [
1047                 have_silc="yes"
1048                 silcincludes="yes"
1049                 silcclient="yes"
1050         ], [
1051                 have_silc="no"
1052         ])
1053         if test "x$have_silc" = "xno"; then
1054                 PKG_CHECK_MODULES(SILC, silcclient, [
1055                         have_silc="yes"
1056                         silc10includes="yes"
1057                         silc10client="yes"
1058                 ], [
1059                         have_silc="no"
1060                 ])
1061                 dnl If silcclient.pc wasn't found, check for just silc.pc
1062                 if test "x$have_silc" = "xno"; then
1063                         PKG_CHECK_MODULES(SILC, silc, [
1064                                 have_silc="yes"
1065                                 silc10includes="yes"
1066                                 silc10client="yes"
1067                         ], [
1068                                 have_silc="no"
1069                         ])
1070                 fi
1071         fi
1072 else
1073         if test "$ac_silc_includes" != "no"; then
1074                 SILC_CFLAGS="-I$ac_silc_includes"
1075         fi
1076         CPPFLAGS_save="$CPPFLAGS"
1077         CPPFLAGS="$CPPFLAGS $SILC_CFLAGS"
1078         AC_CHECK_HEADER(silc.h, [silcincludes=yes])
1079         CPPFLAGS="$CPPFLAGS_save"
1081         if test "$ac_silc_libs" != "no"; then
1082                 SILC_LIBS="-L$ac_silc_libs"
1083         fi
1084         SILC_LIBS="$SILC_LIBS -lsilc -lsilcclient -lpthread $LIBDL"
1085         AC_CHECK_LIB(silcclient, silc_client_init, [silcclient=yes], , $SILC_LIBS)
1087         if test "x$silcincludes" = "xyes" -a "x$silcclient" = "xyes"; then
1088                 have_silc="yes"
1089         else
1090                 CPPFLAGS_save="$CPPFLAGS"
1091                 CPPFLAGS="$CPPFLAGS $SILC_CFLAGS"
1092                 AC_CHECK_HEADER(silcincludes.h, [silc10includes=yes])
1093                 CPPFLAGS="$CPPFLAGS_save"
1095                 SILC_LIBS="$SILC_LIBS -lsilc -lsilcclient -lpthread $LIBDL"
1096                 AC_CHECK_LIB(silcclient, silc_client_init, [silc10client=yes], , $SILC_LIBS)
1097                 if test "x$silc10includes" = "xyes" -a "x$silc10client" = "xyes"; then
1098                         have_silc="yes"
1099                 fi
1100         fi
1102 AC_SUBST(SILC_LIBS)
1103 AC_SUBST(SILC_CFLAGS)
1104 dnl SILC Toolkit >= 1.0.1 has a new MIME API
1105 if test "x$silcclient" = "xyes"; then
1106         AC_DEFINE(HAVE_SILCMIME_H, 1, [Define if we have silcmime.h])
1107 elif test "x$silc10client" = "xyes"; then
1108         CPPFLAGS_save="$CPPFLAGS"
1109         CPPFLAGS="$CPPFLAGS $SILC_CFLAGS"
1110                 AC_MSG_CHECKING(for silcmime.h)
1111                 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1112 #include <silcincludes.h>
1113 #include <silcmime.h>
1114                 ]], [[]])], [
1115                 AC_MSG_RESULT(yes)
1116                 AC_DEFINE(HAVE_SILCMIME_H, 1, [Define if we have silcmime.h])
1117                 ], [
1118                 AC_MSG_RESULT(no)
1119                 ])
1120         CPPFLAGS="$CPPFLAGS_save"
1123 dnl #######################################################################
1124 dnl # Check for Gadu-Gadu protocol library (libgadu)
1125 dnl #######################################################################
1127 PKG_CHECK_MODULES(LIBGADU, [libgadu >= 1.12.0], [have_libgadu=yes], [have_libgadu=no])
1129 if test "x$have_libgadu" = "xyes"; then
1130         AC_CHECK_LIB(gadu, gg_is_gpl_compliant, , [
1131                 LIBGADU_LIBS=""
1132                 LIBGADU_CFLAGS=""
1133                 have_libgadu=no
1134                 AC_MSG_WARN([
1135 libgadu is not compatible with the GPL when compiled with OpenSSL support.
1137 To compile against system libgadu, please recompile libgadu using:
1138 ./configure --with-openssl=no
1139 Then rerun this ./configure
1141 Falling back to using our own copy of libgadu.
1142                 ])
1143         ])
1146 AM_CONDITIONAL(HAVE_LIBGADU, test "x$have_libgadu" = "xyes")
1147 if test "x$have_libgadu" = "xyes"; then
1148         AC_DEFINE(HAVE_LIBGADU, 1, [Linked with external libgadu])
1149 else
1150         AC_CHECK_LIB(gnutls, gnutls_certificate_set_x509_system_trust, [gg_have_gnutls_csxst=yes], [gg_have_gnutls_csxst=no])
1152         gg_gnutls_sts=""
1153         if test "x$gg_have_gnutls_csxst" = "xno"; then
1154                 for i in /etc/ssl/ca-bundle.pem \
1155                         /etc/ssl/certs/ca-certificates.crt \
1156                         /etc/pki/tls/cert.pem \
1157                         /usr/local/share/certs/ca-root-nss.crt \
1158                         /etc/ssl/cert.pem
1159                 do
1160                         if test -e $i; then
1161                                 gg_gnutls_sts="$i"
1162                                 break
1163                         fi
1164                 done
1165         fi
1167         if test "x$gg_have_gnutls_csxst" = "xyes"; then
1168                 AC_DEFINE(HAVE_GNUTLS_CERTIFICATE_SET_X509_SYSTEM_TRUST, 1, [gnutls contains the gnutls_certificate_set_x509_system_trust function])
1169         fi
1170         if test "x$gg_gnutls_sts" != "x"; then
1171                 AC_DEFINE_UNQUOTED(GG_CONFIG_GNUTLS_SYSTEM_TRUST_STORE, ["$gg_gnutls_sts"], [use the given file as GnuTLS default trust store])
1172         fi
1174         PKG_CHECK_MODULES([GNUTLS_2_10], [gnutls >= 2.10.0], [
1175                 AC_DEFINE([HAVE_GNUTLS_2_10], [], [Defined if GnuTLS >= 2.10.0 is available.])
1176         ],:)
1179 AC_SUBST(LIBGADU_LIBS)
1180 AC_SUBST(LIBGADU_CFLAGS)
1183 AC_ARG_ENABLE(distrib,,,enable_distrib=no)
1184 AM_CONDITIONAL(DISTRIB, test "x$enable_distrib" = "xyes")
1185 DYNAMIC_PRPLS=all
1186 AC_ARG_WITH(static-prpls, [AC_HELP_STRING([--with-static-prpls], [Link to certain protocols statically])], [STATIC_PRPLS=`echo $withval | $sedpath 's/,/ /g'`], [STATIC_PRPLS=""])
1187 if test "x$STATIC_PRPLS" != "x" -a "x$DYNAMIC_PRPLS" = "xall"; then
1188         DYNAMIC_PRPLS=""
1191 if test "x$STATIC_PRPLS" = "xall" ; then
1192         STATIC_PRPLS="bonjour gg irc jabber novell oscar sametime silc simple zephyr"
1194 if test "x$have_meanwhile" != "xyes" ; then
1195         STATIC_PRPLS=`echo $STATIC_PRPLS | $sedpath 's/sametime//'`
1197 if test "x$avahiincludes" != "xyes" -o "x$avahilibs" != "xyes"; then
1198         STATIC_PRPLS=`echo $STATIC_PRPLS | $sedpath 's/bonjour//'`
1200 if test "x$silcincludes" != "xyes" -o "x$silcclient" != "xyes"; then
1201         STATIC_PRPLS=`echo $STATIC_PRPLS | $sedpath 's/silc/silc10/'`
1203 if test "x$silc10includes" != "xyes" -o "x$silc10client" != "xyes"; then
1204         STATIC_PRPLS=`echo $STATIC_PRPLS | $sedpath 's/silc10//'`
1206 AC_SUBST(STATIC_PRPLS)
1207 STATIC_LINK_LIBS=
1208 extern_init=
1209 load_proto=
1210 for i in $STATIC_PRPLS ; do
1211         dnl Ugly special case for "libsilcpurple.la":
1212         dnl ... and Ugly special case for multi-protocol oscar
1213         if test \( "x$i" = "xoscar" -o "x$i" = "xaim" -o "x$i" = "xicq" \) -a "x$static_oscar" != "xyes"; then
1214                 STATIC_LINK_LIBS="$STATIC_LINK_LIBS \$(top_builddir)/libpurple/protocols/oscar/liboscar.la"
1215                 extern_init="$extern_init extern gboolean purple_init_aim_plugin();"
1216                 extern_init="$extern_init extern gboolean purple_init_icq_plugin();"
1217                 load_proto="$load_proto purple_init_aim_plugin();"
1218                 load_proto="$load_proto purple_init_icq_plugin();"
1219         else
1220                 if test "x$i" = "xsilc"; then
1221                         STATIC_LINK_LIBS="$STATIC_LINK_LIBS \$(top_builddir)/libpurple/protocols/$i/lib${i}purple.la"
1222                 elif test "x$i" = "xsilc10"; then
1223                         STATIC_LINK_LIBS="$STATIC_LINK_LIBS \$(top_builddir)/libpurple/protocols/$i/libsilcpurple.la"
1224                 else
1225                         STATIC_LINK_LIBS="$STATIC_LINK_LIBS \$(top_builddir)/libpurple/protocols/$i/lib$i.la"
1226                 fi
1227                 extern_init="$extern_init extern gboolean purple_init_${i}_plugin();"
1228                 load_proto="$load_proto purple_init_${i}_plugin();"
1229         fi
1230         case $i in
1231                 bonjour)        static_bonjour=yes ;;
1232                 gg)                     static_gg=yes ;;
1233                 irc)            static_irc=yes ;;
1234                 jabber)         static_jabber=yes ;;
1235                 novell)         static_novell=yes ;;
1236                 oscar)          static_oscar=yes ;;
1237                 aim)            static_oscar=yes ;;
1238                 icq)            static_oscar=yes ;;
1239                 sametime)       static_sametime=yes ;;
1240                 silc)           static_silc=yes ;;
1241                 silc10)         static_silc=yes ;;
1242                 simple)         static_simple=yes ;;
1243                 zephyr)         static_zephyr=yes ;;
1244                 *)                      echo "Invalid static protocol $i!!" ; exit 1 ;;
1245         esac
1246 done
1247 AM_CONDITIONAL(STATIC_BONJOUR, test "x$static_bonjour" = "xyes")
1248 AM_CONDITIONAL(STATIC_GG, test "x$static_gg" = "xyes")
1249 AM_CONDITIONAL(STATIC_IRC, test "x$static_irc" = "xyes")
1250 AM_CONDITIONAL(STATIC_JABBER, test "x$static_jabber" = "xyes")
1251 AM_CONDITIONAL(STATIC_NOVELL, test "x$static_novell" = "xyes")
1252 AM_CONDITIONAL(STATIC_OSCAR, test "x$static_oscar" = "xyes")
1253 AM_CONDITIONAL(STATIC_SAMETIME, test "x$static_sametime" = "xyes" -a "x$have_meanwhile" = "xyes")
1254 AM_CONDITIONAL(STATIC_SILC, test "x$static_silc" = "xyes" -a "x$have_silc" = "xyes")
1255 AM_CONDITIONAL(STATIC_SIMPLE, test "x$static_simple" = "xyes")
1256 AM_CONDITIONAL(STATIC_ZEPHYR, test "x$static_zephyr" = "xyes")
1257 AC_SUBST(STATIC_LINK_LIBS)
1258 AC_DEFINE_UNQUOTED(STATIC_PROTO_INIT, $extern_init static void static_proto_init(void) { $load_proto },
1259         [Loads static protocol plugin module initialization functions.])
1261 AC_ARG_WITH(dynamic_prpls, [AC_HELP_STRING([--with-dynamic-prpls], [specify which protocols to build dynamically])], [DYNAMIC_PRPLS=`echo $withval | $sedpath 's/,/ /g'`])
1262 if test "x$DYNAMIC_PRPLS" = "xall" ; then
1263         DYNAMIC_PRPLS="bonjour gg irc jabber novell oscar sametime silc simple zephyr"
1265 if test "x$have_meanwhile" != "xyes"; then
1266         DYNAMIC_PRPLS=`echo $DYNAMIC_PRPLS | $sedpath 's/sametime//'`
1268 if test "x$avahiincludes" != "xyes" -o "x$avahilibs" != "xyes"; then
1269         DYNAMIC_PRPLS=`echo $DYNAMIC_PRPLS | $sedpath 's/bonjour//'`
1271 if test "x$silcincludes" != "xyes" -o "x$silcclient" != "xyes"; then
1272         DYNAMIC_PRPLS=`echo $DYNAMIC_PRPLS | $sedpath 's/silc/silc10/'`
1274 if test "x$silc10includes" != "xyes" -o "x$silc10client" != "xyes"; then
1275         DYNAMIC_PRPLS=`echo $DYNAMIC_PRPLS | $sedpath 's/silc10//'`
1277 AC_SUBST(DYNAMIC_PRPLS)
1278 for i in $DYNAMIC_PRPLS ; do
1279         case $i in
1280                 bonjour)        dynamic_bonjour=yes ;;
1281                 gg)                     dynamic_gg=yes ;;
1282                 irc)            dynamic_irc=yes ;;
1283                 jabber)         dynamic_jabber=yes ;;
1284                 novell)         dynamic_novell=yes ;;
1285                 null)           dynamic_null=yes ;;
1286                 oscar)          dynamic_oscar=yes ;;
1287                 aim)            dynamic_oscar=yes ;;
1288                 icq)            dynamic_oscar=yes ;;
1289                 sametime)       dynamic_sametime=yes ;;
1290                 silc)           dynamic_silc=yes ;;
1291                 silc10)         dynamic_silc=yes ;;
1292                 simple)         dynamic_simple=yes ;;
1293                 zephyr)         dynamic_zephyr=yes ;;
1294                 *)                      echo "Invalid dynamic protocol $i!!" ; exit 1 ;;
1295         esac
1296 done
1298 AC_ARG_ENABLE(plugins, [AC_HELP_STRING([--disable-plugins], [compile without plugin support])], , enable_plugins=yes)
1299 AC_ARG_WITH(krb4, [AC_HELP_STRING([--with-krb4=PREFIX], [compile Zephyr plugin with Kerberos 4 support])], kerberos="$withval", kerberos="no")
1300 AC_ARG_WITH(zephyr, [AC_HELP_STRING([--with-zephyr=PREFIX], [compile Zephyr plugin against external libzephyr])], zephyr="$withval", zephyr="no")
1301 AM_CONDITIONAL(EXTERNAL_LIBZEPHYR, test "x$zephyr" != "xno")
1303 AC_CHECK_HEADERS(sys/utsname.h)
1304 AC_CHECK_FUNC(uname)
1306 AC_ARG_ENABLE(fortify, [AC_HELP_STRING([--disable-fortify], [compile without FORTIFY_SOURCE support])], , enable_fortify=yes)
1308 DEBUG_CFLAGS="$DEBUG_CFLAGS -DPURPLE_DISABLE_DEPRECATED -DPIDGIN_DISABLE_DEPRECATED -DFINCH_DISABLE_DEPRECATED -DGNT_DISABLE_DEPRECATED"
1309 if test "x$GCC" = "xyes"; then
1310         dnl We enable -Wall later.
1311         dnl If it's set after the warning CFLAGS in the compiler invocation, it counteracts the -Wno... flags.
1312         dnl This leads to warnings we don't want.
1313         CFLAGS=`echo $CFLAGS |$sedpath 's/-Wall//'`
1315         dnl ENABLE WARNINGS SUPPORTED BY THE VERSION OF GCC IN USE
1316         dnl
1317         dnl Future Possibilities
1318         dnl
1319         dnl Consider adding -Wbad-function-cast.
1320         dnl     This leads to spurious warnings using GPOINTER_TO_INT(), et al. directly on a function call.
1321         dnl             We'd need an intermediate variable.
1322         dnl
1323         dnl Consider adding -Wfloat-equal.
1324         dnl     This leads to warnings with Perl.
1325         dnl             Perhaps we could write ugly configure magic and pass -Wno-float-equal down to that subdirectory.
1326         dnl             On the other hand, it's probably actually broken, so maybe the Perl folks should fix that?
1327         dnl
1328         dnl Consider removing -Wno-sign-compare (from the -Wextra set) and fixing all those cases.
1329         dnl     This is likely non-trivial.
1330         dnl
1331         for newflag in \
1332                         "-Waggregate-return" \
1333                         "-Wcast-align" \
1334                         "-Wdeclaration-after-statement" \
1335                         "-Wendif-labels" \
1336                         "-Werror-implicit-function-declaration" \
1337                         "-Wextra -Wno-unused-parameter" \
1338                         "-Wformat-security" \
1339                                 "-Werror=format-security" \
1340                         "-Winit-self" \
1341                         "-Wmissing-declarations" \
1342                         "-Wmissing-noreturn" \
1343                         "-Wmissing-prototypes" \
1344                         "-Wpointer-arith" \
1345                         "-Wundef" \
1346         ; do
1347                 orig_CFLAGS="$CFLAGS"
1348                 CFLAGS="$CFLAGS $newflag"
1349                 AC_MSG_CHECKING(for $newflag option to gcc)
1350                 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], [
1351                         AC_MSG_RESULT(yes)
1352                         CFLAGS="$orig_CFLAGS"
1353                         DEBUG_CFLAGS="$DEBUG_CFLAGS $newflag"
1354                 ], [
1355                         AC_MSG_RESULT(no)
1356                         CFLAGS="$orig_CFLAGS"
1357                 ])
1358         done
1360         if test "x$enable_fortify" = "xyes"; then
1361                 AC_MSG_CHECKING(for FORTIFY_SOURCE support)
1362                 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <features.h>]], [[
1363                         #if !(__GNUC_PREREQ (4, 1) \
1364                                 || (defined __GNUC_RH_RELEASE__ && __GNUC_PREREQ (4, 0)) \
1365                                 || (defined __GNUC_RH_RELEASE__ && __GNUC_PREREQ (3, 4) \
1366                                         && __GNUC_MINOR__ == 4 \
1367                                         && (__GNUC_PATCHLEVEL__ > 2 \
1368                                                 || (__GNUC_PATCHLEVEL__ == 2 && __GNUC_RH_RELEASE__ >= 8))))
1369                         #error No FORTIFY_SOURCE support
1370                         #endif
1371                                 return 0;
1372                 ]])], [
1373                         AC_MSG_RESULT(yes)
1374                         DEBUG_CFLAGS="$DEBUG_CFLAGS -Wp,-D_FORTIFY_SOURCE=2"
1375                 ], [
1376                         AC_MSG_RESULT(no)
1377                 ])
1378         fi
1380         DEBUG_CFLAGS="-Wall $DEBUG_CFLAGS"
1381         CFLAGS="-g $CFLAGS"
1384 if test "x$SUNCC" = "xyes"; then
1385         CFLAGS="$CFLAGS -features=extensions" 
1387 AC_SUBST(CFLAGS)
1389 AC_PATH_PROG(pidginpath, pidgin)
1391 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [
1392         #if !defined(__clang__)
1393         #error
1394         #endif
1395 ])], have_clang=yes, have_clang=no)
1397 if test "x$have_clang" = "xyes"; then
1398         dnl we don't care about it for 2.x.y
1399         DEBUG_CFLAGS=`echo $DEBUG_CFLAGS |$sedpath 's/-Wcast-align//'`
1402 dnl #######################################################################
1403 dnl # Check for D-Bus libraries
1404 dnl #######################################################################
1406 AC_ARG_ENABLE(dbus, [AC_HELP_STRING([--disable-dbus], [disable D-Bus support])], , enable_dbus=yes)
1407 AC_ARG_ENABLE(nm, [AC_HELP_STRING([--disable-nm], [disable NetworkManager support (requires D-Bus)])], enable_nm=$enableval, enable_nm=yes)
1409 if test "x$enable_dbus" = "xyes" ; then
1410         AC_CHECK_PROG(enable_dbus, dbus-binding-tool, yes, no)
1413 if test "x$enable_dbus" = "xyes" ; then
1414         PKG_CHECK_MODULES(DBUS, [dbus-1 >= 0.60 dbus-glib-1 >= 0.60], [
1415                 AC_SUBST(DBUS_CFLAGS)
1416                 AC_SUBST(DBUS_LIBS)
1417                 enable_dbus=yes
1418         ], [
1419         enable_dbus=no
1420         if test "x$force_deps" = "xyes" ; then
1421                 AC_MSG_ERROR([
1422 D-Bus development headers not found.
1423 Use --disable-dbus if you do not need D-Bus support.
1425         fi])
1428 dnl Check for NetworkManager.h; if we don't have it, oh well
1429 if test "x$enable_dbus" = "xyes" ; then
1430         if test "x$enable_nm" = "xyes" ; then
1431                 PKG_CHECK_MODULES(NETWORKMANAGER, [NetworkManager >= 0.5.0], [
1432                         AC_SUBST(NETWORKMANAGER_CFLAGS)
1433                         AC_SUBST(NETWORKMANAGER_LIBS)
1434                         AC_DEFINE(HAVE_NETWORKMANAGER, 1, [Define if we have NetworkManager.])
1435                 ], [
1436                         enable_nm=no
1437                         if test "x$force_deps" = "xyes" ; then
1438                                 AC_MSG_ERROR([
1439 NetworkManager development headers not found.
1440 Use --disable-nm if you do not need NetworkManager support.
1442                         fi])
1443         fi
1444 else
1445         enable_nm=no
1448 dnl #######################################################################
1449 dnl # Check for Unity and Messaging Menu
1450 dnl #######################################################################
1451 AC_ARG_ENABLE(unity, [AC_HELP_STRING([--enable-unity],
1452         [compile with support for unity integration plugin])], enable_unity="$enableval", enable_unity="no")
1453 if test "$enable_unity" = yes; then
1454         PKG_CHECK_MODULES(UNITY, [unity >= 6.8 messaging-menu >= 12.10], , [
1455                 AC_MSG_RESULT(no)
1456                 AC_MSG_ERROR([
1457 You must have libunity9 >= 6.8 and libmessaging-menu >= 12.10 to build the unity integration plugin.
1458         ])])
1459         USES_MM_CHAT_SECTION="X-MessagingMenu-UsesChatSection=true"
1460         AC_SUBST(UNITY_CFLAGS)
1461         AC_SUBST(UNITY_LIBS)
1462         AC_SUBST(USES_MM_CHAT_SECTION)
1463 else
1464         enable_unity=no
1466 AM_CONDITIONAL(ENABLE_UNITY, [test "x$enable_unity" = "xyes"])
1468 dnl #######################################################################
1469 dnl # Check for Python
1470 dnl #######################################################################
1472 dnl Python scripts are used to auto-generate about 3000 lines of C
1473 dnl and XML code that wraps (part of) the existing API so that
1474 dnl it is now accessible through D-Bus.
1476 dnl Python is only required if --enable-dbus is used, and only for
1477 dnl the build process to generate the code, not for running pidgin.
1478 dnl This autogenerated code is system-independent, so in principle we
1479 dnl can generate all of it before shipping.  But I thought adding
1480 dnl auto-generated stuff to the repository is inelegant.
1481 dnl Alternatively, these python scripts could be rewritten
1482 dnl in C (brrrr ...).
1484 AC_ARG_WITH([python],
1485                         AC_HELP_STRING([--with-python=PATH],
1486                                                    [which python interpreter to use for dbus code generation]),
1487                         PYTHON=$withval)
1489 if test "x$enable_dbus" = "xyes" || test "x$enable_consoleui" = "xyes" ; then
1490         if test -z "$PYTHON" -o "x$PYTHON" = "xyes"; then
1491                 AC_PATH_PROG([PYTHON], [python], [no])
1492         fi
1494         if test x"$PYTHON" = x"no" ; then
1495                 AC_MSG_WARN([python interpreter not found in your path])
1496                 enable_dbus=no
1497         fi
1499         if $PYTHON -c "import sys; sys.exit(sys.version[[:3]] >= '2.4')" ; then
1500                 AC_MSG_WARN([python version >= 2.4 required])
1501                 enable_dbus=no
1502         fi
1505 dnl ###########################################################################
1506 dnl # Find the D-Bus services dir.
1507 dnl #
1508 dnl # This is a 3 step process that
1509 dnl #
1510 dnl # 1. checks if --with-dbus-services was set, if so use that.
1511 dnl # 2. checks if --prefix was given, if so use that.
1512 dnl # 3. fallbacks to installing into what should be the correct system
1513 dnl #    directories.
1514 dnl #
1515 dnl # This is still prone to error if one of the legacy directories exist
1516 dnl # although a newer dbus is installed.  But I have tried to order the
1517 dnl # directory searching to keep this situation at a minimum.
1518 dnl ###########################################################################
1519 AC_ARG_WITH(dbus-services, [AC_HELP_STRING([--with-dbus-services=<dir>], [where the D-Bus services directory is located.])])
1521 DBUS_SERVICES_DIR=""
1523 if test x"$enable_dbus" = "xyes" ; then
1524         AC_MSG_CHECKING([location of the D-Bus services directory])
1525         if ! test -z "$with_dbus_services" ; then
1526                 if ! test -d "$with_dbus_services" ; then
1527                         AC_MSG_ERROR([$with_dbus_services does not exist, if this is the correct location please make sure that it exists.])
1528                 fi
1530                 DBUS_SERVICES_DIR="$with_dbus_services"
1531         else
1532                 if test x"$prefix" = x"NONE" ; then
1533                         dnl # no prefix given, so we look for the correct dbus system paths.
1534                         dnl # if a prefix is given, we use it.
1536                         serviceprefixes="$prefix/share $prefix/lib /usr/share /usr/local/share"
1537                         DBUS_SERVICES_DIR=""
1539                         for d in $serviceprefixes ; do
1540                                 dir="$d/dbus-1/services"
1541                                 if test -d $dir ; then
1542                                         DBUS_SERVICES_DIR="$dir"
1543                                         break
1544                                 fi
1545                         done
1547                         if test -z $DBUS_SERVICES_DIR ; then
1548                                 AC_MSG_ERROR([D-Bus services directory was not found!  Please use --with-dbus-services and specify its location.])
1549                         fi
1550                 else
1551                         DBUS_SERVICES_DIR="$datadir/dbus-1/services"
1552                 fi
1553         fi
1554         AC_MSG_RESULT([$DBUS_SERVICES_DIR])
1555         AC_DEFINE(HAVE_DBUS, 1, [Define if we are using D-Bus.])
1557 AC_SUBST(DBUS_SERVICES_DIR)
1559 if test "x$enable_dbus" = "xyes" ; then
1560         echo "Building with D-Bus support"
1561 else
1562         echo "Building without D-Bus support"
1565 AM_CONDITIONAL(ENABLE_DBUS, test "x$enable_dbus" = "xyes")
1567 dnl Check for Python headers (currently useful only for libgnt)
1568 dnl (Thanks to XChat)
1569 if test "x$enable_consoleui" = "xyes" -a ! -z "$PYTHON" -a x"$PYTHON" != x"no" ; then
1570         AC_MSG_CHECKING(for Python compile flags)
1571         if test -f ${PYTHON}-config; then
1572                 PY_CFLAGS=`${PYTHON}-config --includes`
1573                 PY_LIBS=`${PYTHON}-config --libs`
1574                 AC_DEFINE(USE_PYTHON, [1], [Define if python headers are available.])
1575                 AC_MSG_RESULT(ok)
1576         else
1577                 AC_MSG_RESULT([Cannot find ${PYTHON}-config])
1578                 PY_CFLAGS=""
1579                 PY_LIBS=""
1580         fi
1582 AC_SUBST(PY_CFLAGS)
1583 AC_SUBST(PY_LIBS)
1585 dnl #######################################################################
1586 dnl # Check for Mono support
1587 dnl #######################################################################
1588 AC_ARG_ENABLE(mono, [AC_HELP_STRING([--enable-mono], [compile with Mono runtime support (experimental)])], , enable_mono=no)
1589 if test x"$enable_mono" = x"yes" ; then
1590         PKG_CHECK_MODULES(MONO, mono, [
1591                 AC_SUBST(MONO_CFLAGS)
1592                 AC_SUBST(MONO_LIBS)
1593                 enable_mono=yes
1594         ], [
1595                 AC_MSG_RESULT(no)
1596                 AC_MSG_ERROR([
1597 Mono development headers not found.
1598 Use --disable-mono if you do not need Mono support.
1600         ])
1601         if test x"$enable_mono" = x"yes"; then
1602                 oldLIBS="$LIBS"
1603                 LIBS="$LIBS $MONO_LIBS"
1604                 AC_MSG_CHECKING(for libmono)
1605                 AC_CHECK_FUNCS(mono_jit_init, [], enable_mono=no)
1606                 LIBS="$oldLIBS"
1608                 oldCPPFLAGS="$CPPFLAGS"
1609                 CPPFLAGS="$CPPFLAGS $MONO_CFLAGS"
1610                 AC_CHECK_HEADERS(mono/jit/jit.h, [], enable_mono=no)
1611                 AC_CHECK_HEADERS(mono/metadata/object.h, [], enable_mono=no)
1612                 CPPFLAGS="$oldCPPFLAGS"
1614                 AC_DEFINE(ENABLE_MONO, 1, [Define if mono enabled.])
1615         fi
1616 else
1617         MONO_CFLAGS=
1618         MONO_LIBS=
1619         enable_mono=no
1622 AC_SUBST(MONO_CFLAGS)
1623 AC_SUBST(MONO_LIBS)
1624 AM_CONDITIONAL(USE_MONO, test x"$enable_mono" = x"yes")
1626 dnl #######################################################################
1627 dnl # Check for Perl support
1628 dnl #######################################################################
1629 AC_ARG_ENABLE(perl, [AC_HELP_STRING([--disable-perl], [compile without perl scripting])], , enable_perl=yes)
1631 if test "$enable_plugins" = no ; then
1632         enable_perl=no
1634 looked_for_perl="no"
1635 if test "$enable_perl" = yes ; then
1636         looked_for_perl="yes"
1637         AC_PATH_PROG(perlpath, perl)
1638         AC_MSG_CHECKING(for Perl compile flags)
1639         PERL_CFLAGS=`$perlpath -MExtUtils::Embed -e ccopts 2>/dev/null`
1640         if test "_$PERL_CFLAGS" = _ ; then
1641                 AC_MSG_RESULT([not found, building without perl.])
1642                 enable_perl=no
1643         else
1644                 PERL_LIBS=`$perlpath -MExtUtils::Embed -e ldopts 2>/dev/null |$sedpath 's/-lgdbm //'`
1645                 PERL_LIBS=`echo $PERL_LIBS |$sedpath 's/-ldb //'`
1646                 PERL_LIBS=`echo $PERL_LIBS |$sedpath 's/-lndbm //'`
1647                 if test "$system" = "Linux"; then
1648                         PERL_LIBS=`echo $PERL_LIBS |$sedpath 's/-lnsl //'`
1649                         PERL_LIBS=`echo $PERL_LIBS |$sedpath 's/-lposix //'`
1650                 fi
1651                 PERL_LIBS=`echo $PERL_LIBS |$sedpath 's/-lc //'`
1652                 AC_MSG_RESULT(ok)
1654                 oldLIBS="$LIBS"
1655                 LIBS="$LIBS $PERL_LIBS"
1656                 AC_MSG_CHECKING(for libperl)
1657                 AC_CHECK_FUNCS(perl_run, [], enable_perl=no)
1658                 LIBS="$oldLIBS"
1660                 oldCPPFLAGS="$CPPFLAGS"
1661                 CPPFLAGS="$CPPFLAGS $PERL_CFLAGS"
1662                 AC_CHECK_HEADERS(EXTERN.h)
1663                 AC_CHECK_HEADERS(perl.h, [], enable_perl=no,
1664                 [#if HAVE_EXTERN_H
1665                  # include <EXTERN.h>
1666                  #endif])
1667                 CPPFLAGS="$oldCPPFLAGS"
1668         fi
1671 if test "$enable_perl" = yes ; then
1672         AC_PROG_PERL_MODULES(ExtUtils::MakeMaker, , have_makemaker=no)
1674         if test "x$have_makemaker" = "xno"; then
1675                 enable_perl=no
1676                 PERL_CFLAGS=
1677                 PERL_LIBS=
1678                 AM_CONDITIONAL(USE_PERL, false)
1679                 AC_MSG_WARN(Compiling perl requires ExtUtils::MakeMaker)
1680         else
1681                 AC_DEFINE(HAVE_PERL, [1], [Compile with support for perl])
1682                 AC_SUBST(PERL_CFLAGS)
1683                 AC_SUBST(PERL_LIBS)
1684                 AM_CONDITIONAL(USE_PERL, true)
1686                 dnl This is almost definitely wrong, but in case there's
1687                 dnl something I'm missing, I'll leave it in.
1688                 AC_CHECK_FUNCS(Perl_eval_pv)
1690                 AC_MSG_CHECKING(for old perl)
1691                 PERL_OLD=`$perlpath -e 'if($]<5.006){printf"yes\n";}else{printf"no\n";}'`
1693                 if test "x$PERL_OLD" = "xyes"; then
1694                         AC_DEFINE(OLD_PERL, 1, [Define if old perl is installed.])
1695                         AC_MSG_RESULT(yes)
1696                 else
1697                         AC_MSG_RESULT(no)
1698                 fi
1700                 AC_MSG_CHECKING(for DynaLoader.a)
1701                 DYNALOADER_A=`echo $PERL_LDFLAGS | $perlpath -pe 's/^(.* )*([[^ ]]*DynaLoader\.a).*/\2/'`
1703                 dnl Don't check libperl.a if dynaloader.a wasn't found.
1704                 if test -n "$DYNALOADER_A"; then
1705                         AC_MSG_RESULT(yes)
1707                         dnl Find either libperl.a or libperl.so
1708                         AC_MSG_CHECKING(for libperl.a or libperl.so)
1709                         LIBPERL_A=`echo "$PERL_LDFLAGS -L/usr/lib"|$perlpath -e 'foreach (split(/ /, <STDIN>)) { if (/^-L(.*)/) { my $dir=$1; if (\`ls $dir/libperl.so* 2>/dev/null\`) { print "-lperl"; last; }; if (-e "$dir/libperl.a") { print "$dir/libperl.a"; last } } };'`
1710                         if test -z "$LIBPERL_A"; then
1711                                 AC_MSG_RESULT(no)
1712                                 DYNALOADER_A=
1713                         else
1714                                 AC_MSG_RESULT(yes)
1716                                 if test "$LIBPERL_A" = "-lperl"; then
1717                                         LIBPERL_A=
1718                                 fi
1719                         fi
1721                         PERL_LIBS=`echo $PERL_LIBS | $perlpath -pe 's/^(.* )*[[^ ]]*DynaLoader\.a/\1libperl_dynaloader.la/'`
1723                         if test -n "$LIBPERL_A"; then
1724                                 PERL_LIBS=`echo $PERL_LDFLAGS | $sedpath -e 's/-lperl /libperl_orig.la /' -e 's/-lperl$/libperl_orig.la$/'`
1725                         fi
1727                         AC_SUBST(DYNALOADER_A)
1728                         AC_SUBST(LIBPERL_A)
1729                 else
1730                         AC_MSG_RESULT(no)
1731                 fi
1732         fi
1733 else
1734         PERL_CFLAGS=
1735         PERL_LIBS=
1736         AM_CONDITIONAL(USE_PERL, false)
1739 if test "x$looked_for_perl" = "xyes" -a "x$enable_perl" = "xno" -a "x$force_deps" = "xyes"; then
1740         AC_MSG_ERROR([
1741 Perl development headers not found.
1742 Use --disable-perl if you do not need Perl scripting support.
1746 dnl #######################################################################
1747 dnl # SSL support
1748 dnl #
1749 dnl # Thanks go to Evolution for the checks.
1750 dnl #######################################################################
1752 AC_ARG_WITH(system-ssl-certs, [AC_HELP_STRING([--with-system-ssl-certs=<dir>], [directory containing system-wide SSL CA certificates])], [ssl_certificates_dir=$withval])
1754 SSL_CERTIFICATES_DIR=""
1755 if ! test -z "$ssl_certificates_dir" ; then
1756         if test "x$ssl_certificates_dir" = "xyes" ; then
1757                 AC_MSG_ERROR([--with-system-ssl-certs requires that a location is specified, eg. --with-system-ssl-certs=/etc/pki/tls/certs])
1758         fi
1759         if ! test -d "$ssl_certificates_dir" ; then
1760                 AC_MSG_ERROR([$ssl_certificates_dir does not exist, if this is the correct location please make sure that it exists.])
1761         fi
1762         SSL_CERTIFICATES_DIR="$ssl_certificates_dir"
1764 AC_SUBST(SSL_CERTIFICATES_DIR)
1765 AM_CONDITIONAL(INSTALL_SSL_CERTIFICATES, test "x$SSL_CERTIFICATES_DIR" = "x")
1767 dnl These two are inverses of each other <-- stolen from evolution!
1769 AC_ARG_ENABLE(gnutls,
1770         [  --enable-gnutls=[yes,no]  attempt to use GnuTLS for SSL support [default=yes]],
1771         [enable_gnutls="$enableval"],
1772         [enable_gnutls="yes"])
1774 AC_ARG_ENABLE(nss,
1775         [  --enable-nss=[yes,no,static]    attempt to use Mozilla libnss for SSL support [default=yes]],
1776         [enable_nss="$enableval"],
1777         [enable_nss="yes"])
1779 msg_ssl="None. Novell Groupwise and Google Talk will not work without GnuTLS or NSS. OpenSSL is NOT usable!"
1780 looked_for_gnutls="no"
1781 dnl #
1782 dnl # Check for GnuTLS if it's specified.
1783 dnl #
1784 if test "x$enable_gnutls" != "xno"; then
1785         enable_gnutls="no"
1786         prefix=`eval echo $prefix`
1787         looked_for_gnutls="yes"
1789         AC_ARG_WITH(gnutls-includes,
1790                 [  --with-gnutls-includes=PREFIX   location of GnuTLS includes.],
1791                 [ with_gnutls_includes="$withval" ],
1792                 [ with_gnutls_includes="$prefix/include" ])
1794         have_gnutls_includes="no"
1796         if test "x$with_gnutls_includes" != "xno"; then
1797                 CPPFLAGS_save="$CPPFLAGS"
1799                 AC_MSG_CHECKING(for GnuTLS includes)
1800                 AC_MSG_RESULT("")
1802                 CPPFLAGS="$CPPFLAGS -I$with_gnutls_includes"
1803                 AC_CHECK_HEADERS(gnutls/gnutls.h, [ gnutls_includes="yes" ])
1804                 CPPFLAGS="$CPPFLAGS_save"
1806                 if test "x$gnutls_includes" != "xno" -a \
1807                         "x$gnutls_includes" != "x"; then
1808                         have_gnutls_includes="yes"
1810                         if test "x$with_gnutls_includes" != "xNONE/include"; then
1811                                 GNUTLS_CFLAGS="-I$with_gnutls_includes"
1812                         fi
1813                 else
1814                         GNUTLS_CFLAGS=""
1815                 fi
1816         else
1817                 AC_MSG_CHECKING(for GnuTLS includes)
1818                 AC_MSG_RESULT(no)
1819         fi
1821         AC_ARG_WITH(gnutls-libs,
1822                 [AC_HELP_STRING([--with-gnutls-libs=PREFIX], [location of GnuTLS libraries.])],
1823                 [ with_gnutls_libs="$withval" ])
1825         if test "x$with_gnutls_libs"     != "xno" -a \
1826                 "x$have_gnutls_includes" != "xno"; then
1828                 LIBS_save="$LIBS"
1830                 case $with_gnutls_libs in
1831                         ""|-L*) ;;
1832                         *) with_gnutls_libs="-L$with_gnutls_libs" ;;
1833                 esac
1835                 AC_CACHE_CHECK([for GnuTLS libraries], ac_cv_gnutls_libs,
1836                 [
1837                         LIBS="$LIBS $with_gnutls_libs -lgnutls"
1838                         AC_TRY_LINK_FUNC(gnutls_init, ac_cv_gnutls_libs="yes", ac_cv_gnutls_libs="no")
1839                         LIBS="$LIBS_save"
1840                 ])
1842                 if test "x$ac_cv_gnutls_libs" != "xno"; then
1843                         AC_DEFINE(HAVE_GNUTLS, 1, [Define if you have GnuTLS])
1844                         AC_DEFINE(HAVE_SSL)
1845                         msg_gnutls="GnuTLS"
1846                         GNUTLS_LIBS="$with_gnutls_libs -lgnutls"
1848                         enable_gnutls="yes"
1849                 else
1850                         GNUTLS_CFLAGS=""
1851                         GNUTLS_LIBS=""
1852                 fi
1853         else
1854                 AC_MSG_CHECKING(for GnuTLS libraries)
1855                 AC_MSG_RESULT(no)
1856         fi
1857 else
1858         GNUTLS_CFLAGS=""
1859         GNUTLS_LIBS=""
1862 AC_SUBST(GNUTLS_CFLAGS)
1863 AC_SUBST(GNUTLS_LIBS)
1865 if test "x$enable_gnutls" = "xyes"; then
1866         AC_MSG_CHECKING(for gnutls_priority_set_direct and gnutls_priority_set)
1867         LIBS_save="$LIBS"
1868         LIBS="$LIBS $GNUTLS_LIBS"
1869         CPPFLAGS_save="$CPPFLAGS"
1870         CPPFLAGS="$CPPFLAGS $GNUTLS_CFLAGS"
1871         AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <gnutls/gnutls.h>]],
1872                                         [[gnutls_session s; gnutls_priority_set_direct(s, NULL, NULL); gnutls_priority_set(s, NULL);]])],
1873                        [AC_DEFINE([HAVE_GNUTLS_PRIORITY_FUNCS], 1,
1874                                   [Define if your gnutls has gnutls_priority_set_direct and friends])
1875                         AC_MSG_RESULT(yes)],
1876                        [AC_MSG_RESULT(no)])
1877         CPPFLAGS="$CPPFLAGS_save"
1878         LIBS="$LIBS_save"
1881 if test "x$enable_gnutls" = "xyes"; then
1882         AC_MSG_CHECKING(for GNUTLS_CERT_INSECURE_ALGORITHM)
1883         LIBS_save="$LIBS"
1884         LIBS="$LIBS $GNUTLS_LIBS"
1885         CPPFLAGS_save="$CPPFLAGS"
1886         CPPFLAGS="$CPPFLAGS $GNUTLS_CFLAGS"
1887         AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <gnutls/gnutls.h>]],
1888                                         [[unsigned int verify = GNUTLS_CERT_INSECURE_ALGORITHM;]])],
1889                        [AC_DEFINE([HAVE_GNUTLS_CERT_INSECURE_ALGORITHM], 1,
1890                                   [Define if your gnutls has the GNUTLS_CERT_INSECURE_ALGORITHM flag])
1891                         AC_MSG_RESULT(yes)],
1892                        [AC_MSG_RESULT(no)])
1893         CPPFLAGS="$CPPFLAGS_save"
1894         LIBS="$LIBS_save"
1898 AM_CONDITIONAL(USE_GNUTLS, test "x$enable_gnutls" = "xyes")
1901 dnl #
1902 dnl # Check for NSS if it's specified, or if GnuTLS checks failed.
1903 dnl #
1904 looked_for_nss="no"
1905 if test "x$enable_nss" != "xno"; then
1906         looked_for_nss="yes"
1908         AC_ARG_WITH(nspr-includes,
1909                 [AC_HELP_STRING([--with-nspr-includes=PREFIX], [specify location of Mozilla nspr4 includes.])],
1910                 [with_nspr_includes="$withval"])
1912         AC_ARG_WITH(nspr-libs,
1913                 [AC_HELP_STRING([--with-nspr-libs=PREFIX], [specify location of Mozilla nspr4 libs.])],
1914                 [with_nspr_libs="$withval"])
1916         AC_ARG_WITH(nss-includes,
1917                 [AC_HELP_STRING([--with-nss-includes=PREFIX], [specify location of Mozilla nss3 includes.])],
1918                 [with_nss_includes="$withval"])
1920         AC_ARG_WITH(nss-libs,
1921                 [AC_HELP_STRING([--with-nss-libs=PREFIX], [specify location of Mozilla nss3 libs.])],
1922                 [with_nss_libs="$withval"])
1925         if test -n "$with_nspr_includes" || test -n "$with_nspr_libs" || \
1926            test -n "$with_nss_includes"  || test -n "$with_nss_libs"  ||
1927            test "x$enable_nss" = "xstatic"; then
1929                 nss_manual_check="yes"
1930         else
1931                 nss_manual_check="no"
1932         fi
1934         enable_nss="no"
1936         if test "x$nss_manual_check" = "xno"; then
1937                 if `$PKG_CONFIG --exists mozilla-nss`; then
1938                         PKG_CHECK_MODULES(NSS, mozilla-nss, [
1939                                 have_nss="yes"
1940                         ], [
1941                                 AC_MSG_RESULT(no)
1942                                 have_nss="no"
1943                         ])
1944                         mozilla_nspr="mozilla-nspr"
1945                         mozilla_nss="mozilla-nss"
1946                 elif `$PKG_CONFIG --exists nss`; then
1947                         PKG_CHECK_MODULES(NSS, nss, [
1948                                 have_nss="yes"
1949                         ], [
1950                                 AC_MSG_RESULT(no)
1951                                 have_nss="no"
1952                         ])
1953                         mozilla_nspr="nspr"
1954                         mozilla_nss="nss"
1955                 elif `$PKG_CONFIG --exists microb-engine-nss`; then
1956                         PKG_CHECK_MODULES(NSS, microb-engine-nss, [
1957                                 have_nss="yes"
1958                         ], [
1959                                 AC_MSG_RESULT(no)
1960                                 have_nss="no"
1961                         ])
1962                         mozilla_nspr="mozilla-nspr"
1963                         mozilla_nss="microb-engine-nss"
1964                 fi
1966                 if test "x$have_nss" = "xyes"; then
1968                         AC_DEFINE(HAVE_NSS, 1, [Define if you have Mozilla NSS])
1969                         AC_DEFINE(HAVE_SSL, 1, [Define if you have SSL])
1971                         msg_nss="Mozilla NSS"
1972                         enable_nss="yes"
1973                 else
1974                         nss_manual_check="yes"
1975                 fi
1976         fi
1978         if test "x$nss_manual_check" = "xyes"; then
1979                 mozilla_nss=""
1980                 have_nspr_includes="no"
1982                 if test "x$with_nspr_includes" != "xno"; then
1983                         CPPFLAGS_save=$CPPFLAGS
1985                         AC_MSG_CHECKING(for Mozilla nspr4 includes in $with_nspr_includes)
1986                         AC_MSG_RESULT("")
1988                         CPPFLAGS="$CPPFLAGS -I$with_nspr_includes"
1989                         AC_CHECK_HEADERS(nspr.h prio.h, [ moz_nspr_includes="yes" ])
1990                         CPPFLAGS=$CPPFLAGS_save
1992                         if test "x$moz_nspr_includes" != "xno" -a \
1993                                 "x$moz_nspr_includes" != "x"; then
1995                                 have_nspr_includes="yes"
1996                                 NSPR_CFLAGS="-I$with_nspr_includes"
1997                         fi
1998                 else
1999                         AC_MSG_CHECKING(for Mozilla nspr4 includes)
2000                         AC_MSG_RESULT(no)
2002                         enable_nss="no"
2003                 fi
2005                 have_nspr_libs="no"
2007                 if test "x$with_nspr_libs"     != "xno" -a \
2008                         "x$have_nspr_includes" != "xno"; then
2010                         CFLAGS_save=$CFLAGS
2011                         LDFLAGS_save=$LDFLAGS
2013                         if test "$enable_nss" = "static"; then
2014                                 if test -z "$with_nspr_libs"; then
2015                                         AC_MSG_ERROR(
2016                                                 [Static linkage requested, but path to nspr libraries not set.]
2017                                                 [Please specify the path to libnspr4.a]
2018                                                 [Example: --with-nspr-libs=/usr/lib])
2020                                         enable_nss="no"
2021                                 else
2022                                         nsprlibs="$LIBDL $with_nspr_libs/libplc4.a $with_nspr_libs/libplds4.a $with_nspr_libs/libnspr4.a $PTHREAD_LIB"
2023                                 fi
2024                         else
2025                                 nsprlibs="$LIBDL -lplc4 -lplds4 -lnspr4 $PTHREAD_LIB"
2026                         fi
2028                         AC_CACHE_CHECK([for Mozilla nspr libraries], ac_cv_moz_nspr_libs,
2029                         [
2030                                 LIBS_save=$LIBS
2031                                 CFLAGS="$CFLAGS $NSPR_CFLAGS"
2033                                 LIBS="$nsprlibs"
2035                                 if test "x$with_nspr_libs" != "x"; then
2036                                         LDFLAGS="$LDFLAGS -L$with_nspr_libs"
2037                                 else
2038                                         LDFLAGS="$LDFLAGS"
2039                                 fi
2041                                 AC_TRY_LINK_FUNC(PR_Init,
2042                                         [ac_cv_moz_nspr_libs="yes"],
2043                                         [ac_cv_moz_nspr_libs="no"])
2045                                 CFLAGS=$CFLAGS_save
2046                                 LDFLAGS=$LDFLAGS_save
2047                                 LIBS=$LIBS_save
2048                         ])
2050                         if test "x$ac_cv_moz_nspr_libs" != "xno"; then
2051                                 have_nspr_libs="yes"
2052                                 NSPR_LIBS="-L$with_nspr_libs $nsprlibs"
2053                         else
2054                                 NSPR_CFLAGS=""
2055                                 enable_nss="no"
2056                         fi
2057                 else
2058                         AC_MSG_CHECKING(for Mozilla nspr4 libraries)
2059                         AC_MSG_RESULT(no)
2060                 fi
2062                 have_nss_includes="no"
2064                 if test "x$with_nss_includes" != "xno" -a \
2065                                 "x$have_nspr_libs"    != "xno"; then
2067                         CPPFLAGS_save=$CPPFLAGS
2069                         AC_MSG_CHECKING(for Mozilla nss3 includes in $with_nss_includes)
2070                         AC_MSG_RESULT("")
2072                         if test "x$with_nspr_includes" != "x"; then
2073                                 CPPFLAGS="$CPPFLAGS -I$with_nspr_includes -I$with_nss_includes"
2074                         else
2075                                 CPPFLAGS="$CPPFLAGS -I$with_nss_includes"
2076                         fi
2078                         AC_CHECK_HEADERS(nss.h ssl.h smime.h,
2079                                 [moz_nss_includes="yes"],
2080                                 [moz_nss_includes="no"])
2082                         CPPFLAGS=$CPPFLAGS_save
2084                         if test "x$moz_nss_includes" = "xyes"; then
2085                                 have_nss_includes="yes"
2086                                 NSS_CFLAGS="-I$with_nss_includes"
2087                         else
2088                                 NSPR_CFLAGS=""
2089                                 NSPR_LIBS=""
2090                                 enable_nss="no"
2091                         fi
2092                 else
2093                         AC_MSG_CHECKING(for Mozilla nss3 includes)
2094                         AC_MSG_RESULT(no)
2095                         enable_nss="no"
2096                 fi
2098                 if test "x$with_nss_libs"     != "xno" -a \
2099                                 "x$have_nss_includes" != "xno"; then
2101                         LDFLAGS_save=$LDFLAGS
2103                         if test "$enable_nss" = "static"; then
2104                                 if test -z "$with_nss_libs"; then
2105                                         AC_MSG_ERROR(
2106                                                 [Static linkage requested, but path to nss libraries not set.]
2107                                                 [Please specify the path to libnss3.a]
2108                                                 [Example: --with-nspr-libs=/usr/lib/mozilla])
2109                                         enable_nss="no"
2110                                 else
2111                                         nsslibs="-ldb1 $with_nss_libs/libnssckfw.a $with_nss_libs/libasn1.a $with_nss_libs/libcrmf.a $with_nss_libs/libswfci.a $with_nss_libs/libjar.a $with_nss_libs/libpkcs12.a $with_nss_libs/libpkcs7.a $with_nss_libs/libpki1.a $with_nss_libs/libsmime.a $with_nss_libs/libssl.a $with_nss_libs/libnss.a $with_nss_libs/libpk11wrap.a $with_nss_libs/libsoftokn.a $with_nss_libs/libfreebl.a $with_nss_libs/libnsspki.a $with_nss_libs/libnssdev.a $with_nss_libs/libcryptohi.a $with_nss_libs/libcerthi.a $with_nss_libs/libcertdb.a $with_nss_libs/libsecutil.a $with_nss_libs/libnssb.a"
2113                                         case "$host" in
2114                                                 *solaris*)
2115                                                         nsslibs="$nsslibs $with_nss_libs/libfreeb1.a"
2116                                                         ;;
2117                                         esac
2118                                 fi
2119                         else
2120                                 nsslibs="-lssl3 -lsmime3 -lnss3 -lsoftokn3"
2121                         fi
2123                         AC_CACHE_CHECK([for Mozilla nss libraries], ac_cv_moz_nss_libs,
2124                         [
2125                                 LIBS_save=$LIBS
2126                                 LDFLAGS="$LDFLAGS -L$with_nspr_libs -L$with_nss_libs"
2127                                 LIBS="$nsslibs $nsprlibs"
2129                                 AC_TRY_LINK_FUNC(NSS_Init,
2130                                         [ac_cv_moz_nss_libs="yes"],
2131                                         [ac_cv_moz_nss_libs="no"])
2133                                 if test "x$ac_cv_moz_nss_libs" = "xno"; then
2134                                         nsslibs="-lssl3 -lsmime3 -lnss3 -lsoftokn3"
2135                                         LDFLAGS="$LDFLAGS -L$with_nspr_libs -L$with_nss_libs"
2136                                         LIBS="$LIBS $nsslibs"
2137                                         AC_TRY_LINK_FUNC(NSS_Init,
2138                                                 [ac_cv_moz_nss_libs="yes"],
2139                                                 [ac_cv_moz_nss_libs="no"])
2140                                 fi
2142                                 LDFLAGS=$LDFLAGS_save
2143                                 LIBS=$LIBS_save
2144                         ])
2146                         if test "x$ac_cv_moz_nss_libs" != "xno"; then
2147                                 AC_DEFINE(HAVE_NSS)
2148                                 AC_DEFINE(HAVE_SSL)
2150                                 NSS_LIBS="-L$with_nss_libs $nsslibs"
2152                                 if test "$enable_nss" = "static"; then
2153                                         msg_nss="Mozilla NSS (static)"
2154                                 else
2155                                         msg_nss="Mozilla NSS"
2156                                 fi
2158                                 enable_nss="yes"
2159                         else
2160                                 NSS_CFLAGS=""
2161                                 NSPR_CFLAGS=""
2162                                 NSPR_LIBS=""
2163                                 enable_nss="no"
2164                         fi
2165                 else
2166                         AC_MSG_CHECKING(for Mozilla nss libraries)
2167                         AC_MSG_RESULT(no)
2168                 fi
2170                 NSS_CFLAGS="$NSPR_CFLAGS $NSS_CFLAGS"
2171                 NSS_LIBS="$NSPR_LIBS $NSS_LIBS"
2172         fi
2174         AC_SUBST(NSS_CFLAGS)
2175         AC_SUBST(NSS_LIBS)
2178 AM_CONDITIONAL(USE_NSS, test "x$enable_nss" = "xyes")
2180 if test "x$msg_nss" != "x" -a "x$msg_gnutls" != "x"; then
2181         msg_ssl="$msg_nss and $msg_gnutls"
2182 elif test "x$msg_nss" != "x"; then
2183         msg_ssl=$msg_nss
2184 elif test "x$msg_gnutls" != "x"; then
2185         msg_ssl=$msg_gnutls
2186 elif test "x$looked_for_gnutls" = "xyes" -a "x$looked_for_nss" = "xyes" -a "x$force_deps" = "xyes" ; then
2187         AC_MSG_ERROR([
2188 Neither GnuTLS or NSS SSL development headers found.
2189 Use --disable-nss --disable-gnutls if you do not need SSL support.
2190 Novell Groupwise and Google Talk will not work without GnuTLS or NSS. OpenSSL is NOT usable!
2192 elif test "x$looked_for_gnutls" = "xyes" -a "x$force_deps" = "xyes" ; then
2193         AC_MSG_ERROR([
2194 GnuTLS SSL development headers not found.
2195 Use --disable-gnutls if you do not need SSL support.
2196 Novell Groupwise and Google Talk will not work without SSL support.
2198 elif test "x$looked_for_nss" = "xyes" -a "x$force_deps" = "xyes" ; then
2199         AC_MSG_ERROR([
2200 NSS SSL development headers not found.
2201 Use --disable-nss if you do not need SSL support.
2202 Novell Groupwise and Google Talk will not work without SSL support.
2206 dnl #######################################################################
2207 dnl # Check for Tcl
2208 dnl #######################################################################
2209 AC_ARG_ENABLE(tcl, [AC_HELP_STRING([--disable-tcl],
2210         [compile without Tcl scripting])], enable_tcl="$enableval", enable_tcl="yes")
2211 AC_ARG_WITH(tclconfig, [AC_HELP_STRING([--with-tclconfig=DIR],
2212         [directory containing tclConfig.sh])])
2214 if test "$enable_plugins" = no; then
2215         enable_tcl=no
2218 if test "$enable_tcl" = yes; then
2219         AC_MSG_CHECKING([for tclConfig.sh])
2220         TCLCONFIG=no
2221         TCLCONFIGDIRS="/usr/lib \
2222                         /usr/lib64 \
2223                         /usr/lib/tcl8.5 \
2224                         /usr/lib/tcl8.4 \
2225                         /usr/lib/tcl8.3 \
2226                         /usr/lib/tcl8.2 \
2227                         /usr/lib64/tcl8.5 \
2228                         /usr/lib64/tcl8.4 \
2229                         /System/Library/Tcl/8.3 \
2230                         /usr/local/lib"
2231         for dir in $with_tclconfig $TCLCONFIGDIRS; do
2232                 if test -f $dir/tclConfig.sh; then
2233                         TCLCONFIG=$dir/tclConfig.sh
2234                         AC_MSG_RESULT([yes ($TCLCONFIG)])
2235                         break
2236                 fi
2237         done
2238         if test "$TCLCONFIG" = "no"; then
2239                 AC_MSG_RESULT([no])
2240                 enable_tcl=no
2241                 if test "x$force_deps" = "xyes" ; then
2242                         AC_MSG_ERROR([
2243 Tcl development headers not found.
2244 Use --disable-tcl if you do not need Tcl scripting support.
2246                 fi
2247         else
2248                 . $TCLCONFIG
2249                 AC_MSG_CHECKING([Tcl version compatability])
2250                 if test "$TCL_MAJOR_VERSION" -ne 8 -o "$TCL_MINOR_VERSION" -lt 3; then
2251                         AC_MSG_RESULT([bad, $TCL_VERSION found but 8.3 or later required])
2252                         enable_tcl=no
2253                 else
2254                         AC_MSG_RESULT([ok, $TCL_VERSION])
2255                         eval "TCL_LIB_SPEC=\"$TCL_LIB_SPEC\""
2256                         AC_MSG_CHECKING([for Tcl linkability])
2257                         oldCPPFLAGS=$CPPFLAGS
2258                         CPPFLAGS="$CPPFLAGS $TCL_INCLUDE_SPEC -I$TCL_PREFIX/include"
2259                         oldLIBS=$LIBS
2260                         LIBS="$LIBS $TCL_LIB_SPEC"
2261                         AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <tcl.h>]],
2262                                 [[Tcl_Interp *interp=NULL; Tcl_Init(interp)]])],
2263                                 [AC_MSG_RESULT([yes]);enable_tcl=yes],
2264                                 [AC_MSG_RESULT([no]);enable_tcl=no])
2265                         CPPFLAGS="$oldCPPFLAGS"
2266                         LIBS="$oldLIBS"
2267                 fi
2268         fi
2271 if test "$enable_tcl" = yes; then
2272         AM_CONDITIONAL(USE_TCL, true)
2273         TCL_LIBS=$TCL_LIB_SPEC
2274         AC_DEFINE(HAVE_TCL, [1], [Compile with support for the Tcl toolkit])
2275         AC_SUBST(TCL_LIBS)
2276         TCL_CFLAGS="$TCL_INCLUDE_SPEC -I$TCL_PREFIX/include"
2277         if test "x$GCC" = "xyes"; then
2278                 TCL_CFLAGS="$TCL_CFLAGS -fno-strict-aliasing"
2279         fi
2280         AC_SUBST(TCL_CFLAGS)
2281 else
2282         AM_CONDITIONAL(USE_TCL, false)
2285 dnl #######################################################################
2286 dnl # Check for Tk
2287 dnl #######################################################################
2288 AC_ARG_ENABLE(tk, [AC_HELP_STRING([--disable-tk],
2289         [compile without Tcl support for Tk])], enable_tk="$enableval", enable_tk="yes")
2290 AC_ARG_WITH(tkconfig, [AC_HELP_STRING([--with-tkconfig=DIR],
2291         [directory containing tkConfig.sh])])
2293 if test "$enable_tcl" = yes -a "$enable_tk" = yes; then
2294         AC_MSG_CHECKING([for tkConfig.sh])
2295         TKCONFIG=no
2296         TKCONFIGDIRS="/usr/lib \
2297                         /usr/lib64 \
2298                         /usr/lib/tk8.5 \
2299                         /usr/lib/tk8.4 \
2300                         /usr/lib/tk8.3 \
2301                         /usr/lib/tk8.2 \
2302                         /usr/local/lib"
2303         for dir in $with_tkconfig $TKCONFIGDIRS; do
2304                 if test -f $dir/tkConfig.sh; then
2305                         TKCONFIG=$dir/tkConfig.sh
2306                         AC_MSG_RESULT([yes ($TKCONFIG)])
2307                         break
2308                 fi
2309         done
2310         if test "$TKCONFIG" = "no"; then
2311                 AC_MSG_RESULT([no])
2312                 enable_tk=no
2313                 if test "x$force_deps" = "xyes" ; then
2314                         AC_MSG_ERROR([
2315 Tk development headers not found.
2316 Use --disable-tk if you do not need Tk scripting support.
2318                 fi
2319         else
2320                 . $TKCONFIG
2321                 eval "TK_LIB_SPEC=\"$TK_LIB_SPEC\""
2322                 AC_MSG_CHECKING([for Tk linkability])
2323                 oldCPPFLAGS=$CPPFLAGS
2324                 CPPFLAGS="$CPPFLAGS $TCL_CFLAGS"
2325                 oldLIBS=$LIBS
2326                 LIBS="$LIBS $TCL_LIB_SPEC $TK_LIB_SPEC"
2327                 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <tk.h>]],
2328                                 [[Tcl_Interp *interp=NULL; Tcl_Init(interp); Tk_Init(interp);]])],
2329                                 [AC_MSG_RESULT([yes]);enable_tk=yes],
2330                                 [AC_MSG_RESULT([no]);enable_tk=no])
2331                 CPPFLAGS="$oldCPPFLAGS"
2332                 LIBS="$oldLIBS"
2333         fi
2334 else
2335         enable_tk=no
2338 if test "$enable_tk" = yes; then
2339         AM_CONDITIONAL(USE_TK, true)
2340         AC_DEFINE(HAVE_TK, [1], [Compile with support for the Tk toolkit])
2341         TK_LIBS=$TK_LIB_SPEC
2342         AC_SUBST(TK_LIBS)
2343 else
2344         AM_CONDITIONAL(USE_TK, false)
2347 if test "$ac_cv_cygwin" = yes ; then
2348         LDADD="$LDADD -static"
2349         AC_DEFINE(DEBUG, 1, [Define if debugging is enabled.])
2352 AC_SUBST(DEBUG_CFLAGS)
2353 AC_SUBST(LDADD)
2354 AC_SUBST(LIBS)
2356 if test "x$enable_plugins" = "xyes" ; then
2357         AC_DEFINE(PURPLE_PLUGINS, 1, [Define if plugins are enabled.])
2358         AM_CONDITIONAL(PLUGINS, true)
2359         PLUGINS_DEFINE="#define PURPLE_PLUGINS 1"
2360 else
2361         AM_CONDITIONAL(PLUGINS, false)
2362         PLUGINS_DEFINE="#undef PURPLE_PLUGINS"
2364 AC_SUBST(PLUGINS_DEFINE)
2366 dnl #######################################################################
2367 dnl # Check for Cyrus-SASL (for xmpp/irc)
2368 dnl #######################################################################
2369 dnl AC_CHECK_SIZEOF(short)
2370 AC_CHECK_FUNCS(snprintf connect)
2371 AC_SUBST(SASL_LIBS)
2372 AC_ARG_ENABLE(cyrus-sasl, AC_HELP_STRING([--enable-cyrus-sasl], [enable Cyrus SASL support for xmpp/irc]), enable_cyrus_sasl=$enableval, enable_cyrus_sasl=no)
2373 if test "x$enable_cyrus_sasl" = "xyes" ; then
2374         AC_CHECK_LIB(sasl2, sasl_client_init, [
2375                         AM_CONDITIONAL(USE_CYRUS_SASL, true)
2376                         AC_DEFINE(HAVE_CYRUS_SASL, [1], [Define to 1 if Cyrus SASL is present])
2377                         SASL_LIBS=-"lsasl2"
2378                 ], [
2379                         AM_CONDITIONAL(USE_CYRUS_SASL, false)
2380                         AC_MSG_ERROR([Cyrus SASL library not found])
2381                 ])
2382 else
2383         AM_CONDITIONAL(USE_CYRUS_SASL, false)
2386 dnl #######################################################################
2387 dnl # Check for Kerberos (for Zephyr)
2388 dnl #######################################################################
2389 AC_DEFINE(ZEPHYR_INT32, long, [Size of an int32.])
2390 AC_SUBST(KRB4_CFLAGS)
2391 AC_SUBST(KRB4_LDFLAGS)
2392 AC_SUBST(KRB4_LIBS)
2393 if test "$kerberos" != "no" ; then
2394         if test "$kerberos" != "yes" ; then
2395                 KRB4_CFLAGS="-I${kerberos}/include"
2396                 if test -d "$kerberos/include/kerberosIV" ; then
2397                         KRB4_CFLAGS="$KRB4_CFLAGS -I${kerberos}/include/kerberosIV"
2398                 fi
2399                 KRB4_LDFLAGS="-L${kerberos}/lib"
2400         elif test -d /usr/local/include/kerberosIV ; then
2401                 KRB4_CFLAGS="-I/usr/local/include/kerberosIV"
2402         elif test -d /usr/include/kerberosIV ; then
2403                 KRB4_CFLAGS="-I/usr/include/kerberosIV"
2404         fi
2405         AC_DEFINE(ZEPHYR_USES_KERBEROS, 1, [Define if kerberos should be used in Zephyr.])
2407         orig_LDFLAGS="$LDFLAGS"
2408         LDFLAGS="$LDFLAGS $KRB4_LDFLAGS"
2409         AC_CHECK_LIB(krb4, krb_rd_req,
2410                         [KRB4_LIBS="-lkrb4 -ldes425 -lkrb5 -lk5crypto -lcom_err"],
2411                         [AC_CHECK_LIB(krb, krb_rd_req,
2412                                 [KRB4_LIBS="-lkrb -ldes"],
2413                                 [AC_MSG_ERROR([Kerberos 4 libraries not found])],
2414                                 -ldes)],
2415                         -ldes425 -lkrb5 -lk5crypto -lcom_err)
2416         orig_LIBS="$LIBS"
2417         LIBS="$LIBS $KRB4_LIBS"
2418         AC_CHECK_FUNCS(krb_set_key krb_rd_req krb_get_lrealm)
2419         AC_CHECK_FUNCS(krb_get_err_text krb_log)
2420         LIBS="$orig_LIBS"
2421         LDFLAGS="$orig_LDFLAGS"
2424 dnl #######################################################################
2425 dnl # Check for external libzephyr
2426 dnl #######################################################################
2427 AC_SUBST(ZEPHYR_CFLAGS)
2428 AC_SUBST(ZEPHYR_LDFLAGS)
2429 AC_SUBST(ZEPHYR_LIBS)
2430 if test "$zephyr" != "no" ; then
2431         if test "$zephyr" != "yes" ; then
2432                 ZEPHYR_CFLAGS="-I${zephyr}/include"
2433                 ZEPHYR_LDFLAGS="-L${zephyr}/lib"
2434         elif test -d /usr/athena/include/zephyr ; then
2435                 ZEPHYR_CFLAGS="-I/usr/athena/include"
2436         elif test -d /usr/include/zephyr ; then
2437                 ZEPHYR_CFLAGS="-I/usr/include"
2438         elif test -d /usr/local/include/zephyr ; then
2439                 ZEPHYR_CFLAGS="-I/usr/local/include"
2440         fi
2441         AC_DEFINE(LIBZEPHYR_EXT, 1 , [Define if external libzephyr should be used.])
2442         AM_CONDITIONAL(EXTERNAL_LIBZEPHYR, test "x$zephyr" != "xno")
2443         orig_LDFLAGS="$LDFLAGS"
2444         LDFLAGS="$LDFLAGS $ZEPHYR_LDFLAGS"
2445         AC_CHECK_LIB(zephyr, ZInitialize,
2446                 [ZEPHYR_LIBS="-lzephyr"],
2447                 [AC_MSG_ERROR([Zephyr libraries not found])],
2448                 -lzephyr)
2449         orig_LIBS="$LIBS"
2450         LIBS="$orig_LIBS"
2451         LDFLAGS="$orig_LDFLAGS"
2454 AC_MSG_CHECKING(for me pot o' gold)
2455 AC_MSG_RESULT(no)
2456 AC_CHECK_FUNCS(gethostid lrand48 timegm)
2457 AC_CHECK_FUNCS(memcpy memmove random strchr strerror vprintf)
2458 AC_CHECK_HEADERS(malloc.h paths.h sgtty.h stdarg.h sys/cdefs.h)
2459 AC_CHECK_HEADERS(sys/file.h sys/filio.h sys/ioctl.h sys/msgbuf.h)
2460 AC_CHECK_HEADERS(sys/select.h sys/uio.h sys/utsname.h sys/wait.h)
2461 AC_CHECK_HEADERS(termios.h)
2463 # sys/sysctl.h on OpenBSD 4.2 requires sys/param.h
2464 # sys/sysctl.h on FreeBSD requires sys/types.h
2465 AC_CHECK_HEADERS(sys/param.h)
2466 AC_CHECK_HEADERS(sys/sysctl.h, [], [],
2467         [[
2468                 #include <sys/types.h>
2469                 #ifdef HAVE_PARAM_H
2470                 # include <sys/param.h>
2471                 #endif
2472         ]])
2474 AC_CHECK_HEADERS(sys/socket.h)
2475 AC_VAR_TIMEZONE_EXTERNALS
2477 AC_CACHE_CHECK(for tm_gmtoff in struct tm, ac_cv_struct_tm_gmtoff,
2478         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2479                 #include <time.h>
2480         ]], [[
2481                 struct tm tm;
2482                 tm.tm_gmtoff = 1;
2483         ]])], [ac_cv_struct_tm_gmtoff=yes], [ac_cv_struct_tm_gmtoff=no]))
2484 if test $ac_cv_struct_tm_gmtoff = yes; then
2485         AC_DEFINE(HAVE_TM_GMTOFF, 1, [Define if you have a tm_gmtoff member in struct tm])
2488 AC_CACHE_CHECK([whether va_lists can be copied by value], ac_cv_va_val_copy,[
2489         AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdarg.h>
2490 #include <stdlib.h>
2491         void f (int i, ...) {
2492         va_list args1, args2;
2493         va_start (args1, i);
2494         args2 = args1;
2495         if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
2496           exit (1);
2497         va_end (args1); va_end (args2);
2498         }
2499         int main() {
2500           f (0, 42);
2501           return 0;
2502         }]])],
2503         [ac_cv_va_val_copy=yes],
2504         [ac_cv_va_val_copy=no],
2505         [ac_cv_va_val_copy=yes])
2508 if test "x$ac_cv_va_val_copy" = "xno"; then
2509         AC_DEFINE(VA_COPY_AS_ARRAY, 1, ['va_lists' cannot be copied as values])
2512 dnl #######################################################################
2513 dnl # Check for check
2514 dnl #######################################################################
2515 PKG_CHECK_MODULES(CHECK, [check >= 0.9.4], , [AC_MSG_RESULT([no, testing is disabled])])
2516 AM_CONDITIONAL(HAVE_CHECK, [test "x$CHECK_LIBS" != "x"])
2517 AC_SUBST(CHECK_CFLAGS)
2518 AC_SUBST(CHECK_LIBS)
2520 dnl #######################################################################
2521 dnl # Disable pixmap installation
2522 dnl #######################################################################
2523 AC_ARG_ENABLE(pixmaps-install, AC_HELP_STRING([--disable-pixmaps-install], [disable installation of pixmap files - Pidgin still needs them!]), enable_pixmaps="$enableval", enable_pixmaps=yes)
2525 AM_CONDITIONAL(INSTALL_PIXMAPS, test "x$enable_pixmaps" = "xyes")
2527 dnl #######################################################################
2528 dnl # Tweak status tray icon installation directory
2529 dnl #######################################################################
2530 AC_ARG_ENABLE(trayicon-compat, AC_HELP_STRING([--enable-trayicon-compat], [install tray icons in location compatible with older releases of hicolor-icon-theme]), enable_traycompat="$enableval", enable_traycompat=no)
2532 AM_CONDITIONAL(ENABLE_TRAYCOMPAT, test "x$enable_traycompat" = "xyes")
2534 dnl #######################################################################
2535 dnl # Check for Doxygen and dot (part of GraphViz)
2536 dnl #######################################################################
2537 AC_ARG_ENABLE(doxygen,
2538         [AC_HELP_STRING([--disable-doxygen],
2539                 [disable documentation with doxygen])],
2540         enable_doxygen="$enableval", enable_doxygen="yes")
2541 AC_ARG_ENABLE(dot,
2542         [AC_HELP_STRING([--disable-dot],
2543                 [disable graphs in doxygen via 'dot'])],
2544         enable_dot="$enableval", enable_dot="yes")
2545 AC_ARG_ENABLE(devhelp,
2546         [AC_HELP_STRING([--disable-devhelp],
2547                 [disable building index for devhelp documentation browser])],
2548         enable_devhelp="$enableval", enable_devhelp="yes")
2550 if test "x$enable_doxygen" = xyes; then
2551         AC_CHECK_PROG(DOXYGEN, doxygen, true, false)
2552         if test $DOXYGEN = false; then
2553                 AC_MSG_WARN([*** Doxygen not found, docs will not be available])
2554                 enable_doxygen="no"
2555         else
2556                 AC_DEFINE_UNQUOTED(HAVE_DOXYGEN, 1, [whether or not we have doxygen])
2558                 if test "x$enable_dot" = "xyes"; then
2559                         AC_CHECK_PROG(DOT, dot, true, false)
2561                         if test $DOT = false; then
2562                                 enable_dot="no";
2563                                 AC_MSG_WARN([*** GraphViz dot not found, docs will not have graphs])
2564                         else
2565                                 AC_DEFINE_UNQUOTED(HAVE_DOT, 1, [whether or not we have dot])
2566                         fi
2567                 fi
2569                 if test "x$enable_devhelp" = "xyes"; then
2570                         AC_CHECK_PROG(XSLTPROC, xsltproc, true, false)
2572                         if test $XSLTPROC = false; then
2573                                 enable_devhelp="no";
2574                                 AC_MSG_WARN([*** xsltproc not found; devhelp index will not be created])
2575                         else
2576                                 AC_DEFINE_UNQUOTED(HAVE_XSLTPROC, 1, [whether or not we have xsltproc for devhelp index])
2577                         fi
2578                 fi
2579         fi
2580 else
2581         enable_dot="no"
2582         enable_devhelp="no"
2585 AC_SUBST(enable_doxygen)
2586 AC_SUBST(enable_dot)
2587 AC_SUBST(enable_devhelp)
2588 AM_CONDITIONAL(HAVE_DOXYGEN, test "x$enable_doxygen" = "xyes")
2589 AM_CONDITIONAL(HAVE_XSLTPROC, test "x$enable_devhelp" = "xyes")
2591 AC_ARG_ENABLE(debug, [AC_HELP_STRING([--enable-debug],
2592         [compile with debugging support])], , enable_debug=no)
2594 if test "x$enable_debug" = "xyes" ; then
2595         AC_DEFINE(DEBUG, 1, [Define if debugging is enabled.])
2598 AM_CONDITIONAL(PURPLE_AVAILABLE, true)
2600 AC_CONFIG_FILES([Makefile
2601                    Doxyfile
2602                    doc/Makefile
2603                    doc/pidgin.1
2604                    doc/finch.1
2605                    m4macros/Makefile
2606                    pidgin.apspec
2607                    pidgin/Makefile
2608                    pidgin/data/pidgin.desktop.in
2609                    pidgin/data/pidgin.pc
2610                    pidgin/data/pidgin-uninstalled.pc
2611                    pidgin/data/pidgin-2.pc
2612                    pidgin/data/pidgin-2-uninstalled.pc
2613                    pidgin/pixmaps/Makefile
2614                    pidgin/pixmaps/emotes/default/24/Makefile
2615                    pidgin/pixmaps/emotes/none/Makefile
2616                    pidgin/pixmaps/emotes/small/16/Makefile
2617                    pidgin/plugins/Makefile
2618                    pidgin/plugins/cap/Makefile
2619                    pidgin/plugins/disco/Makefile
2620                    pidgin/plugins/gestures/Makefile
2621                    pidgin/plugins/gevolution/Makefile
2622                    pidgin/plugins/musicmessaging/Makefile
2623                    pidgin/plugins/perl/Makefile
2624                    pidgin/plugins/perl/common/Makefile.PL
2625                    pidgin/plugins/ticker/Makefile
2626                    libpurple/data/gconf/Makefile
2627                    libpurple/data/purple.pc
2628                    libpurple/data/purple-uninstalled.pc
2629                    libpurple/data/purple-2.pc
2630                    libpurple/data/purple-2-uninstalled.pc
2631                    libpurple/ciphers/Makefile
2632                    libpurple/example/Makefile
2633                    libpurple/plugins/Makefile
2634                    libpurple/plugins/mono/Makefile
2635                    libpurple/plugins/mono/api/Makefile
2636                    libpurple/plugins/mono/loader/Makefile
2637                    libpurple/plugins/perl/Makefile
2638                    libpurple/plugins/perl/common/Makefile.PL
2639                    libpurple/plugins/ssl/Makefile
2640                    libpurple/plugins/tcl/Makefile
2641                    libpurple/Makefile
2642                    libpurple/protocols/Makefile
2643                    libpurple/protocols/bonjour/Makefile
2644                    libpurple/protocols/gg/Makefile
2645                    libpurple/protocols/irc/Makefile
2646                    libpurple/protocols/jabber/Makefile
2647                    libpurple/protocols/novell/Makefile
2648                    libpurple/protocols/null/Makefile
2649                    libpurple/protocols/oscar/Makefile
2650                    libpurple/protocols/sametime/Makefile
2651                    libpurple/protocols/silc/Makefile
2652                    libpurple/protocols/silc10/Makefile
2653                    libpurple/protocols/simple/Makefile
2654                    libpurple/protocols/zephyr/Makefile
2655                    libpurple/tests/Makefile
2656                    libpurple/purple.h
2657                    libpurple/version.h
2658                    share/sounds/Makefile
2659                    share/ca-certs/Makefile
2660                    finch/finch.pc
2661                    finch/Makefile
2662                    finch/libgnt/Makefile
2663                    finch/libgnt/gnt.pc
2664                    finch/libgnt/wms/Makefile
2665                    finch/plugins/Makefile
2666                    po/Makefile.in
2667                    pidgin.spec
2668                   ])
2669 AC_OUTPUT
2671 echo
2672 echo $PACKAGE $VERSION
2674 echo
2675 echo Build GTK+ 2.x UI............. : $enable_gtkui
2676 echo Build console UI.............. : $enable_consoleui
2677 echo Build for X11................. : $with_x
2678 echo
2679 echo Enable Gestures............... : $enable_gestures
2680 echo Protocols to build dynamically : $DYNAMIC_PRPLS
2681 echo Protocols to link statically.. : $STATIC_PRPLS
2682 echo
2683 echo Build with GStreamer support.. : $enable_gst
2684 echo Build for GStreamer version... : $with_gstreamer
2685 echo Build with D-Bus support...... : $enable_dbus
2686 echo Build with voice and video.... : $enable_vv
2687 if test "x$enable_dbus" = "xyes" ; then
2688         eval eval echo D-Bus services directory...... : $DBUS_SERVICES_DIR
2690 echo Build with GNU Libidn......... : $enable_idn
2691 echo Build with NetworkManager..... : $enable_nm
2692 echo SSL Library/Libraries......... : $msg_ssl
2693 if test "x$SSL_CERTIFICATES_DIR" != "x" ; then
2694         eval eval echo SSL CA certificates directory. : $SSL_CERTIFICATES_DIR
2696 echo Build with Cyrus SASL support. : $enable_cyrus_sasl
2697 echo Use kerberos 4 with zephyr.... : $kerberos
2698 echo Use external libzephyr........ : $zephyr
2699 echo Use external libgadu.......... : $have_libgadu
2700 echo Install pixmaps............... : $enable_pixmaps
2701 echo Old tray icon compatibility... : $enable_traycompat
2702 echo Install translations.......... : $enable_i18n
2703 echo Has you....................... : yes
2704 echo
2705 echo Use XScreenSaver Extension.... : $enable_screensaver
2706 echo Use X Session Management...... : $enable_sm
2707 echo Use startup notification...... : $enable_startup_notification
2708 echo Build with GtkSpell support... : $enable_gtkspell
2709 echo Build Unity integration plugin.: $enable_unity
2710 echo
2711 echo Build with plugin support..... : $enable_plugins
2712 echo Build with Mono support....... : $enable_mono
2713 echo Build with Perl support....... : $enable_perl
2714 echo Build with Tcl support........ : $enable_tcl
2715 echo Build with Tk support......... : $enable_tk
2716 echo
2717 echo Print debugging messages...... : $enable_debug
2718 echo
2719 eval eval echo Pidgin will be installed in $bindir.
2720 if test "x$pidginpath" != "x" ; then
2721         echo Warning: You have an old copy of Pidgin at $pidginpath.
2723 if test "x$enable_pixmaps" = "xno" ; then
2724         echo
2725         echo Warning: You have disabled the installation of pixmap data, but Pidgin
2726         echo still requires installed pixmaps.  Be sure you know what you are doing.
2728 if test "x$enable_i18n" = "xno" ; then
2729         echo
2730         echo Warning: You have disabled the building and installation of translation
2731         echo data.  This will prevent building pidgin.desktop and the GConf schemas.
2732         echo Be sure you know what you are doing.
2734 echo
2735 echo configure complete, now type \'make\'
2736 echo