diff --git a/configure.ac b/configure.ac
index 415beb53897e9330ff2920ceda5cf771f513ca7a..b268b2549bb7d4fc30e56f020b3a74a55faebcb4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,6 +1,6 @@
 dnl Process this file with autoconf to produce a configure script.
 
-dnl Copyright © 2009-2018 Dynare Team
+dnl Copyright © 2009-2019 Dynare Team
 dnl
 dnl This file is part of Dynare.
 dnl
@@ -77,19 +77,20 @@ CPPFLAGS="$CPPFLAGS_SAVED"
 # Don't use deprecated hash structures
 AC_DEFINE([BOOST_NO_HASH], [], [Don't use deprecated STL hash structures])
 
+# Check if internal documentation can be built
 AC_CHECK_PROG([DOXYGEN], [doxygen], [doxygen])
 AM_CONDITIONAL([HAVE_DOXYGEN], [test -n "$DOXYGEN"])
 
-AC_CHECK_PROG([PDFLATEX], [pdflatex], [pdflatex])
-AM_CONDITIONAL([HAVE_PDFLATEX], [test -n "$PDFLATEX"])
+# Check if user documentation can be built
+AC_ARG_ENABLE([doc], AS_HELP_STRING([--disable-doc], [disable compilation of documentation]), [], [enable_doc=yes])
+AM_CONDITIONAL([ENABLE_DOC], [test "$enable_doc" = yes])
 
-AC_CHECK_PROG([BIBTEX], [bibtex], [bibtex])
-AM_CONDITIONAL([HAVE_BIBTEX], [test -n "$BIBTEX"])
-
-if test -n "$PDFLATEX" -a -n "$BIBTEX"; then
-  AX_LATEX_CLASS([beamer], [ax_latex_have_beamer])
+if test "$enable_doc" = yes; then
+  AC_CHECK_PROG([PDFLATEX], [pdflatex], [pdflatex], [AC_MSG_ERROR([pdflatex cannot be found. If you want to skip the compilation of the documentation, pass the --disable-doc flag.])])
+  AC_CHECK_PROG([BIBTEX], [bibtex], [bibtex], [AC_MSG_ERROR([bibtex cannot be found. If you want to skip the compilation of the documentation, pass the --disable-doc flag.])])
+  AX_LATEX_CLASS([beamer], [ax_latex_have_beamer], [], [AC_MSG_ERROR([beamer cannot be found. If you want to skip the compilation of the documentation, pass the --disable-doc flag.])])
 fi
-AM_CONDITIONAL([HAVE_BEAMER], [test "$ax_latex_have_beamer" = yes])
+
 
 AC_CONFIG_FILES([Makefile
                  src/Makefile
@@ -100,16 +101,15 @@ AC_CONFIG_FILES([Makefile
 ])
 
 if test -n "$DOXYGEN"; then
-  BUILD_DYNARE_PREPROC_DOC="yes"
+  BUILD_INTERNAL_DOC="yes"
 else
-  BUILD_DYNARE_PREPROC_DOC="no (missing doxygen)"
+  BUILD_INTERNAL_DOC="no (missing doxygen)"
 fi
 
-
-if test -n "$PDFLATEX" -a "$ax_latex_have_beamer" = yes; then
-  BUILD_BEAMER_DOC="yes"
+if test "$enable_doc" = yes; then
+  BUILD_DOC="yes"
 else
-  BUILD_BEAMER_DOC="no (missing one of: pdflatex, beamer)"
+  BUILD_DOC="no"
 fi
 
 AC_MSG_NOTICE([
@@ -120,10 +120,10 @@ Binaries (with "make")
  Dynare preprocessor:                         yes
 
 PDF documentation (with "make pdf"):
- Preprocessor & Macroprocessor presentations: $BUILD_BEAMER_DOC
+ Preprocessor & Macroprocessor presentations: $BUILD_DOC
 
 HTML documentation (with "make html"):
- Dynare preprocessor developer doc:           $BUILD_DYNARE_PREPROC_DOC
+ Dynare preprocessor internal doc:            $BUILD_INTERNAL_DOC
 
 ])
 
diff --git a/doc/Makefile.am b/doc/Makefile.am
index 8e622799a91b747a6989e5f0db3b4c0d1843bfe7..975faa5676e36e107afbd116733ea900fa470d21 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -1,7 +1,3 @@
 SUBDIRS = preprocessor macroprocessor
 
-PDF_TARGETS =
-
 EXTRA_DIST = logos
-
-pdf-local: $(PDF_TARGETS)
diff --git a/doc/macroprocessor/Makefile.am b/doc/macroprocessor/Makefile.am
index 5d06b17d7e4d9ff8a80575a540386337d9c14e93..b6304dc041b8def779a0f91a8260ab1a98629c6a 100644
--- a/doc/macroprocessor/Makefile.am
+++ b/doc/macroprocessor/Makefile.am
@@ -1,8 +1,6 @@
-if HAVE_PDFLATEX
-if HAVE_BEAMER
+if ENABLE_DOC
 pdf-local: macroprocessor.pdf
 endif
-endif
 
 SRC = macroprocessor.tex new-design.pdf
 
diff --git a/doc/preprocessor/Makefile.am b/doc/preprocessor/Makefile.am
index 65ee1437338e28a11d6078fef82f0af87d98ea5d..63b9a182be7f0b0b3f903216f466f56bf7f2c7b6 100644
--- a/doc/preprocessor/Makefile.am
+++ b/doc/preprocessor/Makefile.am
@@ -1,8 +1,6 @@
-if HAVE_PDFLATEX
-if HAVE_BEAMER
+if ENABLE_DOC
 pdf-local: preprocessor.pdf
 endif
-endif
 
 SRC = preprocessor.tex expr.png expr-sharing.png matrices.png overview.png json-preprocessor.png