Index: configure.in
===================================================================
--- configure.in	(revision 24535)
+++ configure.in	(working copy)
@@ -982,6 +983,8 @@ AC_SUBST(LIBTIFF)
 # Check for libjpeg
 ###################
 
+jpeg_ok=yes
+
 AC_ARG_WITH(libjpeg,  [  --without-libjpeg       build without JPEG support])
   if test "x$with_libjpeg" != xno && test -z "$LIBJPEG"; then
     AC_CHECK_LIB(jpeg, jpeg_destroy_decompress,
@@ -1016,9 +1019,10 @@ AC_ARG_WITH(libjpeg,  [  --without-libjp
 *** --without-libjpeg to configure but you won't be able to use JPEGs then.])
   fi
 
-AC_SUBST(JPEG)
+AM_CONDITIONAL(BUILD_JPEG, test "x$jpeg_ok" = xyes)
 AC_SUBST(LIBJPEG)
 
+
 ## xjt does build, but it is more confusing than useful on Win32,
 ## as it wants to run tar, mv and bzip2, which seldom are available
 AM_CONDITIONAL(BUILD_XJT, test "x$jpeg_ok" = xyes && test "x$os_win32" = xno)
Index: plug-ins/Makefile.am
===================================================================
--- plug-ins/Makefile.am	(revision 24535)
+++ plug-ins/Makefile.am	(working copy)
@@ -8,6 +8,10 @@ if BUILD_HELPBROWSER
 helpbrowser = helpbrowser
 endif
 
+if BUILD_JPEG
+jpeg = jpeg
+endif
+
 if BUILD_PRINT
 print = print
 endif
@@ -60,7 +64,7 @@ SUBDIRS = \
 	$(helpbrowser)		\
 	ifscompose		\
 	imagemap		\
-	jpeg                    \
+	$(jpeg)                 \
 	maze			\
 	metadata		\
 	pagecurl		\
