-AC_PATH_X
-
-PACKAGE_VERSION=1.0.1
-
-# Set major version
-PACKAGE_MAJOR=`echo $PACKAGE_VERSION | awk -F . '{ print $1 }'`
-PACKAGE_MINOR=`echo $PACKAGE_VERSION | awk -F . '{ print $2 }'`
-PACKAGE_REVISION=`echo $PACKAGE_VERSION | awk -F . '{ print $3 }'`
-AC_SUBST(PACKAGE_VERSION)
-AC_SUBST(PACKAGE_MAJOR)
-AC_SUBST(PACKAGE_MINOR)
-AC_SUBST(PACKAGE_REVISION)
-
-OBJEXT="o"
-AC_SUBST(OBJEXT)
-
-AC_DEFINE_UNQUOTED(PACKAGE_MAJOR,$PACKAGE_MAJOR)
-AC_DEFINE_UNQUOTED(PACKAGE_MINOR,$PACKAGE_MINOR)
-AC_DEFINE_UNQUOTED(PACKAGE_REVISION,$PACKAGE_REVISION)
-
+AC_LIBTOOL_WIN32_DLL
+AM_PROG_LIBTOOL
+AC_PROG_MAKE_SET
+
+dnl ==========================================================================
+
+case "$host" in
+ *-*-mingw*)
+ os_win32=yes
+ ;;
+ *)
+ os_win32=no
+esac
+AM_CONDITIONAL(OS_WIN32, test "$os_win32" = "yes")
+
+if test "$os_win32" = "yes"; then
+ AC_CHECK_PROG(ms_librarian, lib.exe, yes, no)
+fi
+AM_CONDITIONAL(MS_LIB_AVAILABLE, test x$ms_librarian = xyes)
+
+WARN_CFLAGS=""
+if test "x$GCC" = "xyes"; then
+ WARN_CFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes \
+ -Wmissing-prototypes -Wmissing-declarations \
+ -Wnested-externs -fno-strict-aliasing"
+ AC_DEFINE_UNQUOTED(HAVE_WARNING_CPP_DIRECTIVE,1,
+ [Can use #warning in C files])
+fi
+AC_SUBST(WARN_CFLAGS)
+
+
+dnl ==========================================================================
+
+AM_CONDITIONAL(CROSS_COMPILING, test $cross_compiling = yes)
+
+dnl ==========================================================================
+
+# Setup for compiling build tools (fc-glyphname, etc)
+AC_MSG_CHECKING([for a C compiler for build tools])
+if test $cross_compiling = yes; then
+ AC_CHECK_PROGS(CC_FOR_BUILD, gcc cc)
+else
+ CC_FOR_BUILD=$CC
+fi
+AC_MSG_RESULT([$CC_FOR_BUILD])
+AC_SUBST(CC_FOR_BUILD)
+
+AC_MSG_CHECKING([for suffix of executable build tools])
+if test $cross_compiling = yes; then
+ cat >conftest.c <<\_______EOF
+int
+main ()
+{
+ exit (0);
+}
+_______EOF
+ for i in .exe ""; do
+ compile="$CC_FOR_BUILD conftest.c -o conftest$i"
+ if AC_TRY_EVAL(compile); then
+ if (./conftest) 2>&AC_FD_CC; then
+ EXEEXT_FOR_BUILD=$i
+ break
+ fi
+ fi
+ done
+ rm -f conftest*
+ if test "${EXEEXT_FOR_BUILD+set}" != set; then
+ AC_MSG_ERROR([Cannot determine suffix of executable build tools])
+ fi
+else
+ EXEEXT_FOR_BUILD=$EXEEXT
+fi
+AC_MSG_RESULT([$EXEEXT_FOR_BUILD])
+AC_SUBST(EXEEXT_FOR_BUILD)
+
+dnl ==========================================================================
+
+AC_ARG_WITH(arch, [ --with-arch=ARCH Force architecture to ARCH], arch="$withval", arch=auto)
+
+if test $cross_compiling = yes; then
+ case "$arch" in
+ auto)
+ AC_MSG_ERROR([Cannot autodetect architecture in cross compile environment]
+ [Use --with-arch=ARCH to specify architecture])
+ ;;
+ esac
+fi
+
+ARCHITECTURE=$arch
+AC_SUBST(ARCHITECTURE)
+
+dnl ==========================================================================
+