+# Need full path to Perl for glib-mkenums
+#
+if test "x$PERL" != x ; then
+ AC_PATH_PROG(PERL_PATH, $PERL)
+else
+ PERL_PATH="/usr/bin/env perl"
+fi
+AC_SUBST(PERL_PATH)
+
+dnl ***********************
+dnl *** Tests for iconv ***
+dnl ***********************
+dnl
+dnl We do this before the gettext checks, to avoid distortion
+
+AC_ARG_WITH(libiconv, [ --with-libiconv=[no/gnu/native] use the libiconv library ],,with_libiconv=maybe)
+
+found_iconv=no
+case $with_libiconv in
+ maybe)
+ # Check in the C library first
+ AC_CHECK_FUNC(iconv_open, with_libiconv=no; found_iconv=yes)
+ # Check if we have GNU libiconv
+ if test $found_iconv = "no"; then
+ AC_CHECK_LIB(iconv, libiconv_open, with_libiconv=gnu; found_iconv=yes)
+ fi
+ # Check if we have a iconv in -liconv, possibly from vendor
+ if test $found_iconv = "no"; then
+ AC_CHECK_LIB(iconv, iconv_open, with_libiconv=native; found_iconv=yes)
+ fi
+ ;;
+ no)
+ AC_CHECK_FUNC(iconv_open, with_libiconv=no; found_iconv=yes)
+ ;;
+ gnu|yes)
+ AC_CHECK_LIB(iconv, libiconv_open, with_libiconv=gnu; found_iconv=yes)
+ ;;
+ native)
+ AC_CHECK_LIB(iconv, iconv_open, with_libiconv=native; found_iconv=yes)
+ ;;
+esac
+
+if test "x$found_iconv" = "xno" ; then
+ AC_MSG_ERROR([*** No iconv() implementation found in C library or libiconv])
+fi
+
+dnl
+dnl gettext support
+dnl
+
+ALL_LINGUAS="az ca cs de el es eu fr gl hi ja ko ms nl nn no pl pt ro ru sk sl sv ta tr uk vi zh_CN zh_TW"
+AM_GLIB_GNU_GETTEXT
+
+if test "$gt_cv_func_dgettext_libc" = "yes" || test "$gt_cv_func_dgettext_libintl" = "yes"; then
+ :
+else
+ AC_MSG_ERROR([
+*** You must have either have gettext support in your C library, or use the
+*** GNU gettext library. (http://www.gnu.org/software/gettext/gettext.html
+])
+fi
+
+LIBS="$LIBS $INTLLIBS"
+
+GETTEXT_PACKAGE=glib20
+AC_SUBST(GETTEXT_PACKAGE)
+AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE")
+
+# AM_GLIB_GNU_GETTEXT above substs $DATADIRNAME
+# this is the directory where the *.{mo,gmo} files are installed
+GLIB_LOCALE_DIR="${prefix}/${DATADIRNAME}/locale"
+AC_DEFINE_UNQUOTED(GLIB_LOCALE_DIR,"$GLIB_LOCALE_DIR")
+
+AC_CHECK_FUNCS(bind_textdomain_codeset)
+
+dnl
+dnl Now we are done with gettext checks, figure out ICONV_LIBS
+dnl
+
+if test x$with_libiconv != xno ; then
+ case " $INTLLIBS " in
+ *[[\ \ ]]-liconv[[\ \ ]]*) ;;
+ *) ICONV_LIBS="-liconv" ;;
+ esac
+fi
+AC_SUBST(ICONV_LIBS)
+
+case $with_libiconv in
+ gnu)
+ AC_DEFINE(USE_LIBICONV_GNU, [Using GNU libiconv])
+ ;;
+ native)
+ AC_DEFINE(USE_LIBICONV_NATIVE, [Using a native implementation of iconv in a separate library])
+ ;;
+esac
+
+dnl Initialize libtool
+AM_DISABLE_STATIC
+AC_LIBTOOL_WIN32_DLL
+AM_PROG_LIBTOOL