aboutsummaryrefslogblamecommitdiffstats
path: root/configure.in
blob: 08c75f977a2a4615266f998fd0b1288ed680b645 (plain) (tree)
1
2
3
4
5
6
7
8
9
                                                                
               
 
                                                                                     


                                                     
                          
 
                 
                                                                                                      
 


                                         


                              


            
           

            




                                                       




                
 









                                                  
              
                
 
                                                                                                                                                                  
                   
 
                             
                         
                                                                                   



                                           
                      
                 

               
            
                          
 








                                              
                                                                                        

                            
 
   
                  
   
                  
 


                     
                                                                        
                                                                                          

                                      
                                               



                                       
                                                                                               
 





























                                                                                  
 










                                                                          
                                                                                  







                                                                  
                                                                                         






                                                                        
                                                                                                





                                                                    
 
                                       
 
                                                      









                                                                            
                                          







                                                  
                                                                 


                                                      


                                                      
                                















                                                                                          
                                                                                           




                                                   
    
        
                                                           
                                                                                

  





























                                                                                                        
                                                                                 

  

                                                      






                                                      





























                                                                                                                 


                                                      













                                                                                                                     
  


                                                          
                                                      
                 
                                                      


                      

                   
  







                                        
    
 
                                                      


                                                      
                                                                                                     
                                      
                                                         
                    
    
                   


                                                      












                                                                                                                             
 
                                                      

                                                      
 

                                          
 


                                                                          
 



                                                                            
 



                                


                        
                                      
 
 
                                                      





                                                                                                                 
                                                                 
             
    
                




                                                                                                                              
                                                                     


                                                  
                                                                       

                  
                


    
 












                                                                                                                                          
                                                                                                                           
  
 
                                 
 
 



             
                                          

                        
                                                                       
                         
 
 


                                  


                                                                                                           
                                                       

                             
                                            
                               
                                            












                                                                                                     
                                                                               
                         




                                                                                  

                               



                                                                                                     

                                                                              
                                            
                
    
               
  

                            
 


            

                                                                                                                         
 
             
                                      



                                                                    
                                                             
         



                                                                                   
                                                                                                                      


                                       
                                                    
                                                                
                                                                 
                                                                                
                                                          

                                            
                                                                                   
                                                                  

                                                

                                                                    


                                       
  
 

                                      
                               
                                                           
         
                                        




                                                                                  

                                                           



                                                                                                            
                                                           

                                                                      
                                                                                 
                         



                                                                                               
          
                               
                                                    
                                                                
                              

                                                                                                     

                                                                
                                                                                  

                                                                    
                



                                                
                                                                                               

                                     


                                       
  
 





                      







                                                                                    
            
              

                                               
                                                                                                          

                                                  

                                                                                                    



                                           
                                                      
  
 











                                                                                                     
                                                                            
                                                                                                                                                                                    





                                                                                             
                                                                                        


                                                                   

                                                     

                                                   

                                                                                          



                                             



















                                                                                                         
                                                                          

























                                                                                                                                                    
                                                                    















                                                                                                  
                                                                              
                            
                                                     

























                                                                                               
                                                                        
                            

                                                     















































                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 

                                                             
                                                                           
                            


                                                     





                                                                  

                                                                          
          
  
 

                                                        



                            
 




















                                                                              



















                                                                                                        



                                  


                                                                            









































                                                                                                           
                                                                              














                                                                                       
 


                         








                                                                  



                             

                             






                                                                        
 
                     

                                        
                                                                                                                                                                                      


                            
                                                           



                                 


                                                              

  

                                


                      
 


                          
                                        
 
                                                                                                                                            
 
                                                   


                           


                                                                 
                                              

                         

                                                
                                                                                        

                                                                                                   

                      
 










                                                                
                                                                        


                        
                                                                                      


                       
                                                                                                                                                                                                                                                        


                       








                                                                                           




                                                                                                                     


                                                                                       
 
                                                                                                                        

                          


                               
                                                                                                                                                                 




                                   
                                                                                                                                                                                                                                               
 


                                                                         
 
                                            


                                                                                                 
  
 

                                
                                                                                                                                                                                                                                                                               

                                   
 
                                            
                                                                                                                        

                                           
  


                            
                                                                                                                                                                                                                                                                                                        

                               
 


                                                                                                                            
 

                                                                                                
                                  

                                      


                        
 



                       


                                                                   
 

                                                           
                                                                               
 
                                              

                    
                                                      

                        





                                                      


                                               


                                     
                                             

                

                                  
 
                                

                        
















                                        
 


                                                           







                                                                                                 

                                 
 












                                                                       

                                               














                                                                                 







                                                                                                                                                 
                      


    

                                                            





                                        



                                                                                     
                                                                                        
 
                                                                                                                                          


                                                                   



                                                                                             

                                              

                                                
                                                      
          
                                              

                         
  
                                                             

                        
                                  


                                  


                     
 
                                 

                       
                          
        

                      
                     



                                               




                                            
                            
                             
                         
            

                        
                             
                              
                              



                                 







                                
             










                                                           
                     
                           




                                    
                                
                                 
                                 
               
               

               
              
                       

                       









                                  
                 
                           
                        
                     


                                   


                                  
                 
             


                  
              
                  
        
  
 
                                         
      




                                                                       
 
      
                                                             
                                    




                                    
                                    
                                             
                                  
                                    
                                   

                                   
                                          


                                     

                                                                    


                                                          
                                                   
                                                             
 
  
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.52)

AC_INIT(evolution, 1.5.1, http://bugzilla.ximian.com/enter_bug.cgi?product=Evolution)
AC_CONFIG_SRCDIR(README)
AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)

AM_CONFIG_HEADER(config.h)

AC_CANONICAL_HOST
AC_DEFINE_UNQUOTED(VERSION_COMMENT, "", [Define if you want a comment appended to the version number])

dnl Put the ACLOCAL flags in the Makefile
ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS"

dnl Initialize maintainer mode
AM_MAINTAINER_MODE

AC_ISC_POSIX
AC_PROG_CC
AC_PROG_CPP
AC_C_INLINE
AM_PROG_LEX
AC_PROG_YACC
case $YACC in
*yacc*)
    AC_MSG_ERROR(You need bison to build Evolution)
    ;;
esac
AC_STDC_HEADERS
AC_ARG_PROGRAM
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET

dnl  Test whether jw is installed
AC_PATH_PROG(JW,jw,no)
if test x$JW = xno; then
  HAVE_JW="no"
else
  HAVE_JW="yes"
fi
AM_CONDITIONAL(HAVE_JW, test "x$HAVE_JW" = "xyes")
AC_SUBST(HAVE_JW)

dnl I18N stuff
AC_PROG_INTLTOOL

ALL_LINGUAS="am az be bg ca cs da de el en_AU en_GB es et eu fi fr ga gl hu it ja ko lt lv ms nl nn no pl pt pt_BR ro ru sk sl sr sr@Latn sv tr uk vi zh_CN zh_TW"
AM_GLIB_GNU_GETTEXT

GETTEXT_PACKAGE=evolution-1.5
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Package name for gettext])

localedir='$(prefix)/$(DATADIRNAME)/locale'
AC_SUBST(localedir)

dnl Initialize libtool
AM_DISABLE_STATIC
AM_PROG_LIBTOOL

dnl alloca()
AC_CHECK_HEADERS(alloca.h)

dnl check for socklen_t (in Unix98)
AC_MSG_CHECKING(for socklen_t)
AC_TRY_COMPILE([#include <sys/socket.h>
socklen_t x;
],[],[AC_MSG_RESULT(yes)],[
AC_TRY_COMPILE([#include <sys/socket.h>
int accept (int, struct sockaddr *, size_t *);
],[],[
AC_MSG_RESULT(size_t)
AC_DEFINE(socklen_t,size_t,[Define to appropriate type if socklen_t is not defined])], [
AC_MSG_RESULT(int)
AC_DEFINE(socklen_t,int)])])

dnl
dnl Purify support
dnl
EVO_PURIFY_SUPPORT

dnl
dnl system mail stuff
dnl
AC_PATH_PROG(SENDMAIL, sendmail, /usr/sbin/sendmail, /usr/sbin:/usr/lib)
AC_DEFINE_UNQUOTED(SENDMAIL_PATH, "$SENDMAIL", [Path to a sendmail binary, or equivalent])

AC_MSG_CHECKING(system mail directory)
if test -d /var/mail -a '!' -h /var/mail ; then
    system_mail_dir=/var/mail
else
    system_mail_dir=/var/spool/mail
fi
AC_DEFINE_UNQUOTED(SYSTEM_MAIL_DIR, "$system_mail_dir", [Directory local mail is delivered to])

case `ls -ld $system_mail_dir 2>&1 | awk '{print $1;}'` in
d??????rw?)
    CAMEL_LOCK_HELPER_USER=""
    CAMEL_LOCK_HELPER_GROUP=""
    system_mail_perm="world writable"
    ;;

d???rw????)
    CAMEL_LOCK_HELPER_USER=""
    CAMEL_LOCK_HELPER_GROUP=`ls -ld $system_mail_dir 2>&1 | awk '{print $4;}'`
    system_mail_perm="writable by group $CAMEL_LOCK_HELPER_GROUP"
    ;;

drw???????)
    CAMEL_LOCK_HELPER_USER=`ls -ld $system_mail_dir 2>&1 | awk '{print $3;}'`
    CAMEL_LOCK_HELPER_GROUP=""
    system_mail_perm="writable by user $CAMEL_LOCK_HELPER_USER"
    ;;

*)
    CAMEL_LOCK_HELPER_USER=""
    CAMEL_LOCK_HELPER_GROUP=""
    system_mail_perm="???"
    ;;
esac

AC_MSG_RESULT([$system_mail_dir, $system_mail_perm])
AC_SUBST(CAMEL_LOCK_HELPER_USER)
AC_SUBST(CAMEL_LOCK_HELPER_GROUP)


dnl ***************
dnl Timezone checks
dnl ***************
AC_CACHE_CHECK(for tm_gmtoff in struct tm, ac_cv_struct_tm_gmtoff,
    AC_TRY_COMPILE([
        #include <time.h>
        ], [
        struct tm tm;
        tm.tm_gmtoff = 1;
        ], 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, [Define if struct tm has a tm_gmtoff member])
else
    AC_CACHE_CHECK(for timezone variable, ac_cv_var_timezone,
        AC_TRY_COMPILE([
            #include <time.h>
        ], [
            timezone = 1;
        ], ac_cv_var_timezone=yes, ac_cv_var_timezone=no))
    if test $ac_cv_var_timezone = yes; then
        AC_DEFINE(HAVE_TIMEZONE, 1, [Define if libc defines a timezone variable])
        AC_CACHE_CHECK(for altzone variable, ac_cv_var_altzone,
            AC_TRY_COMPILE([
                #include <time.h>
            ], [
                altzone = 1;
            ], ac_cv_var_altzone=yes, ac_cv_var_altzone=no))
        if test $ac_cv_var_altzone = yes; then
            AC_DEFINE(HAVE_ALTZONE, 1, [Define if libc defines an altzone variable])
        fi
    else
        AC_ERROR(unable to find a way to determine timezone)
    fi
fi


AC_CHECK_FUNCS(mkstemp mkdtemp isblank)

dnl **************************************************
dnl ctime_r prototype
dnl **************************************************

AC_CACHE_CHECK([if ctime_r wants three arguments], ac_cv_ctime_r_three_args,
[
    AC_TRY_COMPILE([
        #include <time.h>
    ],[
        char *buf;
        time_t date;
        ctime_r (&date, buf, 100);
    ],[
        ac_cv_ctime_r_three_args=yes
    ],[
        ac_cv_ctime_r_three_args=no
    ])
])
    
if test x"$ac_cv_ctime_r_three_args" = xyes ; then
    AC_DEFINE(CTIME_R_THREE_ARGS, 1, [Solaris-style ctime_r])
fi

dnl **************************************************
dnl gethostbyname_r prototype
dnl **************************************************

AC_CHECK_FUNCS(gethostbyname_r,[
AC_CACHE_CHECK([if gethostbyname_r wants five arguments], ac_cv_gethostbyname_r_five_args,
[
    AC_TRY_COMPILE([
        #include "confdefs.h"
        #include <sys/types.h>
        #include <sys/socket.h>
        #include <netinet/in.h>
        #include <netdb.h>

        #define BUFSIZE (sizeof(struct hostent)+10)
    ],[
        struct hostent hent;
        char buffer[BUFSIZE];
        int bufsize=BUFSIZE;
        int h_errno;

        (void)gethostbyname_r ("www.ximian.com", &hent, buffer, bufsize, &h_errno);
    ],[
        ac_cv_gethostbyname_r_five_args=yes
    ],[
        ac_cv_gethostbyname_r_five_args=no
    ])
])])
    
if test "x$ac_cv_gethostbyname_r_five_args" = "xyes" ; then
    AC_DEFINE(GETHOSTBYNAME_R_FIVE_ARGS, 1, [Solaris-style gethostbyname_r])
fi

dnl **************************************************
dnl gethostbyaddr_r prototype
dnl **************************************************

AC_CHECK_FUNCS(gethostbyaddr_r,[
AC_CACHE_CHECK([if gethostbyaddr_r wants seven arguments], ac_cv_gethostbyaddr_r_seven_args,
[
    AC_TRY_COMPILE([
        #include "confdefs.h"
        #include <sys/types.h>
        #include <sys/socket.h>
        #include <netinet/in.h>
        #include <netdb.h>

        #define BUFSIZE (sizeof(struct hostent)+10)
    ],[
        struct hostent hent;
        char buffer[BUFSIZE];
        int bufsize=BUFSIZE;
        int h_errno;

        (void)gethostbyaddr_r ("www.ximian.com", 14, AF_INET, &hent, buffer, bufsize, &h_errno);
    ],[
        ac_cv_gethostbyaddr_r_seven_args=yes
    ],[
        ac_cv_gethostbyaddr_r_seven_args=no
    ])
])])
    
if test "x$ac_cv_gethostbyaddr_r_seven_args" = "xyes" ; then
    AC_DEFINE(GETHOSTBYADDR_R_SEVEN_ARGS, 1, [Solaris-style gethostbyaddr_r])
fi


dnl **************************************************
dnl * Accessibility support
dnl **************************************************
PKG_CHECK_MODULES(A11Y, atk)
AC_SUBST(A11Y_CFLAGS)
AC_SUBST(A11Y_LIBS)

dnl **************************************************
dnl * IPv6 support
dnl **************************************************
AC_ARG_ENABLE(ipv6, [  --enable-ipv6=[no/yes]      Enable support for resolving IPv6 addresses.],,enable_ipv6=no)
if test "x$enable_ipv6" = "xyes"; then
AC_CACHE_CHECK([if system has necessary structs and functions for IPv6 support], msg_ipv6,
[
    AC_TRY_COMPILE([
        #include "confdefs.h"
        #include <sys/types.h>
        #include <sys/socket.h>
        #include <netinet/in.h>
        #include <netdb.h>

    ],[
        struct addrinfo hints, *res;
        struct sockaddr_in6 sin6;
        int af = AF_INET6;
        
        getaddrinfo ("www.ximian.com", NULL, &hints, &res);
        freeaddrinfo (res);
    ],[
        msg_ipv6=yes
    ],[
        enable_ipv6=no
        msg_ipv6=no
    ])
])
else
    msg_ipv6=no
fi

if test "x$enable_ipv6" = "xyes"; then
    AC_DEFINE(ENABLE_IPv6,1,[Enable IPv6 support])
    AC_TRY_COMPILE([
        #include "confdefs.h"
        #include <sys/types.h>
        #include <sys/socket.h>
        #include <netinet/in.h>
        #include <netdb.h>

    ],[
        struct addrinfo hints;
        
        hints.ai_flags = AI_ADDRCONFIG;
    ],[
        AC_DEFINE(HAVE_AI_ADDRCONFIG,1,[Define if the system defines the AI_ADDRCONFIG flag for getaddrinfo])
    ])
fi
AM_CONDITIONAL(ENABLE_IPv6, test "x$enable_ipv6" = "xyes")


dnl **************************************************
dnl LDAP support.
dnl **************************************************
EVO_LDAP_CHECK(no)
case $with_openldap in
no)
    msg_ldap=no
    ;;
*)
    case $with_static_ldap in
    yes)
        msg_ldap="yes (static)"
        ;;
    *)
        msg_ldap="yes (dynamic)"
        ;;
    esac
esac

dnl **************************************************
dnl NNTP support.
dnl **************************************************
AC_ARG_ENABLE(nntp, 
[  --enable-nntp=[no/yes]      Attempt to compile incomplete, unsupported NNTP code],,enable_nntp=no)
if test "x$enable_nntp" = "xyes"; then
    AC_DEFINE(ENABLE_NNTP,1,[Don't try this at home])
    msg_nntp=yes
else
    msg_nntp=no
fi
AM_CONDITIONAL(ENABLE_NNTP, test x$enable_nntp = xyes)

dnl **************************************************
dnl New IMAP code support.
dnl **************************************************
AC_ARG_ENABLE(imapp, 
[  --enable-imapp=[no/yes]      Attempt to compile alternative, incomplete, very unsupported IMAPv4r1 code],,enable_imapp=no)
if test "x$enable_imapp" = "xyes"; then
    AC_DEFINE(ENABLE_IMAPP,1,[Really don't try this at home])
    msg_imapp=yes
else
    msg_imapp=no
fi
AM_CONDITIONAL(ENABLE_IMAPP, test x$enable_imapp = xyes)


dnl **************************************************
dnl * Posix thread support
dnl **************************************************

dnl GLIB_CONFIG=${GLIB_CONFIG-glib-config}
dnl GNOME_PTHREAD_CHECK

dnl if test "x$PTHREAD_LIB" = "x" ; then
dnl     AC_MSG_ERROR([POSIX threads are currently required for Evolution])
dnl fi

dnl
dnl Notice that this is a hack, and we wont be able to use this forever, but
dnl at least for some time
dnl

EVO_PTHREAD_CHECK

THREADS_LIBS="$PTHREAD_LIB"
THREADS_CFLAGS="$PTHREAD_CFLAGS"

AC_SUBST(THREADS_LIBS)
AC_SUBST(THREADS_CFLAGS)
AC_DEFINE(ENABLE_THREADS,1,[Required])


dnl **************************************************
dnl * File locking
dnl **************************************************

AC_ARG_ENABLE(dot-locking, 
[  --enable-dot-locking=[yes/no] Enable support for locking mail files with dot locking],,enable_dot_locking=yes)
if test "x$enable_dot_locking" = "xyes"; then
  AC_DEFINE(USE_DOT,1,[Define to use dot locking for mbox files])
  msg_dot=yes
else
  msg_dot=no    
fi

AC_ARG_ENABLE(file-locking, 
[  --enable-file-locking=[fcntl/flock/no] Enable support for locking mail files with file locking],,enable_file_locking=fcntl)
if test "x$enable_file_locking" = "xfcntl"; then
  AC_DEFINE(USE_FCNTL,1,[Define to use fcntl locking for mbox files])
  msg_file=fcntl
else
  if test "x$enable_file_locking" = "xflock"; then
    AC_DEFINE(USE_FLOCK,1,[Define to use flock locking for mbox files])
    msg_file=flock
  else
    msg_file=no 
  fi
fi


dnl **************************************************
dnl * sendmail operation
dnl **************************************************

AC_MSG_CHECKING(for SunOS broken spool format)
if test "x$host_os" = "xsunos" ; then
   with_broken_spool="yes"
fi

AC_ARG_WITH(broken-spool, 
[  --with-broken-spool=[yes/no] Using SunOS/Solaris sendmail which has a broken spool format],,with_broken_spool=${with_broken_spool:=no})

if test "x$with_broken_spool" = "xyes"; then
  AC_DEFINE(HAVE_BROKEN_SPOOL,1,[Define if mail delivered to the system mail directory is in broken Content-Length format])
fi

AC_MSG_RESULT($with_broken_spool)


dnl *********
dnl Libraries
dnl *********

PKG_CHECK_MODULES(GTKHTML, libgtkhtml-3.1)
AC_SUBST(GTKHTML_CFLAGS)
AC_SUBST(GTKHTML_LIBS)
GTKHTML_DATADIR=`$PKG_CONFIG --variable gtkhtml_datadir libgtkhtml-3.1`
AC_SUBST(GTKHTML_DATADIR)


dnl ******************************
dnl Pilot checking
dnl ******************************
AC_ARG_ENABLE(pilot-conduits, 
[  --enable-pilot-conduits=[no/yes] Enable support for building pilot conduits.],,enable_pilot_conduits=no)
if test "x$enable_pilot_conduits" = "xyes"; then
    PKG_CHECK_MODULES(GNOME_PILOT, gnome-pilot-2.0)

    CFLAGS_save="$CFLAGS"
    CFLAGS="$CFLAGS $GNOME_PILOT_CFLAGS"
    LDFLAGS_save="$LDFLAGS"
    LDFLAGS="$LDFLAGS $GNOME_PILOT_LIBS"

    AC_CACHE_CHECK([if pilot-link handles UTF-8 conversions], ac_cv_pilot_link_utf8, AC_TRY_RUN([

#include <stdlib.h>
#include <string.h>
#include <pi-util.h>

int main (int argc, char **argv)
{
    const char *utf8 = "\x66\x66\x66\x66\x66\x66\x66\xC2\xA9";
    size_t utf8_real_len = strlen (utf8);
    char *pstring;  

    if (convert_ToPilotChar ("UTF-8", utf8, utf8_real_len, &pstring) == -1)
        exit (1);

    exit (0);
}
], ac_cv_pilot_link_utf8=yes, ac_cv_pilot_link_utf8=no, ac_cv_pilot_link_utf8=no))

    CFLAGS="$CFLAGS_save"
    LDFLAGS="$LDFLAGS_save"

    if test "$ac_cv_pilot_link_utf8" = no; then
        AC_MSG_ERROR(evolution requires pilot-link to have working UTF-8 conversion routines)
    fi
fi
AM_CONDITIONAL(ENABLE_PILOT_CONDUITS, test "x$enable_pilot_conduits" = "xyes")
if test x$enable_pilot_conduits = xyes; then
   msg_pilot=yes
else
   msg_pilot=no
fi
AC_SUBST(GNOME_PILOT_CFLAGS)
AC_SUBST(GNOME_PILOT_LIBS)

dnl ********
dnl Kerberos
dnl ********
AC_ARG_WITH(krb5, [  --with-krb5=PREFIX      Location of Kerberos 5 libs/includes], with_krb5="$withval", with_krb5="no")
AC_ARG_WITH(krb4, [  --with-krb4=PREFIX      Location of Kerberos 4 libs/includes], with_krb4="$withval", with_krb4="no")

msg_krb5="no"
if test "x${with_krb5}" != "xno"; then
    LDFLAGS_save="$LDFLAGS"
    
    mitlibs="-lkrb5 -lk5crypto -lcom_err -lgssapi_krb5"
    heimlibs="-lkrb5 -lcrypto -lasn1 -lcom_err -lroken -lgssapi"
    AC_CACHE_CHECK([for Kerberos 5], ac_cv_lib_kerberos5,
    [
        LDFLAGS="$LDFLAGS -L$with_krb5/lib $mitlibs"
        AC_TRY_LINK_FUNC(krb5_init_context, ac_cv_lib_kerberos5="$mitlibs",
        [
            LDFLAGS="$LDFLAGS_save -L$with_krb5/lib $heimlibs"
            AC_TRY_LINK_FUNC(krb5_init_context, ac_cv_lib_kerberos5="$heimlibs", ac_cv_lib_kerberos5="no")
        ])
        LDFLAGS="$LDFLAGS_save"
    ])
    if test "$ac_cv_lib_kerberos5" != "no"; then
        AC_DEFINE(HAVE_KRB5,1,[Define if you have Krb5])
        if test "$ac_cv_lib_kerberos5" = "$mitlibs"; then
            AC_DEFINE(HAVE_MIT_KRB5,1,[Define if you have MIT Krb5])
            KRB5_CFLAGS="-I$with_krb5/include"
            msg_krb5="yes (MIT)"
        else
            AC_DEFINE(HAVE_HEIMDAL_KRB5,1,[Define if you have Heimdal])
            KRB5_CFLAGS="-I$with_krb5/include/heimdal"
            msg_krb5="yes (Heimdal)"
        fi
        KRB5_LDFLAGS="-L$with_krb5/lib $ac_cv_lib_kerberos5"
    fi
else
    AC_MSG_CHECKING(for Kerberos 5)
    AC_MSG_RESULT($with_krb5)
fi

msg_krb4="no"
if test "x${with_krb4}" != "xno"; then
    LDFLAGS_save="$LDFLAGS"
    AC_CACHE_CHECK(for Kerberos 4, ac_cv_lib_kerberos4,
    [
        ac_cv_lib_kerberos4="no"

        mitcompatlibs="-lkrb4 -ldes425 -lkrb5 -lk5crypto -lcom_err"
        # Look for MIT krb5 compat krb4
        LDFLAGS="$LDFLAGS -L$with_krb4/lib $mitcompatlibs"
        AC_TRY_LINK_FUNC(krb_mk_req, ac_cv_lib_kerberos4="$mitcompatlibs")
        
        if test "$ac_cv_lib_kerberos4" = "no"; then
            # Look for KTH krb4
            LDFLAGS="$LDFLAGS_save -L$with_krb4/lib -lkrb -lcrypto -lcom_err -lroken"
            AC_TRY_LINK_FUNC(krb_mk_req, ac_cv_lib_kerberos4="-lkrb -lcrypto -lcom_err -lroken")
        fi
        if test "$ac_cv_lib_kerberos4" = "no"; then
            # Look for old MIT krb4
            LDFLAGS="$LDFLAGS_save -L$with_krb4/lib -lkrb"
            AC_TRY_LINK_FUNC(krb_mk_req, ac_cv_lib_kerberos4="-lkrb",
            [
                LDFLAGS="$LDFLAGS -ldes"
                AC_TRY_LINK_FUNC(krb_mk_req, ac_cv_lib_kerberos4="-lkrb -ldes")
            ])
        fi
    ])
    LDFLAGS="$LDFLAGS_save"
    if test "$ac_cv_lib_kerberos4" != "no"; then
        AC_DEFINE(HAVE_KRB4,1,[Define if you have Krb4])
        msg_krb4="yes"
        if test -f "$with_krb4/include/krb.h" -o -f "$with_krb4/include/port-sockets.h"; then
            KRB4_CFLAGS="-I$with_krb4/include"
        fi
        if test -d "$with_krb4/include/kerberosIV"; then
            KRB4_CFLAGS="$KRB4_CFLAGS -I$with_krb4/include/kerberosIV"
        fi
        KRB4_LDFLAGS="-L$with_krb4/lib $ac_cv_lib_kerberos4"
        
        CFLAGS_save="$CFLAGS"
        CFLAGS="$CFLAGS $KRB4_CFLAGS"
        AC_TRY_COMPILE([#include "krb.h"
        int krb_sendauth;
        ],[return 0],[AC_DEFINE(NEED_KRB_SENDAUTH_PROTO,1,[Need krb_sendauth proto])],)
        CFLAGS="$CFLAGS_save"
    fi
else
    AC_MSG_CHECKING(for Kerberos 4)
    AC_MSG_RESULT(${with_krb4})
fi

AC_SUBST(KRB5_CFLAGS)
AC_SUBST(KRB5_LDFLAGS)
AC_SUBST(KRB4_CFLAGS)
AC_SUBST(KRB4_LDFLAGS)


dnl ********************************************************************************
dnl security extension support (SSL and S/MIME)
dnl
dnl The following voodoo does detection of mozilla libraries (nspr and nss) 
dnl needed by Camel (SSL and S/MIME).
dnl
dnl The Evolution security extensions are only built if these libraries are found
dnl ********************************************************************************
msg_ssl="no"
msg_smime="no"

dnl these 2 enable's are inverses of each other
AC_ARG_ENABLE(nss, [  --enable-nss=[yes,no,static]        Attempt to use Mozilla libnss for SSL support.],
    enable_nss="$enableval", enable_nss="yes")

AC_ARG_ENABLE(openssl, [  --enable-openssl=[no,yes]        Attempt to use OpenSSL for SSL support.],
    enable_openssl="$enableval", enable_openssl="no")

if test "x${enable_openssl}" = "xyes"; then
dnl User wants to override nss with OpenSSL
    enable_nss="no"
    AC_MSG_WARN([OpenSSL enabled, disabling NSS.])
fi

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

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

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

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

if test "x${enable_nss}" = "xyes" || test "x${enable_nss}" = "xstatic"; then
    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
dnl If the user specifies --with-foo or --enable-nss=static, then we have to do this manually
        check_manually="yes"
    else
        check_manually="no"
    fi
    
    if test "x${check_manually}" = "xno" && `$PKG_CONFIG --exists mozilla-nss`; then
        PKG_CHECK_MODULES(NSS, mozilla-nss, have_nss="yes")
        if test "x${have_nss}" = "xyes"; then
            msg_ssl="yes (Mozilla NSS)"
            msg_smime="yes (Mozilla NSS)"
            enable_smime="yes"
            mozilla_nspr="mozilla-nspr"
            mozilla_nss="mozilla-nss"
            AC_DEFINE(HAVE_NSS,1,[Define if you have NSS])
            AC_DEFINE(HAVE_SSL,1,[Define if you have a supported SSL library])
            MANUAL_NSPR_CFLAGS=""
            MANUAL_NSPR_LIBS=""
            MANUAL_NSS_CFLAGS=""
            MANUAL_NSS_LIBS=""
        else
            check_manually="yes"
        fi
    fi
    
    if test "x${check_manually}" = "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"
                MANUAL_NSPR_CFLAGS="-I$with_nspr_includes"
            fi
        else
            AC_MSG_CHECKING(for Mozilla nspr4 includes)
            AC_MSG_RESULT(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])
                    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 $MANUAL_NSPR_CFLAGS"
                
                if test "x${with_nspr_libs}" != "x"; then
                        LIBS="$nsprlibs"
                        LDFLAGS="$LDFLAGS -L$with_nspr_libs"
                else
                        LIBS="$nsprlibs"
                        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"
                MANUAL_NSPR_LIBS="-L$with_nspr_libs $nsprlibs"
            else
                MANUAL_NSPR_CLFAGS=""
            fi
        else
            AC_MSG_CHECKING(for Mozilla nspr4 libraries)
            AC_MSG_RESULT(no)
        fi
        
        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,
                [ have_nss_includes="yes" ], 
                [ have_nss_includes="no" ])
            
            CPPFLAGS="$CPPFLAGS_save"
            
            if test "x${have_nss_includes}" = "xyes"; then  
                have_nss_includes="yes"
                MANUAL_NSS_CFLAGS="-I$with_nss_includes"
            else
                MANUAL_NSPR_CFLAGS=""
                MANUAL_NSPR_LIBS=""
            fi
        else
            AC_MSG_CHECKING(for Mozilla nss3 includes)
            AC_MSG_RESULT(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])
                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/libfreebl.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 "$moz_nss_libs" = no; 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 "$moz_nss_libs" != no; then
                AC_DEFINE(HAVE_NSS)
                AC_DEFINE(HAVE_SSL)
                if test "$enable_nss" = "static"; then
                    msg_ssl="yes (Mozilla NSS:static)"
                else
                    msg_ssl="yes (Mozilla NSS)"
                fi # static_nss
                msg_smime="yes (Mozilla NSS)"
                enable_smime="yes"
                MANUAL_NSS_LIBS="-L$with_nss_libs $nsslibs"
            else
                MANUAL_NSS_CFLAGS=""
                MANUAL_NSPR_CFLAGS=""
                MANUAL_NSPR_LIBS=""
            fi
        else
            AC_MSG_CHECKING(for Mozilla nss libraries)
            AC_MSG_RESULT(no)
        fi
        
        MANUAL_NSS_CFLAGS="$MANUAL_NSPR_CFLAGS $MANUAL_NSS_CFLAGS"
        MANUAL_NSS_LIBS="$MANUAL_NSPR_LIBS $MANUAL_NSS_LIBS"
    fi
fi

AM_CONDITIONAL(ENABLE_SMIME, test x$enable_smime = xyes)

AC_SUBST(MANUAL_NSPR_CFLAGS)
AC_SUBST(MANUAL_NSPR_LIBS)
AC_SUBST(MANUAL_NSS_CFLAGS)
AC_SUBST(MANUAL_NSS_LIBS)

dnl ******************
dnl CDE dtappintegrate
dnl ******************

AC_ARG_WITH(cde-path, [  --with-cde-path=PATH   Location of CDE installation],
        [with_cde_path="$withval"])
if test -z "$with_cde_path"; then
    with_cde_path="/usr/dt"
fi

AC_MSG_CHECKING(for dtappintegrate)
if test -x "$with_cde_path/bin/dtappintegrate" ; then
    DTAPPINTEGRATE="$with_cde_path/bin/dtappintegrate"
else
    DTAPPINTEGRATE="no"
fi
AC_MSG_RESULT([$DTAPPINTEGRATE])

AC_SUBST(DTAPPINTEGRATE)
AM_CONDITIONAL(HAVE_DTAPPINTEGRATE, test "x$DTAPPINTEGRATE" != "xno")

dnl *****************
dnl killall or pkill?
dnl *****************

AC_MSG_CHECKING(for command to kill processes)

if test `uname -s` = "SunOS" ; then
    KILL_PROCESS_CMD="pkill";
else
    KILL_PROCESS_CMD="killall";
fi

KILL_PROCESS_CMD=`which $KILL_PROCESS_CMD`
if test -z "$KILL_PROCESS_CMD" ; then
    AC_MSG_RESULT(none)
else
    AC_MSG_RESULT($KILL_PROCESS_CMD)
    AC_DEFINE_UNQUOTED([KILL_PROCESS_CMD], "$KILL_PROCESS_CMD", [Command to kill processes by name])
fi

dnl ******************************
dnl OpenSSL
dnl ******************************

dnl only continue detecting OpenSSL if we haven't already found all of the
dnl Mozilla libnss includes/libraries and if user actually wants ssl support
if test "$msg_ssl" = "no" -a "x${enable_openssl}" != "xno"; then
    AC_ARG_WITH(openssl-includes, [  --with-openssl-includes=PREFIX     Location of OpenSSL includes.],
        with_openssl_includes="$withval", with_openssl_includes="/usr/include")
    have_openssl_includes="no"
    if test "x${with_openssl_includes}" != "xno"; then
        CPPFLAGS_save="$CPPFLAGS"
        
        AC_MSG_CHECKING(for OpenSSL includes)
        AC_MSG_RESULT("")
        
        CPPFLAGS="$CPPFLAGS -I$with_openssl_includes"
        AC_CHECK_HEADERS(openssl/ssl.h openssl/x509.h, [ openssl_includes="yes" ])
        CPPFLAGS="$CPPFLAGS_save"
        
        if test "x{$openssl_includes}" != "xno" -a "x{$openssl_includes}" != "x"; then
            have_openssl_includes="yes"
            OPENSSL_CFLAGS="-I$with_openssl_includes"
        else
            OPENSSL_CFLAGS=""
        fi
    else
        AC_MSG_CHECKING(for OpenSSL includes)
        AC_MSG_RESULT(no)
    fi
    
    AC_ARG_WITH(openssl-libs, [  --with-openssl-libs=PREFIX         Location of OpenSSL libs.],
        with_openssl_libs="$withval")
    if test "x${with_openssl_libs}" != "xno" -a "x${have_openssl_includes}" != "xno"; then
        LDFLAGS_save="$LDFLAGS"
    
        case $with_openssl_libs in
        ""|-L*) ;;
        *) with_openssl_libs="-L$with_openssl_libs" ;;
        esac
    
        AC_CHECK_LIB(dl, dlopen, DL_LDFLAGS="-ldl", DL_LDFLAGS="")
        AC_CACHE_CHECK([for OpenSSL libraries], openssl_libs,
        [
            LDFLAGS="$LDFLAGS $with_openssl_libs -lssl -lcrypto $DL_LDFLAGS"
            AC_TRY_LINK_FUNC(SSL_read, openssl_libs="yes", openssl_libs="no")
            LDFLAGS="$LDFLAGS_save"
        ])
        if test "x${openssl_libs}" != "xno"; then
            AC_DEFINE(HAVE_OPENSSL,1,[Define if you have OpenSSL])
            AC_DEFINE(HAVE_SSL)
            msg_ssl="yes (OpenSSL)"
            OPENSSL_LDFLAGS="$with_openssl_libs -lssl -lcrypto $DL_LDFLAGS"
        else
            OPENSSL_CFLAGS=""
            OPENSSL_LDFLAGS=""
        fi
    else
        AC_MSG_CHECKING(for OpenSSL libraries)
        AC_MSG_RESULT(no)
    fi
else
    OPENSSL_CFLAGS=""
    OPENSSL_LDFLAGS=""
fi

AC_SUBST(OPENSSL_CFLAGS)
AC_SUBST(OPENSSL_LDFLAGS)

dnl *******************
dnl GObject marshalling
dnl *******************
AM_PATH_GLIB_2_0

dnl We use AC_SUBST_FILE because AC_SUBST won't deal with newlines
EVO_MARSHAL_RULE=$srcdir/marshal.mk
AC_SUBST_FILE(EVO_MARSHAL_RULE)

dnl *************************
dnl CFLAGS and LIBS and stuff
dnl *************************

GNOME_COMPILE_WARNINGS(yes)
CFLAGS="$CFLAGS $WARN_CFLAGS"
case $CFLAGS in
*-Wall*)
    # Turn off the annoying "comparison between signed and unsigned"
    # warning in gcc 3.3
    CFLAGS="$CFLAGS -Wno-sign-compare"
    ;;
esac

AM_PATH_ORBIT2(2.8.0)

AC_MSG_CHECKING(for CORBA include paths)
IDL_INCLUDES="-I "`pkg-config --variable=idldir libbonobo-2.0`" -I "`pkg-config --variable=idldir bonobo-activation-2.0`" -I "`pkg-config --variable=idldir evolution-data-server-1.0`
AC_MSG_RESULT($IDL_INCLUDES)
AC_SUBST(IDL_INCLUDES)

dnl Utility macro to set compiler flags for a specific lib.
AC_DEFUN(EVO_SET_COMPILE_FLAGS, [
    deps="$2"
    extra_cflags="$3"
    extra_libs="$4"
    PKG_CHECK_MODULES(EVOLUTION, $deps)
    $1_CFLAGS="$EVOLUTION_CFLAGS \$(WERROR) $extra_cflags"
    $1_LIBS="$EVOLUTION_LIBS $extra_libs"
])

dnl --- Required version numbers

GAL_REQUIRED=2.1.2
GTKHTML_REQUIRED=3.1.5
EDS_REQUIRED=0.0.4

AC_SUBST(GAL_REQUIRED)
AC_SUBST(GTKHTML_REQUIRED)

dnl --- Flags to get all the GNOME stuff

FULL_GNOME_DEPS="libbonoboui-2.0 gnome-vfs-2.0 libgnomeui-2.0 libglade-2.0 libgnomecanvas-2.0 libxml-2.0 gconf-2.0 gal-2.2 >= $GAL_REQUIRED"

EVO_SET_COMPILE_FLAGS(GNOME_FULL, $FULL_GNOME_DEPS)
AC_SUBST(GNOME_FULL_CFLAGS)
AC_SUBST(GNOME_FULL_LIBS)

CPPFLAGS_save="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS `$PKG_CONFIG --cflags-only-I libgnomeui-2.0`"
AC_CHECK_HEADERS(libgnomeui/gnome-icon-lookup.h)
AC_CHECK_HEADERS(libgnomeui/gnome-thumbnail.h)
CPPFLAGS="$CPPFLAGS_save"

dnl --- Flags for the various libraries we build

EVO_SET_COMPILE_FLAGS(CAMEL, glib-2.0 gthread-2.0 gal-2.2 >= $GAL_REQUIRED $mozilla_nss,
              $THREADS_CFLAGS $KRB4_CFLAGS $KRB5_CFLAGS $MANUAL_NSS_CFLAGS $OPENSSL_CFLAGS,
                  $THREADS_LIBS $KRB4_LDFLAGS $KRB5_LDFLAGS $MANUAL_NSS_LIBS $OPENSSL_LDFLAGS)
AC_SUBST(CAMEL_CFLAGS)
AC_SUBST(CAMEL_LIBS)

if test "x$mozilla_nss" != "x"; then
   EVO_SET_COMPILE_FLAGS(MOZILLA_NSS, $mozilla_nss)
   MOZILLA_L_DIR=`pkg-config --libs-only-L $mozilla_nss`
else
    if test "x$MOZILLA_MANUAL_LIBS" != "x"; then
       MOZILLA_L_DIR="-L$with_nss_lib"
    fi
fi

EVO_SET_COMPILE_FLAGS(CERT_UI, glib-2.0 gobject-2.0 gthread-2.0,
                      $MANUAL_NSS_CFLAGS $MOZILLA_NSS_CFLAGS,
                  $MOZILLA_L_DIR $MANUAL_NSS_LIBS $MOZILLA_NSS_LIBS)
AC_SUBST(CERT_UI_CFLAGS)
AC_SUBST(CERT_UI_LIBS)

EVO_SET_COMPILE_FLAGS(E_NAME, libgnomeui-2.0 libbonoboui-2.0 gal-2.2 >= $GAL_REQUIRED)
AC_SUBST(E_NAME_CFLAGS)
AC_SUBST(E_NAME_LIBS)

EVO_SET_COMPILE_FLAGS(E_UTIL, gthread-2.0 gconf-2.0 libxml-2.0 libbonoboui-2.0 libglade-2.0 gal-2.2 >= $GAL_REQUIRED libgnomeui-2.0 libgnome-2.0 libgnomecanvas-2.0 $mozilla_nspr, $THREADS_CFLAGS $MANUAL_NSPR_CFLAGS, $THREADS_LIBS $MANUAL_NSPR_LIBS)
AC_SUBST(E_UTIL_CFLAGS)
AC_SUBST(E_UTIL_LIBS)

EVO_SET_COMPILE_FLAGS(TZDIALOG, libecal-1.0, $GNOME_FULL_CFLAGS, $GNOME_FULL_LIBS)
AC_SUBST(TZDIALOG_CFLAGS)
AC_SUBST(TZDIALOG_LIBS)

EVO_SET_COMPILE_FLAGS(SOURCE_SEL, libedataserver-1.0, $GNOME_FULL_CFLAGS, $GNOME_FULL_LIBS)
AC_SUBST(SOURCE_SEL_CFLAGS)
AC_SUBST(SOURCE_SEL_LIBS)


dnl 
dnl EVO_SET_COMPILE_FLAGS(E_WIDGETS, bonobo_conf bonobox_print gdk_pixbuf gnomecanvaspixbuf gnomeui libglade oaf vfs)
dnl AC_SUBST(E_WIDGETS_CFLAGS)
dnl AC_SUBST(E_WIDGETS_LIBS)
dnl 
EVO_SET_COMPILE_FLAGS(IMPORTERS, gconf-2.0 libglade-2.0 libbonoboui-2.0 libgnomeui-2.0)
AC_SUBST(IMPORTERS_CFLAGS)
AC_SUBST(IMPORTERS_LIBS)

EVO_SET_COMPILE_FLAGS(LIBFILTER, libgnome-2.0 libgnomeui-2.0 libglade-2.0 libxml-2.0 gconf-2.0 gal-2.2 >= $GAL_REQUIRED)
AC_SUBST(LIBFILTER_CFLAGS)
AC_SUBST(LIBFILTER_LIBS)

dnl --- evolution (shell) flags

EVO_SET_COMPILE_FLAGS(SHELL, libgnome-2.0 libgnomeui-2.0 libbonoboui-2.0 gal-2.2 >= $GAL_REQUIRED libglade-2.0 gnome-vfs-2.0 libgtkhtml-3.1 >= $GTKHTML_REQUIRED)
AC_SUBST(SHELL_CFLAGS)
AC_SUBST(SHELL_LIBS)

dnl --- evolution-addressbook flags

EVOLUTION_ADDRESSBOOK_DEPS="gconf-2.0 libbonoboui-2.0 libglade-2.0 gal-2.2 >= $GAL_REQUIRED libgnomeui-2.0 libgnome-2.0 libgnomecanvas-2.0 gnome-vfs-2.0 libgnomeprintui-2.2 libgtkhtml-3.1 >= $GTKHTML_REQUIRED libebook-1.0 >= $EDS_REQUIRED"

EVO_SET_COMPILE_FLAGS(EVOLUTION_ADDRESSBOOK, $EVOLUTION_ADDRESSBOOK_DEPS)
AC_SUBST(EVOLUTION_ADDRESSBOOK_CFLAGS)
AC_SUBST(EVOLUTION_ADDRESSBOOK_LIBS)

if test x$enable_pilot_conduits = xyes; then
EVO_SET_COMPILE_FLAGS(EVOLUTION_ADDRESSBOOK_CONDUIT, gnome-pilot-2.0 $EVOLUTION_ADDRESSBOOK_DEPS)
AC_SUBST(EVOLUTION_ADDRESSBOOK_CONDUIT_CFLAGS)
AC_SUBST(EVOLUTION_ADDRESSBOOK_CONDUIT_LIBS)
fi

dnl --- evolution-calendar flags

EVO_SET_COMPILE_FLAGS(EVOLUTION_CALENDAR, libgnome-2.0 libgnomeui-2.0 libbonoboui-2.0 gal-2.2 >= $GAL_REQUIRED libglade-2.0 gnome-vfs-2.0 libgnomeprint-2.2 libgnomeprintui-2.2 libgtkhtml-3.1 >= $GTKHTML_REQUIRED libebook-1.0 >= $EDS_REQUIRED libecal-1.0 >= $EDS_REQUIRED)
AC_SUBST(EVOLUTION_CALENDAR_CFLAGS)
AC_SUBST(EVOLUTION_CALENDAR_LIBS)

if test x$enable_pilot_conduits = xyes; then
EVO_SET_COMPILE_FLAGS(EVOLUTION_CALENDAR_CONDUIT, gnome-pilot-2.0, $EVOLUTION_CALENDAR_CFLAGS, $EVOLUTION_CALENDAR_LIBS)
AC_SUBST(EVOLUTION_CALENDAR_CONDUIT_CFLAGS)
AC_SUBST(EVOLUTION_CALENDAR_CONDUIT_LIBS)
fi

dnl --- evolution-mail flags

EVO_SET_COMPILE_FLAGS(EVOLUTION_MAIL, libgnome-2.0 libgnomeui-2.0 libbonoboui-2.0 gal-2.2 >= $GAL_REQUIRED libglade-2.0 gnome-vfs-module-2.0 libgnomeprint-2.2 libgnomeprintui-2.2 libgtkhtml-3.1 >= $GTKHTML_REQUIRED libxml-2.0 bonobo-activation-2.0 gthread-2.0 gconf-2.0 $mozilla_nss libebook-1.0)
AC_SUBST(EVOLUTION_MAIL_CFLAGS)
AC_SUBST(EVOLUTION_MAIL_LIBS)

dnl -- evolution-data-server IDL and version

AC_DEFINE_UNQUOTED(DATASERVER_VERSION, "`pkg-config --modversion evolution-data-server-1.0`", evolution-data-server version)

AC_MSG_CHECKING(for evolution-data-server IDL)
DATASERVER_IDL=`pkg-config --variable=idldir evolution-data-server-1.0`/Evolution-DataServer.idl
if test -f "$DATASERVER_IDL"; then
    AC_MSG_RESULT($DATASERVER_IDL)
     AC_SUBST(DATASERVER_IDL)
else
    AC_MSG_ERROR(no)
fi

dnl *******************
dnl Special directories
dnl *******************

dnl --- If you add something here, consider whether or not you also
dnl --- need to add it to one or more .pc.in files (for Connector,
dnl --- etc)

BASE_VERSION=`echo $VERSION | awk -F. '{print $1 "." $2;}'`
AC_SUBST(BASE_VERSION)
AC_DEFINE_UNQUOTED(BASE_VERSION, "$BASE_VERSION", [Base version (Major.Minor)])

privlibdir='${libdir}'/evolution/$BASE_VERSION
AC_SUBST(privlibdir)

privlibexecdir='${libexecdir}'/evolution/$BASE_VERSION
AC_SUBST(privlibexecdir)

privdatadir='${datadir}'/evolution/$BASE_VERSION
AC_SUBST(privdatadir)

privincludedir='${includedir}'/evolution-$BASE_VERSION
AC_SUBST(privincludedir)

camel_providerdir="$privlibdir/camel-providers"
AC_SUBST(camel_providerdir)

componentdir="$privlibdir/components"
AC_SUBST(componentdir)

idldir="$datadir/idl/evolution-$BASE_VERSION"
AC_SUBST(idldir)

serverdir="$libdir/bonobo/servers"
AC_SUBST(serverdir)

evolutionuidir="$privdatadir/ui"
AC_SUBST(evolutionuidir)

imagesdir="$privdatadir/images"
AC_SUBST(imagesdir)

buttonsdir="$privdatadir/images/buttons"
AC_SUBST(buttonsdir)

soundsdir="$privdatadir/sounds"
AC_SUBST(soundsdir)

gladedir="$privdatadir/glade"
AC_SUBST(gladedir)

etspecdir="$privdatadir/etspec"
AC_SUBST(etspecdir)

viewsdir="$privdatadir/views"
AC_SUBST(viewsdir)

privconduitdir='${libdir}'/evolution/$BASE_VERSION/conduits
AC_SUBST(privconduitdir)

dnl ************************
dnl IDL/Component Versioning
dnl ************************

INTERFACE_VERSION="$BASE_VERSION"
AC_SUBST(INTERFACE_VERSION)
AC_DEFINE_UNQUOTED(INTERFACE_VERSION, "INTERFACE_VERSION", [IDL interface version (Major.Minor)])

EVO_SERVER_RULE=$srcdir/server.mk
AC_SUBST_FILE(EVO_SERVER_RULE)

##################################################
# Check for gtk-doc.
##################################################

AC_ARG_WITH(html-dir, [  --with-html-dir=PATH path to installed docs ])

if test "x$with_html_dir" = "x" ; then
  HTML_DIR='${datadir}/gnome/html'
else
  HTML_DIR=$with_html_dir
fi

AC_SUBST(HTML_DIR)

AC_CHECK_PROG(GTKDOC, gtkdoc-mkdb, true, false)

gtk_doc_min_version=0.6
if $GTKDOC ; then 
    gtk_doc_version=`gtkdoc-mkdb --version`
    AC_MSG_CHECKING([gtk-doc version ($gtk_doc_version) >= $gtk_doc_min_version])
    if perl <<EOF ; then
      exit (("$gtk_doc_version" =~ /^[[0-9]]+\.[[0-9]]+$/) &&
            ("$gtk_doc_version" >= "$gtk_doc_min_version") ? 0 : 1);
EOF
      AC_MSG_RESULT(yes)
   else
      AC_MSG_RESULT(no)
      GTKDOC=false
   fi
fi

dnl Let people disable the gtk-doc stuff.
AC_ARG_ENABLE(gtk-doc, [  --enable-gtk-doc  Use gtk-doc to build documentation [default=auto]], enable_gtk_doc="$enableval", enable_gtk_doc=auto)

if test x$enable_gtk_doc = xauto ; then
  if test x$GTKDOC = xtrue ; then
    enable_gtk_doc=yes
  else
    enable_gtk_doc=no 
  fi
fi

AM_CONDITIONAL(ENABLE_GTK_DOC, test x$enable_gtk_doc = xyes)

dnl ***********
dnl GConf stuff
dnl ***********
AC_PATH_PROG(GCONFTOOL, gconftool-2, no)
AM_GCONF_SOURCE_2

dnl ******************
dnl Sub-version number
dnl ******************
AC_ARG_WITH(sub-version, [  --with-sub-version=VERSION Specify a sub-version string])
AC_DEFINE_UNQUOTED(SUB_VERSION, "$with_sub_version", [Version substring, for packagers])

AC_ARG_ENABLE(default-binary, [  --disable-default-binary Do not install as the default "evolution" binary  ], , enable_default_binary=no)
AM_CONDITIONAL(DEFAULT_BINARY, test x$enable_default_binary = xyes)


dnl ********************
dnl KDE applnk directory
dnl ********************
AC_ARG_WITH(kde-applnk-path, [  --with-kde-applnk-path=PATH    Location of KDE applnk files],
            [with_kde_applnk_path="$withval"],
        [with_kde_applnk_path="no"])
if test x"$with_kde_applnk_path" != x"no"; then
    if test -z "$with_kde_applnk_path"; then
        with_kde_applnk_path="$datadir/applnk"
    fi
    KDE_APPLNK_DIR="$with_kde_applnk_path"
else
    KDE_APPLNK_DIR=""
fi
AM_CONDITIONAL(HAVE_KDE_APPLNK, test x"$KDE_APPLNK_DIR" != x)
AC_SUBST(KDE_APPLNK_DIR)

dnl ******************************
dnl Makefiles
dnl ******************************

export privlibdir
export privincludedir
export privdatadir

EVOLUTION_DIR=`(cd $srcdir; pwd)`
AC_SUBST(EVOLUTION_DIR)

AC_OUTPUT([ po/Makefile.in
Makefile
a11y/Makefile
a11y/calendar/Makefile
a11y/widgets/Makefile
addressbook/Makefile
addressbook/gui/Makefile
addressbook/gui/component/Makefile
addressbook/gui/component/select-names/Makefile
addressbook/gui/contact-editor/Makefile
addressbook/gui/contact-list-editor/Makefile
addressbook/gui/merging/Makefile
addressbook/gui/search/Makefile
addressbook/gui/widgets/Makefile
addressbook/conduit/Makefile
addressbook/printing/Makefile
addressbook/util/Makefile
art/Makefile
camel/Makefile
camel/providers/Makefile
camel/providers/imap/Makefile
camel/providers/imapp/Makefile
camel/providers/local/Makefile
camel/providers/nntp/Makefile
camel/providers/pop3/Makefile
camel/providers/sendmail/Makefile
camel/providers/smtp/Makefile
camel/tests/Makefile
camel/tests/folder/Makefile
camel/tests/lib/Makefile
camel/tests/message/Makefile
camel/tests/mime-filter/Makefile
camel/tests/misc/Makefile
camel/tests/smime/Makefile
camel/tests/stream/Makefile
data/Makefile
data/cde_app_root/Makefile
data/cde_app_root/dt/Makefile
data/cde_app_root/dt/appconfig/Makefile
data/cde_app_root/dt/appconfig/appmanager/Makefile
data/cde_app_root/dt/appconfig/appmanager/C/Makefile
data/cde_app_root/dt/appconfig/appmanager/C/Ximian/Makefile
data/cde_app_root/dt/appconfig/icons/Makefile
data/cde_app_root/dt/appconfig/icons/C/Makefile
data/cde_app_root/dt/appconfig/types/Makefile
data/cde_app_root/dt/appconfig/types/C/Makefile
data/cde_app_root/dt/appconfig/types/C/Ximian.dt
default_user/Makefile
default_user/local/Makefile
default_user/local/Calendar/Makefile
default_user/local/Contacts/Makefile
default_user/local/Drafts/Makefile
default_user/local/Inbox/Makefile
default_user/local/Outbox/Makefile
default_user/local/Sent/Makefile
default_user/local/Tasks/Makefile
default_user/local/Trash/Makefile
e-util/Makefile
filter/Makefile
help/Makefile
help/C/Makefile
shell/Makefile
shell/evolution-nognome
shell/glade/Makefile
shell/importer/Makefile
ui/Makefile
views/Makefile
views/addressbook/Makefile
views/calendar/Makefile
views/mail/Makefile
views/tasks/Makefile
widgets/Makefile
widgets/e-timezone-dialog/Makefile
widgets/menus/Makefile
widgets/misc/Makefile
calendar/Makefile
calendar/importers/Makefile
calendar/common/Makefile
calendar/idl/Makefile
calendar/conduits/Makefile
calendar/conduits/todo/Makefile
calendar/conduits/calendar/Makefile
calendar/gui/Makefile
calendar/gui/alarm-notify/Makefile
calendar/gui/dialogs/Makefile
composer/Makefile
mail/Makefile
smime/Makefile
smime/lib/Makefile
smime/gui/Makefile
tools/Makefile
evolution-shell.pc
camel.pc
])

if test "x$with_sub_version" != "x"; then
echo "
    Evolution ($with_sub_version) has been configured as follows: "
else
echo "
    Evolution has been configured as follows: "
fi

echo "
    Mail Directory:   $system_mail_dir, $system_mail_perm
    LDAP support:     $msg_ldap"
if test "$msg_nntp" = "yes"; then
echo "\
    NNTP support:     $msg_nntp"
fi
echo "\
    Pilot conduits:   $msg_pilot
    Kerberos 4/5:     $msg_krb4/$msg_krb5
    SSL support:      $msg_ssl
    SMIME support:    $msg_smime
    IPv6 support:     $msg_ipv6
    Dot Locking:      $msg_dot
    File Locking:     $msg_file
    Gtk-doc:      $enable_gtk_doc"

if test x$enable_gtk_doc = xyes; then
echo "
    Programming documentation files will be built automatically.
"
else
echo "
    Programming documentation files will not be built.
    You may want to install the gtk-doc package
    so that you will get the Evolution Developer's Guide.
"
fi