--- /dev/null
+diff -Nur DjVu3.orig/config/cc.sh DjVu3/config/cc.sh
+--- DjVu3.orig/config/cc.sh Tue Jan 9 18:29:22 2001
++++ DjVu3/config/cc.sh Mon Jul 9 00:58:27 2001
+@@ -89,27 +89,6 @@
+ fi
+ CCFLAGS=`echo "${CCPIPE}" "${CCFLAGS}"`
+
+- CCMMX=""
+- m=`${uname} -m`
+- if [ "${m}" = i686 ]
+- then
+- echon "Chesking whether ${CC} -mpentiumpro and -mmx work ... "
+- if ( run $CC ${CCFLAGS} -mpentiumpro -c $temp.c)
+- then
+- CCMMX="-mpentiumpro"
+- if ( run $CC ${CCFLAGS} ${CCMMX} -mmx -c $temp.c )
+- then
+- CCMMX="$CCMMX -mmx"
+- echo "yes, both work"
+- else
+- echo "just $CCMMX works"
+- fi
+- else
+- echo no
+- fi
+- CCFLAGS=`echo "${CCMMX}" "${CCFLAGS}"`
+- fi
+-
+ echon "Checking whether ${CC} is gcc ... "
+ echo 'int main(void) { return __GNUC__;}' | testfile $temp.c
+ CCOPT=""
+@@ -120,19 +99,11 @@
+ echo yes
+ cc_is_gcc=yes
+ CCWARN="-Wall"
+- echon "Checking whether ${CC} -O3 works ... "
+- if ( run $CC ${CCFLAGS} -O3 -c $temp.c )
+- then
+- echo yes
+- CCOPT="-O3"
+- else
+- echo no
+- fi
+- echon "Checking whether ${CC} -funroll-loops works ... "
+- if ( run $CC ${CCFLAGS} ${CCOPT} -funroll-loops -c $temp.c )
++ echon "Checking whether ${CC} ${OPT} works ... "
++ if ( run $CC ${CCFLAGS} ${OPT} -c $temp.c )
+ then
+ echo yes
+- CCUNROLL="-funroll-loops"
++ CCOPT="${OPT}"
+ else
+ echo no
+ fi
+diff -Nur DjVu3.orig/config/cxx.sh DjVu3/config/cxx.sh
+--- DjVu3.orig/config/cxx.sh Tue Jan 9 18:29:22 2001
++++ DjVu3/config/cxx.sh Mon Jul 9 01:00:18 2001
+@@ -94,19 +94,6 @@
+ fi
+ CXXFLAGS=`echo "${CXXPIPE}" "${CXXFLAGS}"`
+
+- CXXMMX=""
+- if [ `uname -m` = i686 ]
+- then
+- echon "Checking ${CXX} supports pentium optimizations ... "
+- check_compile_flags CXXMMX $temp.cpp "-mpentiumpro -mmx" "-mpentiumpro"
+- if [ -z "$CXXMMX" ] ; then
+- echo "none"
+- else
+- echo "$CXXMMX"
+- CXXFLAGS="${CXXMMX} ${CXXFLAGS}"
+- fi
+- fi
+-
+ echon "Checking whether ${CXX} is gcc ... "
+ echo 'int main(void) { return __GNUG__;}' | testfile $temp.cpp
+ CXXOPT=""
+@@ -117,18 +104,10 @@
+ echo yes
+ cxx_is_gcc=yes
+ CXXWARN="-Wall"
+- echon "Checking whether ${CXX} -O3 works ... "
+- if ( run $CXX ${CXXFLAGS} -O3 -c $temp.cpp ) ; then
+- echo yes
+- CXXOPT="-O3"
+- else
+- echo no
+- fi
+- echon "Checking whether ${CXX} -funroll-loops works ... "
+- if ( run $CXX ${CXXFLAGS} ${CXXOPT} -funroll-loops -c $temp.cpp )
+- then
++ echon "Checking whether ${CXX} ${OPTXX} works ... "
++ if ( run $CXX ${CXXFLAGS} ${OPTXX} -c $temp.cpp ) ; then
+ echo yes
+- CXXUNROLL="-funroll-loops"
++ CXXOPT="${OPTXX}"
+ else
+ echo no
+ fi
+diff -Nur DjVu3.orig/configure DjVu3/configure
+--- DjVu3.orig/configure Thu Nov 9 21:15:05 2000
++++ DjVu3/configure Mon Jul 9 00:56:09 2001
+@@ -1,4 +1,4 @@
+-#!/bin/ksh
++#!/bin/sh
+ #C-
+ #C- DjVu® Reference Library (v. 3.0)
+ #C-
+@@ -88,18 +88,13 @@
+ esac
+ done
+
+-if [ ! -d "$TOPSRCDIR/src/3rd-party/libjpeg" ]
+-then
+- without_jpeg=true
+-fi
+-
+ if [ -z "$without_jpeg" ]
+ then
+ C_DEFS=APPEND
+ A_DEFS="$A_DEFS -DNEED_JPEG_DECODER"
+ C_INCS=APPEND
+- A_INCS="$A_INCS -I./TOPDIR/src/3rd-party/libjpeg -I./TOPDIR/SRCDIR/src/3rd-party/libjpeg"
+- LIBJPEG='$(LIBPATH)/libdjpeg.a'
++ A_INCS="$A_INCS -I/usr/include"
++ LIBJPEG='-ljpeg'
+ else
+ LIBJPEG=""
+ fi
+@@ -141,21 +136,6 @@
+ generate_makefile src/libdjvu++/Test
+ generate_makefile src/djvutools/reference
+
+-if [ -z "$without_jpeg" ]
+-then
+- ## This is the version with JPEG
+- generate_makefile src/3rd-party/libjpeg
+- generate_main_makefile src/3rd-party/libjpeg src/libdjvu++ <<\EOF
+-all:
+- ( cd src/3rd-party/libjpeg; $(MAKE) lib prog)
+- ( cd src/libdjvu++; $(MAKE) lib )
+- ( cd src/djvutools/reference; $(MAKE) prog )
+-
+-install:
+- echo Rule not supported...
+-EOF
+-
+-else
+ ## This is the regular version
+ generate_main_makefile src/libdjvu++ <<\EOF
+ all:
+@@ -165,7 +145,6 @@
+ install:
+ echo Rule not supported...
+ EOF
+-fi
+
+
+
--- /dev/null
+--- DjVu3.orig/src/libdjvu++/JPEGDecoder.h Thu Jan 4 23:04:55 2001
++++ DjVu3/src/libdjvu++/JPEGDecoder.h Mon Jul 9 01:25:02 2001
+@@ -43,11 +43,12 @@
+
+ #ifdef NEED_JPEG_DECODER
+
++#include <stdio.h>
++
+ #ifdef __cplusplus
+ extern "C" {
+ #endif
+
+-#include <jinclude.h>
+ #include <jpeglib.h>
+ #include <jerror.h>
+
+--- DjVu3.orig/src/libdjvu++/JPEGDecoder.cpp Tue Mar 6 20:55:42 2001
++++ DjVu3/src/libdjvu++/JPEGDecoder.cpp Mon Jul 9 01:36:09 2001
+@@ -240,11 +240,11 @@
+ { /* first time for this JPEG object? */
+ cinfo->src = (struct jpeg_source_mgr *)
+ (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
+- SIZEOF(byte_stream_src_mgr));
++ sizeof(byte_stream_src_mgr));
+ src = (byte_stream_src_ptr) cinfo->src;
+ src->buffer = (JOCTET *)
+ (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
+- INPUT_BUF_SIZE * SIZEOF(JOCTET));
++ INPUT_BUF_SIZE * sizeof(JOCTET));
+ }
+
+ src = (byte_stream_src_ptr) cinfo->src;
--- /dev/null
+Summary: DjVu Reference Library
+Summary(pl): Biblioteka do obs³ugi formatu DjVu
+Name: djvu
+Version: 3.0
+%define snap 20010511
+Release: 0.%{snap}
+Group: Libraries
+Group(de): Libraries
+Group(es): Bibliotecas
+Group(fr): Librairies
+Group(pl): Biblioteki
+License: GPL
+Source0: http://www.lizardtech.com/software/djvureferencelibrary/version3/DjVu%{version}.snapshot-%{snap}.src.tar.gz
+Patch0: %{name}-config.patch
+Patch1: %{name}-libjpeg.patch
+URL: http://www.djvu.att.com/
+BuildRequires: libjpeg-devel
+BuildRequires: libstdc++-devel
+BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%description
+DjVu Reference Library.
+
+%description -l pl
+Biblioteka do obs³ugi formatu DjVu.
+
+%package devel
+Summary: DjVu Reference Library development package
+Summary(pl): Biblioteka DjVu dla programistów
+Group: Development/Libraries
+Group(de): Entwicklung/Libraries
+Group(fr): Development/Librairies
+Group(pl): Programowanie/Biblioteki
+# doesn't require base
+
+%description devel
+DjVu Reference Library - static library and header files.
+
+%description devel -l pl
+Biblioteka DjVu - biblioteka statyczna i pliki nag³ówkowe.
+
+%prep
+%setup -q -n DjVu3
+%patch0 -p1
+%patch1 -p1
+
+%build
+OPT="%{rpmcflags}"
+%ifarch i586 i686
+OPT="$OPT -DMMX"
+%endif
+# uses exceptions and implicit templactes
+OPTXX="$OPT"
+export OPT OPTXX
+./configure --with-threads=posix
+cd build/linux-libc6/configure
+%{__make}
+
+%install
+rm -rf $RPM_BUILD_ROOT
+install -d $RPM_BUILD_ROOT{%{_bindir},%{_libdir},%{_includedir}}
+
+install build/linux-libc6/configure/bin/* $RPM_BUILD_ROOT%{_bindir}
+install build/linux-libc6/configure/lib/*.a $RPM_BUILD_ROOT%{_libdir}
+install src/include/*.h $RPM_BUILD_ROOT%{_includedir}
+
+gzip -9nf README.txt Samples/README
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(644,root,root,755)
+%doc Doc Samples *.gz
+%attr(755,root,root) %{_bindir}/*
+
+%files devel
+%defattr(644,root,root,755)
+%{_libdir}/*.a
+%{_includedir}/*.h