view configure.ac @ 9842:595a2fb511b9

[gaim-migrate @ 10720] a few updates committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Mon, 23 Aug 2004 23:10:21 +0000
parents 34a929fbbb30
children 708d9a068999
line wrap: on
line source

dnl Process this file with autoconf to produce a configure script.
AC_INIT([gaim], [0.82cvs], [gaim-devel@lists.sourceforge.net])
AC_CANONICAL_SYSTEM
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)

AC_PREREQ([2.50])

AC_PATH_PROG(sedpath, sed)

dnl Storing configure arguments
AC_DEFINE_UNQUOTED(CONFIG_ARGS, "$ac_configure_args", [configure arguments])

dnl Checks for programs.
AC_PROG_CC
AC_DISABLE_STATIC
AM_PROG_LIBTOOL
LIBTOOL="$LIBTOOL --silent"
AC_PROG_INSTALL

# before gettexting, in case iconv matters
case "$host_os" in
darwin*)
	AC_MSG_CHECKING([for fink])
	if test -d /sw; then
		AC_MSG_RESULT([found, adding /sw to search paths])
		CFLAGS="$CFLAGS -I/sw/include"
	else
		AC_MSG_RESULT([not found])
	fi
	;;
*)
	;;
esac

ALL_LINGUAS="am bg ca cs da de en_CA en_GB es fi fr he hi hu it ja ko lt mk nl no pl pt_BR pt ro ru sk sl sr sr@Latn sv vi zh_CN zh_TW"
AM_GNU_GETTEXT_VERSION(0.10.40)
AM_GNU_GETTEXT

dnl we don't use autobreak on cygwin!!
dnl AC_CYGWIN

dnl Checks for header files.
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(fcntl.h sys/time.h unistd.h locale.h signal.h stdint.h)

dnl Check for SILC includes
AC_ARG_WITH(silc-includes, [  --with-silc-includes=DIR
                          Compile the SILC plugin against includes in DIR ], [ac_silc_includes="$withval"], [ac_silc_includes="no"])
SILC_INCLUDES=""
if test "$ac_silc_includes" != "no"; then
	SILC_INCLUDES="-I$ac_silc_includes"
fi
CPPFLAGS_save="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $SILC_INCLUDES"
AC_CHECK_HEADER(silcincludes.h, [silcincludes=yes])
CPPFLAGS="$CPPFLAGS_save"
AC_SUBST(SILC_INCLUDES)

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_STRUCT_TM

dnl Checks for library functions.
AC_TYPE_SIGNAL
AC_FUNC_STRFTIME
AC_CHECK_FUNCS(strdup strstr atexit)
dnl Checks for getopt in standard library
AC_CHECK_FUNCS(getopt_long,,
[
	AC_LIBOBJ(getopt)
	AC_LIBOBJ(getopt1)
])

dnl Check for inet_aton
AC_CHECK_FUNC(inet_aton, , [AC_CHECK_LIB(resolv, inet_aton, , 
				         [AC_ERROR(inet_aton not found)])])
AC_CHECK_LIB(nsl, gethostent)
AC_CHECK_FUNC(socket, , 
              [AC_CHECK_LIB(socket, socket, , [AC_ERROR([socket not found])])])
dnl If all goes well, by this point the previous two checks will have
dnl pulled in -lsocket and -lnsl if we need them.
AC_CHECK_FUNC(getaddrinfo, [AC_DEFINE([HAVE_GETADDRINFO], [1],
                                      [Define to 1 if you have the getaddrinfo function.])],
              [AC_CHECK_LIB(socket, getaddrinfo,
                            [AC_DEFINE([HAVE_GETADDRINFO]) LIBS="-lsocket -lsnl $LIBS"], , , -lnsl)])

dnl Check for socklen_t (in Unix98)
AC_MSG_CHECKING(for socklen_t)
AC_TRY_COMPILE([
	#include <sys/types.h>
	#include <sys/socket.h>
	socklen_t x;
], [],
[
	AC_MSG_RESULT(yes)
], [
	AC_TRY_COMPILE([
		#include <sys/types.h>
		#include <sys/socket.h>
		int accept(int, struct sockaddr *, size_t *);
	], [], [
		AC_MSG_RESULT(size_t)
		AC_DEFINE(socklen_t, size_t, [socklen_t size])
	], [
		AC_MSG_RESULT(int)
		AC_DEFINE(socklen_t, int, [socklen_t size])
	])
])

dnl check for SILC client libraries
AC_ARG_WITH(silc-libs, [  --with-silc-libs=DIR    Compile the SILC plugin against the SILC libs in DIR], [ac_silc_libs="$withval"], [ac_silc_libs="no"])
SILC_LIBS=""
if test "$ac_silc_libs" != "no"; then
	SILC_LIBS="-L$ac_silc_libs"
fi
SILC_LIBS="$SILC_LIBS -lsilc -lsilcclient -lpthread -ldl"
AC_CHECK_LIB(silcclient, silc_client_init, [silcclient=yes], , $SILC_LIBS)
AC_SUBST(SILC_LIBS)

AC_ARG_ENABLE(distrib,,,enable_distrib=no)
AM_CONDITIONAL(DISTRIB, test "x$enable_distrib" = "xyes")
AC_ARG_ENABLE(prpls,   [  --disable-prpls         don't build dynamic protocol plugins],,enable_prpls=yes)
DYNAMIC_PRPLS=all
AC_ARG_WITH(static-prpls,    [  --with-static-prpls     link in certain protocols statically],[STATIC_PRPLS=`echo $withval | $sedpath 's/,/ /g'`],STATIC_PRPLS="")
if test "x$STATIC_PRPLS" != "x" -a "x$DYNAMIC_PRPLS" = "xall"; then
	DYNAMIC_PRPLS=""
fi

if test "x$STATIC_PRPLS" = "xall" ; then
	STATIC_PRPLS="gg irc jabber msn napster novell oscar silc yahoo zephyr"
fi
if test "x$silcincludes" != "xyes" -o "x$silcclient" != "xyes"; then
	STATIC_PRPLS=`echo $STATIC_PRPLS | $sedpath 's/silc//'`
fi
AC_SUBST(STATIC_PRPLS)
STATIC_LINK_LIBS=
extern_init=
load_proto=
for i in $STATIC_PRPLS ; do
	STATIC_LINK_LIBS="$STATIC_LINK_LIBS protocols/$i/lib$i.a"
	extern_init="$extern_init extern gboolean gaim_init_${i}_plugin();"
	load_proto="$load_proto gaim_init_${i}_plugin();"
	case $i in
		gg)			static_gg=yes ;;
		irc)		static_irc=yes ;;
		jabber)		static_jabber=yes ;;
		msn)		static_msn=yes ;;
		napster)	static_napster=yes ;;
		novell)		static_novell=yes ;;
		oscar)		static_oscar=yes ;;
		rendezvous)	static_rendezvous=yes ;;
		silc)		static_silc=yes ;;
		toc)		static_toc=yes ;;
		trepia)		static_trepia=yes ;;
		yahoo)		static_yahoo=yes ;;
		zephyr)		static_zephyr=yes ;;
		*)			echo "Invalid static protocol $i!!" ; exit ;;
	esac
done
AM_CONDITIONAL(STATIC_GG, test "x$static_gg" = "xyes")
AM_CONDITIONAL(STATIC_IRC, test "x$static_irc" = "xyes")
AM_CONDITIONAL(STATIC_JABBER, test "x$static_jabber" = "xyes")
AM_CONDITIONAL(STATIC_MSN, test "x$static_msn" = "xyes")
AM_CONDITIONAL(STATIC_NAPSTER, test "x$static_napster" = "xyes")
AM_CONDITIONAL(STATIC_NOVELL, test "x$static_novell" = "xyes")
AM_CONDITIONAL(STATIC_OSCAR, test "x$static_oscar" = "xyes")
AM_CONDITIONAL(STATIC_RENDEZVOUS, test "x$static_rendezvous" = "xyes")
AM_CONDITIONAL(STATIC_SILC, test "x$static_silc" = "xyes" -a "x$silcincludes" = "xyes" -a "x$silcclient" = "xyes")
AM_CONDITIONAL(STATIC_TOC, test "x$static_toc" = "xyes")
AM_CONDITIONAL(STATIC_TREPIA, test "x$static_trepia" = "xyes")
AM_CONDITIONAL(STATIC_YAHOO, test "x$static_yahoo" = "xyes")
AM_CONDITIONAL(STATIC_ZEPHYR, test "x$static_zephyr" = "xyes")
AC_SUBST(STATIC_LINK_LIBS)
AC_DEFINE_UNQUOTED(STATIC_PROTO_INIT, $extern_init void static_proto_init() { $load_proto },
	[Loads static protocol plugin module initialization functions.])

AC_ARG_WITH(dynamic_prpls,   [  --with-dynamic-prpls    specify which protocols to build dynamically],[DYNAMIC_PRPLS=`echo $withval | $sedpath 's/,/ /g'`])
if test "x$DYNAMIC_PRPLS" = "xall" ; then
	DYNAMIC_PRPLS="gg irc jabber msn napster novell oscar silc yahoo zephyr"
fi
if test "x$silcincludes" != "xyes" -o "x$silcclient" != "xyes"; then
	DYNAMIC_PRPLS=`echo $DYNAMIC_PRPLS | $sedpath 's/silc//'`
fi
AC_SUBST(DYNAMIC_PRPLS)
for i in $DYNAMIC_PRPLS ; do
	case $i in
		gg)			dynamic_gg=yes ;;
		irc)		dynamic_irc=yes ;;
		jabber)		dynamic_jabber=yes ;;
		msn)		dynamic_msn=yes ;;
		napster)	dynamic_napster=yes ;;
		novell)		dynamic_novell=yes ;;
		oscar)		dynamic_oscar=yes ;;
		rendezvous)	dynamic_rendezvous=yes ;;
		silc)		dynamic_silc=yes ;;
		toc)		dynamic_toc=yes ;;
		trepia)		dynamic_trepia=yes ;;
		yahoo)		dynamic_yahoo=yes ;;
		zephyr)		dynamic_zephyr=yes ;;
		*)			echo "Invalid dynamic protocol $i!!" ; exit ;;
	esac
done
AM_CONDITIONAL(DYNAMIC_GG, test "x$dynamic_gg" = "xyes")
AM_CONDITIONAL(DYNAMIC_IRC, test "x$dynamic_irc" = "xyes")
AM_CONDITIONAL(DYNAMIC_JABBER, test "x$dynamic_jabber" = "xyes")
AM_CONDITIONAL(DYNAMIC_MSN, test "x$dynamic_msn" = "xyes")
AM_CONDITIONAL(DYNAMIC_NAPSTER, test "x$dynamic_napster" = "xyes")
AM_CONDITIONAL(DYNAMIC_NOVELL, test "x$dynamic_novell" = "xyes")
AM_CONDITIONAL(DYNAMIC_OSCAR, test "x$dynamic_oscar" = "xyes")
AM_CONDITIONAL(DYNAMIC_RENDEZVOUS, test "x$dynamic_rendezvous" = "xyes")
AM_CONDITIONAL(DYNAMIC_SILC, test "x$dynamic_silc" = "xyes" -a "x$silcincludes" = "xyes" -a "x$silcclient" = "xyes")
AM_CONDITIONAL(DYNAMIC_TOC, test "x$dynamic_toc" = "xyes")
AM_CONDITIONAL(DYNAMIC_TREPIA, test "x$dynamic_trepia" = "xyes")
AM_CONDITIONAL(DYNAMIC_YAHOO, test "x$dynamic_yahoo" = "xyes")
AM_CONDITIONAL(DYNAMIC_ZEPHYR, test "x$dynamic_zephyr" = "xyes")

AC_ARG_ENABLE(audio,   [  --disable-audio         compile without libao/libaudiofile for sound playing],,enable_audio=yes)
AC_ARG_ENABLE(nas,     [  --enable-nas            enable NAS (Network Audio System) support],,enable_nas=no)
AC_ARG_ENABLE(plugins, [  --disable-plugins       compile without plugin support],,enable_plugins=yes)
AC_ARG_ENABLE(perl,    [  --disable-perl          compile without perl scripting],,enable_perl=yes)
AC_ARG_ENABLE(tcl,     [  --disable-tcl	          compile without Tcl scripting],,enable_tcl=yes)
AC_ARG_WITH(tclconfig, [  --with-tclconfig=DIR    directory containing tclConfig.sh])
AC_ARG_ENABLE(tk,      [  --disable-tk            compile without Tcl support for Tk],,enable_tk=yes)
AC_ARG_WITH(tkconfig,  [  --with-tkconfig=DIR     directory containing tkConfig.sh])
AC_ARG_ENABLE(gtkspell, [  --disable-gtkspell      compile without GtkSpell automatic spell checking],,enable_gtkspell=yes)
AC_ARG_ENABLE(debug,   [  --enable-debug          compile with debugging support],,enable_debug=no)
AC_ARG_ENABLE(deprecated,    [  --disable-deprecated    compile without deprecated API usage],,enable_deprecated=yes)
AC_ARG_ENABLE(screensaver,   [  --disable-screensaver   compile without X screensaver extension],,enable_xss=yes)
AC_ARG_ENABLE(sm,      [  --disable-sm            compile without X session management support],,enable_sm=yes)
AC_ARG_WITH(krb4,      [  --with-krb4=PREFIX      Compile Zephyr plugin with Kerberos 4 support],kerberos="$withval",kerberos="no")
AC_ARG_WITH(zephyr,    [  --with-zephyr=PREFIX    Compile Zephyr plugin against external libzephyr],zephyr="$withval",zephyr="no")
AM_CONDITIONAL(EXTERNAL_LIBZEPHYR, test "x$zephyr" != "xno")

AC_CHECK_HEADER(sys/utsname.h)
AC_CHECK_FUNC(uname)

if test "$enable_debug" = yes ; then
	AC_DEFINE(DEBUG, 1, [Define if debugging is enabled.])
fi

if test "x$enable_deprecated" = no; then
	DEBUG_CFLAGS="$DEBUG_CFLAGS -DG_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED"
fi

if test "x$GCC" = "xyes"; then
	CFLAGS="$CFLAGS -Wall -g3"
fi
AC_SUBST(CFLAGS)

AM_PATH_GLIB_2_0(2.0.0,,AC_MSG_ERROR([
*** GLib 2.0 is required to build Gaim; please make sure you have the GLib
*** development headers installed. The latest version of GLib is
*** always available at http://www.gtk.org/.]))
AM_PATH_GTK_2_0(2.0.0,,AC_MSG_ERROR([
*** GTK+ 2.0 is required to build Gaim; please make sure you have the GTK+
*** development headers installed. The latest version of GTK+ is
*** always available at http://www.gtk.org/.]))

AC_PATH_PROG(gaimpath, gaim)
AC_SUBST(GTK_CFLAGS)
AC_SUBST(GLIB_CFLAGS)

AC_PATH_XTRA
# We can't assume that $x_libraries will be set, because autoconf does not
# set it in the case when the X libraries are in a standard place.
# Ditto for $x_includes
if test X"$x_libraries" = X"" ; then
	x_libpath_add=
else
	x_libpath_add="-L$x_libraries"
fi
if test X"$x_includes" = X"" ; then
	x_incpath_add=
else
	x_incpath_add="-I$x_includes"
fi

dnl #######################################################################
dnl # Check for startup notification
dnl #######################################################################
AC_ARG_ENABLE(startup-notification, [  --disable-startup-notification    compile without startup notification support],,enable_startup_notification=yes)

if test "x$enable_startup_notification" = "xyes"; then
	PKG_CHECK_MODULES(STARTUP_NOTIFICATION, libstartup-notification-1.0 >= 0.5,
	[
		AC_DEFINE(HAVE_STARTUP_NOTIFICATION, 1, [Define if we're using libstartup-notification.])
		echo "Building with libstartup-notification"
		enable_startup_notification=yes
	],
	[
		echo "Building without libstartup-notification"
		enable_startup_notification=no
	])

	AC_SUBST(STARTUP_NOTIFICATION_CFLAGS)
	AC_SUBST(STARTUP_NOTIFICATION_LIBS)
fi


dnl #######################################################################
dnl # Check for stuff needed by the evolution integration plugin.
dnl #######################################################################
build_gevo=no
AC_ARG_ENABLE(gevolution, [  --disable-gevolution    compile without the Gaim-Evolution plugin],,enable_gevolution=yes)

if test "x$enable_gevolution" = "xyes"; then
	evo_deps="libxml-2.0 libebook-1.0 libedata-book-1.0"
	PKG_CHECK_MODULES(EVOLUTION_ADDRESSBOOK, $evo_deps, build_gevo=yes, build_gevo=no)

	AC_SUBST(EVOLUTION_ADDRESSBOOK_CFLAGS)
	AC_SUBST(EVOLUTION_ADDRESSBOOK_LIBS)

	dnl This can be removed in a few releases of Evolution, especially when
	dnl it goes stable!
	AC_MSG_CHECKING([libebook version])
	LIBEBOOK_VERSION=`$PKG_CONFIG --modversion libebook-1.0`
	LIBEBOOK_MAJOR_VER=`echo $LIBEBOOK_VERSION | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
	LIBEBOOK_MINOR_VER=`echo $LIBEBOOK_VERSION | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
	LIBEBOOK_MICRO_VER=`echo $LIBEBOOK_VERSION | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
	AC_MSG_RESULT($LIBEBOOK_VERSION)
	AC_DEFINE_UNQUOTED(LIBEBOOK_MAJOR_VER, $LIBEBOOK_MAJOR_VER, [libebook major version.])
	AC_DEFINE_UNQUOTED(LIBEBOOK_MINOR_VER, $LIBEBOOK_MINOR_VER, [libebook minor version.])
	AC_DEFINE_UNQUOTED(LIBEBOOK_MICRO_VER, $LIBEBOOK_MICRO_VER, [libebook micro version.])
fi

AM_CONDITIONAL(BUILD_GEVOLUTION, test "x$build_gevo" = "xyes")

dnl #######################################################################
dnl # Check for XScreenSaver
dnl #######################################################################
if test "x$enable_xss" = "xyes" ; then
	old_LIBS="$LIBS"
	LIBS="$LIBS $GTK_LIBS $x_libpath_add"
	XSS_LIBS="no"
	XSS_HEADERS="no"
	AC_CHECK_LIB(Xext, XScreenSaverRegister,[XSS_LIBS="$X_LIBS $X_PRE_LIBS -lX11 -lXext $X_EXTRA_LIBS"],[],[-lX11 -lXext -lm])
	AC_CHECK_LIB(Xss, XScreenSaverRegister,[XSS_LIBS="$X_LIBS $X_PRE_LIBS -lX11 -lXext $X_LIBS $X_EXTRA_LIBS -lXss"],[],[-lX11 -lXext -lm])
	if test \! "$XSS_LIBS" = "no"; then
		oldCPPFLAGS="$CPPFLAGS"
		CPPFLAGS="$CPPFLAGS -I$x_includes"
		AC_TRY_COMPILE([
#include <X11/Xlib.h>
#include <X11/extensions/scrnsaver.h>
				],[],[
				AC_DEFINE(USE_SCREENSAVER, 1, [Define if we're using XScreenSaver.])],[enable_xss=no]
				)
		CPPFLAGS="$oldCPPFLAGS"
	else
	       XSS_LIBS=""
	       enable_xss=no
	fi
	LIBS="$old_LIBS"
else
	XSS_LIBS=""
	enable_xss=no
fi
AC_SUBST(XSS_LIBS)


dnl #######################################################################
dnl # Check for X session management libs
dnl #######################################################################
if test "x$enable_sm" = "xyes"; then
	enable_sm=no
	AC_CHECK_LIB(SM, SmcSaveYourselfDone, found_sm_lib=true, , [$x_libpath_add -lICE])
	if test "$found_sm_lib" = "true"; then
		oldCPPFLAGS="$CPPFLAGS"
		CPPFLAGS="$CPPFLAGS -I$x_includes"
		AC_CHECK_HEADERS(X11/SM/SMlib.h, SM_LIBS="$x_libpath_add -lSM -lICE" enable_sm=yes)
		CPPFLAGS="$oldCPPFLAGS"
	fi
else
	SM_LIBS=""
	enable_sm=no
fi
AC_SUBST(SM_LIBS)
if test "$enable_sm" = "yes"; then
	AC_DEFINE(USE_SM, 1, [Define if we're using X Session Management.])
fi


AC_DEFUN([GC_TM_GMTOFF],
[AC_REQUIRE([AC_STRUCT_TM])dnl
AC_CACHE_CHECK([for tm_gmtoff in struct tm], ac_cv_struct_tm_gmtoff,
[AC_TRY_COMPILE([#include <sys/types.h>
#include <$ac_cv_struct_tm>], [struct tm tm; tm.tm_gmtoff;],
  ac_cv_struct_tm_gmtoff=yes, ac_cv_struct_tm_gmtoff=no)])
if test "$ac_cv_struct_tm_gmtoff" = yes; then
  AC_DEFINE(HAVE_TM_GMTOFF, 1, [tm_gmtoff is available.])
fi
])

GC_TM_GMTOFF


dnl #######################################################################
dnl # Check for Perl support
dnl #######################################################################
if test "$enable_perl" = yes ; then
	AC_PATH_PROG(perlpath, perl)
	AC_MSG_CHECKING(for Perl compile flags)
	PERL_CFLAGS=`$perlpath -MExtUtils::Embed -e ccopts 2>/dev/null`
	if test "_$PERL_CFLAGS" = _ ; then
		AC_MSG_RESULT([not found, building without perl.])
		enable_perl = no
	else
		PERL_LIBS=`$perlpath -MExtUtils::Embed -e ldopts 2>/dev/null |$sedpath 's/-lgdbm //'`
		PERL_LIBS=`echo $PERL_LIBS |$sedpath 's/-ldb //'`
		PERL_LIBS=`echo $PERL_LIBS |$sedpath 's/-lndbm //'`
		if test "$system" = "Linux"; then
			PERL_LIBS=`echo $PERL_LIBS |$sedpath 's/-lnsl //'`
			PERL_LIBS=`echo $PERL_LIBS |$sedpath 's/-lposix //'`
		fi
		PERL_LIBS=`echo $PERL_LIBS |$sedpath 's/-lc //'`
		AC_MSG_RESULT(ok)

		oldLIBS="$LIBS"
		LIBS="$LIBS $PERL_LIBS"
		AC_MSG_CHECKING(for libperl)
		AC_CHECK_FUNCS(perl_run, [], enable_perl=no)
		LIBS="$oldLIBS"
	fi
fi

if test "$enable_perl" = yes ; then
	AC_PROG_PERL_MODULES(ExtUtils::MakeMaker, , have_makemaker=no)

	if test "x$have_makemaker" = "xno"; then
		enable_perl=no
		PERL_CFLAGS=
		PERL_LIBS=
		AM_CONDITIONAL(USE_PERL, false)
		AC_MSG_WARN(Compiling perl requires ExtUtils::MakeMaker)
	else
		AC_SUBST(PERL_CFLAGS)
		AC_SUBST(PERL_LIBS)
		AM_CONDITIONAL(USE_PERL, test "x$enable_perl" = "xyes")

		dnl This is almost definitely wrong, but in case there's
		dnl something I'm missing, I'll leave it in.
		AC_CHECK_FUNCS(Perl_eval_pv)

		AC_MSG_CHECKING(for old perl)
		PERL_OLD=`$perlpath -e 'if($]<5.006){printf"yes\n";}else{printf"no\n";}'`

		if test "x$PERL_OLD" = "xyes"; then
			AC_DEFINE(OLD_PERL, 1, [Define if old perl is installed.])
			AC_MSG_RESULT(yes)
		else
			AC_MSG_RESULT(no)
		fi

		if test "x$prefix" != "xNONE"; then
			prefix=`eval echo $prefix`
			PERL_MM_PARAMS="INSTALLDIRS=vendor PREFIX=$prefix"
		fi

		AC_ARG_WITH(perl-lib,
		[  --with-perl-lib=[site|vendor|DIR]  Specify where to install the
								   Perl libraries for gaim. Default is site.],
		[
			if test "x$withval" = xsite; then
				PERL_MM_PARAMS=""
			elif test "x$withval" = xvendor; then
				if test -z "`$perlpath -v | grep '5\.0'`"; then
					PERL_MM_PARAMS="INSTALLDIRS=vendor"
				else
					PERL_MM_PARAMS="INSTALLDIRS=vendor PREFIX=`perl -e 'use Config; print $Config{prefix}'`"
				fi
			else
				PERL_MM_PARAMS="INSTALLDIRS=vendor PREFIX=$withval"
			fi
		])

		AC_SUBST(PERL_MM_PARAMS)

		AC_MSG_CHECKING(for DynaLoader.a)
		DYNALOADER_A=`echo $PERL_LDFLAGS | $perlpath -pe 's/^(.* )*([[^ ]]*DynaLoader\.a).*/\2/'`

		dnl Don't check libperl.a if dynaloader.a wasn't found.
		if test -n "$DYNALOADER_A"; then
			AC_MSG_RESULT(yes)

			dnl Find either libperl.a or libperl.so
			AC_MSG_CHECKING(for libperl.a or libperl.so)
			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 } } };'`
			if test -z "$LIBPERL_A"; then
				AC_MSG_RESULT(no)
				DYNALOADER_A=
			else
				AC_MSG_RESULT(yes)

				if test "$LIBPERL_A" = "-lperl"; then
					LIBPERL_A=
				fi
			fi

			PERL_LIBS=`echo $PERL_LIBS | $perlpath -pe 's/^(.* )*[[^ ]]*DynaLoader\.a/\1libperl_dynaloader.la/'`

			if test -n "$LIBPERL_A"; then
				PERL_LIBS=`echo $PERL_LDFLAGS | $sedpath -e 's/-lperl /libperl_orig.la /' -e 's/-lperl$/libperl_orig.la$/'`
			fi

			AC_SUBST(DYNALOADER_A)
			AC_SUBST(LIBPERL_A)
		else
			AC_MSG_RESULT(no)
		fi
	fi
else
	PERL_CFLAGS=
	PERL_LIBS=
	AM_CONDITIONAL(USE_PERL, false)
fi

dnl #######################################################################
dnl # SSL support
dnl #
dnl # Thanks go to Evolution for the checks.
dnl #######################################################################

dnl These two are inverses of each other <-- stolen from evolution!

AC_ARG_ENABLE(gnutls,
	[  --enable-gnutls=[yes,no]    Attempt to use GNUTLS for SSL support (preferred) [default=yes]],
	[enable_gnutls="$enableval"],
	[enable_gnutls="yes"])

AC_ARG_ENABLE(nss,
	[  --enable-nss=[yes,no,static]    Attempt to use Mozilla libnss for SSL support [default=yes]],
	[enable_nss="$enableval"],
	[enable_nss="yes"])

msg_ssl="None"

dnl #
dnl # Check for GNUTLS if it's specified.
dnl #
if test "x$enable_gnutls" != "xno"; then
	enable_gnutls="no"
	prefix=`eval echo $prefix`

	AC_ARG_WITH(gnutls-includes,
		[  --with-gnutls-includes=PREFIX   Location of GNUTLS includes.],
		[ with_gnutls_includes="$withval" ],
		[ with_gnutls_includes="$prefix/include" ])

	have_gnutls_includes="no"

	if test "x$with_gnutls_includes" != "xno"; then
		CPPFLAGS_save="$CPPFLAGS"

		AC_MSG_CHECKING(for GNUTLS includes)
		AC_MSG_RESULT("")

		CPPFLAGS="$CPPFLAGS -I$with_gnutls_includes"
		AC_CHECK_HEADERS(gnutls/gnutls.h, [ gnutls_includes="yes" ])
		CPPFLAGS="$CPPFLAGS_save"

		if test "x$gnutls_includes" != "xno" -a \
		        "x$gnutls_includes" != "x"; then
			have_gnutls_includes="yes"

			GNUTLS_CFLAGS="-I$with_gnutls_includes"
		else
			GNUTLS_CFLAGS=""
		fi
	else
		AC_MSG_CHECKING(for GNUTLS includes)
		AC_MSG_RESULT(no)
	fi

	AC_ARG_WITH(gnutls-libs,
		[  --with-gnutls-libs=PREFIX       Location of GNUTLS libraries.],
		[ with_gnutls_libs="$withval" ])

	if test "x$with_gnutls_libs"     != "xno" -a \
	        "x$have_gnutls_includes" != "xno"; then

		LDFLAGS_save="$LDFLAGS"

		case $with_gnutls_libs in
			""|-L*) ;;
			*) with_gnutls_libs="-L$with_gnutls_libs" ;;
		esac

		AC_CACHE_CHECK([for GNUTLS libraries], gnutls_libs,
		[
			LDFLAGS="$LDFLAGS $with_gnutls_libs -lgnutls -lgcrypt"
			AC_TRY_LINK_FUNC(gnutls_init, gnutls_libs="yes", gnutls_libs="no")
			LDFLAGS="$LDFLAGS_save"
		])

		if test "x$gnutls_libs" != "xno"; then
			AC_DEFINE(HAVE_GNUTLS, 1, [Define if you have GNUTLS])
			AC_DEFINE(HAVE_SSL)
			msg_gnutls="GNUTLS"
			GNUTLS_LIBS="$with_gnutls_libs -lgnutls -lgcrypt"

			enable_gnutls="yes"
		else
			GNUTLS_CFLAGS=""
			GNUTLS_LIBS=""
		fi
	else
		AC_MSG_CHECKING(for GNUTLS libraries)
		AC_MSG_RESULT(no)
	fi
else
	GNUTLS_CFLAGS=""
	GNUTLS_LIBS=""
fi

AC_SUBST(GNUTLS_CFLAGS)
AC_SUBST(GNUTLS_LIBS)

AM_CONDITIONAL(USE_GNUTLS, test "x$enable_gnutls" = "xyes")


dnl #
dnl # Check for NSS if it's specified, or if GNUTLS checks failed.
dnl #
if test "x$enable_nss" != "xno"; then

	AC_ARG_WITH(nspr-includes,
		[  --with-nspr-includes=PREFIX     Specify location of Mozilla nspr4 includes.],
		[with_nspr_includes="$withval"])

	AC_ARG_WITH(nspr-libs,
		[  --with-nspr-libs=PREFIX         Specify location of Mozilla nspr4 libs.],
		[with_nspr_libs="$withval"])

	AC_ARG_WITH(nss-includes,
		[  --with-nss-includes=PREFIX      Specify location of Mozilla nss3 includes.],
		[with_nss_includes="$withval"])

	AC_ARG_WITH(nss-libs,
		[  --with-nss-libs=PREFIX          Specify location of Mozilla nss3 libs.],
		[with_nss_libs="$withval"])


	if test -n "$with_nspr_includes" || test -n "$with_nspr_libs" || \
	   test -n "$with_nss_includes"  || test -n "$with_nss_libs"  ||
	   test "x$enable_nss" = "xstatic"; then

		nss_manual_check="yes"
	else
		nss_manual_check="no"
	fi

	enable_nss="no"

	if test "x$nss_manual_check" = "xno"; then
		PKG_CHECK_MODULES(NSS, mozilla-nss, have_nss="yes", have_nss="no")

		if test "x$have_nss" = "xyes"; then
			mozilla_nspr="mozilla-nspr"
			mozilla_nss="mozilla-nss"

			AC_DEFINE(HAVE_NSS, 1, [Define if you have Mozilla NSS])
			AC_DEFINE(HAVE_SSL, 1, [Define if you have SSL])

			msg_nss="Mozilla NSS"
			enable_nss="yes"
		else
			nss_manual_check="yes"
		fi
	fi

	if test "x$nss_manual_check" = "xyes"; then
		mozilla_nss=""
		have_nspr_includes="no"

		if test "x$with_nspr_includes" != "xno"; then
			CPPFLAGS_save=$CPPFLAGS

			AC_MSG_CHECKING(for Mozilla nspr4 includes in $with_nspr_includes)
			AC_MSG_RESULT("")

			CPPFLAGS="$CPPFLAGS -I$with_nspr_includes"
			AC_CHECK_HEADERS(nspr.h prio.h, [ moz_nspr_includes="yes" ])
			CPPFLAGS=$CPPFLAGS_save

			if test "x$moz_nspr_includes" != "xno" -a \
			        "x$moz_nspr_includes" != "x"; then

				have_nspr_includes="yes"
				NSPR_CFLAGS="-I$with_nspr_includes"
			fi
		else
			AC_MSG_CHECKING(for Mozilla nspr4 includes)
			AC_MSG_RESULT(no)

			enable_nss="no"
		fi

		have_nspr_libs="no"

		if test "x$with_nspr_libs"     != "xno" -a \
		        "x$have_nspr_includes" != "xno"; then

			CFLAGS_save=$CFLAGS
			LDFLAGS_save=$LDFLAGS

			if test "$enable_nss" = "static"; then
				if test -z "$with_nspr_libs"; then
					AC_MSG_ERROR(
						[Static linkage requested, but path to nspr libraries not set.]
						[Please specify the path to libnspr4.a]
						[Example: --with-nspr-libs=/usr/lib])

					enable_nss="no"
				else
					nsprlibs="-ldl $with_nspr_libs/libplc4.a $with_nspr_libs/libplds4.a $with_nspr_libs/libnspr4.a $PTHREAD_LIB"
				fi
			else
				nsprlibs="-ldl -lplc4 -lplds4 -lnspr4 $PTHREAD_LIB"
			fi

			AC_CACHE_CHECK([for Mozilla nspr libraries], moz_nspr_libs,
			[
				LIBS_save=$LIBS
				CFLAGS="$CFLAGS $NSPR_CFLAGS"

				LIBS="$nsprlibs"

				if test "x$with_nspr_libs" != "x"; then
					LDFLAGS="$LDFLAGS -L$with_nspr_libs"
				else
					LDFLAGS="$LDFLAGS"
				fi

				AC_TRY_LINK_FUNC(PR_Init,
					[moz_nspr_libs="yes"],
					[moz_nspr_libs="no"])

				CFLAGS=$CFLAGS_save
				LDFLAGS=$LDFLAGS_save
				LIBS=$LIBS_save
			])

			if test "x$moz_nspr_libs" != "xno"; then
				have_nspr_libs="yes"
				NSPR_LIBS="-L$with_nspr_libs $nsprlibs"
			else
				NSPR_CFLAGS=""
				enable_nss="no"
			fi
		else
			AC_MSG_CHECKING(for Mozilla nspr4 libraries)
			AC_MSG_RESULT(no)
		fi

		have_nss_includes="no"

		if test "x$with_nss_includes" != "xno" -a \
				"x$have_nspr_libs"    != "xno"; then

			CPPFLAGS_save=$CPPFLAGS

			AC_MSG_CHECKING(for Mozilla nss3 includes in $with_nss_includes)
			AC_MSG_RESULT("")

			if test "x$with_nspr_includes" != "x"; then
				CPPFLAGS="$CPPFLAGS -I$with_nspr_includes -I$with_nss_includes"
			else
				CPPFLAGS="$CPPFLAGS -I$with_nss_includes"
			fi

			AC_CHECK_HEADERS(nss.h ssl.h smime.h,
				[moz_nss_includes="yes"],
				[moz_nss_includes="no"])

			CPPFLAGS=$CPPFLAGS_save

			if test "x$moz_nss_includes" = "xyes"; then
				have_nss_includes="yes"
				NSS_CFLAGS="-I$with_nss_includes"
			else
				NSPR_CFLAGS=""
				NSPR_LIBS=""
				enable_nss="no"
			fi
		else
			AC_MSG_CHECKING(for Mozilla nss3 includes)
			AC_MSG_RESULT(no)
			enable_nss="no"
		fi

		if test "x$with_nss_libs"     != "xno" -a \
				"x$have_nss_includes" != "xno"; then

			LDFLAGS_save=$LDFLAGS

			if test "$enable_nss" = "static"; then
				if test -z "$with_nss_libs"; then
					AC_MSG_ERROR(
						[Static linkage requested, but path to nss libraries not set.]
						[Please specify the path to libnss3.a]
						[Example: --with-nspr-libs=/usr/lib/mozilla])
					enable_nss="no"
				else
					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"

					case "$host" in
						*solaris*)
							nsslibs="$nsslibs $with_nss_libs/libfreeb1.a"
							;;
					esac
				fi
			else
				nsslibs="-lssl3 -lsmime3 -lnss3 -lsoftokn3"
			fi

			AC_CACHE_CHECK([for Mozilla nss libraries], moz_nss_libs,
			[
				LIBS_save=$LIBS
				LDFLAGS="$LDFLAGS -L$with_nspr_libs $nsprlibs -L$with_nss_libs $nsslibs"
				LIBS="$nsslibs $nsprlibs"

				AC_TRY_LINK_FUNC(NSS_Init,
					[moz_nss_libs="yes"],
					[moz_nss_libs="no"])

				if test "x$moz_nss_libs" = "xno"; then
					nsslibs="-lssl3 -lsmime3 -lnss3 -lsoftokn3"
					LDFLAGS="$LDFLAGS -L$with_nspr_libs $nsprlibs -L$with_nss_libs $nsslibs"
					AC_TRY_LINK_FUNC(NSS_Init,
						[moz_nss_libs="yes"],
						[moz_nss_libs="no"])
				fi

				LDFLAGS=$LDFLAGS_save
				LIBS=$LIBS_save
			])

			if test "x$moz_nss_libs" != "xno"; then
				AC_DEFINE(HAVE_NSS)
				AC_DEFINE(HAVE_SSL)

				NSS_LIBS="-L$with_nss_libs $nsslibs"

				if test "$enable_nss" = "static"; then
					msg_nss="Mozilla NSS (static)"
				else
					msg_nss="Mozilla NSS"
				fi

				enable_nss="yes"
			else
				NSS_CFLAGS=""
				NSPR_CFLAGS=""
				NSPR_LIBS=""
				enable_nss="no"
			fi
		else
			AC_MSG_CHECKING(for Mozilla nss libraries)
			AC_MSG_RESULT(no)
		fi

		NSS_CFLAGS="$NSPR_CFLAGS $NSS_CFLAGS"
		NSS_LIBS="$NSPR_LIBS $NSS_LIBS"
	fi

	AC_SUBST(NSS_CFLAGS)
	AC_SUBST(NSS_LIBS)
fi

AM_CONDITIONAL(USE_NSS, test "x$enable_nss" = "xyes")

if test "x$msg_nss" != "x" -a "x$msg_gnutls" != "x"; then
	msg_ssl="$msg_nss and $msg_gnutls"
elif test "x$msg_nss" != "x"; then
	msg_ssl=$msg_nss
elif test "x$msg_gnutls" != "x"; then
	msg_ssl=$msg_gnutls
fi

dnl Check for Tcl
if test "$enable_tcl" = yes; then
	AC_MSG_CHECKING([for tclConfig.sh])
        TCLCONFIG=no
	TCLCONFIGDIRS="/usr/lib \
		       /usr/lib/tcl8.4 \
		       /usr/lib/tcl8.3 \
		       /usr/lib/tcl8.2 \
		       /System/Library/Tcl/8.3 \
		       /usr/local/lib"
	for dir in $with_tclconfig $TCLCONFIGDIRS; do
		if test -f $dir/tclConfig.sh; then
			TCLCONFIG=$dir/tclConfig.sh
			AC_MSG_RESULT([yes ($TCLCONFIG)])
		fi
	done
	if test "$TCLCONFIG" = "no"; then
		AC_MSG_RESULT([no])
		enable_tcl=no
	else
		. $TCLCONFIG
		AC_MSG_CHECKING([Tcl version compatability])
		if test "$TCL_MAJOR_VERSION" -ne 8 -o "$TCL_MINOR_VERSION" -lt 3; then
			AC_MSG_RESULT([bad, $TCL_VERSION found but 8.3 or later required])
			enable_tcl=no
		else
			AC_MSG_RESULT([ok, $TCL_VERSION])
			eval "TCL_LIB_SPEC=\"$TCL_LIB_SPEC\""
			AC_MSG_CHECKING([for Tcl linkability])
			oldCPPFLAGS=$CPPFLAGS
			CPPFLAGS="$CPPFLAGS $TCL_INCLUDE_SPEC -I$TCL_PREFIX/include"
			oldLIBS=$LIBS
			LIBS="$LIBS $TCL_LIB_SPEC"
			AC_TRY_LINK([#include <tcl.h>],
				    [Tcl_Interp *interp; Tcl_Init(interp)],
				    [AC_MSG_RESULT([yes]);enable_tcl=yes],
				    [AC_MSG_RESULT([no]);enable_tcl=no])
			CPPFLAGS="$oldCPPFLAGS"
			LIBS="$oldLIBS"
		fi
	fi
fi

if test "$enable_tcl" = yes; then
	AM_CONDITIONAL(USE_TCL, true)
	TCL_LIBS=$TCL_LIB_SPEC
	AC_SUBST(TCL_LIBS)
	TCL_CFLAGS="$TCL_INCLUDE_SPEC -I$TCL_PREFIX/include"
	if test "x$GCC" = "xyes"; then
		TCL_CFLAGS="$TCL_CFLAGS -fno-strict-aliasing"
	fi
	AC_SUBST(TCL_CFLAGS)
else
	AM_CONDITIONAL(USE_TCL, false)
fi

dnl Check for Tk
if test "$enable_tcl" = yes -a "$enable_tk" = yes; then
	AC_MSG_CHECKING([for tkConfig.sh])
	TKCONFIG=no
	TKCONFIGDIRS="/usr/lib \
	              /usr/lib/tk8.4 \
		      /usr/lib/tk8.3 \
		      /usr/lib/tk8.2 \
		      /usr/local/lib"
	for dir in $with_tkconfig $TKCONFIGDIRS; do
		if test -f $dir/tkConfig.sh; then
			TKCONFIG=$dir/tkConfig.sh
			AC_MSG_RESULT([yes ($TKCONFIG)])
		fi
	done
	if test "$TKCONFIG" = "no"; then
		AC_MSG_RESULT([no])
		enable_tk=no
	else
		. $TKCONFIG
		eval "TK_LIB_SPEC=\"$TK_LIB_SPEC\""
		AC_MSG_CHECKING([for Tk linkability])
		oldCPPFLAGS=$CPPFLAGS
		CPPFLAGS="$CPPFLAGS $TCL_CFLAGS"
		oldLIBS=$LIBS
		LIBS="$LIBS $TCL_LIB_SPEC $TK_LIB_SPEC"
		AC_TRY_LINK([#include <tk.h>], [Tcl_Interp *interp; Tcl_Init(interp); Tk_Init(interp);],
			    [AC_MSG_RESULT([yes]);enable_tk=yes],
			    [AC_MSG_RESULT([no]);enable_tk=no])
		CPPFLAGS="$oldCPPFLAGS"
		LIBS="$oldLIBS"
	fi
else
	enable_tk=no
fi

if test "$enable_tk" = yes; then
	AM_CONDITIONAL(USE_TK, true)
	AC_DEFINE(HAVE_TK, [1], [Compile with support for the Tk toolkit])
	TK_LIBS=$TK_LIB_SPEC
	AC_SUBST(TK_LIBS)
else
	AM_CONDITIONAL(USE_TK, false)
fi

dnl Thanks, Evan.
if test "$enable_gtkspell" = yes ; then
	PKG_CHECK_MODULES(GTKSPELL, gtkspell-2.0 >= 2.0.2, , enable_gtkspell=no)
	if test "$enable_gtkspell" = "yes" ; then
		AC_SUBST(GTKSPELL_CFLAGS)
		AC_SUBST(GTKSPELL_LIBS)
		AC_DEFINE(USE_GTKSPELL,,[do we have gtkspell?])
	fi
fi

if test "$enable_nas" = yes ; then
	AC_DEFINE(USE_NAS_AUDIO, 1, [Define if we have NAS sound support.])
	SOUND_LIBS="$SOUND_LIBS -laudio -lXt"
fi

if test "$enable_audio" = yes ; then
	GAIM_PATH_AO(found_ao_lib=true)

	AM_PATH_AUDIOFILE([0.2.0], found_af_lib=true)

	if test "$found_ao_lib" = "true" -a "$found_af_lib" = "true"; then
		SOUND_LIBS="$SOUND_LIBS $AO_LIBS $AUDIOFILE_LIBS"
		AC_SUBST(SOUND_LIBS)
		AC_DEFINE(USE_AO, 1, [Define if we're using libao and libaudiofile for sound playing])
		enable_audio=yes
	else
		enable_audio=no
	fi
else
	enable_audio=no
fi

if test "$ac_cv_cygwin" = yes ; then
	LDADD="$LDADD -static"
	AC_DEFINE(DEBUG, 1, [Define if debugging is enabled.])
fi

AC_SUBST(DEBUG_CFLAGS)
AC_SUBST(LDADD)
AC_SUBST(LIBS)

if test "x$enable_plugins" = "xyes" ; then
	AC_DEFINE(GAIM_PLUGINS, 1, [Define if plugins are enabled.])
	AM_CONDITIONAL(PLUGINS, test "x$enable_plugins" = "xyes")
else
	AM_CONDITIONAL(PLUGINS, false)
	enable_plugins=no
	enable_prpls=no
fi

if test "x$enable_prpls" = "xyes" ; then
	AM_CONDITIONAL(PRPLS, test "x$enable_plugins" = "xyes")
else
	AM_CONDITIONAL(PRPLS, false)
	enable_prpls=no
fi

dnl checks for icqlib
AC_CHECK_HEADERS(asm/byteorder.h byteswap.h endian.h machine/endian.h arpa/nameser_compat.h)
AC_CHECK_FUNCS(bswap_32 bswap_16)
AC_C_BIGENDIAN

dnl checks for jabber
dnl AC_CHECK_SIZEOF(short)
AC_CHECK_FUNCS(snprintf connect)

dnl checks for zephyr
AC_DEFINE(ZEPHYR_INT32, long, [Size of an int32.])
AC_SUBST(KRB4_CFLAGS)
AC_SUBST(KRB4_LDFLAGS)
AC_SUBST(KRB4_LIBS)
if test "$kerberos" != "no" ; then
	if test "$kerberos" != "yes" ; then
		KRB4_CFLAGS="-I${kerberos}/include"
		if test -d "$kerberos/include/kerberosIV" ; then
			KRB4_CFLAGS="$KRB4_CFLAGS -I${kerberos}/include/kerberosIV"
		fi
		KRB4_LDFLAGS="-L${kerberos}/lib"
	elif test -d /usr/local/include/kerberosIV ; then
		KRB4_CFLAGS="-I/usr/local/include/kerberosIV"
	elif test -d /usr/include/kerberosIV ; then
		KRB4_CFLAGS="-I/usr/include/kerberosIV"
	fi
	AC_DEFINE(ZEPHYR_USES_KERBEROS, 1, [Define if kerberos should be used in Zephyr.])

	orig_LDFLAGS="$LDFLAGS"
	LDFLAGS="$LDFLAGS $KRB4_LDFLAGS"
	AC_CHECK_LIB(krb4, krb_rd_req,
			[KRB4_LIBS="-lkrb4 -ldes425 -lkrb5 -lk5crypto -lcom_err"],
			[AC_CHECK_LIB(krb, krb_rd_req,
				[KRB4_LIBS="-lkrb -ldes"],
				[AC_ERROR(Kerberos 4 libraries not found)],
				-ldes)],
			-ldes425 -lkrb5 -lk5crypto -lcom_err)
	orig_LIBS="$LIBS"
	LIBS="$LIBS $KRB4_LIBS"
	AC_CHECK_FUNCS(krb_set_key krb_rd_req krb_get_lrealm)
	AC_CHECK_FUNCS(krb_get_err_text krb_log)
	LIBS="$orig_LIBS"
	LDFLAGS="$orig_LDFLAGS"
fi

dnl checks for an external libzephyr
AC_SUBST(ZEPHYR_CFLAGS)
AC_SUBST(ZEPHYR_LDFLAGS)
AC_SUBST(ZEPHYR_LIBS)
if test "$zephyr" != "no" ; then
	if test "$zephyr" != "yes" ; then 
		ZEPHYR_CFLAGS="-I${zephyr}/include" 
		ZEPHYR_LDFLAGS="-L${zephyr}/lib"
	elif test -d /usr/athena/include/zephyr ; then
		ZEPHYR_CFLAGS="-I/usr/athena/include"
	elif test -d /usr/include/zephyr ; then
 		ZEPHYR_CFLAGS="-I/usr/include"
 	elif test -d /usr/local/include/zephyr ; then
 		ZEPHYR_CFLAGS="-I/usr/local/include"
	fi
	AC_DEFINE(LIBZEPHYR_EXT, 1 , [Define if external libzephyr should be used.]) 
	AM_CONDITIONAL(EXTERNAL_LIBZEPHYR, test "x$zephyr" != "xno")
	orig_LDFLAGS="$LDFLAGS"
	LDFLAGS="$LDFLAGS $ZEPHYR_LDFLAGS"
	AC_CHECK_LIB(zephyr, ZInitialize,
			  [ZEPHYR_LIBS="-lzephyr"],
			  [AC_ERROR(Zephyr libraries not found)],
			  -lzephyr)
	orig_LIBS="$LIBS"
	LIBS="$orig_LIBS"
	LDFLAGS="$orig_LDFLAGS"
fi


AC_MSG_CHECKING(for me pot o' gold)
AC_MSG_RESULT(no)
AC_CHECK_FUNCS(gethostid lrand48)
AC_CHECK_FUNCS(memcpy memmove random strchr strerror vprintf)
AC_CHECK_HEADERS(malloc.h paths.h sgtty.h stdarg.h sys/cdefs.h)
AC_CHECK_HEADERS(sys/file.h sys/filio.h sys/ioctl.h sys/msgbuf.h)
AC_CHECK_HEADERS(sys/select.h sys/uio.h sys/utsname.h sys/wait.h)
AC_CHECK_HEADERS(termios.h)
AC_VAR_TIMEZONE_EXTERNALS

AC_CONFIG_COMMANDS_PRE([
	if test -e VERSION; then
		cp -p VERSION VERSION.ac-save
	fi
])

AC_CONFIG_COMMANDS_POST([
	cmp VERSION VERSION.ac-save || touch -r VERSION.ac-save VERSION
	rm -f VERSION.ac-save
])

AC_OUTPUT([Makefile
		   Doxyfile
		   doc/Makefile
		   doc/gaim.1
		   doc/gaim-remote.1
		   intl/Makefile
		   pixmaps/Makefile
		   pixmaps/smileys/Makefile
		   pixmaps/smileys/default/Makefile
		   pixmaps/smileys/none/Makefile
		   pixmaps/status/Makefile
		   pixmaps/status/default/Makefile
		   plugins/Makefile
		   plugins/docklet/Makefile
		   plugins/gevolution/Makefile
		   plugins/gaim-remote/Makefile
		   plugins/gestures/Makefile
		   plugins/perl/Makefile
		   plugins/perl/common/Makefile.PL
		   plugins/ssl/Makefile
		   plugins/tcl/Makefile
		   plugins/ticker/Makefile
		   po/Makefile.in
		   sounds/Makefile
		   src/Makefile
		   src/protocols/Makefile
		   src/protocols/gg/Makefile
		   src/protocols/irc/Makefile
		   src/protocols/jabber/Makefile
		   src/protocols/msn/Makefile
		   src/protocols/napster/Makefile
		   src/protocols/novell/Makefile
		   src/protocols/oscar/Makefile
		   src/protocols/rendezvous/Makefile
		   src/protocols/silc/Makefile
		   src/protocols/toc/Makefile
		   src/protocols/trepia/Makefile
		   src/protocols/yahoo/Makefile
		   src/protocols/zephyr/Makefile
		   gaim.pc
		   gaim.spec
		  ])

echo
echo $PACKAGE $VERSION

echo
echo Build Protocol Plugins........ : $enable_prpls
echo Protocols to link statically.. : $STATIC_PRPLS
echo Protocols to build dynamically : $DYNAMIC_PRPLS
echo
echo UI Library.................... : GTK 2.x
echo SSL Library/Libraries......... : $msg_ssl
echo
echo Build with Plugin support..... : $enable_plugins
echo Build with Perl support....... : $enable_perl
echo Build with Tcl support........ : $enable_tcl
echo Build with Tk support......... : $enable_tk
echo Build with Audio support...... : $enable_audio
echo Build with NAS support........ : $enable_nas
echo Build with GtkSpell support... : $enable_gtkspell
echo
echo Use kerberos 4 with zephyr.... : $kerberos
echo Use external libzephyr........ : $zephyr
echo
echo Use XScreenSaver Extension.... : $enable_xss
echo Use X Session Management...... : $enable_sm
echo Use startup notification.......: $enable_startup_notification
echo
echo Print debugging messages...... : $enable_debug
echo
eval eval echo Gaim will be installed in $bindir.
if test "x$gaimpath" != "x" ; then
	echo Warning: You have an old copy of gaim at $gaimpath.
fi
echo
echo configure complete, now type \'make\'
echo