--- a/configure.ac
+++ b/configure.ac
@@ -96,8 +96,11 @@
 
 dnl Checks which levels of APIs should be compiled.
 
-AC_ARG_ENABLE(gui,
-	      AS_HELP_STRING([--enable-gui],[enable GUI level APIs (default is YES)]))
+PKG_PROG_PKG_CONFIG
+AM_CONDITIONAL([HAVE_PKG_CONFIG], [test "x$PKG_CONFIG" != x])
+
+AC_ARG_WITH(gui,
+	    AS_HELP_STRING([--with-gui],[enable GUI level APIs (default is YES)]))
 
 AM_CONDITIONAL(WITH_GUI, test x$with_gui != xno)
 
@@ -117,14 +120,14 @@
 
 M17N_EXT_LIBS=
 
-PKG_PROG_PKG_CONFIG
-AM_CONDITIONAL([HAVE_PKG_CONFIG], [test "x$PKG_CONFIG" != x])
-
 if test "x$no_x" != "xyes"; then
   AC_DEFINE(HAVE_X11, 1, [Define to 1 if you have X11.])
   X11_LD_FLAGS="-lXt -lX11"
   M17N_EXT_LIBS="$M17N_EXT_LIBS X11"
 
+  AC_ARG_WITH(athena,
+	      AS_HELP_STRING([--with-athena],[with X Athena Widget suport]))
+  if test "x$with_athena" != "xno"; then
   if test "x$HAVE_XAW" = "xyes"; then
     AC_DEFINE(HAVE_X11_XAW_COMMAND_H, 1,
 	      [Define to 1 if you have the Xaw header files.])
@@ -132,11 +135,15 @@
     CONFIG_FLAGS="$CONFIG_FLAGS -DHAVE_X11_XAW_COMMAND_H"
     M17N_EXT_LIBS="$M17N_EXT_LIBS Xaw"
   fi
+  fi
 fi
 AC_SUBST(X11_LD_FLAGS)
 AC_SUBST(XAW_LD_FLAGS)
 
 dnl Check for fribidi library.
+AC_ARG_WITH(fribidi,
+	    AS_HELP_STRING([--with-fribidi],[with FriBidi suport]))
+if test "x$with_fribidi" != "xno"; then
 save_CPPFLAGS="$CPPFLAGS"
 save_LIBS="$LIBS"
 AC_CHECK_PROG(HAVE_FRIBIDI_CONFIG, fribidi-config, yes)
@@ -158,6 +165,7 @@
   FRIBIDI_LD_FLAGS=
 fi
 LIBS="$save_LIBS"
+fi
 AC_SUBST(FRIBIDI_LD_FLAGS)
 
 dnl Check for otflib usability.
@@ -201,11 +209,14 @@
 AC_SUBST(OTF_LD_FLAGS)
 
 dnl Check for Freetype2 usability.
+AC_ARG_WITH(freetype,
+	    AS_HELP_STRING([--with-freetype],[with FreeType support]))
+if test "x$with_freetype" != "xno"; then
 PKG_CHECK_MODULES([FREETYPE], [freetype2], [HAVE_FREETYPE=yes],
                                            [HAVE_FREETYPE=no])
 AS_IF([test "x$HAVE_FREETYPE" = "xyes"],
   [CPPFLAGS="$CPPFLAGS $FREETYPE_CFLAGS";
-   FREETYPE_LD_FLAGS=FREETYPE_LIBS;
+   FREETYPE_LD_FLAGS=$FREETYPE_LIBS;
    AC_DEFINE([HAVE_FREETYPE], [1],
              [Define to 1 if you have FreeType library and header file.])
    M17N_EXT_LIBS="$M17N_EXT_LIBS freetype";
@@ -220,9 +231,13 @@
   ],
   []
   )
+fi
 AC_SUBST([FREETYPE_LD_FLAGS])
 
 dnl Check for Xft2 usability.
+AC_ARG_WITH(xft,
+	    AS_HELP_STRING([--with-xft],[with Xft support]))
+if test "x$with_xft" != "xno"; then
 save_CPPFLAGS="$CPPFLAGS"
 save_LIBS="$LIBS"
 XFT2_LD_FLAGS="-lXft -lfreetype -lfontconfig -lXrender -lX11"
@@ -253,6 +268,7 @@
   CPPFLAGS="$save_CPPFLAGS"
 fi
 LIBS="$save_LIBS"
+fi
 AC_SUBST(XFT2_LD_FLAGS)
 
 dnl Check for fontconfig usability.
@@ -306,6 +322,9 @@
 fi
 
 dnl Check for libxml2 usability.
+AC_ARG_WITH(libxml2,
+	    AS_HELP_STRING([--with-libxml2],[with libxml2 suport]))
+if test "x$with_libxml2" != "xno"; then
 save_CPPFLAGS="$CPPFLAGS"
 save_LIBS="$LIBS"
 AC_CHECK_PROG(HAVE_XML2_CONFIG, xml2-config, yes)
@@ -328,10 +347,13 @@
   CPPFLAGS="$save_CPPFLAGS"
 fi
 LIBS="$save_LIBS"
+fi
 AC_SUBST(XML2_LD_FLAGS)
 
 dnl Check for Anthy usability.
-
+AC_ARG_WITH(anthy,
+	    AS_HELP_STRING([--with-anthy],[with Anthy suport]))
+if test "x$with_anthy" != "xno"; then
 PKG_CHECK_MODULES(ANTHY, anthy, HAVE_ANTHY=yes, HAVE_ANTHY=no)
 if test "x$HAVE_ANTHY" = "xyes"; then
   AC_DEFINE(HAVE_ANTHY, 1,
@@ -340,15 +362,20 @@
   ANTHY_LD_FLAGS="$ANTHY_LIBS"
   CONFIG_FLAGS="$CONFIG_FLAGS -DHAVE_ANTHY"
 fi
+fi
 AC_SUBST(ANTHY_LD_FLAGS)
 
 dnl Check for Ispell usability.
+AC_ARG_WITH(ispell,
+	    AS_HELP_STRING([--with-ispell],[with Ispell suport]))
+if test "x$with_ispell" != "xno"; then
 AC_CHECK_PROG(HAVE_ISPELL, ispell, yes)
 if test "x$HAVE_ISPELL" = "xyes"; then
   AC_DEFINE(HAVE_ISPELL, 1, [Define if ispell is available.])
   M17N_EXT_LIBS="$M17N_EXT_LIBS ispell"
   CONFIG_FLAGS="$CONFIG_FLAGS -DHAVE_ISPELL"
 fi
+fi
 
 dnl Check for Thai word-segmentation library.
 dnl If we have one, define HAVE_THAI_WORDSEG and one of these:
