inital gtk2 patch
[claws.git] / configure.ac
index 2b8d9f40b98e192e727075b72aec8d4c7f854f01..78ae27fd37f95dc0d0773d6a133c9f6c5f348e10 100644 (file)
@@ -8,10 +8,10 @@ PACKAGE=sylpheed
 dnl version number
 MAJOR_VERSION=0
 MINOR_VERSION=9
-MICRO_VERSION=3
+MICRO_VERSION=5
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=87
+EXTRA_VERSION=0
 if test $EXTRA_VERSION -eq 0; then
     VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION}claws
 else
@@ -79,18 +79,58 @@ AC_PROG_YACC
 AM_PROG_LIBTOOL
 
 SYLPHEED_ACLOCAL_INCLUDE(ac)
+  
+dnl ******************************
+dnl Checks for host
+dnl ******************************
+AC_CANONICAL_HOST
+
+dnl Copied from the official gtk+-2 configure.in
+AC_MSG_CHECKING([for some Win32 platform])
+case "$host" in
+  *-*-mingw*|*-*-cygwin*)
+    platform_win32=yes
+    LDFLAGS="$LDFLAGS -mwindows"
+    ;;
+  *)
+    platform_win32=no
+    ;;
+esac
+AC_MSG_RESULT([$platform_win32])
+AM_CONDITIONAL(PLATFORM_WIN32, test x"$platform_win32" = x"yes")
+
+if test x"$platform_win32" = x"yes"; then
+    WINDRES=windres
+    AC_SUBST(WINDRES)
+fi
+
+AC_MSG_CHECKING([for native Win32])
+case "$host" in
+  *-*-mingw*)
+    os_win32=yes
+    ;;
+  *)
+    os_win32=no
+    ;;
+esac
+AC_MSG_RESULT([$os_win32])
+AM_CONDITIONAL(OS_WIN32, test x"$os_win32" = x"yes")
 
 case "$target" in
 *-darwin*)
        CFLAGS="$CFLAGS -traditional-cpp -fno-common"
        ;;
 esac
-
+  
+dnl Checks for iconv
 AM_ICONV
 
 dnl for gettext
-ALL_LINGUAS="bg cs de el en_GB es fr hr hu it ja ko nl pl pt_BR ru sr sv zh_TW.Big5"
-AM_GNU_GETTEXT([use-libtool])
+ALL_LINGUAS="bg cs de el en_GB es fr hr hu it ja ko nl pl pt_BR ru sk sr sv zh_TW.Big5"
+GETTEXT_PACKAGE=sylpheed
+AC_SUBST(GETTEXT_PACKAGE)
+AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Define text domain.])
+AM_GLIB_GNU_GETTEXT
 dnl AC_CHECK_FUNC(gettext, AC_CHECK_LIB(intl, gettext))
 localedir='${prefix}/${DATADIRNAME}/locale'
 AC_SUBST(localedir)
@@ -187,9 +227,15 @@ dnl ** common code **
 dnl *****************
 
 dnl check for glib
-AM_PATH_GLIB(1.2.6,,
+AM_PATH_GLIB_2_0(2.0.0,,
        AC_MSG_ERROR(Test for GLIB failed. See the file 'INSTALL' for help.),
-       gthread)
+       gmodule gobject gthread)
+
+dnl Check for bind_textdomain_codeset, including -lintl if GLib brings it in.
+syl_save_LIBS=$LIBS
+LIBS="$LIBS $GTK_LIBS"
+AC_CHECK_FUNCS(bind_textdomain_codeset)
+LIBS=$syl_save_LIBS
 
 dnl check for IPv6 option
 AC_ARG_ENABLE(ipv6,
@@ -240,7 +286,7 @@ dnl ** GTK user interface **
 dnl ************************
 
 dnl Checks for GTK
-AM_PATH_GTK(1.2.6,,
+AM_PATH_GTK_2_0(2.0.0,,
        AC_MSG_ERROR(Test for GTK failed. See the file 'INSTALL' for help.))
 
 dnl check if gdk / gtk was compiled with USE_XIM
@@ -385,35 +431,42 @@ dnl *************************
 
 PLUGINS=""
 
+dnl --- Trayicon ---
 AC_ARG_ENABLE(trayicon-plugin,
        [  --enable-trayicon-plugin   System Tray Icon [default=no]],
-       [ac_cv_enable_trayicon_plugin=$enableval], [ac_cv_enable_trayicon_plugin=no])
-AM_CONDITIONAL(BUILD_TRAYICON_PLUGIN, test x"$ac_cv_enable_trayicon_plugin" = xyes)
+       [ac_cv_enable_trayicon_plugin=$enableval], [ac_cv_enable_trayicon_plugin=yes])
 if test x"$ac_cv_enable_trayicon_plugin" = xyes; then
        PLUGINS="trayicon $PLUGINS"
 fi
+AM_CONDITIONAL(BUILD_TRAYICON_PLUGIN, test x"$ac_cv_enable_trayicon_plugin" = xyes)
 
+dnl --- SpamAssassin ---
 AC_ARG_ENABLE(spamassassin-plugin,
        [  --enable-spamassassin-plugin    Build SpamAssassin plugin [default=no]],
        [ac_cv_enable_spamassassin_plugin=$enableval], [ac_cv_enable_spamassassin_plugin=no])
-AM_CONDITIONAL(BUILD_SPAMASSASSIN_PLUGIN, test x"$ac_cv_enable_spamassassin_plugin" = xyes)
 if test x"$ac_cv_enable_spamassassin_plugin" = xyes; then
        AC_SPAMASSASSIN
        PLUGINS="spamassassin $PLUGINS"
 fi
+AM_CONDITIONAL(BUILD_SPAMASSASSIN_PLUGIN, test x"$ac_cv_enable_spamassassin_plugin" = xyes)
 
+dnl --- MathML Viewer ---
 AC_ARG_ENABLE(mathml-viewer-plugin,
        [  --enable-mathml-viewer-plugin    Build MathML-Viewer plugin [default=no]],
-       [ac_cv_enable_mathml_viewer_plugin=$enableval], [ac_cv_enable_mathml_viewer_plugin=no])
-AM_CONDITIONAL(BUILD_MATHML_VIEWER_PLUGIN, test x"$ac_cv_enable_mathml_viewer_plugin" = xyes)
+       [ac_cv_enable_mathml_viewer_plugin=$enableval], [ac_cv_enable_mathml_viewer_plugin=yes])
 if test x"$ac_cv_enable_mathml_viewer_plugin" = xyes; then
-       PKG_CHECK_MODULES(GTK_MATH_VIEW, gtkmathview >= 0.4.2)
-       AC_SUBST(GTK_MATH_VIEW_CFLAGS)
-       AC_SUBST(GTK_MATH_VIEW_LIBS)
+       PKG_CHECK_MODULES(GTK_MATH_VIEW, gtkmathview >= 0.4.2, :, ac_cv_enable_mathml_viewer_plugin=no)
 
-       PLUGINS="mathml-viewer $PLUGINS"
+       if test x"$ac_cv_enable_mathml_viewer_plugin" = xyes; then
+               AC_SUBST(GTK_MATH_VIEW_CFLAGS)
+               AC_SUBST(GTK_MATH_VIEW_LIBS)
+
+               PLUGINS="mathml-viewer $PLUGINS"
+       fi
 fi
+AM_CONDITIONAL(BUILD_MATHML_VIEWER_PLUGIN, test x"$ac_cv_enable_mathml_viewer_plugin" = xyes)
 
+dnl --- Image Viewer ---
 AC_ARG_ENABLE(image-viewer-plugin,
        [  --disable-image-viewer-plugin   Do not build image viewer plugin],
        [ac_cv_enable_image_viewer_plugin=$enableval], [ac_cv_enable_image_viewer_plugin=yes])
@@ -426,59 +479,55 @@ if test x"$ac_cv_enable_image_viewer_plugin" = xyes; then
                [ac_cv_enable_imlib=$enableval], [ac_cv_enable_imlib=yes])
 
        if test "$ac_cv_enable_gdk_pixbuf" = yes; then
-               AM_PATH_GDK_PIXBUF(0.8.0,
-                       [AC_DEFINE(HAVE_GDK_PIXBUF, 1, Define if you use gdk-pixbuf to support image viewer)
-                        ac_cv_enable_imlib=no], [ac_cv_enable_gdk_pixbuf=no])
-       fi
-       if test "$ac_cv_enable_imlib" = yes; then
-               AM_PATH_GDK_IMLIB(1.9,
-                       AC_DEFINE(HAVE_GDK_IMLIB, 1, Define if you use gdk_imlib to support image viewer),
-                       [ac_cv_enable_imlib=no])
+               PKG_CHECK_MODULES(GDK_PIXBUF, \
+                       [ gdk-pixbuf-2.0 ],
+                       [ AC_DEFINE(HAVE_GDK_PIXBUF, 1, Define if you use gdk-pixbuf to support image viewer) ],
+                       [ ac_cv_enable_gdk_pixbuf=no ])
        fi
-       if test x"$ac_cv_enable_gdk_pixbuf" = xno -a x"$ac_cv_enable_imlib" = xno; then
-               $ac_cv_enable_image_viewer_plugin = no
-       fi
-fi
-AM_CONDITIONAL(BUILD_IMAGE_VIEWER_PLUGIN, test x"$ac_cv_enable_image_viewer_plugin" = xyes)
-if test x"$ac_cv_enable_image_viewer_plugin" = xyes; then
+
        if test "$ac_cv_enable_gdk_pixbuf" = yes; then
                PLUGINS="image-viewer(gdk-pixbuf) $PLUGINS"
-       elif test "$ac_cv_enable_imlib" = yes; then
-               PLUGINS="image-viewer(gdk_imlib) $PLUGINS"
+       else
+               ac_cv_enable_image_viewer_plugin=no
        fi
 fi
+AM_CONDITIONAL(BUILD_IMAGE_VIEWER_PLUGIN, test x"$ac_cv_enable_image_viewer_plugin" = xyes)
 
+dnl --- Dillo Viewer ---
 AC_ARG_ENABLE(dillo-viewer-plugin,
        [  --enable-dillo-viewer-plugin   Build Dillo plugin for html mail rendering [default=no]],
-       [ac_cv_enable_dillo_viewer_plugin=$enableval], [ac_cv_enable_dillo_viewer_plugin=no])
-AM_CONDITIONAL(BUILD_DILLO_VIEWER_PLUGIN, test x"$ac_cv_enable_dillo_viewer_plugin" = xyes)
+       [ac_cv_enable_dillo_viewer_plugin=$enableval], [ac_cv_enable_dillo_viewer_plugin=yes])
 if test x"$ac_cv_enable_dillo_viewer_plugin" = xyes; then
        PLUGINS="dillo-viewer $PLUGINS"
 fi
+AM_CONDITIONAL(BUILD_DILLO_VIEWER_PLUGIN, test x"$ac_cv_enable_dillo_viewer_plugin" = xyes)
 
+dnl --- Demo ---
 AC_ARG_ENABLE(demo-plugin,
        [  --enable-demo-plugin    Build demo plugin [default=no]],
        [ac_cv_enable_demo_plugin=$enableval], [ac_cv_enable_demo_plugin=no])
-AM_CONDITIONAL(BUILD_DEMO_PLUGIN, test x"$ac_cv_enable_demo_plugin" = xyes)
 if test x"$ac_cv_enable_demo_plugin" = xyes; then
        PLUGINS="demo $PLUGINS"
 fi
+AM_CONDITIONAL(BUILD_DEMO_PLUGIN, test x"$ac_cv_enable_demo_plugin" = xyes)
 
+dnl --- ClamAV ---
 AC_ARG_ENABLE(clamav-plugin,
        [  --enable-clamav-plugin    Build Clam AntiVirus plugin [default=no]],
-       [ac_cv_enable_clamav_plugin=$enableval], [ac_cv_enable_clamav_plugin=no])
-AM_CONDITIONAL(BUILD_CLAMAV_PLUGIN, test x"$ac_cv_enable_clamav_plugin" = xyes)
+       [ac_cv_enable_clamav_plugin=$enableval], [ac_cv_enable_clamav_plugin=yes])
 if test x"$ac_cv_enable_clamav_plugin" = xyes; then
-       AC_CHECK_LIB(clamav, cl_scanfile, clamav_lib=-lclamav)
-       if test -z "${clamav_lib}"
-       then
-               AC_MSG_ERROR(clamav library not found)
-       fi
-       CLAMAV_LIBS="${clamav_lib}"
-       AC_SUBST(CLAMAV_LIBS)
+       AC_CHECK_LIB(clamav, cl_scanfile, clamav_lib=-lclamav, ac_cv_enable_clamav_plugin=no)
+       AC_CHECK_HEADERS(clamav.h, :, ac_cv_enable_clamav_plugin=no)
+       if test x"$ac_cv_enable_clamav_plugin" = xyes; then
+               CLAMAV_LIBS="${clamav_lib}"
+               AC_SUBST(CLAMAV_LIBS)
 
-       PLUGINS="clamav $PLUGINS"
+               PLUGINS="clamav $PLUGINS"
+       else
+               AC_MSG_NOTICE([clamav library not found, will not build clamav plugin])
+       fi
 fi
+AM_CONDITIONAL(BUILD_CLAMAV_PLUGIN, test x"$ac_cv_enable_clamav_plugin" = xyes)
 
 dnl ****************************
 dnl ** Final configure output **
@@ -487,7 +536,6 @@ dnl ****************************
 AC_OUTPUT([
 Makefile
 sylpheed.spec
-intl/Makefile
 ac/Makefile
 po/Makefile.in
 src/common/version.h
@@ -519,6 +567,7 @@ manual/fr/Makefile
 manual/ja/Makefile
 tools/Makefile
 config/Makefile
+sylpheed-claws.pc
 ])
 
 dnl Output the configuration summary