--- /dev/null
+diff -Naur ann_1.1.2.orig/src/kd_dump.cpp ann_1.1.2/src/kd_dump.cpp
+--- ann_1.1.2.orig/src/kd_dump.cpp 2010-01-28 05:40:01.000000000 +0100
++++ ann_1.1.2/src/kd_dump.cpp 2013-03-22 15:59:40.675142146 +0100
+@@ -31,6 +31,9 @@
+ // desired.)
+ //----------------------------------------------------------------------
+
++#include <cstring> // C standard string
++#include <cstdlib> // C standard lib
++
+ #include "kd_tree.h" // kd-tree declarations
+ #include "bd_tree.h" // bd-tree declarations
+
+diff -Naur ann_1.1.2.orig/test/ann_test.cpp ann_1.1.2/test/ann_test.cpp
+--- ann_1.1.2.orig/test/ann_test.cpp 2010-01-28 05:40:01.000000000 +0100
++++ ann_1.1.2/test/ann_test.cpp 2013-03-22 15:59:40.676142171 +0100
+@@ -37,6 +37,9 @@
+ // Allow round-off error in validation test
+ //----------------------------------------------------------------------
+
++#include <cstring> // C standard string
++#include <cstdlib> // C standard lib
++
+ #include <ctime> // clock
+ #include <cmath> // math routines
+ #include <cstring> // C string ops
--- /dev/null
+diff -Naur ann_1.1.2.orig/Make-config ann_1.1.2/Make-config
+--- ann_1.1.2.orig/Make-config 2010-01-28 05:40:01.000000000 +0100
++++ ann_1.1.2/Make-config 2013-03-22 15:56:58.290617102 +0100
+@@ -67,6 +67,14 @@
+ # files in the MS_WIN32 directory).
+ #-----------------------------------------------------------------------------
+
++# Linux shared library using g++
++linux:
++ $(MAKE) targets \
++ "ANNLIB = libANN.so.1.0" \
++ "ANNDEVLIB = libANN.so" \
++ "C++ = g++" \
++ "MAKELIB = $(C++) -shared -Wl,-soname -Wl,libANN.so.1 -o" \
++ "RANLIB = true"
+ # Linux using g++
+ linux-g++:
+ $(MAKE) targets \
+diff -Naur ann_1.1.2.orig/Makefile ann_1.1.2/Makefile
+--- ann_1.1.2.orig/Makefile 2010-01-28 05:40:01.000000000 +0100
++++ ann_1.1.2/Makefile 2013-03-22 15:56:58.290617102 +0100
+@@ -56,7 +56,7 @@
+ #-----------------------------------------------------------------------------
+ # main make entry point
+ #-----------------------------------------------------------------------------
+-alpha-g++ macosx-g++ linux-g++ sgi sunos4 sunos4-g++ sunos5 sunos5-g++ sunos5-g++-sl authors-debug authors-perf:
++alpha-g++ macosx-g++ linux linux-g++ sgi sunos4 sunos4-g++ sunos5 sunos5-g++ sunos5-g++-sl authors-debug authors-perf:
+ cd src ; $(MAKE) $@
+ cd test ; $(MAKE) $@
+ cd sample ; $(MAKE) $@
+diff -Naur ann_1.1.2.orig/src/Makefile ann_1.1.2/src/Makefile
+--- ann_1.1.2.orig/src/Makefile 2010-01-28 05:40:01.000000000 +0100
++++ ann_1.1.2/src/Makefile 2013-03-22 15:56:58.290617102 +0100
+@@ -56,7 +56,8 @@
+ $(LIBDIR)/$(ANNLIB): $(OBJECTS)
+ $(MAKELIB) $(ANNLIB) $(OBJECTS)
+ $(RANLIB) $(ANNLIB)
+- mv $(ANNLIB) $(LIBDIR)
++ [ -z "$(ANNDEVLIB)" ] || ln -s $(ANNLIB) $(ANNDEVLIB)
++ mv $(ANNLIB) $(ANNDEVLIB) $(LIBDIR)
+
+ #-----------------------------------------------------------------------------
+ # Make object files
--- /dev/null
+#
+# Conditional build:
+%bcond_without static_libs # static library build
+#
+Summary: Library for searching Approximate Nearest Neighbors
+Summary(pl.UTF-8): Biblioteka do przybliżonego wyszukiwania najbliższych sąsiadów
+Name: ann
+Version: 1.1.2
+Release: 1
+License: LGPL v2.1+
+Group: Libraries
+#Source0Download: http://www.cs.umd.edu/~mount/ANN/
+Source0: http://www.cs.umd.edu/~mount/ANN/Files/%{version}/%{name}_%{version}.tar.gz
+# Source0-md5: 7ffaacc7ea79ca39d4958a6378071365
+Patch0: %{name}-make.patch
+Patch1: %{name}-gcc43.patch
+URL: http://www.cs.umd.edu/~mount/ANN/
+BuildRequires: libstdc++-devel
+BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%description
+ANN is a library written in the C++ programming language to support
+both exact and approximate nearest neighbor searching in spaces of
+various dimensions.
+
+%description -l pl.UTF-8
+ANN to napisana w języku C++ biblioteka do zarówno dokładnego, jak i
+przybliżonego wyszukiwania najbliższych sąsiadów w przestrzeniach o
+różnej liczbie wymiarów.
+
+%package devel
+Summary: Header files for ANN library
+Summary(pl.UTF-8): Pliki nagłówkowe biblioteki ANN
+Group: Development/Libraries
+Requires: %{name} = %{version}-%{release}
+Requires: libstdc++-devel
+
+%description devel
+Header files for ANN library.
+
+%description devel -l pl.UTF-8
+Pliki nagłówkowe biblioteki ANN.
+
+%package static
+Summary: Static ANN library
+Summary(pl.UTF-8): Statyczna biblioteka ANN
+Group: Development/Libraries
+Requires: %{name}-devel = %{version}-%{release}
+
+%description static
+Static ANN library.
+
+%description static -l pl.UTF-8
+Statyczna biblioteka ANN.
+
+%prep
+%setup -q -n %{name}_%{version}
+%patch0 -p1
+%patch1 -p1
+
+%build
+%if %{with static_libs}
+# static
+%{__make} -C src targets \
+ ANNLIB="libANN.a" \
+ "C++ = %{__cxx}" \
+ CFLAGS="%{rpmcxxflags}" \
+ MAKELIB="ar ruv" \
+ RANLIB=true
+%{__rm} src/*.o
+%endif
+
+# shared
+for d in src ann2fig ; do
+%{__make} -C $d targets \
+ ANNLIB="libANN.so.1.0" \
+ ANNDEVLIB="libANN.so" \
+ "C++ = %{__cxx}" \
+ CFLAGS="%{rpmcxxflags} -fPIC" \
+ MAKELIB="%{__cxx} %{rpmldflags} -shared -Wl,-soname,libANN.so.1 -o" \
+ RANLIB=true
+done
+
+%install
+rm -rf $RPM_BUILD_ROOT
+install -d $RPM_BUILD_ROOT{%{_bindir},%{_libdir},%{_includedir}/ANN,%{_pkgconfigdir}}
+
+install bin/ann2fig $RPM_BUILD_ROOT%{_bindir}
+%{?with_static_libs:install lib/libANN.a $RPM_BUILD_ROOT%{_libdir}}
+install lib/libANN.so.1.0 $RPM_BUILD_ROOT%{_libdir}
+ln -sf libANN.so.1.0 $RPM_BUILD_ROOT%{_libdir}/libANN.so.1
+ln -sf libANN.so.1.0 $RPM_BUILD_ROOT%{_libdir}/libANN.so
+
+# create pkg-config file
+cat >$RPM_BUILD_ROOT%{_pkgconfigdir}/ann.pc <<'EOF'
+prefix=%{_prefix}
+exec_prefix=%{_exec_prefix}
+libdir=%{_libdir}
+includedir=%{_includedir}
+
+Name: ann
+Description: Library for searching Approximate Nearest Neighbors
+Version: %{version}
+Requires:
+Libs: -L${libdir} -lANN
+Cflags: -I${includedir}
+EOF
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%post -p /sbin/ldconfig
+%postun -p /sbin/ldconfig
+
+%files
+%defattr(644,root,root,755)
+%doc Copyright.txt ReadMe.txt
+%attr(755,root,root) %{_bindir}/ann2fig
+%attr(755,root,root) %{_libdir}/libANN.so.*.*
+%attr(755,root,root) %ghost %{_libdir}/libANN.so.1
+
+%files devel
+%defattr(644,root,root,755)
+%doc doc/ANNmanual.pdf
+%attr(755,root,root) %{_libdir}/libANN.so
+%{_includedir}/ANN
+%{_pkgconfigdir}/ann.pc
+
+%if %{with static_libs}
+%files static
+%defattr(644,root,root,755)
+%{_libdir}/libANN.a
+%endif