diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index c2ef19f87492177c387619d8d1b62d79f4062062..9de4523b20d9c89643c379b1532a8ebd4c22831f 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,9 @@
+2012-01-18  Benjamin Kosnik  <bkoz@redhat.com>
+
+	* configure.ac: Move epub checks...
+	* acinclude (GLIBCXX_CONFIGURE_DOCBOOK): ...here, use
+	test -f instead of AC_CHECK_FILES.
+
 2012-01-18  François Dumont  <fdumont@gcc.gnu.org>
 	    Roman Kononov  <roman@binarylife.net>
 
diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
index 9d08178c35e6da95c8ba935b89b161426546ed52..fd3ba96c4abd309219d1e72614b06d0c8329c32c 100644
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -631,7 +631,7 @@ AC_DEFUN([GLIBCXX_CONFIGURE_TESTSUITE], [
 
 
 dnl
-dnl Does any necessary configuration of the documentation directory.
+dnl Does any necessary configuration for docbook in the docs directory.
 dnl
 dnl XSLTPROC must be set before this
 dnl
@@ -642,7 +642,7 @@ dnl  XSL_STYLE_DIR
 dnl
 AC_DEFUN([GLIBCXX_CONFIGURE_DOCBOOK], [
 
-AC_MSG_CHECKING([for stylesheets used in generation of documentation])
+AC_MSG_CHECKING([for docbook stylesheets for documentation creation])
 glibcxx_stylesheets=no
 if test x${XSLTPROC} = xyes && echo '<title/>' | xsltproc --noout --nonet --xinclude http://docbook.sourceforge.net/release/xsl-ns/current/xhtml-1_1/docbook.xsl - 2>/dev/null; then
   glibcxx_stylesheets=yes
@@ -669,6 +669,18 @@ if test x"$glibcxx_local_stylesheets" = x"yes"; then
 else
   glibcxx_stylesheets=no
 fi
+
+# Check for epub3 dependencies.
+AC_MSG_CHECKING([for epub3 stylesheets for documentation creation])
+glibcxx_epub_stylesheets=no
+if test x"$glibcxx_local_stylesheets" = x"yes"; then
+   if test -f ${XSL_STYLE_DIR}/epub3/chunk.xsl; then
+      glibcxx_epub_stylesheets=yes
+   fi
+fi
+AC_MSG_RESULT($glibcxx_epub_stylesheets)
+AM_CONDITIONAL(BUILD_EPUB, test $glibcxx_epub_stylesheets= "yes")
+
 ])
 
 
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index 5b7cacfef7e091377a5ead329bf1b512ce513853..8ee0d24cc309a2d5c74f4bf39c02c3c3016692b3 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -618,8 +618,6 @@ CPU_DEFINES_SRCDIR
 ATOMIC_FLAGS
 ATOMIC_WORD_SRCDIR
 ATOMICITY_SRCDIR
-BUILD_EPUB_FALSE
-BUILD_EPUB_TRUE
 BUILD_PDF_FALSE
 BUILD_PDF_TRUE
 PDFLATEX
@@ -630,6 +628,8 @@ BUILD_HTML_FALSE
 BUILD_HTML_TRUE
 BUILD_XML_FALSE
 BUILD_XML_TRUE
+BUILD_EPUB_FALSE
+BUILD_EPUB_TRUE
 XSL_STYLE_DIR
 XMLLINT
 XSLTPROC
@@ -65753,8 +65753,8 @@ fi
 
 
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stylesheets used in generation of documentation" >&5
-$as_echo_n "checking for stylesheets used in generation of documentation... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for docbook stylesheets for documentation creation" >&5
+$as_echo_n "checking for docbook stylesheets for documentation creation... " >&6; }
 glibcxx_stylesheets=no
 if test x${XSLTPROC} = xyes && echo '<title/>' | xsltproc --noout --nonet --xinclude http://docbook.sourceforge.net/release/xsl-ns/current/xhtml-1_1/docbook.xsl - 2>/dev/null; then
   glibcxx_stylesheets=yes
@@ -65786,6 +65786,27 @@ else
   glibcxx_stylesheets=no
 fi
 
+# Check for epub3 dependencies.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for epub3 stylesheets for documentation creation" >&5
+$as_echo_n "checking for epub3 stylesheets for documentation creation... " >&6; }
+glibcxx_epub_stylesheets=no
+if test x"$glibcxx_local_stylesheets" = x"yes"; then
+   if test -f ${XSL_STYLE_DIR}/epub3/chunk.xsl; then
+      glibcxx_epub_stylesheets=yes
+   fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_epub_stylesheets" >&5
+$as_echo "$glibcxx_epub_stylesheets" >&6; }
+ if test $glibcxx_epub_stylesheets= "yes"; then
+  BUILD_EPUB_TRUE=
+  BUILD_EPUB_FALSE='#'
+else
+  BUILD_EPUB_TRUE='#'
+  BUILD_EPUB_FALSE=
+fi
+
+
+
 
 # Check for xml/html dependencies.
  if test $ac_cv_prog_DOXYGEN = "yes" &&
@@ -65912,59 +65933,6 @@ else
 fi
 
 
-# Check for epub dependencies.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for /usr/share/xml/docbook/stylesheet/docbook-xsl-ns/epub3/chunk.xsl" >&5
-$as_echo_n "checking for /usr/share/xml/docbook/stylesheet/docbook-xsl-ns/epub3/chunk.xsl... " >&6; }
-if test "${ac_cv_file__usr_share_xml_docbook_stylesheet_docbook_xsl_ns_epub3_chunk_xsl+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  test "$cross_compiling" = yes &&
-  as_fn_error "cannot check for file existence when cross compiling" "$LINENO" 5
-if test -r "/usr/share/xml/docbook/stylesheet/docbook-xsl-ns/epub3/chunk.xsl"; then
-  ac_cv_file__usr_share_xml_docbook_stylesheet_docbook_xsl_ns_epub3_chunk_xsl=yes
-else
-  ac_cv_file__usr_share_xml_docbook_stylesheet_docbook_xsl_ns_epub3_chunk_xsl=no
-fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_file__usr_share_xml_docbook_stylesheet_docbook_xsl_ns_epub3_chunk_xsl" >&5
-$as_echo "$ac_cv_file__usr_share_xml_docbook_stylesheet_docbook_xsl_ns_epub3_chunk_xsl" >&6; }
-if test "x$ac_cv_file__usr_share_xml_docbook_stylesheet_docbook_xsl_ns_epub3_chunk_xsl" = x""yes; then :
-  ac_cv_file_epub3_a=yes
-else
-  ac_cv_file_epub3_a=no
-fi
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for /usr/share/sgml/docbook/xsl-ns-stylesheets/epub3/chunk.xsl" >&5
-$as_echo_n "checking for /usr/share/sgml/docbook/xsl-ns-stylesheets/epub3/chunk.xsl... " >&6; }
-if test "${ac_cv_file__usr_share_sgml_docbook_xsl_ns_stylesheets_epub3_chunk_xsl+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  test "$cross_compiling" = yes &&
-  as_fn_error "cannot check for file existence when cross compiling" "$LINENO" 5
-if test -r "/usr/share/sgml/docbook/xsl-ns-stylesheets/epub3/chunk.xsl"; then
-  ac_cv_file__usr_share_sgml_docbook_xsl_ns_stylesheets_epub3_chunk_xsl=yes
-else
-  ac_cv_file__usr_share_sgml_docbook_xsl_ns_stylesheets_epub3_chunk_xsl=no
-fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_file__usr_share_sgml_docbook_xsl_ns_stylesheets_epub3_chunk_xsl" >&5
-$as_echo "$ac_cv_file__usr_share_sgml_docbook_xsl_ns_stylesheets_epub3_chunk_xsl" >&6; }
-if test "x$ac_cv_file__usr_share_sgml_docbook_xsl_ns_stylesheets_epub3_chunk_xsl" = x""yes; then :
-  ac_cv_file_epub3_b=yes
-else
-  ac_cv_file_epub3_b=no
-fi
-
- if test $ac_cv_file_epub3_a = "yes" ||
-	       test $ac_cv_file_epub3_b = "yes"; then
-  BUILD_EPUB_TRUE=
-  BUILD_EPUB_FALSE='#'
-else
-  BUILD_EPUB_TRUE='#'
-  BUILD_EPUB_FALSE=
-fi
-
-
 
 # Propagate the target-specific source directories through the build chain.
 ATOMICITY_SRCDIR=config/${atomicity_dir}
@@ -66556,6 +66524,10 @@ if test -z "${BUILD_INFO_TRUE}" && test -z "${BUILD_INFO_FALSE}"; then
   as_fn_error "conditional \"BUILD_INFO\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
+if test -z "${BUILD_EPUB_TRUE}" && test -z "${BUILD_EPUB_FALSE}"; then
+  as_fn_error "conditional \"BUILD_EPUB\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
 if test -z "${BUILD_XML_TRUE}" && test -z "${BUILD_XML_FALSE}"; then
   as_fn_error "conditional \"BUILD_XML\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
@@ -66572,10 +66544,6 @@ if test -z "${BUILD_PDF_TRUE}" && test -z "${BUILD_PDF_FALSE}"; then
   as_fn_error "conditional \"BUILD_PDF\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
-if test -z "${BUILD_EPUB_TRUE}" && test -z "${BUILD_EPUB_FALSE}"; then
-  as_fn_error "conditional \"BUILD_EPUB\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5
-fi
 
 : ${CONFIG_STATUS=./config.status}
 ac_write_fail=0
diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac
index 1c62aeadb464f724f8ce0937c04d032b8abd7522..2429f04d8111cafbf0b4677a2d6fb16fd5a01d5d 100644
--- a/libstdc++-v3/configure.ac
+++ b/libstdc++-v3/configure.ac
@@ -380,15 +380,6 @@ AM_CONDITIONAL(BUILD_PDF,
 	       test $ac_cv_prog_DBLATEX = "yes" &&
 	       test $ac_cv_prog_PDFLATEX = "yes")
 
-# Check for epub dependencies.
-AC_CHECK_FILE(/usr/share/xml/docbook/stylesheet/docbook-xsl-ns/epub3/chunk.xsl,
-	      ac_cv_file_epub3_a=yes, ac_cv_file_epub3_a=no)
-AC_CHECK_FILE(/usr/share/sgml/docbook/xsl-ns-stylesheets/epub3/chunk.xsl,
-	      ac_cv_file_epub3_b=yes, ac_cv_file_epub3_b=no)
-AM_CONDITIONAL(BUILD_EPUB,
-	       test $ac_cv_file_epub3_a = "yes" ||
-	       test $ac_cv_file_epub3_b = "yes")
-
 
 # Propagate the target-specific source directories through the build chain.
 ATOMICITY_SRCDIR=config/${atomicity_dir}