[gaim-migrate @ 4850]
[pidgin-git.git] / configure.ac
blob41f955b0326491fce9f66fd8ee57384046a30b22
1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(src/main.c)
3 AM_CONFIG_HEADER(config.h)
4 AM_INIT_AUTOMAKE([gaim], [0.60cvs])
6 AC_PREREQ([2.50])
8 AC_PATH_PROG(sedpath, sed)
10 dnl Checks for programs.
11 AC_PROG_CC
12 AC_DISABLE_STATIC
13 AM_PROG_LIBTOOL
14 LIBTOOL="$LIBTOOL --silent"
15 AC_PROG_INSTALL
18 ALL_LINGUAS="bg cs da de es fi fr hu it ja ko nl pl ro ru sk sv zh_CN zh_TW"
19 AM_GNU_GETTEXT_VERSION(0.10.40)
20 AM_GNU_GETTEXT
22 AC_CYGWIN
25 dnl Checks for header files.
26 AC_HEADER_STDC
27 AC_HEADER_SYS_WAIT
28 AC_CHECK_HEADERS(fcntl.h sys/time.h unistd.h locale.h signal.h)
30 dnl Checks for typedefs, structures, and compiler characteristics.
31 AC_C_CONST
32 AC_STRUCT_TM
34 dnl Checks for library functions.
35 AC_TYPE_SIGNAL
36 AC_FUNC_STRFTIME
37 AC_CHECK_FUNCS(strdup strstr atexit)
38 dnl Checks for getopt in standard library
39 AC_CHECK_FUNCS(getopt_long , ,
40 AC_LIBOBJ(getopt)
41 AC_LIBOBJ(getopt1)) 
44 dnl Check for inet_aton
45 AC_CHECK_FUNC(inet_aton, , [AC_CHECK_LIB(resolv, inet_aton, , 
46                                          [AC_ERROR(inet_aton not found)])])
47 AC_CHECK_LIB(nsl, gethostent)
48 AC_CHECK_FUNC(socket, , 
49               [AC_CHECK_LIB(socket, socket, , [AC_ERROR([socket not found])])])
50 dnl If all goes well, by this point the previous two checks will have
51 dnl pulled in -lsocket and -lnsl if we need them.
52 AC_CHECK_FUNC(getaddrinfo, [AC_DEFINE([HAVE_GETADDRINFO], [1],
53                                       [Define to 1 if you have the getaddrinfo function.])],
54               [AC_CHECK_LIB(socket, getaddrinfo,
55                             [AC_DEFINE([HAVE_GETADDRINFO]) LIBS="-lsocket -lsnl $LIBS"], , , -lnsl)])
57 dnl Check for socklen_t (in Unix98)
58 AC_MSG_CHECKING(for socklen_t)
59 AC_TRY_COMPILE([
60         #include <sys/types.h>
61         #include <sys/socket.h>
62         socklen_t x;
63 ], [],
65         AC_MSG_RESULT(yes)
66 ], [
67         AC_TRY_COMPILE([
68                 #include <sys/types.h>
69                 #include <sys/socket.h>
70                 int accept(int, struct sockaddr *, size_t *);
71         ], [], [
72                 AC_MSG_RESULT(size_t)
73                 AC_DEFINE(socklen_t, size_t, [socklen_t size])
74         ], [
75                 AC_MSG_RESULT(int)
76                 AC_DEFINE(socklen_t, int, [socklen_t size])
77         ])
80 dnl This is a bad, bad hack.  I am a bad, bad man.
81 CFLAGS="$CFLAGS -I/opt/include -I\$(top_srcdir)"
83 AC_ARG_ENABLE(distrib,,,enable_distrib=no)
84 AM_CONDITIONAL(DISTRIB, test "x$enable_distrib" = "xyes")
85 AC_ARG_ENABLE(multi,   [  --disable-multi         disable multiple connections],,enable_multi=yes)
86 AC_ARG_ENABLE(prpls,   [  --disable-prpls         don't build dynamic protocol plugins],,enable_prpls=yes)
87 AC_ARG_WITH(static-prpls,    [  --with-static-prpls     link in certain protocols statically],[STATIC_PRPLS=`echo $withval | $sedpath 's/,/ /g'`],STATIC_PRPLS="")
88 if test "x$STATIC_PRPLS" = "xall" ; then
89         STATIC_PRPLS="gg irc jabber msn napster oscar toc yahoo zephyr"
91 AC_SUBST(STATIC_PRPLS)
92 STATIC_LINK_LIBS=
93 extern_init=
94 load_proto=
95 for i in $STATIC_PRPLS ; do
96         STATIC_LINK_LIBS="$STATIC_LINK_LIBS protocols/$i/lib$i.a"
97         extern_init="$extern_init extern void ${i}_init(struct prpl *);"
98         load_proto="$load_proto load_protocol(${i}_init);"
99         case $i in
100                 gg) static_gg=yes ;;
101                 irc) static_irc=yes ;;
102                 jabber) static_jabber=yes ;;
103                 msn) static_msn=yes ;;
104                 napster) static_napster=yes ;;
105                 oscar) static_oscar=yes ;;
106                 toc) static_toc=yes ;;
107                 yahoo) static_yahoo=yes ;;
108                 zephyr) static_zephyr=yes ;;
109                 *) echo "Invalid static protocol $i!!" ; exit ;;
110         esac
111 done
112 AM_CONDITIONAL(STATIC_GG, test "x$static_gg" = "xyes")
113 AM_CONDITIONAL(STATIC_IRC, test "x$static_irc" = "xyes")
114 AM_CONDITIONAL(STATIC_JABBER, test "x$static_jabber" = "xyes")
115 AM_CONDITIONAL(STATIC_MSN, test "x$static_msn" = "xyes")
116 AM_CONDITIONAL(STATIC_NAPSTER, test "x$static_napster" = "xyes")
117 AM_CONDITIONAL(STATIC_OSCAR, test "x$static_oscar" = "xyes")
118 AM_CONDITIONAL(STATIC_TOC, test "x$static_toc" = "xyes")
119 AM_CONDITIONAL(STATIC_YAHOO, test "x$static_yahoo" = "xyes")
120 AM_CONDITIONAL(STATIC_ZEPHYR, test "x$static_zephyr" = "xyes")
121 AC_SUBST(STATIC_LINK_LIBS)
122 AC_DEFINE_UNQUOTED(STATIC_PROTO_INIT, $extern_init void static_proto_init() { $load_proto },
123         [Loads static protocol plugin module initialization functions.])
125 AC_ARG_ENABLE(audio,   [  --disable-audio         compile without libao/libaudiofile for sound playing],,enable_audio=yes)
126 AC_ARG_ENABLE(plugins, [  --disable-plugins       compile without plugin support],,enable_plugins=yes)
127 AC_ARG_ENABLE(perl,    [  --disable-perl          compile without perl scripting],,enable_perl=yes)
128 AC_ARG_ENABLE(gtkspell, [  --disable-gtkspell      compile without GtkSpell automatic spell checking],,enable_gtkspell=yes)
129 AC_ARG_ENABLE(debug,   [  --enable-debug          compile with debugging support],,enable_debug=no)
130 AC_ARG_ENABLE(screensaver,   [  --disable-screensaver   compile without X screensaver extension],,enable_xss=yes)
131 AC_ARG_ENABLE(sm,      [  --disable-sm            compile without X session management support],,enable_sm=yes)
132 AC_ARG_WITH(krb4,      [  --with-krb4=PREFIX      Compile Zephyr plugin with Kerberos 4 support],kerberos="$withval",kerberos="no")
134 if test "$enable_debug" = yes ; then
135         CFLAGS="$CFLAGS -Wall -g3"
136         AC_DEFINE(DEBUG, 1, [Define if debugging is enabled.])
139 AM_PATH_GLIB_2_0(2.0.0,,AC_MSG_ERROR([
140 *** GLib 2.0 is required to build Gaim; please make sure you have the GLib
141 *** development headers installed. The latest version of GLib is
142 *** always available at http://www.gtk.org/.]))
143 AM_PATH_GTK_2_0(2.0.0,,AC_MSG_ERROR([
144 *** GTK+ 2.0 is required to build Gaim; please make sure you have the GTK+
145 *** development headers installed. The latest version of GTK+ is
146 *** always available at http://www.gtk.org/.]))
148 AC_PATH_PROG(gaimpath, gaim)
149 CFLAGS="$CFLAGS $GTK_CFLAGS -DGTK_ENABLE_BROKEN"
151 AC_PATH_X
153 dnl Check for XScreenSaver
154 if test "x$enable_xss" = "xyes" ; then
155         old_LIBS="$LIBS"
156         LIBS="$LIBS $GTK_LIBS -L$x_libraries"
157         XSS_LIBS="no"
158         XSS_HEADERS="no"
159         AC_CHECK_LIB(Xext, XScreenSaverRegister,[XSS_LIBS="-L$x_libraries"],[],[-lX11 -lXext -lm])
160         AC_CHECK_LIB(Xss, XScreenSaverRegister,[XSS_LIBS="-L$x_libraries -lXss"],[],[-lX11 -lXext -lm])
161         if test \! "$XSS_LIBS" = "no"; then
162                 AC_TRY_COMPILE([
163 #include <X11/extensions/scrnsaver.h>
164                                 ],[],[enable_xss=no],[
165                                 AC_DEFINE(USE_SCREENSAVER, 1, [Define if we're using XScreenSaver.])
166                                 ])
167         else
168                XSS_LIBS=""
169                enable_xss=no
170         fi
171         LIBS="$old_LIBS"
172 else
173         XSS_LIBS=""
174         enable_xss=no
176 AC_SUBST(XSS_LIBS)
179 dnl Check for X session management libs
180 if test "x$enable_sm" = "xyes"; then
181         enable_sm=no
182         AC_CHECK_LIB(SM, SmcSaveYourselfDone, found_sm_lib=true, , [-L$x_libraries -lICE])
183         if test "$found_sm_lib" = "true"; then
184                 AC_CHECK_HEADERS(X11/SM/SMlib.h, SM_LIBS="-L$x_libraries -lSM -lICE" enable_sm=yes)
185         fi
186 else
187         SM_LIBS=""
188         enable_sm=no
190 AC_SUBST(SM_LIBS)
191 if test "$enable_sm" = "yes"; then
192         AC_DEFINE(USE_SM, 1, [Define if we're using X Session Management.])
196 AC_DEFUN(GC_TM_GMTOFF,
197 [AC_REQUIRE([AC_STRUCT_TM])dnl
198 AC_CACHE_CHECK([for tm_gmtoff in struct tm], ac_cv_struct_tm_gmtoff,
199 [AC_TRY_COMPILE([#include <sys/types.h>
200 #include <$ac_cv_struct_tm>], [struct tm tm; tm.tm_gmtoff;],
201   ac_cv_struct_tm_gmtoff=yes, ac_cv_struct_tm_gmtoff=no)])
202 if test "$ac_cv_struct_tm_gmtoff" = yes; then
203   AC_DEFINE(HAVE_TM_GMTOFF, 1, [tm_gmtoff is available.])
207 GC_TM_GMTOFF
211 dnl This was taken straight from X-Chat.
212 dnl X-Chat is the greatest application ever, not only
213 dnl because it's a rocking IRC client but also because
214 dnl it's very easy to learn from.
215 if test "$enable_perl" = yes ; then
216         AC_PATH_PROG(perlpath, perl)
217         AC_MSG_CHECKING(for Perl compile flags)
218         PERL_CFLAGS=`$perlpath -MExtUtils::Embed -e ccopts 2>/dev/null`
219         if test "_$PERL_CFLAGS" = _ ; then
220                 AC_MSG_RESULT([not found, building without perl.])
221                 enable_perl = no
222         else
223                 PERL_LIBS=`$perlpath -MExtUtils::Embed -e ldopts 2>/dev/null |$sedpath 's/-lgdbm //'`
224                 PERL_LIBS=`echo $PERL_LIBS |$sedpath 's/-ldb //'`
225                 PERL_LIBS=`echo $PERL_LIBS |$sedpath 's/-lndbm //'`
226                 if test "$system" = "Linux"; then
227                         PERL_LIBS=`echo $PERL_LIBS |$sedpath 's/-lnsl //'`
228                         PERL_LIBS=`echo $PERL_LIBS |$sedpath 's/-lposix //'`
229                 fi
230                 PERL_LIBS=`echo $PERL_LIBS |$sedpath 's/-lc //'`
231                 AC_MSG_RESULT(ok)
233                 oldLIBS=$LIBS
234                 LIBS="$LIBS $PERL_LIBS"
235                 AC_MSG_CHECKING(for libperl)
236                 AC_CHECK_FUNCS(perl_run, [], enable_perl=no)
237                 LIBS=$oldLIBS
238         fi
241 if test "$enable_perl" = yes ; then
242         AC_SUBST(PERL_CFLAGS)
243         AC_SUBST(PERL_LIBS)
244         AC_DEFINE(USE_PERL, 1, [Define if Perl is enabled.])
246         dnl This is almost definitely wrong, but in case there's
247         dnl something I'm missing, I'll leave it in.
248         AC_CHECK_FUNCS(Perl_eval_pv)
250         AC_MSG_CHECKING(for old perl)
251         PERL_OLD=`$perlpath -e 'if($]<5.006){printf"yes\n";}else{printf"no\n";}'`
253         if test "$PERL_OLD" = "yes"; then
254                 AC_DEFINE(OLD_PERL, 1, [Define if old perl is installed.])
255                 AC_MSG_RESULT(yes)
256         else
257                 AC_MSG_RESULT(no)
258         fi
259 else
260         PERL_CFLAGS=
261         PERL_LIBS=
264 dnl Thanks, Evan.
265 if test "$enable_gtkspell" = yes ; then
266         PKG_CHECK_MODULES(GTKSPELL, gtkspell-2.0 >= 2.0.2, , enable_gtkspell=no)
267         if test "$enable_gtkspell" = "yes" ; then
268                 AC_SUBST(GTKSPELL_CFLAGS)
269                 AC_SUBST(GTKSPELL_LIBS)
270                 AC_DEFINE(USE_GTKSPELL,,[do we have gtkspell?])
271         fi
274 if test "$enable_audio" = yes ; then
275         GAIM_PATH_AO(found_ao_lib=true)
277         AM_PATH_AUDIOFILE([0.2.0], found_af_lib=true)
279         if test "$found_ao_lib" = "true" -a "$found_af_lib" = "true"; then
280                 SOUND_LIBS="$AO_LIBS $AUDIOFILE_LIBS"
281                 AC_SUBST(SOUND_LIBS)
282                 AC_DEFINE(USE_AO, 1, [Define if we're using libao and libaudiofile for sound playing])
283                 enable_audio=yes
284         else
285                 enable_audio=no
286         fi
287 else
288         enable_audio=no
291 if test "$ac_cv_cygwin" = yes ; then
292         LDADD="$LDADD -static"
293         CFLAGS="$CFLAGS -Wall -g"
294         AC_DEFINE(DEBUG, 1, [Define if debugging is enabled.])
295 fi                           
297 AC_SUBST(CFLAGS)
298 AC_SUBST(LDADD)
299 AC_SUBST(LIBS)
301 if test "x$enable_multi" != "xyes" ; then
302         AC_DEFINE(NO_MULTI, 1, [Define if multiple connections is disabled.])
303         enable_multi=no
306 if test "x$enable_plugins" = "xyes" ; then
307         AC_DEFINE(GAIM_PLUGINS, 1, [Define if plugins are enabled.])
308         AM_CONDITIONAL(PLUGINS, test "x$enable_plugins" = "xyes")
309 else
310         AM_CONDITIONAL(PLUGINS, false)
311         enable_plugins=no
312         enable_prpls=no
315 if test "x$enable_prpls" = "xyes" ; then
316         AM_CONDITIONAL(PRPLS, test "x$enable_plugins" = "xyes")
317 else
318         AM_CONDITIONAL(PRPLS, false)
319         enable_prpls=no
322 dnl checks for icqlib
323 AC_CHECK_HEADERS(asm/byteorder.h byteswap.h endian.h machine/endian.h arpa/nameser_compat.h)
324 AC_CHECK_FUNCS(bswap_32 bswap_16)
325 AC_C_BIGENDIAN
327 dnl checks for jabber
328 dnl AC_CHECK_SIZEOF(short)
329 AC_CHECK_FUNCS(snprintf connect)
331 dnl checks for zephyr
332 AC_DEFINE(ZEPHYR_INT32, long, [Size of an int32.])
333 AC_SUBST(KRB4_CFLAGS)
334 AC_SUBST(KRB4_LDFLAGS)
335 AC_SUBST(KRB4_LIBS)
336 if test "$kerberos" != "no" ; then
337         if test "$kerberos" != "yes" ; then
338                 KRB4_CFLAGS="-I${kerberos}/include"
339                 if test -d "$kerberos/include/kerberosIV" ; then
340                         KRB4_CFLAGS="$KRB4_CFLAGS -I${kerberos}/include/kerberosIV"
341                 fi
342                 KRB4_LDFLAGS="-L${kerberos}/lib"
343         elif test -d /usr/local/include/kerberosIV ; then
344                 KRB4_CFLAGS="-I/usr/local/include/kerberosIV"
345         elif test -d /usr/include/kerberosIV ; then
346                 KRB4_CFLAGS="-I/usr/include/kerberosIV"
347         fi
348         AC_DEFINE(ZEPHYR_USES_KERBEROS, 1, [Define if kerberos should be used in Zephyr.])
350         orig_LDFLAGS="$LDFLAGS"
351         LDFLAGS="$LDFLAGS $KRB4_LDFLAGS"
352         AC_CHECK_LIB(krb4, krb_rd_req,
353                         [KRB4_LIBS="-lkrb4 -ldes425 -lkrb5 -lk5crypto -lcom_err"],
354                         [AC_CHECK_LIB(krb, krb_rd_req,
355                                 [KRB4_LIBS="-lkrb -ldes"],
356                                 [AC_ERROR(Kerberos 4 libraries not found)],
357                                 -ldes)],
358                         -ldes425 -lkrb5 -lk5crypto -lcom_err)
359         orig_LIBS="$LIBS"
360         LIBS="$LIBS $KRB4_LIBS"
361         AC_CHECK_FUNCS(krb_set_key krb_rd_req krb_get_lrealm)
362         AC_CHECK_FUNCS(krb_get_err_text krb_log)
363         LIBS="$orig_LIBS"
364         LDFLAGS="$orig_LDFLAGS"
366 AC_CHECK_FUNCS(gethostid lrand48)
367 AC_CHECK_FUNCS(memcpy memmove random strchr strerror vprintf)
368 AC_CHECK_HEADERS(malloc.h paths.h sgtty.h stdarg.h sys/cdefs.h)
369 AC_CHECK_HEADERS(sys/file.h sys/filio.h sys/ioctl.h sys/msgbuf.h)
370 AC_CHECK_HEADERS(sys/select.h sys/uio.h sys/utsname.h sys/wait.h)
371 AC_CHECK_HEADERS(termios.h)
372 AC_VAR_TIMEZONE_EXTERNALS
374 AC_OUTPUT([Makefile
375                Doxyfile
376            doc/Makefile
377            intl/Makefile
378            pixmaps/Makefile
379            pixmaps/protocols/Makefile
380            pixmaps/protocols/msn/Makefile
381            pixmaps/protocols/yahoo/Makefile
382            pixmaps/protocols/oscar/Makefile
383            pixmaps/protocols/napster/Makefile
384            pixmaps/protocols/jabber/Makefile
385            pixmaps/protocols/irc/Makefile
386            pixmaps/protocols/icq/Makefile
387            pixmaps/protocols/gg/Makefile
388            pixmaps/smileys/Makefile
389            pixmaps/smileys/default/Makefile
390            plugins/Makefile
391            plugins/docklet/Makefile
392            plugins/gestures/Makefile
393            plugins/ticker/Makefile
394            po/Makefile.in 
395            sounds/Makefile
396            src/Makefile
397            src/protocols/Makefile
398            src/protocols/gg/Makefile
399            src/protocols/icq/Makefile
400            src/protocols/irc/Makefile
401            src/protocols/jabber/Makefile
402            src/protocols/msn/Makefile
403            src/protocols/napster/Makefile
404            src/protocols/oscar/Makefile
405            src/protocols/toc/Makefile
406            src/protocols/yahoo/Makefile
407            src/protocols/zephyr/Makefile
408            gaim.spec
409           ])
411 echo
412 echo $PACKAGE $VERSION
414 echo
415 echo Allow Multiple Connections.... : $enable_multi
416 echo Build Protocol Plugins........ : $enable_prpls
417 echo Protocols to link statically.. : $STATIC_PRPLS
418 echo
419 echo UI Library.................... : GTK 2.x
420 echo
421 echo Build with Plugin support..... : $enable_plugins
422 echo Build with Perl support....... : $enable_perl
423 echo Build with Audio support...... : $enable_audio
424 echo Build with GtkSpell support... : $enable_gtkspell
425 echo
426 echo Use XScreenSaver Extension.... : $enable_xss
427 echo Use X Session Management...... : $enable_sm
428 echo
429 echo Print debugging messages...... : $enable_debug
430 echo
431 eval eval echo Gaim will be installed in $bindir.
432 if test "x$gaimpath" != "x" ; then
433         echo Warning: You have an old copy of gaim at $gaimpath.
435 echo
436 echo configure complete, now type \'make\'
437 echo