*** Plucked rev 3f699c081b38f9d19632fcee1c23cbc96fce3092 (sulabh@soc.pidgin.im):
[pidgin-git.git] / configure.ac
blob686cd680ca67525faed9af89131964d14e84901f
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], [5])
47 m4_define([purple_major_version], [2])
48 m4_define([purple_minor_version], [5])
49 m4_define([purple_micro_version], [7])
50 m4_define([purple_version_suffix], [])
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], [5])
56 m4_define([gnt_major_version], [2])
57 m4_define([gnt_minor_version], [5])
58 m4_define([gnt_micro_version], [7])
59 m4_define([gnt_version_suffix], [])
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_SYSTEM
76 AM_CONFIG_HEADER(config.h)
77 AM_INIT_AUTOMAKE([1.9 -Wno-portability dist-bzip2])
79 PURPLE_MAJOR_VERSION=purple_major_version
80 PURPLE_MINOR_VERSION=purple_minor_version
81 PURPLE_MICRO_VERSION=purple_micro_version
82 PURPLE_VERSION=[purple_display_version]
83 AC_SUBST(PURPLE_MAJOR_VERSION)
84 AC_SUBST(PURPLE_MINOR_VERSION)
85 AC_SUBST(PURPLE_MICRO_VERSION)
86 AC_SUBST(PURPLE_VERSION)
88 PURPLE_LT_VERSION_INFO="purple_lt_current:purple_micro_version:purple_minor_version"
89 AC_SUBST(PURPLE_LT_VERSION_INFO)
91 GNT_MAJOR_VERSION=gnt_major_version
92 GNT_MINOR_VERSION=gnt_minor_version
93 GNT_MICRO_VERSION=gnt_micro_version
94 GNT_VERSION=[gnt_display_version]
95 AC_SUBST(GNT_MAJOR_VERSION)
96 AC_SUBST(GNT_MINOR_VERSION)
97 AC_SUBST(GNT_MICRO_VERSION)
98 AC_SUBST(GNT_VERSION)
100 GNT_LT_VERSION_INFO="gnt_lt_current:gnt_micro_version:gnt_minor_version"
101 AC_SUBST(GNT_LT_VERSION_INFO)
103 AC_PATH_PROG(sedpath, sed)
105 dnl Storing configure arguments
106 AC_DEFINE_UNQUOTED(CONFIG_ARGS, "$ac_configure_args", [configure arguments])
108 dnl Checks for programs.
109 AC_PROG_CC
110 AM_PROG_CC_C_O
111 AC_DISABLE_STATIC
112 AC_PROG_LIBTOOL
113 LIBTOOL="$LIBTOOL --silent"
114 AC_PROG_INSTALL
115 AC_PROG_INTLTOOL
116 PKG_PROG_PKG_CONFIG
117 AC_FUNC_ALLOCA
118 GETTEXT_PACKAGE=pidgin
119 AC_SUBST(GETTEXT_PACKAGE)
122 # before gettexting, in case iconv matters
123 case "$host_os" in
124 darwin*)
125         AC_CHECK_LIB(resolv, res_query)
127         AC_CHECK_HEADER(CoreFoundation/CoreFoundation.h, [
128                 AC_CHECK_HEADER(IOKit/IOKitLib.h, [
129                         AC_DEFINE(HAVE_IOKIT, 1, [Define if we have IOKit])
130                         LIBS="$LIBS -framework IOKit -framework CoreFoundation"
131                 ], [])
132         ], [])
134         AC_MSG_CHECKING([for fink])
135         if test -d /sw; then
136                 AC_MSG_RESULT([found, adding /sw to search paths])
137                 CPPFLAGS="$CPPFLAGS -I/sw/include"
138                 LDFLAGS="$LDFLAGS -L/sw/lib"
139         else
140                 AC_MSG_RESULT([not found])
141         fi
142         ;;
144         ;;
145 esac
147 ALL_LINGUAS="af am ar az be@latin bg bn bs ca ca@valencia cs da de dz el en_AU en_CA en_GB eo es et eu fa fi fr ga gl gu he hi hu id it ja ka km kn ko ku lo lt mk mn my_MM nb ne nl nn oc pa pl pt_BR pt ps ro ru si sk sl sq sr sr@latin sv ta te th tr uk ur vi xh zh_CN zh_HK zh_TW"
148 AM_GLIB_GNU_GETTEXT
150 dnl If we don't have msgfmt, then po/ is going to fail -- ensure that
151 dnl AM_GLIB_GNU_GETTEXT found it.
153 if test x$MSGFMT = xno -o x$MSGFMT$GMSGFMT$INTLTOOL_MSGFMT = x
154 then
155         AC_ERROR([
157 The msgfmt command is required to build libpurple.  If it is installed
158 on your system, ensure that it is in your path.  If it is not, install
159 GNU gettext to continue.
161 If you have msgfmt installed, but for some reason this error message
162 is still displayed, you have encountered what appears to be a bug in
163 third-party configure macros.  Try setting the MSGFMT environment
164 variable to the absolute path to your msgfmt binary and trying
165 configure again, like this:
167 MSGFMT=/path/to/msgfmt ./configure ...
171 dnl we don't use autobreak on cygwin!!
172 dnl AC_CYGWIN
174 dnl Checks for header files.
175 AC_HEADER_STDC
176 AC_HEADER_SYS_WAIT
177 AC_CHECK_HEADERS(arpa/nameser_compat.h fcntl.h sys/time.h unistd.h locale.h signal.h stdint.h regex.h)
179 dnl Checks for typedefs, structures, and compiler characteristics.
180 AC_C_CONST
181 AC_STRUCT_TM
182 AC_CHECK_SIZEOF(time_t, ,[
183 #include <stdio.h>
184 #include <time.h>])
186 AC_C_BIGENDIAN
188 dnl Checks for library functions.
189 AC_TYPE_SIGNAL
190 AC_FUNC_STRFTIME
191 AC_CHECK_FUNCS(strdup strstr atexit setlocale)
192 dnl Checks for getopt in standard library
193 AC_CHECK_FUNCS(getopt_long,,
195         AC_LIBOBJ(getopt)
196         AC_LIBOBJ(getopt1)
199 dnl Check for inet_aton
200 AC_CHECK_FUNC(inet_aton, , [AC_CHECK_LIB(resolv, inet_aton, ,
201                                          [AC_ERROR(inet_aton not found)])])
202 AC_CHECK_LIB(resolv, __res_query)
203 AC_CHECK_LIB(nsl, gethostent)
204 AC_CHECK_FUNC(socket, ,
205         [AC_CHECK_LIB(socket, socket, , [AC_ERROR([socket not found])])])
206 dnl If all goes well, by this point the previous two checks will have
207 dnl pulled in -lsocket and -lnsl if we need them.
208 AC_CHECK_FUNC(getaddrinfo,
209         [AC_DEFINE([HAVE_GETADDRINFO], [1],
210                 [Define to 1 if you have the getaddrinfo function.])],
211         [AC_CHECK_LIB(socket, getaddrinfo,
212                 [AC_DEFINE([HAVE_GETADDRINFO]) LIBS="-lsocket -lsnl $LIBS"], , , -lnsl)])
213 AC_CHECK_FUNCS(inet_ntop)
214 dnl Check for socklen_t (in Unix98)
215 AC_MSG_CHECKING(for socklen_t)
216 AC_TRY_COMPILE([
217         #include <sys/types.h>
218         #include <sys/socket.h>
219         socklen_t x;
220 ], [],
222         AC_MSG_RESULT(yes)
223 ], [
224         AC_TRY_COMPILE([
225                 #include <sys/types.h>
226                 #include <sys/socket.h>
227                 int accept(int, struct sockaddr *, size_t *);
228         ], [], [
229                 AC_MSG_RESULT(size_t)
230                 AC_DEFINE(socklen_t, size_t, [socklen_t size])
231         ], [
232                 AC_MSG_RESULT(int)
233                 AC_DEFINE(socklen_t, int, [socklen_t size])
234         ])
237 dnl Some systems do not have sa_len field for struct sockaddr.
238 AC_CHECK_MEMBER([struct sockaddr.sa_len],
239         [AC_DEFINE([HAVE_STRUCT_SOCKADDR_SA_LEN],[1],
240         [Define if struct sockaddr has an sa_len member])],[:],
241         [#include <sys/socket.h>])
243 dnl to prevent the g_stat()/g_unlink() crash,
244 dnl (09:50:07) Robot101: LSchiere2: it's easy. +LC_SYS_LARGEFILE somewhere in configure.ac
245 AC_SYS_LARGEFILE
247 dnl FreeBSD doesn't have libdl, dlopen is provided by libc
248 AC_CHECK_FUNC(dlopen, LIBDL="", [AC_CHECK_LIB(dl, dlopen, LIBDL="-ldl")])
250 AC_MSG_CHECKING(for fileno())
251 AC_TRY_RUN([
252 #include <stdio.h>
254 int main(int argc, char *argv[])
256         int fd;
258         fd = fileno(stdout);
260         return !(fd > 0);
262 ], [
263         AC_MSG_RESULT(yes)
264         AC_DEFINE([HAVE_FILENO], [1],
265                   [Define to 1 if your stdio has int fileno(FILE *).])
266 ], [
267         AC_MSG_RESULT(no)
268 ], [
269         # Fallback for Cross Compiling...
270         # This will enable the compatibility code.
271         AC_MSG_RESULT(no)
274 AC_MSG_CHECKING(for the %z format string in strftime())
275 AC_TRY_RUN([
276 #ifdef HAVE_SYS_TIME_H
277 #include <sys/time.h>
278 #endif
279 #include <time.h>
280 #include <stdio.h>
282 int main()
284         char buf[6];
285         time_t t = time(NULL);
287         if (strftime(buf, sizeof(buf), "%z", localtime(&t)) != 5)
288                 return 1;
290         fprintf(stderr, "strftime(\"%%z\") yields: \"%s\"\n", buf);
292         return !((buf[0] == '-' || buf[0] == '+') &&
293                  (buf[1] >= '0' && buf[1] <= '9') &&
294                  (buf[2] >= '0' && buf[2] <= '9') &&
295                  (buf[3] >= '0' && buf[3] <= '9') &&
296                  (buf[4] >= '0' && buf[4] <= '9')
297                 );
299 ], [
300         AC_MSG_RESULT(yes)
301         AC_DEFINE([HAVE_STRFTIME_Z_FORMAT], [1],
302                 [Define to 1 if you have a strftime() that supports the %z format string.])
303 ], [
304         AC_MSG_RESULT(no)
305 ], [
306         # Fallback for Cross Compiling...
307         # This will enable the compatibility code.
308         AC_MSG_RESULT(no)
312 dnl #######################################################################
313 dnl # Check for GLib 2.0 (required)
314 dnl #######################################################################
315 PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.0.0 gobject-2.0 gmodule-2.0 gthread-2.0], , [
316         AC_MSG_RESULT(no)
317         AC_MSG_ERROR([
319 You must have the GLib 2.0 development headers installed to build.
321 If you have these installed already you may need to install pkg-config so
322 I can find them.
323 ])])
324 AC_SUBST(GLIB_CFLAGS)
325 AC_SUBST(GLIB_LIBS)
327 AC_ARG_WITH([extraversion],
328                         AC_HELP_STRING([--with-extraversion=STRING],
329                                                    [extra version number to be displayed in Help->About and --help (for packagers)]),
330                                                    EXTRA_VERSION=$withval)
332 if test x"$EXTRA_VERSION" != "x" ; then
333         AC_DEFINE_UNQUOTED(DISPLAY_VERSION, "$VERSION-$EXTRA_VERSION", [display version info])
334 else
335         AC_DEFINE_UNQUOTED(DISPLAY_VERSION, "$VERSION", [display version info])
338 AC_ARG_ENABLE(missing-dependencies, [AC_HELP_STRING([--disable-missing-dependencies],
339                 [skip missing dependencies instead of aborting configure])],
340         force_deps="$enableval", force_deps="yes")
342 AC_ARG_WITH(x, [],
343         with_x="$withval", with_x="yes")
344 AC_ARG_ENABLE(gtkui, [AC_HELP_STRING([--disable-gtkui],
345                 [compile without GTK+ user interface])],
346         enable_gtkui="$enableval", enable_gtkui="yes")
347 AC_ARG_ENABLE(consoleui, [AC_HELP_STRING([--disable-consoleui],
348                 [compile without console user interface])],
349         [enable_consoleui=$enableval force_finch=$enableval], [enable_consoleui=yes force_finch=no])
351 dnl #######################################################################
352 dnl # Check for GTK+ 2.0 and other things used by the GTK UI
353 dnl #######################################################################
354 AC_ARG_ENABLE(screensaver,
355         [AC_HELP_STRING([--disable-screensaver],
356                 [compile without X screensaver extension (used to detect idleness)])],
357         enable_screensaver="$enableval", enable_screensaver="yes")
358 AC_ARG_ENABLE(sm,
359         [AC_HELP_STRING([--disable-sm],
360                 [compile without X session management support])],
361         enable_sm="$enableval", enable_sm="yes")
362 AC_ARG_ENABLE(startup-notification,
363         [AC_HELP_STRING([--disable-startup-notification],
364                 [compile without startup notification support])],
365         enable_startup_notification="$enableval", enable_startup_notification="yes")
366 AC_ARG_ENABLE(gtkspell,
367         [AC_HELP_STRING([--disable-gtkspell],
368                 [compile without GtkSpell automatic spell checking])],
369         enable_gtkspell="$enableval", enable_gtkspell="yes")
370 AC_ARG_ENABLE(gevolution,
371         [AC_HELP_STRING([--enable-gevolution],
372                 [compile with the Evolution plugin])],
373         enable_gevolution="$enableval", enable_gevolution="no")
374 AC_ARG_ENABLE(cap,
375         [AC_HELP_STRING([--enable-cap],
376                 [compile with Contact Availability Prediction plugin])],
377         enable_cap="$enableval", enable_cap="no")
378 AC_ARG_ENABLE(gestures,
379         [AC_HELP_STRING([--disable-gestures],
380                 [compile without the gestures plugin])],
381         enable_gestures="$enableval", enable_gestures="yes")
383 AC_PATH_XTRA
384 # We can't assume that $x_libraries will be set, because autoconf does not
385 # set it in the case when the X libraries are in a standard place.
386 # Ditto for $x_includes
387 if test X"$x_libraries" = X"" || test X"$x_libraries" = XNONE; then
388     x_libpath_add=
389 else
390     x_libpath_add="-L$x_libraries"
392 if test X"$x_includes" = X"" || test X"$x_includes" = XNONE; then
393     x_incpath_add=
394 else
395     x_incpath_add="-I$x_includes"
398 if test "x$enable_gtkui" = "xyes" ; then
399         PKG_CHECK_MODULES(GTK, [gtk+-2.0 >= 2.0.0], , [
400                 AC_MSG_RESULT(no)
401                 AC_MSG_ERROR([
403 You must have the GTK+ 2.0 development headers installed to compile Pidgin.
404 If you want to build only Finch then specify --disable-gtkui when running configure.
405 ])])
407         AC_SUBST(GTK_CFLAGS)
408         AC_SUBST(GTK_LIBS)
410         dnl We only really need Pango >= 1.4 for decent RTL support
411         PKG_CHECK_MODULES(PANGO, [pango >= 1.4.0],
412                         AC_DEFINE(HAVE_PANGO14, 1, [Define if we have Pango 1.4 or newer.]),:)
414         dnl #######################################################################
415         dnl # Check if we should compile with X support
416         dnl #######################################################################
417         if test "x$with_x" = "xyes" ; then
418                 PKG_CHECK_MODULES(X11, x11,
419                         [AC_DEFINE(HAVE_X11, 1, [Define to 1 if you have X11])],
420                         [AC_MSG_RESULT(no)
421                                 if test "x$x_incpath_add" != "x" -a "x$x_libpath_add" != "x"; then
422                                         X11_LIBS="$x_libpath_add"
423                                         X11_CFLAGS="$x_incpath_add"
424                                 else
425                                         if test "x$force_deps" = "xyes" ; then
426                                                 AC_MSG_ERROR([
427 X11 development headers not found.
428 Use --without-x if you do not need X11 support.
430                                         fi
431                                 fi
432                         ])
433                 AC_SUBST(X11_LIBS)
434                 AC_SUBST(X11_CFLAGS)
435         else
436                 enable_screensaver=no
437                 enable_sm=no
438                 enable_gestures=no
439         fi
441         dnl #######################################################################
442         dnl # Check for XScreenSaver
443         dnl #######################################################################
444         if test "x$enable_screensaver" = "xyes" ; then
445                 if test "x$with_x" = "xyes" ; then
446                         old_LIBS="$LIBS"
447                         LIBS="$LIBS $GTK_LIBS $x_libpath_add"
448                         XSS_LIBS=""
449                         XSS_HEADERS=""
450                         AC_CHECK_LIB(Xext, XScreenSaverRegister,[XSS_LIBS="$X_LIBS $X_PRE_LIBS -lX11 -lXext $X_EXTRA_LIBS"],[],[-lX11 -lXext -lm])
451                         AC_CHECK_LIB(Xss, XScreenSaverRegister,[XSS_LIBS="$X_LIBS $X_PRE_LIBS -lX11 -lXext $X_LIBS $X_EXTRA_LIBS -lXss"],[],[-lX11 -lXext -lm])
452                         if test "x$XSS_LIBS" != "x"; then
453                                 oldCPPFLAGS="$CPPFLAGS"
454                                 CPPFLAGS="$CPPFLAGS $x_incpath_add"
455                                 AC_TRY_COMPILE([
456                                         #include <X11/Xlib.h>
457                                         #include <X11/extensions/scrnsaver.h>
458                                         ], [], [], [enable_screensaver=no])
459                                 CPPFLAGS="$oldCPPFLAGS"
460                         else
461                                 enable_screensaver=no
462                         fi
463                         LIBS="$old_LIBS"
465                         if test "x$enable_screensaver" = "xyes" ; then
466                                 AC_DEFINE(USE_SCREENSAVER, 1, [Define if we're using XScreenSaver.])
467                                 AC_SUBST(XSS_LIBS)
468                         else
469                                 if test "x$force_deps" = "xyes" ; then
470                                         AC_MSG_ERROR([
471 XScreenSaver extension development headers not found.
472 Use --disable-screensaver if you do not need XScreenSaver extension support,
473 this is required for detecting idle time by mouse and keyboard usage.
475                                 fi
476                         fi
477                 else
478                         AC_MSG_ERROR([X support is required to build with XScreenSaver extensions])
479                 fi
480         fi
482         dnl #######################################################################
483         dnl # Check for X session management libs
484         dnl #######################################################################
485         if test "x$enable_sm" = "xyes"; then
486                 if test "x$with_x" = "xyes" ; then
487                         enable_sm=no
488                         AC_CHECK_LIB(SM, SmcSaveYourselfDone, found_sm_lib=true, , [$x_libpath_add -lICE])
489                         if test "x$found_sm_lib" = "xtrue"; then
490                                 oldCPPFLAGS="$CPPFLAGS"
491                                 CPPFLAGS="$CPPFLAGS $x_incpath_add"
492                                 AC_CHECK_HEADERS(X11/SM/SMlib.h, SM_LIBS="$x_libpath_add -lSM -lICE" enable_sm=yes)
493                                 CPPFLAGS="$oldCPPFLAGS"
494                         fi
496                         if test "x$enable_sm" = "xyes"; then
497                                 AC_DEFINE(USE_SM, 1, [Define if we're using X Session Management.])
498                                 AC_SUBST(SM_LIBS)
499                         else
500                                 if test "x$force_deps" = "xyes" ; then
501                                         AC_MSG_ERROR([
502 X session management development headers not found.
503 Use --disable-sm if you do not need session management support.
505                                 fi
506                         fi
507                 else
508                         AC_MSG_ERROR([X support is required to build with X session management support])
509                 fi
510         fi
512         dnl #######################################################################
513         dnl # Check for X11 to allow the gestures plugin
514         dnl #######################################################################
515         if test "x$enable_gestures" = "xyes"; then
516                 if test "x$with_x" = "xno" ; then
517                         enable_gestures=no
518                 fi
519         fi
521         dnl #######################################################################
522         dnl # Check for startup notification
523         dnl #######################################################################
524         if test "x$enable_startup_notification" = "xyes"; then
525                 PKG_CHECK_MODULES(STARTUP_NOTIFICATION, [libstartup-notification-1.0 >= 0.5], , [
526                         AC_MSG_RESULT(no)
527                         if test "x$force_deps" = "xyes" ; then
528                                 AC_MSG_ERROR([
529 Startup notification development headers not found.
530 Use --disable-startup-notification if you do not need it.
532                         fi])
534                 if test "x$enable_startup_notification" = "xyes"; then
535                         AC_DEFINE(HAVE_STARTUP_NOTIFICATION, 1, [Define if we're using libstartup-notification.])
536                         AC_SUBST(STARTUP_NOTIFICATION_CFLAGS)
537                         AC_SUBST(STARTUP_NOTIFICATION_LIBS)
538                 fi
539         fi
541         dnl #######################################################################
542         dnl # Check for GtkSpell
543         dnl #######################################################################
544         if test "x$enable_gtkspell" = "xyes" ; then
545                 PKG_CHECK_MODULES(GTKSPELL, gtkspell-2.0 >= 2.0.2, , [
546                         AC_MSG_RESULT(no)
547                         if test "x$force_deps" = "xyes" ; then
548                                 AC_MSG_ERROR([
549 GtkSpell development headers not found.
550 Use --disable-gtkspell if you do not need it.
552                         fi])
553                 if test "x$enable_gtkspell" = "xyes" ; then
554                         AC_DEFINE(USE_GTKSPELL, 1, [Define if we're using GtkSpell])
555                         AC_SUBST(GTKSPELL_CFLAGS)
556                         AC_SUBST(GTKSPELL_LIBS)
557                 fi
558         fi
560         dnl #######################################################################
561         dnl # Check for stuff needed by the Evolution integration plugin.
562         dnl #######################################################################
563         if test "x$enable_gevolution" = "xyes"; then
564                 evo_deps="libebook-1.2 libedata-book-1.2"
565                 PKG_CHECK_MODULES(EVOLUTION_ADDRESSBOOK, $evo_deps, , [
566                         AC_MSG_RESULT(yes)
567                         enable_gevolution="no"
568                 ])
569                 if test "x$enable_gevolution" = "xno"; then
570                         evo_deps="libebook-1.0 libedata-book-1.0"
571                         PKG_CHECK_MODULES(EVOLUTION_ADDRESSBOOK, $evo_deps, [
572                                 enable_gevolution="yes"
573                         ], [
574                                 AC_MSG_RESULT(yes)
575                         ])
576                 fi
577                 if test "x$enable_gevolution" = "xyes"; then
578                         AC_DEFINE(HAVE_EVOLUTION_ADDRESSBOOK, 1, [Define if we're using evolution addressbook.])
579                         AC_SUBST(EVOLUTION_ADDRESSBOOK_CFLAGS)
580                         AC_SUBST(EVOLUTION_ADDRESSBOOK_LIBS)
581                 else
582                         if test "x$force_deps" = "xyes" ; then
583                                 AC_MSG_ERROR([
584 Evolution development headers not found.
585 Use --disable-gevolution if you do not need it.
587                         fi
588                 fi
589         fi
591         dnl #######################################################################
592         dnl # Check for libsqlite3 (for the Contact Availability Prediction plugin)
593         dnl #######################################################################
594         if test "x$enable_cap" = "xyes"; then
595                 PKG_CHECK_MODULES(SQLITE3, sqlite3 >= 3.3,,[
596                         AC_MSG_RESULT(no)
597                         if test "x$force_deps" = "xyes" ; then
598                                 AC_MSG_ERROR([
599 sqlite3 development headers not found.
600 Use --disable-cap if you do not need the Contact Availability Prediction plugin.
602                         fi])
603         fi
604         
606 else # GTK
607         enable_cap=no
608         enable_gevolution=no
609         enable_gtkspell=no
610         enable_screensaver=no
611         enable_sm=no
612         enable_startup_notification=no
613 fi      # GTK
615 AM_CONDITIONAL(ENABLE_GTK, test "x$enable_gtkui" = "xyes")
616 AM_CONDITIONAL(BUILD_GEVOLUTION, test "x$enable_gevolution" = "xyes")
617 AM_CONDITIONAL(ENABLE_CAP, test "x$enable_cap" = "xyes")
618 AM_CONDITIONAL(ENABLE_GESTURES, test "x$enable_gestures" = "xyes")
621 dnl #######################################################################
622 dnl # Check for ncurses and other things used by the console UI
623 dnl #######################################################################
624 GNT_LIBS=""
625 GNT_CFLAGS=""
626 AC_ARG_WITH(ncurses-headers, [AC_HELP_STRING([--with-ncurses-headers=DIR],
627                 [compile finch against the ncurses includes in DIR])],
628                 [ac_ncurses_includes="$withval"], [ac_ncurses_includes=""])
629 if test "x$enable_consoleui" = "xyes"; then
630         AC_CHECK_LIB(ncursesw, initscr, [GNT_LIBS="-lncursesw"], [enable_consoleui=no])
631         AC_CHECK_LIB(panelw, update_panels, [GNT_LIBS="$GNT_LIBS -lpanelw"], [enable_consoleui=no])
633         if test "x$enable_consoleui" = "xyes"; then
634                 dnl # Some distros put the headers in ncursesw/, some don't
635                 found_ncurses_h=no
636                 for location in $ac_ncurses_includes $NCURSES_HEADERS /usr/include/ncursesw /usr/include
637                 do
638                         f="$location/ncurses.h"
639                         AC_CHECK_HEADER($f,[
640                                 AC_MSG_CHECKING([if $f supports wide characters])
641                                 AC_TRY_COMPILE([
642                                         #define _XOPEN_SOURCE_EXTENDED
643                                         #include <$f>
644                                 ], [
645                                         #ifndef get_wch
646                                         # error get_wch not found!
647                                         #endif
648                                 ], [
649                                         dir=$location
650                                         if test x"$dir" != x"." ; then
651                                                 GNT_CFLAGS="-I$dir/"
652                                         else
653                                                 GNT_CFLAGS=""
654                                         fi
656                                         found_ncurses_h=yes
657                                         AC_MSG_RESULT([yes])
658                                         break
659                                 ], [
660                                         AC_MSG_RESULT([no])
661                                 ])
662                         ])
663                 done
665                 if test x"$found_ncurses_h" = x"no" ; then
666                         GNT_LIBS=""
667                         GNT_CFLAGS=""
668                         enable_consoleui=no
669                 fi
670         else
671                 # ncursesw was not found. Look for plain old ncurses
672                 enable_consoleui=yes
673                 AC_CHECK_LIB(ncurses, initscr, [GNT_LIBS="-lncurses"], [enable_consoleui=no])
674                 AC_CHECK_LIB(panel, update_panels, [GNT_LIBS="$GNT_LIBS -lpanel"], [enable_consoleui=no])
675                 AC_DEFINE(NO_WIDECHAR, 1, [Define to 1 if you don't have wide-character support.])
676                 if test x"$ac_ncurses_includes" != "x"; then
677                         GNT_CFLAGS="-I$ac_ncurses_includes"
678                 else
679                         if test x"$NCURSES_HEADERS" != "x"; then
680                                 GNT_CFLAGS="-I$NCURSES_HEADERS"
681                         fi
682                 fi
683         fi
686 if test "x$force_finch" = "xyes" -a "x$enable_consoleui" != "xyes"; then
687         AC_MSG_ERROR([
689 Finch will not be built. You need to install ncursesw (or ncurses) and its development headers.
694 AC_SUBST(GNT_LIBS)
695 AC_SUBST(GNT_CFLAGS)
696 AM_CONDITIONAL(ENABLE_GNT, test "x$enable_consoleui" = "xyes")
698 #AC_CHECK_FUNC(wcwidth, [AC_DEFINE([HAVE_WCWIDTH], [1], [Define to 1 if you have wcwidth function.])])
700 dnl #######################################################################
701 dnl # Check for LibXML2 (required)
702 dnl #######################################################################
703 PKG_CHECK_MODULES(LIBXML, [libxml-2.0 >= 2.6.0], , [
704         AC_MSG_RESULT(no)
705         AC_MSG_ERROR([
707 You must have libxml2 >= 2.6.0 development headers installed to build.
708 ])])
709 AC_SUBST(LIBXML_CFLAGS)
710 AC_SUBST(LIBXML_LIBS)
712 dnl #######################################################################
713 dnl # GConf schemas
714 dnl #######################################################################
715 AC_PATH_PROG(GCONFTOOL, gconftool-2, no)
716 AM_CONDITIONAL(USE_GCONFTOOL, test "x$GCONFTOOL" != "xno")
717 AM_GCONF_SOURCE_2
719 dnl #######################################################################
720 dnl # Check for GStreamer
721 dnl #######################################################################
723 dnl TODO: Depend on gstreamer >= 0.10.10, and remove the conditional use of
724 dnl       gst_registry_fork_set_enabled.
725 AC_ARG_ENABLE(gstreamer,
726         [AC_HELP_STRING([--disable-gstreamer], [compile without GStreamer audio support])],
727         enable_gst="$enableval", enable_gst="yes")
728 if test "x$enable_gst" != "xno"; then
729         PKG_CHECK_MODULES(GSTREAMER, [gstreamer-0.10], [
730                 AC_DEFINE(USE_GSTREAMER, 1, [Use GStreamer for playing sounds])
731                 AC_SUBST(GSTREAMER_CFLAGS)
732                 AC_SUBST(GSTREAMER_LIBS)
733                 AC_CHECK_LIB(gstreamer-0.10, gst_registry_fork_set_enabled,
734                         [ AC_DEFINE(GST_CAN_DISABLE_FORKING, [],
735                           [Define if gst_registry_fork_set_enabled exists])],
736                         [], [$GSTREAMER_LIBS])
737         ], [
738                 AC_MSG_RESULT(no)
739                 if test "x$force_deps" = "xyes" ; then
740                         AC_MSG_ERROR([
741 GStreamer development headers not found.
742 Use --disable-gstreamer if you do not need GStreamer (sound) support.
744                 fi])
747 dnl #######################################################################
748 dnl # Check for Meanwhile headers (for Sametime)
749 dnl #######################################################################
750 AC_ARG_ENABLE(meanwhile,
751         [AC_HELP_STRING([--disable-meanwhile],
752                 [compile without meanwhile (required for Sametime support)])],
753         enable_meanwhile="$enableval", enable_meanwhile="yes")
754 if test "x$enable_meanwhile" = "xyes"; then
755         PKG_CHECK_MODULES(MEANWHILE, [meanwhile >= 1.0.0 meanwhile < 2.0.0], [
756                 have_meanwhile="yes"
757         ], [
758                 have_meanwhile="no"
759                 if test "x$force_deps" = "xyes" ; then
760                         AC_MSG_ERROR([
761 Meanwhile development headers not found.
762 Use --disable-meanwhile if you do not need meanwhile (Sametime) support.
764                 fi])
766 AC_SUBST(MEANWHILE_CFLAGS)
767 AC_SUBST(MEANWHILE_LIBS)
769 dnl #######################################################################
770 dnl # Check for Native Avahi headers (for Bonjour)
771 dnl #######################################################################
772 AC_ARG_ENABLE(avahi,
773         [AC_HELP_STRING([--disable-avahi],
774                 [compile without avahi (required for Bonjour support)])],
775         enable_avahi="$enableval", enable_avahi="yes")
776 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"])
777 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"])
778 AVAHI_CFLAGS=""
779 AVAHI_LIBS=""
781 dnl Attempt to autodetect Avahi
782 PKG_CHECK_MODULES(AVAHI, [avahi-client avahi-glib], [
783         avahiincludes="yes"
784         avahilibs="yes"
785 ], [
786         avahiincludes="no"
787         avahilibs="no"
790 dnl Override AVAHI_CFLAGS if the user specified an include dir
791 if test "$ac_avahi_client_includes" != "no"; then
792         AVAHI_CFLAGS="-I$ac_avahi_client_includes"
794 CPPFLAGS_save="$CPPFLAGS"
795 CPPFLAGS="$CPPFLAGS $AVAHI_CFLAGS"
796 AC_CHECK_HEADER(avahi-client/client.h, [avahiincludes=yes], [avahiincludes=no])
797 CPPFLAGS="$CPPFLAGS $AVAHI_CFLAGS $GLIB_CFLAGS"
798 AC_CHECK_HEADER(avahi-glib/glib-malloc.h, [avahiincludes=yes], [avahiincludes=no])
799 CPPFLAGS="$CPPFLAGS_save"
801 dnl Override AVAHI_LIBS if the user specified a libs dir
802 if test "$ac_avahi_client_libs" != "no"; then
803         AVAHI_LIBS="-L$ac_avahi_client_libs -lavahi-common -lavahi-client -lavahi-glib "
805 AC_CHECK_LIB(avahi-client, avahi_client_new, [avahilibs=yes], [avahilibs=no], $AVAHI_LIBS)
807 if test "x$enable_avahi" = "xyes" -a "x$force_deps" = "xyes" -a \( "x$avahiincludes" = "xno" -o "x$avahilibs" = "xno" \); then
808         AC_MSG_ERROR([
809 avahi development headers not found.
810 Use --disable-avahi if you do not need avahi (Bonjour) support.
813 AC_SUBST(AVAHI_CFLAGS)
814 AC_SUBST(AVAHI_LIBS)
817 dnl #######################################################################
818 dnl # Check for SILC client includes and libraries
819 dnl #######################################################################
820 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"])
821 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"])
822 SILC_CFLAGS=""
823 SILC_LIBS=""
824 have_silc="no"
825 if test -n "$with_silc_includes" || test -n "$with_silc_libs"; then
826         silc_manual_check="yes"
827 else
828         silc_manual_check="no"
830 if test "x$silc_manual_check" = "xno"; then
831         PKG_CHECK_MODULES(SILC, [silcclient >= 1.1], [
832                 have_silc="yes"
833                 silcincludes="yes"
834                 silcclient="yes"
835         ], [
836                 have_silc="no"
837         ])
838         if test "x$have_silc" = "xno"; then
839                 PKG_CHECK_MODULES(SILC, silcclient, [
840                         have_silc="yes"
841                         silc10includes="yes"
842                         silc10client="yes"
843                 ], [
844                         have_silc="no"
845                 ])
846                 dnl If silcclient.pc wasn't found, check for just silc.pc
847                 if test "x$have_silc" = "xno"; then
848                         PKG_CHECK_MODULES(SILC, silc, [
849                                 have_silc="yes"
850                                 silc10includes="yes"
851                                 silc10client="yes"
852                         ], [
853                                 have_silc="no"
854                         ])
855                 fi
856         fi
857 else
858         if test "$ac_silc_includes" != "no"; then
859                 SILC_CFLAGS="-I$ac_silc_includes"
860         fi
861         CPPFLAGS_save="$CPPFLAGS"
862         CPPFLAGS="$CPPFLAGS $SILC_CFLAGS"
863         AC_CHECK_HEADER(silc.h, [silcincludes=yes])
864         CPPFLAGS="$CPPFLAGS_save"
866         if test "$ac_silc_libs" != "no"; then
867                 SILC_LIBS="-L$ac_silc_libs"
868         fi
869         SILC_LIBS="$SILC_LIBS -lsilc -lsilcclient -lpthread $LIBDL"
870         AC_CHECK_LIB(silcclient, silc_client_init, [silcclient=yes], , $SILC_LIBS)
872         if test "x$silcincludes" = "xyes" -a "x$silcclient" = "xyes"; then
873                 have_silc="yes"
874         else
875                 CPPFLAGS_save="$CPPFLAGS"
876                 CPPFLAGS="$CPPFLAGS $SILC_CFLAGS"
877                 AC_CHECK_HEADER(silcincludes.h, [silc10includes=yes])
878                 CPPFLAGS="$CPPFLAGS_save"
880                 SILC_LIBS="$SILC_LIBS -lsilc -lsilcclient -lpthread $LIBDL"
881                 AC_CHECK_LIB(silcclient, silc_client_init, [silc10client=yes], , $SILC_LIBS)
882                 if test "x$silc10includes" = "xyes" -a "x$silc10client" = "xyes"; then
883                         have_silc="yes"
884                 fi
885         fi
887 AC_SUBST(SILC_LIBS)
888 AC_SUBST(SILC_CFLAGS)
889 dnl SILC Toolkit >= 1.0.1 has a new MIME API
890 if test "x$silcclient" = "xyes"; then
891         AC_DEFINE(HAVE_SILCMIME_H, 1, [Define if we have silcmime.h])
892 elif test "x$silc10client" = "xyes"; then
893         CPPFLAGS_save="$CPPFLAGS"
894         CPPFLAGS="$CPPFLAGS $SILC_CFLAGS"
895                 AC_MSG_CHECKING(for silcmime.h)
896                 AC_TRY_COMPILE([
897 #include <silcincludes.h>
898 #include <silcmime.h>
899                 ], [], [
900                 AC_MSG_RESULT(yes)
901                 AC_DEFINE(HAVE_SILCMIME_H, 1, [Define if we have silcmime.h])
902                 ], [
903                 AC_MSG_RESULT(no)
904                 ])
905         CPPFLAGS="$CPPFLAGS_save"
908 dnl #######################################################################
909 dnl # Check for Gadu-Gadu client includes and libraries
910 dnl #######################################################################
911 AC_ARG_WITH(gadu-includes, [AC_HELP_STRING([--with-gadu-includes=DIR], [compile the Gadu-Gadu plugin against includes in DIR])], [ac_gadu_includes="$withval"], [ac_gadu_includes="no"])
912 AC_ARG_WITH(gadu-libs, [AC_HELP_STRING([--with-gadu-libs=DIR], [compile the Gadu-Gadu plugin against the libs in DIR])], [ac_gadu_libs="$withval"], [ac_gadu_libs="no"])
913 GADU_CFLAGS=""
914 GADU_LIBS=""
915 if test -n "$with_gadu_includes" || test -n "$with_gadu_libs"; then
916         gadu_manual_check="yes"
917 else
918         gadu_manual_check="no"
920 if test "x$gadu_manual_check" = "xno"; then
921         PKG_CHECK_MODULES(GADU, libgadu, [
922                 gadu_includes="yes"
923                 gadu_libs="yes"
924         ], [
925                 AC_MSG_RESULT(no)
926         ])
927 else
928         if test "$ac_gadu_includes" != "no"; then
929                 GADU_CFLAGS="-I$ac_gadu_includes"
930         fi
931         CPPFLAGS_save="$CPPFLAGS"
932         CPPFLAGS="$CPPFLAGS $GADU_CFLAGS"
933         AC_CHECK_HEADER(libgadu.h, [gadu_includes=yes])
934         CPPFLAGS="$CPPFLAGS_save"
936         if test "$ac_gadu_libs" != "no"; then
937                 GADU_LIBS="-L$ac_gadu_libs"
938         fi
939         GADU_LIBS="$GADU_LIBS -lgadu"
940         AC_CHECK_LIB(gadu, gg_libgadu_version, [gadu_libs=yes], , $GADU_LIBS)
942 GADU_CFLAGS=`echo $GADU_CFLAGS |$sedpath 's/-Wall//'`
944 if test "x$gadu_libs" = "xyes"; then
945         AC_MSG_CHECKING(for libgadu GPL compatibility)
946         CPPFLAGS_save="$CPPFLAGS"
947         CPPFLAGS="$CPPFLAGS $GADU_CFLAGS"
948         AC_TRY_COMPILE([#include <libgadu.h>], [
949 #if defined(__GG_LIBGADU_HAVE_OPENSSL) || defined(GG_CONFIG_HAVE_OPENSSL)
950 #error "libgadu is not compatible with the GPL when compiled with OpenSSL support."
951 #endif
952         ], [
953                 AC_MSG_RESULT(yes)
954                 AC_DEFINE([HAVE_LIBGADU], [1],
955                         [Define to 1 if you have libgadu.])
956         ], [
957                 AC_MSG_RESULT(no)
958                 echo
959                 echo
960                 echo "libgadu is not compatible with the GPL when compiled with OpenSSL support."
961                 echo "To compile against system libgadu, please recompile libgadu using:"
962                 echo "./autogen.sh --disable-libgadu-openssl --disable-static --enable-shared"
963                 echo "Then rerun this ./configure"
964                 echo
965                 echo "Falling back to using our own copy of libgadu"
966                 echo
967                 GADU_LIBS=""
968                 GADU_CFLAGS=""
969                 gadu_libs=no
970         ])
971         CPPFLAGS="$CPPFLAGS_save"
974 AM_CONDITIONAL(USE_INTERNAL_LIBGADU, test "x$gadu_libs" != "xyes")
976 AC_SUBST(GADU_LIBS)
977 AC_SUBST(GADU_CFLAGS)
979 # change the next line to not make MSNP15 the default (s/disable/enable/; s/yes/no/;)
980 AC_ARG_ENABLE(msnp15,[AC_HELP_STRING([--disable-msnp15], [Disable the newer MSNP15 protocol])],enable_msnp15=$enableval,enable_msnp15=yes)
982 AC_ARG_ENABLE(distrib,,,enable_distrib=no)
983 AM_CONDITIONAL(DISTRIB, test "x$enable_distrib" = "xyes")
984 DYNAMIC_PRPLS=all
985 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=""])
986 if test "x$STATIC_PRPLS" != "x" -a "x$DYNAMIC_PRPLS" = "xall"; then
987         DYNAMIC_PRPLS=""
990 if test "x$STATIC_PRPLS" = "xall" ; then
991         STATIC_PRPLS="bonjour gg irc jabber msn myspace novell oscar qq sametime silc simple yahoo zephyr"
993 if test "x$have_meanwhile" != "xyes" ; then
994         STATIC_PRPLS=`echo $STATIC_PRPLS | $sedpath 's/sametime//'`
996 if test "x$avahiincludes" != "xyes" -o "x$avahilibs" != "xyes"; then
997         STATIC_PRPLS=`echo $STATIC_PRPLS | $sedpath 's/bonjour//'`
999 if test "x$enable_msnp15" != "xyes" ; then
1000         STATIC_PRPLS=`echo $STATIC_PRPLS | $sedpath 's/msn/msnp9/'`
1002 if test "x$silcincludes" != "xyes" -o "x$silcclient" != "xyes"; then
1003         STATIC_PRPLS=`echo $STATIC_PRPLS | $sedpath 's/silc/silc10/'`
1005 if test "x$silc10includes" != "xyes" -o "x$silc10client" != "xyes"; then
1006         STATIC_PRPLS=`echo $STATIC_PRPLS | $sedpath 's/silc10//'`
1008 AC_SUBST(STATIC_PRPLS)
1009 STATIC_LINK_LIBS=
1010 extern_init=
1011 load_proto=
1012 for i in $STATIC_PRPLS ; do
1013         dnl Ugly special case for "libsilcpurple.la":
1014         dnl ... and Ugly special case for multi-protocol oscar
1015         if test \( "x$i" = "xoscar" -o "x$i" = "xaim" -o "x$i" = "xicq" \) -a "x$static_oscar" != "xyes"; then
1016                 STATIC_LINK_LIBS="$STATIC_LINK_LIBS \$(top_builddir)/libpurple/protocols/oscar/liboscar.la"
1017                 extern_init="$extern_init extern gboolean purple_init_aim_plugin();"
1018                 extern_init="$extern_init extern gboolean purple_init_icq_plugin();"
1019                 load_proto="$load_proto purple_init_aim_plugin();"
1020                 load_proto="$load_proto purple_init_icq_plugin();"
1021         else
1022                 if test "x$i" = "xsilc"; then
1023                         STATIC_LINK_LIBS="$STATIC_LINK_LIBS \$(top_builddir)/libpurple/protocols/$i/lib${i}purple.la"
1024                 elif test "x$i" = "xsilc10"; then
1025                         STATIC_LINK_LIBS="$STATIC_LINK_LIBS \$(top_builddir)/libpurple/protocols/$i/libsilcpurple.la"
1026                 elif test "x$i" = "xmsnp9"; then
1027                         STATIC_LINK_LIBS="$STATIC_LINK_LIBS \$(top_builddir)/libpurple/protocols/$i/libmsn.la"
1028                 else
1029                         STATIC_LINK_LIBS="$STATIC_LINK_LIBS \$(top_builddir)/libpurple/protocols/$i/lib$i.la"
1030                 fi
1031                 extern_init="$extern_init extern gboolean purple_init_${i}_plugin();"
1032                 load_proto="$load_proto purple_init_${i}_plugin();"
1033         fi
1034         case $i in
1035                 bonjour)        static_bonjour=yes ;;
1036                 gg)                     static_gg=yes ;;
1037                 irc)            static_irc=yes ;;
1038                 jabber)         static_jabber=yes ;;
1039                 msn)            static_msn=yes ;;
1040                 msnp9)          static_msn=yes ;;
1041                 myspace)        static_myspace=yes ;;
1042                 novell)         static_novell=yes ;;
1043                 oscar)          static_oscar=yes ;;
1044                 aim)            static_oscar=yes ;;
1045                 icq)            static_oscar=yes ;;
1046                 qq)                     static_qq=yes ;;
1047                 sametime)       static_sametime=yes ;;
1048                 silc)           static_silc=yes ;;
1049                 silc10)         static_silc=yes ;;
1050                 simple)         static_simple=yes ;;
1051                 toc)            static_toc=yes ;;
1052                 yahoo)          static_yahoo=yes ;;
1053                 zephyr)         static_zephyr=yes ;;
1054                 *)                      echo "Invalid static protocol $i!!" ; exit ;;
1055         esac
1056 done
1057 AM_CONDITIONAL(STATIC_BONJOUR, test "x$static_bonjour" = "xyes")
1058 AM_CONDITIONAL(STATIC_GG, test "x$static_gg" = "xyes")
1059 AM_CONDITIONAL(STATIC_IRC, test "x$static_irc" = "xyes")
1060 AM_CONDITIONAL(STATIC_JABBER, test "x$static_jabber" = "xyes")
1061 AM_CONDITIONAL(STATIC_MSN, test "x$static_msn" = "xyes")
1062 AM_CONDITIONAL(STATIC_MYSPACE, test "x$static_myspace" = "xyes")
1063 AM_CONDITIONAL(STATIC_NOVELL, test "x$static_novell" = "xyes")
1064 AM_CONDITIONAL(STATIC_OSCAR, test "x$static_oscar" = "xyes")
1065 AM_CONDITIONAL(STATIC_QQ, test "x$static_qq" = "xyes")
1066 AM_CONDITIONAL(STATIC_SAMETIME, test "x$static_sametime" = "xyes" -a "x$have_meanwhile" = "xyes")
1067 AM_CONDITIONAL(STATIC_SILC, test "x$static_silc" = "xyes" -a "x$have_silc" = "xyes")
1068 AM_CONDITIONAL(STATIC_SIMPLE, test "x$static_simple" = "xyes")
1069 AM_CONDITIONAL(STATIC_TOC, test "x$static_toc" = "xyes")
1070 AM_CONDITIONAL(STATIC_YAHOO, test "x$static_yahoo" = "xyes")
1071 AM_CONDITIONAL(STATIC_ZEPHYR, test "x$static_zephyr" = "xyes")
1072 AC_SUBST(STATIC_LINK_LIBS)
1073 AC_DEFINE_UNQUOTED(STATIC_PROTO_INIT, $extern_init static void static_proto_init(void) { $load_proto },
1074         [Loads static protocol plugin module initialization functions.])
1076 AC_ARG_WITH(dynamic_prpls, [AC_HELP_STRING([--with-dynamic-prpls], [specify which protocols to build dynamically])], [DYNAMIC_PRPLS=`echo $withval | $sedpath 's/,/ /g'`])
1077 if test "x$DYNAMIC_PRPLS" = "xall" ; then
1078         DYNAMIC_PRPLS="bonjour gg irc jabber msn myspace novell oscar qq sametime silc simple yahoo zephyr"
1080 if test "x$have_meanwhile" != "xyes"; then
1081         DYNAMIC_PRPLS=`echo $DYNAMIC_PRPLS | $sedpath 's/sametime//'`
1083 if test "x$avahiincludes" != "xyes" -o "x$avahilibs" != "xyes"; then
1084         DYNAMIC_PRPLS=`echo $DYNAMIC_PRPLS | $sedpath 's/bonjour//'`
1086 if test "x$enable_msnp15" != "xyes" ; then
1087         DYNAMIC_PRPLS=`echo $DYNAMIC_PRPLS | $sedpath 's/msn/msnp9/'`
1089 if test "x$silcincludes" != "xyes" -o "x$silcclient" != "xyes"; then
1090         DYNAMIC_PRPLS=`echo $DYNAMIC_PRPLS | $sedpath 's/silc/silc10/'`
1092 if test "x$silc10includes" != "xyes" -o "x$silc10client" != "xyes"; then
1093         DYNAMIC_PRPLS=`echo $DYNAMIC_PRPLS | $sedpath 's/silc10//'`
1095 AC_SUBST(DYNAMIC_PRPLS)
1096 for i in $DYNAMIC_PRPLS ; do
1097         case $i in
1098                 bonjour)        dynamic_bonjour=yes ;;
1099                 gg)                     dynamic_gg=yes ;;
1100                 irc)            dynamic_irc=yes ;;
1101                 jabber)         dynamic_jabber=yes ;;
1102                 msn)            dynamic_msn=yes ;;
1103                 msnp9)          dynamic_msn=yes ;;
1104                 myspace)        dynamic_myspace=yes ;;
1105                 novell)         dynamic_novell=yes ;;
1106                 oscar)          dynamic_oscar=yes ;;
1107                 aim)            dynamic_oscar=yes ;;
1108                 icq)            dynamic_oscar=yes ;;
1109                 qq)                     dynamic_qq=yes ;;
1110                 sametime)       dynamic_sametime=yes ;;
1111                 silc)           dynamic_silc=yes ;;
1112                 silc10)         dynamic_silc=yes ;;
1113                 simple)         dynamic_simple=yes ;;
1114                 toc)            dynamic_toc=yes ;;
1115                 yahoo)          dynamic_yahoo=yes ;;
1116                 zephyr)         dynamic_zephyr=yes ;;
1117                 *)                      echo "Invalid dynamic protocol $i!!" ; exit ;;
1118         esac
1119 done
1120 AM_CONDITIONAL(DYNAMIC_BONJOUR, test "x$dynamic_bonjour" = "xyes"  -a [ "x$avahiincludes" = "xyes" -a "x$avahilibs " = "xyes" ] )
1121 AM_CONDITIONAL(DYNAMIC_GG, test "x$dynamic_gg" = "xyes")
1122 AM_CONDITIONAL(DYNAMIC_IRC, test "x$dynamic_irc" = "xyes")
1123 AM_CONDITIONAL(DYNAMIC_JABBER, test "x$dynamic_jabber" = "xyes")
1124 AM_CONDITIONAL(DYNAMIC_MSN, test "x$dynamic_msn" = "xyes")
1125 AM_CONDITIONAL(DYNAMIC_MYSPACE, test "x$dynamic_myspace" = "xyes")
1126 AM_CONDITIONAL(DYNAMIC_NOVELL, test "x$dynamic_novell" = "xyes")
1127 AM_CONDITIONAL(DYNAMIC_OSCAR, test "x$dynamic_oscar" = "xyes")
1128 AM_CONDITIONAL(DYNAMIC_QQ, test "x$dynamic_qq" = "xyes")
1129 AM_CONDITIONAL(DYNAMIC_SAMETIME, test "x$dynamic_sametime" = "xyes" -a "x$have_meanwhile" = "xyes")
1130 AM_CONDITIONAL(DYNAMIC_SILC, test "x$dynamic_silc" = "xyes" -a "x$have_silc" = "xyes")
1131 AM_CONDITIONAL(DYNAMIC_SIMPLE, test "x$dynamic_simple" = "xyes")
1132 AM_CONDITIONAL(DYNAMIC_TOC, test "x$dynamic_toc" = "xyes")
1133 AM_CONDITIONAL(DYNAMIC_YAHOO, test "x$dynamic_yahoo" = "xyes")
1134 AM_CONDITIONAL(DYNAMIC_ZEPHYR, test "x$dynamic_zephyr" = "xyes")
1136 AC_ARG_ENABLE(plugins, [AC_HELP_STRING([--disable-plugins], [compile without plugin support])], , enable_plugins=yes)
1137 AC_ARG_WITH(krb4, [AC_HELP_STRING([--with-krb4=PREFIX], [compile Zephyr plugin with Kerberos 4 support])], kerberos="$withval", kerberos="no")
1138 AC_ARG_WITH(zephyr, [AC_HELP_STRING([--with-zephyr=PREFIX], [compile Zephyr plugin against external libzephyr])], zephyr="$withval", zephyr="no")
1139 AM_CONDITIONAL(EXTERNAL_LIBZEPHYR, test "x$zephyr" != "xno")
1141 AC_CHECK_HEADERS(sys/utsname.h)
1142 AC_CHECK_FUNC(uname)
1144 AC_ARG_ENABLE(fortify, [AC_HELP_STRING([--disable-fortify], [compile without FORTIFY_SOURCE support])], , enable_fortify=yes)
1146 DEBUG_CFLAGS="$DEBUG_CFLAGS -DPURPLE_DISABLE_DEPRECATED -DPIDGIN_DISABLE_DEPRECATED -DFINCH_DISABLE_DEPRECATED -DGNT_DISABLE_DEPRECATED"
1147 if test "x$GCC" = "xyes"; then
1148         dnl We enable -Wall later.
1149         dnl If it's set after the warning CFLAGS in the compiler invocation, it counteracts the -Wno... flags.
1150         dnl This leads to warnings we don't want.
1151         CFLAGS=`echo $CFLAGS |$sedpath 's/-Wall//'`
1153         dnl ENABLE WARNINGS SUPPORTED BY THE VERSION OF GCC IN USE
1154         dnl
1155         dnl Future Possibilities
1156         dnl
1157         dnl Consider adding -Wbad-function-cast.
1158         dnl     This leads to spurious warnings using GPOINTER_TO_INT(), et al. directly on a function call.
1159         dnl             We'd need an intermediate variable.
1160         dnl
1161         dnl Consider adding -Wfloat-equal.
1162         dnl     This leads to warnings with Perl.
1163         dnl             Perhaps we could write ugly configure magic and pass -Wno-float-equal down to that subdirectory.
1164         dnl             On the other hand, it's probably actually broken, so maybe the Perl folks should fix that?
1165         dnl
1166         dnl Consider removing -Wno-sign-compare (from the -Wextra set) and fixing all those cases.
1167         dnl     This is likely non-trivial.
1168         dnl
1169         for newflag in \
1170                         "-Waggregate-return" \
1171                         "-Wcast-align" \
1172                         "-Wdeclaration-after-statement" \
1173                         "-Wendif-labels" \
1174                         "-Werror-implicit-function-declaration" \
1175                         "-Wextra -Wno-sign-compare -Wno-unused-parameter" \
1176                         "-Wformat-security" \
1177                                 "-Werror=format-security" \
1178                         "-Winit-self" \
1179                         "-Wmissing-declarations" \
1180                         "-Wmissing-noreturn" \
1181                         "-Wmissing-prototypes" \
1182                         "-Wpointer-arith" \
1183                         "-Wundef" \
1184         ; do
1185                 orig_CFLAGS="$CFLAGS"
1186                 CFLAGS="$CFLAGS $newflag"
1187                 AC_MSG_CHECKING(for $newflag option to gcc)
1188                 AC_TRY_COMPILE([], [
1189                         int main() {return 0;}
1190                 ], [
1191                         AC_MSG_RESULT(yes)
1192                         CFLAGS="$orig_CFLAGS"
1193                         DEBUG_CFLAGS="$DEBUG_CFLAGS $newflag"
1194                 ], [
1195                         AC_MSG_RESULT(no)
1196                         CFLAGS="$orig_CFLAGS"
1197                 ])
1198         done
1200         if test "x$enable_fortify" = "xyes"; then
1201                 AC_MSG_CHECKING(for FORTIFY_SOURCE support)
1202                 AC_TRY_COMPILE([#include <features.h>], [
1203                         int main() {
1204                         #if !(__GNUC_PREREQ (4, 1) \
1205                                 || (defined __GNUC_RH_RELEASE__ && __GNUC_PREREQ (4, 0)) \
1206                                 || (defined __GNUC_RH_RELEASE__ && __GNUC_PREREQ (3, 4) \
1207                                         && __GNUC_MINOR__ == 4 \
1208                                         && (__GNUC_PATCHLEVEL__ > 2 \
1209                                                 || (__GNUC_PATCHLEVEL__ == 2 && __GNUC_RH_RELEASE__ >= 8))))
1210                         #error No FORTIFY_SOURCE support
1211                         #endif
1212                                 return 0;
1213                         }
1214                 ], [
1215                         AC_MSG_RESULT(yes)
1216                         DEBUG_CFLAGS="$DEBUG_CFLAGS -Wp,-D_FORTIFY_SOURCE=2"
1217                 ], [
1218                         AC_MSG_RESULT(no)
1219                 ])
1220         fi
1222         DEBUG_CFLAGS="-Wall $DEBUG_CFLAGS"
1223         CFLAGS="-g $CFLAGS"
1225 AC_SUBST(CFLAGS)
1227 AC_PATH_PROG(pidginpath, pidgin)
1229 dnl #######################################################################
1230 dnl # Check for D-Bus libraries
1231 dnl #######################################################################
1233 AC_ARG_ENABLE(dbus, [AC_HELP_STRING([--disable-dbus], [disable D-Bus support])], , enable_dbus=yes)
1234 AC_ARG_ENABLE(nm, [AC_HELP_STRING([--disable-nm], [disable NetworkManager support (requires D-Bus)])], enable_nm=$enableval, enable_nm=yes)
1236 if test "x$enable_dbus" = "xyes" ; then
1237         AC_CHECK_PROG(enable_dbus, dbus-binding-tool, yes, no)
1240 if test "x$enable_dbus" = "xyes" ; then
1241         PKG_CHECK_MODULES(DBUS, [dbus-1 >= 0.60 dbus-glib-1 >= 0.60], [
1242                 AC_SUBST(DBUS_CFLAGS)
1243                 AC_SUBST(DBUS_LIBS)
1244                 enable_dbus=yes
1245         ], [
1246         enable_dbus=no
1247         if test "x$force_deps" = "xyes" ; then
1248                 AC_MSG_ERROR([
1249 D-Bus development headers not found.
1250 Use --disable-dbus if you do not need D-Bus support.
1252         fi])
1255 dnl Check for NetworkManager.h; if we don't have it, oh well
1256 if test "x$enable_dbus" = "xyes" ; then
1257         if test "x$enable_nm" = "xyes" ; then
1258                 PKG_CHECK_MODULES(NETWORKMANAGER, [NetworkManager >= 0.5.0], [
1259                         AC_SUBST(NETWORKMANAGER_CFLAGS)
1260                         AC_SUBST(NETWORKMANAGER_LIBS)
1261                         AC_DEFINE(HAVE_NETWORKMANAGER, 1, [Define if we have NetworkManager.])
1262                 ], [
1263                         enable_nm=no
1264                         if test "x$force_deps" = "xyes" ; then
1265                                 AC_MSG_ERROR([
1266 NetworkManager development headers not found.
1267 Use --disable-nm if you do not need NetworkManager support.
1269                         fi])
1270         fi
1271 else
1272         enable_nm=no
1275 dnl #######################################################################
1276 dnl # Check for Python
1277 dnl #######################################################################
1279 dnl Python scripts are used to auto-generate about 3000 lines of C
1280 dnl and XML code that wraps (part of) the existing API so that
1281 dnl it is now accessible through D-Bus.
1283 dnl Python is only required if --enable-dbus is used, and only for
1284 dnl the build process to generate the code, not for running pidgin.
1285 dnl This autogenerated code is system-independent, so in principle we
1286 dnl can generate all of it before shipping.  But I thought adding
1287 dnl auto-generated stuff to the repository is inelegant.
1288 dnl Alternatively, these python scripts could be rewritten
1289 dnl in C (brrrr ...).
1291 AC_ARG_WITH([python],
1292                         AC_HELP_STRING([--with-python=PATH],
1293                                                    [which python interpreter to use for dbus code generation]),
1294                         PYTHON=$withval)
1296 if test "x$enable_dbus" = "xyes" ; then
1297         if test -z "$PYTHON" -o "x$PYTHON" = "xyes"; then
1298                 AC_PATH_PROG([PYTHON], [python], [no])
1299         fi
1301         if test x"$PYTHON" = x"no" ; then
1302                 AC_MSG_WARN([python interpreter not found in your path])
1303                 enable_dbus=no
1304         fi
1307 if test "x$enable_dbus" = "xyes" ; then
1308         if $PYTHON -c "import sys; sys.exit(sys.version[[:3]] >= '2.4')" ; then
1309                 AC_MSG_WARN([python version >= 2.4 required])
1310                 enable_dbus=no
1311         fi
1314 dnl ###########################################################################
1315 dnl # Find the D-Bus services dir.
1316 dnl #
1317 dnl # This is a 3 step process that
1318 dnl #
1319 dnl # 1. checks if --with-dbus-services was set, if so use that.
1320 dnl # 2. checks if --prefix was given, if so use that.
1321 dnl # 3. fallbacks to installing into what should be the correct system
1322 dnl #    directories.
1323 dnl #
1324 dnl # This is still prone to error if one of the legacy directories exist
1325 dnl # although a newer dbus is installed.  But I have tried to order the
1326 dnl # directory searching to keep this situation at a minimum.
1327 dnl ###########################################################################
1328 AC_ARG_WITH(dbus-services, [AC_HELP_STRING([--with-dbus-services=<dir>], [where the D-Bus services directory is located.])])
1330 DBUS_SERVICES_DIR=""
1332 if test x"$enable_dbus" = "xyes" ; then
1333         AC_MSG_CHECKING([location of the D-Bus services directory])
1334         if ! test -z "$with_dbus_services" ; then
1335                 if ! test -d "$with_dbus_services" ; then
1336                         AC_MSG_ERROR([$with_dbus_services does not exist, if this is the correct location please make sure that it exists.])
1337                 fi
1339                 DBUS_SERVICES_DIR="$with_dbus_services"
1340         else
1341                 if test x"$prefix" = x"NONE" ; then
1342                         dnl # no prefix given, so we look for the correct dbus system paths.
1343                         dnl # if a prefix is given, we use it.
1345                         serviceprefixes="$prefix/share $prefix/lib /usr/share /usr/local/share"
1346                         DBUS_SERVICES_DIR=""
1348                         for d in $serviceprefixes ; do
1349                                 dir="$d/dbus-1/services"
1350                                 if test -d $dir ; then
1351                                         DBUS_SERVICES_DIR="$dir"
1352                                         break
1353                                 fi
1354                         done
1356                         if test -z $DBUS_SERVICES_DIR ; then
1357                                 AC_MSG_ERROR([D-Bus services directory was not found!  Please use --with-dbus-services and specify it's location.])
1358                         fi
1359                 else
1360                         DBUS_SERVICES_DIR="$datadir/dbus-1/services"
1361                 fi
1362         fi
1363         AC_MSG_RESULT([$DBUS_SERVICES_DIR])
1364         AC_DEFINE(HAVE_DBUS, 1, [Define if we are using D-Bus.])
1366 AC_SUBST(DBUS_SERVICES_DIR)
1368 if test "x$enable_dbus" = "xyes" ; then
1369         echo "Building with D-Bus support"
1370 else
1371         echo "Building without D-Bus support"
1374 AM_CONDITIONAL(ENABLE_DBUS, test "x$enable_dbus" = "xyes")
1376 dnl Check for Python headers (currently useful only for libgnt)
1377 dnl (Thanks to XChat)
1378 AC_PATH_PROG(pythonpath, python)
1379 if test "_$pythonpath" != _ ; then
1380         AC_MSG_CHECKING(for Python compile flags)
1381         PY_PREFIX=`$pythonpath -c 'import sys ; print sys.prefix'`
1382         PY_EXEC_PREFIX=`$pythonpath -c 'import sys ; print sys.exec_prefix'`
1383         changequote(<<, >>)dnl
1384         PY_VERSION=`$pythonpath -c 'import sys ; print sys.version[0:3]'`
1385         PY_MAJOR=`$pythonpath -c 'import sys ; print sys.version[0:2]'`
1386         changequote([, ])dnl
1387         if test -f $PY_PREFIX/include/python$PY_VERSION/Python.h -a "$PY_MAJOR" = "2."; then
1388                 AC_CHECK_LIB(pthread, pthread_create, )
1389                 AC_CHECK_LIB(util, openpty, )
1390                 AC_CHECK_LIB(db, dbopen, )
1391                 PY_LIBS="-lpython$PY_VERSION -L$PY_EXEC_PREFIX/lib/python$PY_VERSION/config"
1392                 PY_CFLAGS="-I$PY_PREFIX/include/python$PY_VERSION"
1393                 AC_DEFINE(USE_PYTHON, [1], [Define if python headers are available.])
1394                 AC_MSG_RESULT(ok)
1395         else
1396                 AC_MSG_RESULT([Can't find Python.h])
1397                 PY_LIBS=""
1398                 PY_CFLAGS=""
1399         fi
1401 AC_SUBST(PY_CFLAGS)
1402 AC_SUBST(PY_LIBS)
1404 dnl #######################################################################
1405 dnl # Check for Mono support
1406 dnl #######################################################################
1407 AC_ARG_ENABLE(mono, [AC_HELP_STRING([--enable-mono], [compile with Mono runtime support (experimental)])], , enable_mono=no)
1408 if test x"$enable_mono" = x"yes" ; then
1409         PKG_CHECK_MODULES(MONO, mono, [
1410                 AC_SUBST(MONO_CFLAGS)
1411                 AC_SUBST(MONO_LIBS)
1412                 enable_mono=yes
1413         ], [
1414                 AC_MSG_RESULT(no)
1415                 AC_MSG_ERROR([
1416 Mono development headers not found.
1417 Use --disable-mono if you do not need Mono support.
1419         ])
1420         if test x"$enable_mono" = x"yes"; then
1421                 oldLIBS="$LIBS"
1422                 LIBS="$LIBS $MONO_LIBS"
1423                 AC_MSG_CHECKING(for libmono)
1424                 AC_CHECK_FUNCS(mono_jit_init, [], enable_mono=no)
1425                 LIBS="$oldLIBS"
1427                 oldCPPFLAGS="$CPPFLAGS"
1428                 CPPFLAGS="$CPPFLAGS $MONO_CFLAGS"
1429                 AC_CHECK_HEADERS(mono/jit/jit.h, [], enable_mono=no)
1430                 AC_CHECK_HEADERS(mono/metadata/object.h, [], enable_mono=no)
1431                 CPPFLAGS="$oldCPPFLAGS"
1433                 AC_DEFINE(ENABLE_MONO, 1, [Define if mono enabled.])
1434         fi
1435 else
1436         MONO_CFLAGS=
1437         MONO_LIBS=
1438         enable_mono=no
1441 AC_SUBST(MONO_CFLAGS)
1442 AC_SUBST(MONO_LIBS)
1443 AM_CONDITIONAL(USE_MONO, test x"$enable_mono" = x"yes")
1445 dnl #######################################################################
1446 dnl # Check for Perl support
1447 dnl #######################################################################
1448 AC_ARG_ENABLE(perl, [AC_HELP_STRING([--disable-perl], [compile without perl scripting])], , enable_perl=yes)
1450 if test "$enable_plugins" = no ; then
1451         enable_perl=no
1453 looked_for_perl="no"
1454 if test "$enable_perl" = yes ; then
1455         looked_for_perl="yes"
1456         AC_PATH_PROG(perlpath, perl)
1457         AC_MSG_CHECKING(for Perl compile flags)
1458         PERL_CFLAGS=`$perlpath -MExtUtils::Embed -e ccopts 2>/dev/null`
1459         if test "_$PERL_CFLAGS" = _ ; then
1460                 AC_MSG_RESULT([not found, building without perl.])
1461                 enable_perl=no
1462         else
1463                 PERL_LIBS=`$perlpath -MExtUtils::Embed -e ldopts 2>/dev/null |$sedpath 's/-lgdbm //'`
1464                 PERL_LIBS=`echo $PERL_LIBS |$sedpath 's/-ldb //'`
1465                 PERL_LIBS=`echo $PERL_LIBS |$sedpath 's/-lndbm //'`
1466                 if test "$system" = "Linux"; then
1467                         PERL_LIBS=`echo $PERL_LIBS |$sedpath 's/-lnsl //'`
1468                         PERL_LIBS=`echo $PERL_LIBS |$sedpath 's/-lposix //'`
1469                 fi
1470                 PERL_LIBS=`echo $PERL_LIBS |$sedpath 's/-lc //'`
1471                 AC_MSG_RESULT(ok)
1473                 oldLIBS="$LIBS"
1474                 LIBS="$LIBS $PERL_LIBS"
1475                 AC_MSG_CHECKING(for libperl)
1476                 AC_CHECK_FUNCS(perl_run, [], enable_perl=no)
1477                 LIBS="$oldLIBS"
1479                 oldCPPFLAGS="$CPPFLAGS"
1480                 CPPFLAGS="$CPPFLAGS $PERL_CFLAGS"
1481                 AC_CHECK_HEADERS(EXTERN.h)
1482                 AC_CHECK_HEADERS(perl.h, [], enable_perl=no,
1483                 [#if HAVE_EXTERN_H
1484                  # include <EXTERN.h>
1485                  #endif])
1486                 CPPFLAGS="$oldCPPFLAGS"
1487         fi
1490 if test "$enable_perl" = yes ; then
1491         AC_PROG_PERL_MODULES(ExtUtils::MakeMaker, , have_makemaker=no)
1493         if test "x$have_makemaker" = "xno"; then
1494                 enable_perl=no
1495                 PERL_CFLAGS=
1496                 PERL_LIBS=
1497                 AM_CONDITIONAL(USE_PERL, false)
1498                 AC_MSG_WARN(Compiling perl requires ExtUtils::MakeMaker)
1499         else
1500                 AC_DEFINE(HAVE_PERL, [1], [Compile with support for perl])
1501                 AC_SUBST(PERL_CFLAGS)
1502                 AC_SUBST(PERL_LIBS)
1503                 AM_CONDITIONAL(USE_PERL, true)
1505                 dnl This is almost definitely wrong, but in case there's
1506                 dnl something I'm missing, I'll leave it in.
1507                 AC_CHECK_FUNCS(Perl_eval_pv)
1509                 AC_MSG_CHECKING(for old perl)
1510                 PERL_OLD=`$perlpath -e 'if($]<5.006){printf"yes\n";}else{printf"no\n";}'`
1512                 if test "x$PERL_OLD" = "xyes"; then
1513                         AC_DEFINE(OLD_PERL, 1, [Define if old perl is installed.])
1514                         AC_MSG_RESULT(yes)
1515                 else
1516                         AC_MSG_RESULT(no)
1517                 fi
1519                 if test "x$prefix" != "xNONE"; then
1520                         prefix=`eval echo $prefix`
1521                         PERL_MM_PARAMS="INSTALLDIRS=vendor PREFIX=$prefix"
1522                 fi
1524                 AC_ARG_WITH(perl-lib,
1525                 [AC_HELP_STRING([--with-perl-lib=[site|vendor|DIR]],
1526                         [specify where to install the Perl libraries for pidgin. Default is site.])],
1527                 [
1528                         if test "x$withval" = xsite; then
1529                                 PERL_MM_PARAMS=""
1530                         elif test "x$withval" = xvendor; then
1531                                 if test -z "`$perlpath -v | grep '5\.0'`"; then
1532                                         PERL_MM_PARAMS="INSTALLDIRS=vendor"
1533                                 else
1534                                         PERL_MM_PARAMS="INSTALLDIRS=vendor PREFIX=`perl -e 'use Config; print $Config{prefix}'`"
1535                                 fi
1536                         else
1537                                 PERL_MM_PARAMS="INSTALLDIRS=vendor PREFIX=$withval"
1538                         fi
1539                 ])
1541                 AC_SUBST(PERL_MM_PARAMS)
1543                 AC_MSG_CHECKING(for DynaLoader.a)
1544                 DYNALOADER_A=`echo $PERL_LDFLAGS | $perlpath -pe 's/^(.* )*([[^ ]]*DynaLoader\.a).*/\2/'`
1546                 dnl Don't check libperl.a if dynaloader.a wasn't found.
1547                 if test -n "$DYNALOADER_A"; then
1548                         AC_MSG_RESULT(yes)
1550                         dnl Find either libperl.a or libperl.so
1551                         AC_MSG_CHECKING(for libperl.a or libperl.so)
1552                         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 } } };'`
1553                         if test -z "$LIBPERL_A"; then
1554                                 AC_MSG_RESULT(no)
1555                                 DYNALOADER_A=
1556                         else
1557                                 AC_MSG_RESULT(yes)
1559                                 if test "$LIBPERL_A" = "-lperl"; then
1560                                         LIBPERL_A=
1561                                 fi
1562                         fi
1564                         PERL_LIBS=`echo $PERL_LIBS | $perlpath -pe 's/^(.* )*[[^ ]]*DynaLoader\.a/\1libperl_dynaloader.la/'`
1566                         if test -n "$LIBPERL_A"; then
1567                                 PERL_LIBS=`echo $PERL_LDFLAGS | $sedpath -e 's/-lperl /libperl_orig.la /' -e 's/-lperl$/libperl_orig.la$/'`
1568                         fi
1570                         AC_SUBST(DYNALOADER_A)
1571                         AC_SUBST(LIBPERL_A)
1572                 else
1573                         AC_MSG_RESULT(no)
1574                 fi
1575         fi
1576 else
1577         PERL_CFLAGS=
1578         PERL_LIBS=
1579         AM_CONDITIONAL(USE_PERL, false)
1582 if test "x$looked_for_perl" = "xyes" -a "x$enable_perl" = "xno" -a "x$force_deps" = "xyes"; then
1583         AC_MSG_ERROR([
1584 Perl development headers not found.
1585 Use --disable-perl if you do not need Perl scripting support.
1589 dnl #######################################################################
1590 dnl # SSL support
1591 dnl #
1592 dnl # Thanks go to Evolution for the checks.
1593 dnl #######################################################################
1595 AC_ARG_WITH(with-system-ssl-certs, [AC_HELP_STRING([--with-system-ssl-certs=<dir>], [directory containing system-wide SSL CA certificates])])
1597 SSL_CERTIFICATES_DIR=""
1598 if ! test -z "$with_system_ssl_certs" ; then
1599         if ! test -d "$with_system_ssl_certs" ; then
1600                 AC_MSG_ERROR([$with_system_ssl_certs does not exist, if this is the correct location please make sure that it exists.])
1601         fi
1602         SSL_CERTIFICATES_DIR="$with_system_ssl_certs"
1604 AC_SUBST(SSL_CERTIFICATES_DIR)
1605 AM_CONDITIONAL(INSTALL_SSL_CERTIFICATES, test "x$SSL_CERTIFICATES_DIR" = "x")
1607 dnl These two are inverses of each other <-- stolen from evolution!
1609 AC_ARG_ENABLE(gnutls,
1610         [  --enable-gnutls=[yes,no]  attempt to use GnuTLS for SSL support [default=yes]],
1611         [enable_gnutls="$enableval"],
1612         [enable_gnutls="yes"])
1614 AC_ARG_ENABLE(nss,
1615         [  --enable-nss=[yes,no,static]    attempt to use Mozilla libnss for SSL support [default=yes]],
1616         [enable_nss="$enableval"],
1617         [enable_nss="yes"])
1619 msg_ssl="None. MSN, Novell Groupwise, Yahoo! and Google Talk will not work without GnuTLS or NSS. OpenSSL is NOT usable!"
1620 looked_for_gnutls="no"
1621 dnl #
1622 dnl # Check for GnuTLS if it's specified.
1623 dnl #
1624 if test "x$enable_gnutls" != "xno"; then
1625         enable_gnutls="no"
1626         prefix=`eval echo $prefix`
1627         looked_for_gnutls="yes"
1629         AC_ARG_WITH(gnutls-includes,
1630                 [  --with-gnutls-includes=PREFIX   location of GnuTLS includes.],
1631                 [ with_gnutls_includes="$withval" ],
1632                 [ with_gnutls_includes="$prefix/include" ])
1634         have_gnutls_includes="no"
1636         if test "x$with_gnutls_includes" != "xno"; then
1637                 CPPFLAGS_save="$CPPFLAGS"
1639                 AC_MSG_CHECKING(for GnuTLS includes)
1640                 AC_MSG_RESULT("")
1642                 CPPFLAGS="$CPPFLAGS -I$with_gnutls_includes"
1643                 AC_CHECK_HEADERS(gnutls/gnutls.h, [ gnutls_includes="yes" ])
1644                 CPPFLAGS="$CPPFLAGS_save"
1646                 if test "x$gnutls_includes" != "xno" -a \
1647                         "x$gnutls_includes" != "x"; then
1648                         have_gnutls_includes="yes"
1650                         if test "x$with_gnutls_includes" != "xNONE/include"; then
1651                                 GNUTLS_CFLAGS="-I$with_gnutls_includes"
1652                         fi
1653                 else
1654                         GNUTLS_CFLAGS=""
1655                 fi
1656         else
1657                 AC_MSG_CHECKING(for GnuTLS includes)
1658                 AC_MSG_RESULT(no)
1659         fi
1661         AC_ARG_WITH(gnutls-libs,
1662                 [AC_HELP_STRING([--with-gnutls-libs=PREFIX], [location of GnuTLS libraries.])],
1663                 [ with_gnutls_libs="$withval" ])
1665         if test "x$with_gnutls_libs"     != "xno" -a \
1666                 "x$have_gnutls_includes" != "xno"; then
1668                 LIBS_save="$LIBS"
1670                 case $with_gnutls_libs in
1671                         ""|-L*) ;;
1672                         *) with_gnutls_libs="-L$with_gnutls_libs" ;;
1673                 esac
1675                 AC_CACHE_CHECK([for GnuTLS libraries], ac_cv_gnutls_libs,
1676                 [
1677                         LIBS="$LIBS $with_gnutls_libs -lgnutls -lgcrypt"
1678                         AC_TRY_LINK_FUNC(gnutls_init, ac_cv_gnutls_libs="yes", ac_cv_gnutls_libs="no")
1679                         LIBS="$LIBS_save"
1680                 ])
1682                 if test "x$ac_cv_gnutls_libs" != "xno"; then
1683                         AC_DEFINE(HAVE_GNUTLS, 1, [Define if you have GnuTLS])
1684                         AC_DEFINE(HAVE_SSL)
1685                         msg_gnutls="GnuTLS"
1686                         GNUTLS_LIBS="$with_gnutls_libs -lgnutls -lgcrypt"
1688                         enable_gnutls="yes"
1689                 else
1690                         GNUTLS_CFLAGS=""
1691                         GNUTLS_LIBS=""
1692                 fi
1693         else
1694                 AC_MSG_CHECKING(for GnuTLS libraries)
1695                 AC_MSG_RESULT(no)
1696         fi
1697 else
1698         GNUTLS_CFLAGS=""
1699         GNUTLS_LIBS=""
1702 AC_SUBST(GNUTLS_CFLAGS)
1703 AC_SUBST(GNUTLS_LIBS)
1705 if test "x$enable_gnutls" = "xyes"; then
1706         AC_MSG_CHECKING(for gnutls_priority_set_direct)
1707         LIBS_save="$LIBS"
1708         LIBS="$LIBS $GNUTLS_LIBS"
1709         CPPFLAGS_save="$CPPFLAGS"
1710         CPPFLAGS="$CPPFLAGS $GNUTLS_CFLAGS"
1711         AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <gnutls/gnutls.h>],
1712                                         [gnutls_session s; gnutls_priority_set_direct(s, NULL, NULL);])],
1713                        [AC_DEFINE([HAVE_GNUTLS_PRIORITY_FUNCS], 1,
1714                                   [Define if your gnutls has gnutls_priority_set_direct and friends])
1715                         AC_MSG_RESULT(yes)],
1716                        [AC_MSG_RESULT(no)])
1717         CPPFLAGS="$CPPFLAGS_save"
1718         LIBS="$LIBS_save"
1721 AM_CONDITIONAL(USE_GNUTLS, test "x$enable_gnutls" = "xyes")
1724 dnl #
1725 dnl # Check for NSS if it's specified, or if GnuTLS checks failed.
1726 dnl #
1727 looked_for_nss="no"
1728 if test "x$enable_nss" != "xno"; then
1729         looked_for_nss="yes"
1731         AC_ARG_WITH(nspr-includes,
1732                 [AC_HELP_STRING([--with-nspr-includes=PREFIX], [specify location of Mozilla nspr4 includes.])],
1733                 [with_nspr_includes="$withval"])
1735         AC_ARG_WITH(nspr-libs,
1736                 [AC_HELP_STRING([--with-nspr-libs=PREFIX], [specify location of Mozilla nspr4 libs.])],
1737                 [with_nspr_libs="$withval"])
1739         AC_ARG_WITH(nss-includes,
1740                 [AC_HELP_STRING([--with-nss-includes=PREFIX], [specify location of Mozilla nss3 includes.])],
1741                 [with_nss_includes="$withval"])
1743         AC_ARG_WITH(nss-libs,
1744                 [AC_HELP_STRING([--with-nss-libs=PREFIX], [specify location of Mozilla nss3 libs.])],
1745                 [with_nss_libs="$withval"])
1748         if test -n "$with_nspr_includes" || test -n "$with_nspr_libs" || \
1749            test -n "$with_nss_includes"  || test -n "$with_nss_libs"  ||
1750            test "x$enable_nss" = "xstatic"; then
1752                 nss_manual_check="yes"
1753         else
1754                 nss_manual_check="no"
1755         fi
1757         enable_nss="no"
1759         if test "x$nss_manual_check" = "xno"; then
1760                 if `$PKG_CONFIG --exists mozilla-nss`; then
1761                         PKG_CHECK_MODULES(NSS, mozilla-nss, [
1762                                 have_nss="yes"
1763                         ], [
1764                                 AC_MSG_RESULT(no)
1765                                 have_nss="no"
1766                         ])
1767                         mozilla_nspr="mozilla-nspr"
1768                         mozilla_nss="mozilla-nss"
1769                 elif `$PKG_CONFIG --exists nss`; then
1770                         PKG_CHECK_MODULES(NSS, nss, [
1771                                 have_nss="yes"
1772                         ], [
1773                                 AC_MSG_RESULT(no)
1774                                 have_nss="no"
1775                         ])
1776                         mozilla_nspr="nspr"
1777                         mozilla_nss="nss"
1778                 elif `$PKG_CONFIG --exists microb-engine-nss`; then
1779                         PKG_CHECK_MODULES(NSS, microb-engine-nss, [
1780                                 have_nss="yes"
1781                         ], [
1782                                 AC_MSG_RESULT(no)
1783                                 have_nss="no"
1784                         ])
1785                         mozilla_nspr="mozilla-nspr"
1786                         mozilla_nss="microb-engine-nss"
1787                 fi
1789                 if test "x$have_nss" = "xyes"; then
1791                         AC_DEFINE(HAVE_NSS, 1, [Define if you have Mozilla NSS])
1792                         AC_DEFINE(HAVE_SSL, 1, [Define if you have SSL])
1794                         msg_nss="Mozilla NSS"
1795                         enable_nss="yes"
1796                 else
1797                         nss_manual_check="yes"
1798                 fi
1799         fi
1801         if test "x$nss_manual_check" = "xyes"; then
1802                 mozilla_nss=""
1803                 have_nspr_includes="no"
1805                 if test "x$with_nspr_includes" != "xno"; then
1806                         CPPFLAGS_save=$CPPFLAGS
1808                         AC_MSG_CHECKING(for Mozilla nspr4 includes in $with_nspr_includes)
1809                         AC_MSG_RESULT("")
1811                         CPPFLAGS="$CPPFLAGS -I$with_nspr_includes"
1812                         AC_CHECK_HEADERS(nspr.h prio.h, [ moz_nspr_includes="yes" ])
1813                         CPPFLAGS=$CPPFLAGS_save
1815                         if test "x$moz_nspr_includes" != "xno" -a \
1816                                 "x$moz_nspr_includes" != "x"; then
1818                                 have_nspr_includes="yes"
1819                                 NSPR_CFLAGS="-I$with_nspr_includes"
1820                         fi
1821                 else
1822                         AC_MSG_CHECKING(for Mozilla nspr4 includes)
1823                         AC_MSG_RESULT(no)
1825                         enable_nss="no"
1826                 fi
1828                 have_nspr_libs="no"
1830                 if test "x$with_nspr_libs"     != "xno" -a \
1831                         "x$have_nspr_includes" != "xno"; then
1833                         CFLAGS_save=$CFLAGS
1834                         LDFLAGS_save=$LDFLAGS
1836                         if test "$enable_nss" = "static"; then
1837                                 if test -z "$with_nspr_libs"; then
1838                                         AC_MSG_ERROR(
1839                                                 [Static linkage requested, but path to nspr libraries not set.]
1840                                                 [Please specify the path to libnspr4.a]
1841                                                 [Example: --with-nspr-libs=/usr/lib])
1843                                         enable_nss="no"
1844                                 else
1845                                         nsprlibs="$LIBDL $with_nspr_libs/libplc4.a $with_nspr_libs/libplds4.a $with_nspr_libs/libnspr4.a $PTHREAD_LIB"
1846                                 fi
1847                         else
1848                                 nsprlibs="$LIBDL -lplc4 -lplds4 -lnspr4 $PTHREAD_LIB"
1849                         fi
1851                         AC_CACHE_CHECK([for Mozilla nspr libraries], ac_cv_moz_nspr_libs,
1852                         [
1853                                 LIBS_save=$LIBS
1854                                 CFLAGS="$CFLAGS $NSPR_CFLAGS"
1856                                 LIBS="$nsprlibs"
1858                                 if test "x$with_nspr_libs" != "x"; then
1859                                         LDFLAGS="$LDFLAGS -L$with_nspr_libs"
1860                                 else
1861                                         LDFLAGS="$LDFLAGS"
1862                                 fi
1864                                 AC_TRY_LINK_FUNC(PR_Init,
1865                                         [ac_cv_moz_nspr_libs="yes"],
1866                                         [ac_cv_moz_nspr_libs="no"])
1868                                 CFLAGS=$CFLAGS_save
1869                                 LDFLAGS=$LDFLAGS_save
1870                                 LIBS=$LIBS_save
1871                         ])
1873                         if test "x$ac_cv_moz_nspr_libs" != "xno"; then
1874                                 have_nspr_libs="yes"
1875                                 NSPR_LIBS="-L$with_nspr_libs $nsprlibs"
1876                         else
1877                                 NSPR_CFLAGS=""
1878                                 enable_nss="no"
1879                         fi
1880                 else
1881                         AC_MSG_CHECKING(for Mozilla nspr4 libraries)
1882                         AC_MSG_RESULT(no)
1883                 fi
1885                 have_nss_includes="no"
1887                 if test "x$with_nss_includes" != "xno" -a \
1888                                 "x$have_nspr_libs"    != "xno"; then
1890                         CPPFLAGS_save=$CPPFLAGS
1892                         AC_MSG_CHECKING(for Mozilla nss3 includes in $with_nss_includes)
1893                         AC_MSG_RESULT("")
1895                         if test "x$with_nspr_includes" != "x"; then
1896                                 CPPFLAGS="$CPPFLAGS -I$with_nspr_includes -I$with_nss_includes"
1897                         else
1898                                 CPPFLAGS="$CPPFLAGS -I$with_nss_includes"
1899                         fi
1901                         AC_CHECK_HEADERS(nss.h ssl.h smime.h,
1902                                 [moz_nss_includes="yes"],
1903                                 [moz_nss_includes="no"])
1905                         CPPFLAGS=$CPPFLAGS_save
1907                         if test "x$moz_nss_includes" = "xyes"; then
1908                                 have_nss_includes="yes"
1909                                 NSS_CFLAGS="-I$with_nss_includes"
1910                         else
1911                                 NSPR_CFLAGS=""
1912                                 NSPR_LIBS=""
1913                                 enable_nss="no"
1914                         fi
1915                 else
1916                         AC_MSG_CHECKING(for Mozilla nss3 includes)
1917                         AC_MSG_RESULT(no)
1918                         enable_nss="no"
1919                 fi
1921                 if test "x$with_nss_libs"     != "xno" -a \
1922                                 "x$have_nss_includes" != "xno"; then
1924                         LDFLAGS_save=$LDFLAGS
1926                         if test "$enable_nss" = "static"; then
1927                                 if test -z "$with_nss_libs"; then
1928                                         AC_MSG_ERROR(
1929                                                 [Static linkage requested, but path to nss libraries not set.]
1930                                                 [Please specify the path to libnss3.a]
1931                                                 [Example: --with-nspr-libs=/usr/lib/mozilla])
1932                                         enable_nss="no"
1933                                 else
1934                                         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"
1936                                         case "$host" in
1937                                                 *solaris*)
1938                                                         nsslibs="$nsslibs $with_nss_libs/libfreeb1.a"
1939                                                         ;;
1940                                         esac
1941                                 fi
1942                         else
1943                                 nsslibs="-lssl3 -lsmime3 -lnss3 -lsoftokn3"
1944                         fi
1946                         AC_CACHE_CHECK([for Mozilla nss libraries], ac_cv_moz_nss_libs,
1947                         [
1948                                 LIBS_save=$LIBS
1949                                 LDFLAGS="$LDFLAGS -L$with_nspr_libs -L$with_nss_libs"
1950                                 LIBS="$nsslibs $nsprlibs"
1952                                 AC_TRY_LINK_FUNC(NSS_Init,
1953                                         [ac_cv_moz_nss_libs="yes"],
1954                                         [ac_cv_moz_nss_libs="no"])
1956                                 if test "x$ac_cv_moz_nss_libs" = "xno"; then
1957                                         nsslibs="-lssl3 -lsmime3 -lnss3 -lsoftokn3"
1958                                         LDFLAGS="$LDFLAGS -L$with_nspr_libs -L$with_nss_libs" 
1959                                         LIBS="$LIBS $nsslibs"
1960                                         AC_TRY_LINK_FUNC(NSS_Init,
1961                                                 [ac_cv_moz_nss_libs="yes"],
1962                                                 [ac_cv_moz_nss_libs="no"])
1963                                 fi
1965                                 LDFLAGS=$LDFLAGS_save
1966                                 LIBS=$LIBS_save
1967                         ])
1969                         if test "x$ac_cv_moz_nss_libs" != "xno"; then
1970                                 AC_DEFINE(HAVE_NSS)
1971                                 AC_DEFINE(HAVE_SSL)
1973                                 NSS_LIBS="-L$with_nss_libs $nsslibs"
1975                                 if test "$enable_nss" = "static"; then
1976                                         msg_nss="Mozilla NSS (static)"
1977                                 else
1978                                         msg_nss="Mozilla NSS"
1979                                 fi
1981                                 enable_nss="yes"
1982                         else
1983                                 NSS_CFLAGS=""
1984                                 NSPR_CFLAGS=""
1985                                 NSPR_LIBS=""
1986                                 enable_nss="no"
1987                         fi
1988                 else
1989                         AC_MSG_CHECKING(for Mozilla nss libraries)
1990                         AC_MSG_RESULT(no)
1991                 fi
1993                 NSS_CFLAGS="$NSPR_CFLAGS $NSS_CFLAGS"
1994                 NSS_LIBS="$NSPR_LIBS $NSS_LIBS"
1995         fi
1997         AC_SUBST(NSS_CFLAGS)
1998         AC_SUBST(NSS_LIBS)
2001 AM_CONDITIONAL(USE_NSS, test "x$enable_nss" = "xyes")
2003 if test "x$msg_nss" != "x" -a "x$msg_gnutls" != "x"; then
2004         msg_ssl="$msg_nss and $msg_gnutls"
2005 elif test "x$msg_nss" != "x"; then
2006         msg_ssl=$msg_nss
2007 elif test "x$msg_gnutls" != "x"; then
2008         msg_ssl=$msg_gnutls
2009 elif test "x$looked_for_gnutls" = "xyes" -a "x$looked_for_nss" = "xyes" -a "x$force_deps" = "xyes" ; then
2010         AC_MSG_ERROR([
2011 Neither GnuTLS or NSS SSL development headers found.
2012 Use --disable-nss --disable-gnutls if you do not need SSL support.
2013 MSN, Novell Groupwise and Google Talk will not work without GnuTLS or NSS. OpenSSL is NOT usable!
2015 elif test "x$looked_for_gnutls" = "xyes" -a "x$force_deps" = "xyes" ; then
2016         AC_MSG_ERROR([
2017 GnuTLS SSL development headers not found.
2018 Use --disable-gnutls if you do not need SSL support.
2019 MSN, Novell Groupwise and Google Talk will not work without SSL support.
2021 elif test "x$looked_for_nss" = "xyes" -a "x$force_deps" = "xyes" ; then
2022         AC_MSG_ERROR([
2023 NSS SSL development headers not found.
2024 Use --disable-nss if you do not need SSL support.
2025 MSN, Novell Groupwise and Google Talk will not work without SSL support.
2029 dnl #######################################################################
2030 dnl # Check for Tcl
2031 dnl #######################################################################
2032 AC_ARG_ENABLE(tcl, [AC_HELP_STRING([--disable-tcl],
2033         [compile without Tcl scripting])], enable_tcl="$enableval", enable_tcl="yes")
2034 AC_ARG_WITH(tclconfig, [AC_HELP_STRING([--with-tclconfig=DIR],
2035         [directory containing tclConfig.sh])])
2037 if test "$enable_plugins" = no; then
2038         enable_tcl=no
2041 if test "$enable_tcl" = yes; then
2042         AC_MSG_CHECKING([for tclConfig.sh])
2043         TCLCONFIG=no
2044         TCLCONFIGDIRS="/usr/lib \
2045                         /usr/lib64 \
2046                         /usr/lib/tcl8.5 \
2047                         /usr/lib/tcl8.4 \
2048                         /usr/lib/tcl8.3 \
2049                         /usr/lib/tcl8.2 \
2050                         /usr/lib64/tcl8.5 \
2051                         /usr/lib64/tcl8.4 \
2052                         /System/Library/Tcl/8.3 \
2053                         /usr/local/lib"
2054         for dir in $with_tclconfig $TCLCONFIGDIRS; do
2055                 if test -f $dir/tclConfig.sh; then
2056                         TCLCONFIG=$dir/tclConfig.sh
2057                         AC_MSG_RESULT([yes ($TCLCONFIG)])
2058                 fi
2059         done
2060         if test "$TCLCONFIG" = "no"; then
2061                 AC_MSG_RESULT([no])
2062                 enable_tcl=no
2063                 if test "x$force_deps" = "xyes" ; then
2064                         AC_MSG_ERROR([
2065 Tcl development headers not found.
2066 Use --disable-tcl if you do not need Tcl scripting support.
2068                 fi
2069         else
2070                 . $TCLCONFIG
2071                 AC_MSG_CHECKING([Tcl version compatability])
2072                 if test "$TCL_MAJOR_VERSION" -ne 8 -o "$TCL_MINOR_VERSION" -lt 3; then
2073                         AC_MSG_RESULT([bad, $TCL_VERSION found but 8.3 or later required])
2074                         enable_tcl=no
2075                 else
2076                         AC_MSG_RESULT([ok, $TCL_VERSION])
2077                         eval "TCL_LIB_SPEC=\"$TCL_LIB_SPEC\""
2078                         AC_MSG_CHECKING([for Tcl linkability])
2079                         oldCPPFLAGS=$CPPFLAGS
2080                         CPPFLAGS="$CPPFLAGS $TCL_INCLUDE_SPEC -I$TCL_PREFIX/include"
2081                         oldLIBS=$LIBS
2082                         LIBS="$LIBS $TCL_LIB_SPEC"
2083                         AC_TRY_LINK([#include <tcl.h>],
2084                                 [Tcl_Interp *interp=NULL; Tcl_Init(interp)],
2085                                 [AC_MSG_RESULT([yes]);enable_tcl=yes],
2086                                 [AC_MSG_RESULT([no]);enable_tcl=no])
2087                         CPPFLAGS="$oldCPPFLAGS"
2088                         LIBS="$oldLIBS"
2089                 fi
2090         fi
2093 if test "$enable_tcl" = yes; then
2094         AM_CONDITIONAL(USE_TCL, true)
2095         TCL_LIBS=$TCL_LIB_SPEC
2096         AC_DEFINE(HAVE_TCL, [1], [Compile with support for the Tcl toolkit])
2097         AC_SUBST(TCL_LIBS)
2098         TCL_CFLAGS="$TCL_INCLUDE_SPEC -I$TCL_PREFIX/include"
2099         if test "x$GCC" = "xyes"; then
2100                 TCL_CFLAGS="$TCL_CFLAGS -fno-strict-aliasing"
2101         fi
2102         AC_SUBST(TCL_CFLAGS)
2103 else
2104         AM_CONDITIONAL(USE_TCL, false)
2107 dnl #######################################################################
2108 dnl # Check for Tk
2109 dnl #######################################################################
2110 AC_ARG_ENABLE(tk, [AC_HELP_STRING([--disable-tk],
2111         [compile without Tcl support for Tk])], enable_tk="$enableval", enable_tk="yes")
2112 AC_ARG_WITH(tkconfig, [AC_HELP_STRING([--with-tkconfig=DIR],
2113         [directory containing tkConfig.sh])])
2115 if test "$enable_tcl" = yes -a "$enable_tk" = yes; then
2116         AC_MSG_CHECKING([for tkConfig.sh])
2117         TKCONFIG=no
2118         TKCONFIGDIRS="/usr/lib \
2119                         /usr/lib64 \
2120                         /usr/lib/tk8.4 \
2121                         /usr/lib/tk8.3 \
2122                         /usr/lib/tk8.2 \
2123                         /usr/local/lib"
2124         for dir in $with_tkconfig $TKCONFIGDIRS; do
2125                 if test -f $dir/tkConfig.sh; then
2126                         TKCONFIG=$dir/tkConfig.sh
2127                         AC_MSG_RESULT([yes ($TKCONFIG)])
2128                 fi
2129         done
2130         if test "$TKCONFIG" = "no"; then
2131                 AC_MSG_RESULT([no])
2132                 enable_tk=no
2133                 if test "x$force_deps" = "xyes" ; then
2134                         AC_MSG_ERROR([
2135 Tk development headers not found.
2136 Use --disable-tk if you do not need Tk scripting support.
2138                 fi
2139         else
2140                 . $TKCONFIG
2141                 eval "TK_LIB_SPEC=\"$TK_LIB_SPEC\""
2142                 AC_MSG_CHECKING([for Tk linkability])
2143                 oldCPPFLAGS=$CPPFLAGS
2144                 CPPFLAGS="$CPPFLAGS $TCL_CFLAGS"
2145                 oldLIBS=$LIBS
2146                 LIBS="$LIBS $TCL_LIB_SPEC $TK_LIB_SPEC"
2147                 AC_TRY_LINK([#include <tk.h>],
2148                                 [Tcl_Interp *interp=NULL; Tcl_Init(interp); Tk_Init(interp);],
2149                                 [AC_MSG_RESULT([yes]);enable_tk=yes],
2150                                 [AC_MSG_RESULT([no]);enable_tk=no])
2151                 CPPFLAGS="$oldCPPFLAGS"
2152                 LIBS="$oldLIBS"
2153         fi
2154 else
2155         enable_tk=no
2158 if test "$enable_tk" = yes; then
2159         AM_CONDITIONAL(USE_TK, true)
2160         AC_DEFINE(HAVE_TK, [1], [Compile with support for the Tk toolkit])
2161         TK_LIBS=$TK_LIB_SPEC
2162         AC_SUBST(TK_LIBS)
2163 else
2164         AM_CONDITIONAL(USE_TK, false)
2167 if test "$ac_cv_cygwin" = yes ; then
2168         LDADD="$LDADD -static"
2169         AC_DEFINE(DEBUG, 1, [Define if debugging is enabled.])
2172 AC_SUBST(DEBUG_CFLAGS)
2173 AC_SUBST(LDADD)
2174 AC_SUBST(LIBS)
2176 if test "x$enable_plugins" = "xyes" ; then
2177         AC_DEFINE(PURPLE_PLUGINS, 1, [Define if plugins are enabled.])
2178         AM_CONDITIONAL(PLUGINS, true)
2179         PLUGINS_DEFINE="#define PURPLE_PLUGINS 1"
2180 else
2181         AM_CONDITIONAL(PLUGINS, false)
2182         PLUGINS_DEFINE="#undef PURPLE_PLUGINS"
2184 AC_SUBST(PLUGINS_DEFINE)
2186 dnl #######################################################################
2187 dnl # Check for Cyrus-SASL (for Jabber)
2188 dnl #######################################################################
2189 dnl AC_CHECK_SIZEOF(short)
2190 AC_CHECK_FUNCS(snprintf connect)
2191 AC_SUBST(SASL_LIBS)
2192 AC_ARG_ENABLE(cyrus-sasl, AC_HELP_STRING([--enable-cyrus-sasl], [enable Cyrus SASL support for jabberd]), enable_cyrus_sasl=$enableval, enable_cyrus_sasl=no)
2193 if test "x$enable_cyrus_sasl" = "xyes" ; then
2194         AC_CHECK_LIB(sasl2, sasl_client_init, [
2195                         AC_DEFINE(HAVE_CYRUS_SASL, [1], [Define to 1 if Cyrus SASL is present])
2196                         SASL_LIBS=-"lsasl2"
2197                 ], [
2198                         AC_ERROR(Cyrus SASL library not found)
2199                 ])
2202 dnl #######################################################################
2203 dnl # Check for Kerberos (for Zephyr)
2204 dnl #######################################################################
2205 AC_DEFINE(ZEPHYR_INT32, long, [Size of an int32.])
2206 AC_SUBST(KRB4_CFLAGS)
2207 AC_SUBST(KRB4_LDFLAGS)
2208 AC_SUBST(KRB4_LIBS)
2209 if test "$kerberos" != "no" ; then
2210         if test "$kerberos" != "yes" ; then
2211                 KRB4_CFLAGS="-I${kerberos}/include"
2212                 if test -d "$kerberos/include/kerberosIV" ; then
2213                         KRB4_CFLAGS="$KRB4_CFLAGS -I${kerberos}/include/kerberosIV"
2214                 fi
2215                 KRB4_LDFLAGS="-L${kerberos}/lib"
2216         elif test -d /usr/local/include/kerberosIV ; then
2217                 KRB4_CFLAGS="-I/usr/local/include/kerberosIV"
2218         elif test -d /usr/include/kerberosIV ; then
2219                 KRB4_CFLAGS="-I/usr/include/kerberosIV"
2220         fi
2221         AC_DEFINE(ZEPHYR_USES_KERBEROS, 1, [Define if kerberos should be used in Zephyr.])
2223         orig_LDFLAGS="$LDFLAGS"
2224         LDFLAGS="$LDFLAGS $KRB4_LDFLAGS"
2225         AC_CHECK_LIB(krb4, krb_rd_req,
2226                         [KRB4_LIBS="-lkrb4 -ldes425 -lkrb5 -lk5crypto -lcom_err"],
2227                         [AC_CHECK_LIB(krb, krb_rd_req,
2228                                 [KRB4_LIBS="-lkrb -ldes"],
2229                                 [AC_ERROR(Kerberos 4 libraries not found)],
2230                                 -ldes)],
2231                         -ldes425 -lkrb5 -lk5crypto -lcom_err)
2232         orig_LIBS="$LIBS"
2233         LIBS="$LIBS $KRB4_LIBS"
2234         AC_CHECK_FUNCS(krb_set_key krb_rd_req krb_get_lrealm)
2235         AC_CHECK_FUNCS(krb_get_err_text krb_log)
2236         LIBS="$orig_LIBS"
2237         LDFLAGS="$orig_LDFLAGS"
2240 dnl #######################################################################
2241 dnl # Check for external libzephyr
2242 dnl #######################################################################
2243 AC_SUBST(ZEPHYR_CFLAGS)
2244 AC_SUBST(ZEPHYR_LDFLAGS)
2245 AC_SUBST(ZEPHYR_LIBS)
2246 if test "$zephyr" != "no" ; then
2247         if test "$zephyr" != "yes" ; then
2248                 ZEPHYR_CFLAGS="-I${zephyr}/include"
2249                 ZEPHYR_LDFLAGS="-L${zephyr}/lib"
2250         elif test -d /usr/athena/include/zephyr ; then
2251                 ZEPHYR_CFLAGS="-I/usr/athena/include"
2252         elif test -d /usr/include/zephyr ; then
2253                 ZEPHYR_CFLAGS="-I/usr/include"
2254         elif test -d /usr/local/include/zephyr ; then
2255                 ZEPHYR_CFLAGS="-I/usr/local/include"
2256         fi
2257         AC_DEFINE(LIBZEPHYR_EXT, 1 , [Define if external libzephyr should be used.])
2258         AM_CONDITIONAL(EXTERNAL_LIBZEPHYR, test "x$zephyr" != "xno")
2259         orig_LDFLAGS="$LDFLAGS"
2260         LDFLAGS="$LDFLAGS $ZEPHYR_LDFLAGS"
2261         AC_CHECK_LIB(zephyr, ZInitialize,
2262                 [ZEPHYR_LIBS="-lzephyr"],
2263                 [AC_ERROR(Zephyr libraries not found)],
2264                 -lzephyr)
2265         orig_LIBS="$LIBS"
2266         LIBS="$orig_LIBS"
2267         LDFLAGS="$orig_LDFLAGS"
2270 AC_MSG_CHECKING(for me pot o' gold)
2271 AC_MSG_RESULT(no)
2272 AC_CHECK_FUNCS(gethostid lrand48)
2273 AC_CHECK_FUNCS(memcpy memmove random strchr strerror vprintf)
2274 AC_CHECK_HEADERS(malloc.h paths.h sgtty.h stdarg.h sys/cdefs.h)
2275 AC_CHECK_HEADERS(sys/file.h sys/filio.h sys/ioctl.h sys/msgbuf.h)
2276 AC_CHECK_HEADERS(sys/select.h sys/uio.h sys/utsname.h sys/wait.h)
2277 AC_CHECK_HEADERS(termios.h)
2279 # sys/sysctl.h on OpenBSD 4.2 requires sys/param.h
2280 # sys/sysctl.h on FreeBSD requires sys/types.h
2281 AC_CHECK_HEADERS(sys/param.h)
2282 AC_CHECK_HEADERS(sys/sysctl.h, [], [],
2283         [[
2284                 #include <sys/types.h>
2285                 #ifdef HAVE_PARAM_H
2286                 # include <sys/param.h>
2287                 #endif
2288         ]])
2290 AC_CHECK_HEADERS(sys/socket.h)
2291 AC_VAR_TIMEZONE_EXTERNALS
2293 AC_CACHE_CHECK(for tm_gmtoff in struct tm, ac_cv_struct_tm_gmtoff,
2294         AC_TRY_COMPILE([
2295                 #include <time.h>
2296         ], [
2297                 struct tm tm;
2298                 tm.tm_gmtoff = 1;
2299         ], ac_cv_struct_tm_gmtoff=yes, ac_cv_struct_tm_gmtoff=no))
2300 if test $ac_cv_struct_tm_gmtoff = yes; then
2301         AC_DEFINE(HAVE_TM_GMTOFF, 1, [Define if you have a tm_gmtoff member in struct tm])
2304 AC_CACHE_CHECK([whether va_lists can be copied by value], ac_cv_va_val_copy,[
2305         AC_TRY_RUN([#include <stdarg.h>
2306 #include <stdlib.h>
2307         void f (int i, ...) {
2308         va_list args1, args2;
2309         va_start (args1, i);
2310         args2 = args1;
2311         if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
2312           exit (1);
2313         va_end (args1); va_end (args2);
2314         }
2315         int main() {
2316           f (0, 42);
2317           return 0;
2318         }],
2319         [ac_cv_va_val_copy=yes],
2320         [ac_cv_va_val_copy=no],
2321         [ac_cv_va_val_copy=yes])
2324 if test "x$ac_cv_va_val_copy" = "xno"; then
2325         AC_DEFINE(VA_COPY_AS_ARRAY, 1, ['va_lists' cannot be copied as values])
2328 dnl #######################################################################
2329 dnl # Check for check
2330 dnl #######################################################################
2331 PKG_CHECK_MODULES(CHECK, [check >= 0.9.4], , [AC_MSG_RESULT([no, testing is disabled])])
2332 AM_CONDITIONAL(HAVE_CHECK, [test "x$CHECK_LIBS" != "x"])
2333 AC_SUBST(CHECK_CFLAGS)
2334 AC_SUBST(CHECK_LIBS)
2336 dnl #######################################################################
2337 dnl # Disable pixmap installation
2338 dnl #######################################################################
2339 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)
2341 AM_CONDITIONAL(INSTALL_PIXMAPS, test "x$enable_pixmaps" = "xyes")
2343 dnl #######################################################################
2344 dnl # Disable installation of translation files
2345 dnl #######################################################################
2346 AC_ARG_ENABLE(nls, AC_HELP_STRING([--disable-nls], [disable installation of translation files]), enable_i18n="$enableval", enable_i18n=yes)
2348 AM_CONDITIONAL(INSTALL_I18N, test "x$enable_i18n" = "xyes")
2350 dnl #######################################################################
2351 dnl # Check for Doxygen and dot (part of GraphViz)
2352 dnl #######################################################################
2353 AC_ARG_ENABLE(doxygen,
2354         [AC_HELP_STRING([--disable-doxygen],
2355                 [disable documentation with doxygen])],
2356         enable_doxygen="$enableval", enable_doxygen="yes")
2357 AC_ARG_ENABLE(dot,
2358         [AC_HELP_STRING([--disable-dot],
2359                 [disable graphs in doxygen via 'dot'])],
2360         enable_dot="$enableval", enable_dot="yes")
2361 AC_ARG_ENABLE(devhelp,
2362         [AC_HELP_STRING([--disable-devhelp],
2363                 [disable building index for devhelp documentation browser])],
2364         enable_devhelp="$enableval", enable_devhelp="yes")
2366 if test "x$enable_doxygen" = xyes; then
2367         AC_CHECK_PROG(DOXYGEN, doxygen, true, false)
2368         if test $DOXYGEN = false; then
2369                 AC_MSG_WARN([*** Doxygen not found, docs will not be available])
2370                 enable_doxygen="no"
2371         else
2372                 AC_DEFINE_UNQUOTED(HAVE_DOXYGEN, 1, [whether or not we have doxygen])
2374                 if test "x$enable_dot" = "xyes"; then
2375                         AC_CHECK_PROG(DOT, dot, true, false)
2377                         if test $DOT = false; then
2378                                 enable_dot="no";
2379                                 AC_MSG_WARN([*** GraphViz dot not found, docs will not have graphs])
2380                         else
2381                                 AC_DEFINE_UNQUOTED(HAVE_DOT, 1, [whether or not we have dot])
2382                         fi
2383                 fi
2385                 if test "x$enable_devhelp" = "xyes"; then
2386                         AC_CHECK_PROG(XSLTPROC, xsltproc, true, false)
2388                         if test $XSLTPROC = false; then
2389                                 enable_devhelp="no";
2390                                 AC_MSG_WARN([*** xsltproc not found; devhelp index will not be created])
2391                         else
2392                                 AC_DEFINE_UNQUOTED(HAVE_XSLTPROC, 1, [whether or not we have xsltproc for devhelp index])
2393                         fi
2394                 fi
2395         fi
2396 else
2397         enable_dot="no"
2398         enable_devhelp="no"
2401 AC_SUBST(enable_doxygen)
2402 AC_SUBST(enable_dot)
2403 AC_SUBST(enable_devhelp)
2404 AM_CONDITIONAL(HAVE_DOXYGEN, test "x$enable_doxygen" = "xyes")
2405 AM_CONDITIONAL(HAVE_XSLTPROC, test "x$enable_devhelp" = "xyes")
2407 AC_ARG_ENABLE(debug, [AC_HELP_STRING([--enable-debug],
2408         [compile with debugging support])], , enable_debug=no)
2410 if test "x$enable_debug" = "xyes" ; then
2411         AC_DEFINE(DEBUG, 1, [Define if debugging is enabled.])
2414 AM_CONDITIONAL(PURPLE_AVAILABLE, true)
2416 AC_OUTPUT([Makefile
2417                    Doxyfile
2418                    doc/Makefile
2419                    doc/pidgin.1
2420                    doc/finch.1
2421                    m4macros/Makefile
2422                    pidgin.apspec
2423                    pidgin/Makefile
2424                    pidgin/pidgin.pc
2425                    pidgin/pidgin-uninstalled.pc
2426                    pidgin/pixmaps/Makefile
2427                    pidgin/pixmaps/emotes/default/24/Makefile
2428                    pidgin/pixmaps/emotes/none/Makefile
2429                    pidgin/pixmaps/emotes/small/16/Makefile
2430                    pidgin/plugins/Makefile
2431                    pidgin/plugins/cap/Makefile
2432                    pidgin/plugins/gestures/Makefile
2433                    pidgin/plugins/gevolution/Makefile
2434                    pidgin/plugins/musicmessaging/Makefile
2435                    pidgin/plugins/perl/Makefile
2436                    pidgin/plugins/perl/common/Makefile.PL
2437                    pidgin/plugins/ticker/Makefile
2438                    libpurple/example/Makefile
2439                    libpurple/gconf/Makefile
2440                    libpurple/purple.pc
2441                    libpurple/purple-uninstalled.pc
2442                    libpurple/plugins/Makefile
2443                    libpurple/plugins/mono/Makefile
2444                    libpurple/plugins/mono/api/Makefile
2445                    libpurple/plugins/mono/loader/Makefile
2446                    libpurple/plugins/perl/Makefile
2447                    libpurple/plugins/perl/common/Makefile.PL
2448                    libpurple/plugins/ssl/Makefile
2449                    libpurple/plugins/tcl/Makefile
2450                    libpurple/Makefile
2451                    libpurple/protocols/Makefile
2452                    libpurple/protocols/bonjour/Makefile
2453                    libpurple/protocols/gg/Makefile
2454                    libpurple/protocols/irc/Makefile
2455                    libpurple/protocols/jabber/Makefile
2456                    libpurple/protocols/msn/Makefile
2457                    libpurple/protocols/msnp9/Makefile
2458                    libpurple/protocols/myspace/Makefile
2459                    libpurple/protocols/novell/Makefile
2460                    libpurple/protocols/null/Makefile
2461                    libpurple/protocols/oscar/Makefile
2462                    libpurple/protocols/qq/Makefile
2463                    libpurple/protocols/sametime/Makefile
2464                    libpurple/protocols/silc/Makefile
2465                    libpurple/protocols/silc10/Makefile
2466                    libpurple/protocols/simple/Makefile
2467                    libpurple/protocols/toc/Makefile
2468                    libpurple/protocols/yahoo/Makefile
2469                    libpurple/protocols/zephyr/Makefile
2470                    libpurple/tests/Makefile
2471                    libpurple/purple.h
2472                    libpurple/version.h
2473                    share/sounds/Makefile
2474                    share/ca-certs/Makefile
2475                    finch/finch.pc
2476                    finch/Makefile
2477                    finch/libgnt/Makefile
2478                    finch/libgnt/gnt.pc
2479                    finch/libgnt/wms/Makefile
2480                    finch/plugins/Makefile
2481                    po/Makefile.in
2482                    pidgin.spec
2483                   ])
2485 echo
2486 echo $PACKAGE $VERSION
2488 echo
2489 echo Build GTK+ 2.x UI............. : $enable_gtkui
2490 echo Build console UI.............. : $enable_consoleui
2491 echo Build for X11................. : $with_x
2492 echo
2493 echo Enable Gestures............... : $enable_gestures
2494 echo Protocols to build dynamically : $DYNAMIC_PRPLS
2495 echo Protocols to link statically.. : $STATIC_PRPLS
2496 echo
2497 echo Build with GStreamer support.. : $enable_gst
2498 echo Build with D-Bus support...... : $enable_dbus
2499 if test "x$enable_dbus" = "xyes" ; then
2500         eval eval echo D-Bus services directory...... : $DBUS_SERVICES_DIR
2502 echo Build with NetworkManager..... : $enable_nm
2503 echo SSL Library/Libraries......... : $msg_ssl
2504 if test "x$SSL_CERTIFICATES_DIR" != "x" ; then
2505         eval eval echo SSL CA certificates directory. : $SSL_CERTIFICATES_DIR
2507 echo Build with Cyrus SASL support. : $enable_cyrus_sasl
2508 echo Use kerberos 4 with zephyr.... : $kerberos
2509 echo Use external libzephyr........ : $zephyr
2510 echo Install pixmaps............... : $enable_pixmaps
2511 echo Install translations.......... : $enable_i18n
2512 echo Has you....................... : yes
2513 echo
2514 echo Use XScreenSaver Extension.... : $enable_screensaver
2515 echo Use X Session Management...... : $enable_sm
2516 echo Use startup notification...... : $enable_startup_notification
2517 echo Build with GtkSpell support... : $enable_gtkspell
2518 echo
2519 echo Build with plugin support..... : $enable_plugins
2520 echo Build with Mono support....... : $enable_mono
2521 echo Build with Perl support....... : $enable_perl
2522 echo Build with Tcl support........ : $enable_tcl
2523 echo Build with Tk support......... : $enable_tk
2524 echo
2525 echo Print debugging messages...... : $enable_debug
2526 echo
2527 eval eval echo Pidgin will be installed in $bindir.
2528 if test "x$pidginpath" != "x" ; then
2529         echo Warning: You have an old copy of Pidgin at $pidginpath.
2531 if test "x$enable_pixmaps" = "xno" ; then
2532         echo
2533         echo Warning: You have disabled the installation of pixmap data, but Pidgin
2534         echo still requires installed pixmaps.  Be sure you know what you\'re doing.
2536 echo
2537 echo configure complete, now type \'make\'
2538 echo