Description: don't use the embedded copy of the GAlib library
 Use the system-wide GAlib library, rather than the copy embedded in Gamera
 source tarball. See also Debian bug #544693.
Author: Jakub Wilk <jwilk@debian.org>
Forwarded: not-needed
Last-Update: 2012-04-18

--- a/gamera/gamera_setup.py
+++ b/gamera/gamera_setup.py
@@ -87,7 +87,7 @@
    if macosversion.startswith("10.6"):
       extras['extra_link_args'].append('-L/Developer/SDKs/MacOSX10.5.sdk/usr/lib')
 elif '--compiler=mingw32' in sys.argv or not sys.platform == 'win32':
-   extras['libraries'] = ['stdc++'] # Not for intel compiler
+   extras['libraries'] = ['stdc++', 'ga'] # Not for intel compiler
 
 # Check that we are running a recent enough version of Python.
 # This depends on the platform.
--- a/setup.py
+++ b/setup.py
@@ -122,8 +122,7 @@
 ########################################
 # Non-plugin extensions
 
-ga_files = glob.glob("src/ga/*.cpp")
-ga_files.append("src/knncoremodule.cpp")
+ga_files = ["src/knncoremodule.cpp"]
 graph_files = glob.glob("src/graph/*.cpp") + glob.glob("src/graph/graphmodule/*.cpp")
 kdtree_files = ["src/kdtreemodule.cpp", "src/geostructs/kdtree.cpp"]
 
@@ -146,7 +145,7 @@
                         **gamera_setup.extras
                         ),
               Extension("gamera.knncore", ga_files,
-                        include_dirs=["include", "src/ga", "src"],
+                        include_dirs=["include", "src"],
                         **gamera_setup.extras),
               Extension("gamera.graph", graph_files,
                         include_dirs=["include", "src", "include/graph", "src/graph/graphmodule"],
--- a/src/knncoremodule.cpp
+++ b/src/knncoremodule.cpp
@@ -34,10 +34,11 @@
 #include <assert.h>
 #include <stdio.h>
 // for ga optimization
+#include <ga/gaconfig.h>
+#undef GALIB_USE_COMP_OPERATOR_TEMPLATES
 #include <ga/ga.h>
 #include <ga/GASimpleGA.h>
 #include <ga/GA1DArrayGenome.h>
-#include <ga/GA1DArrayGenome.cpp>
 // for rand
 #include <stdlib.h>
 #include <time.h>
@@ -1527,7 +1528,7 @@
   GA1DArrayGenome<double> & genome = (GA1DArrayGenome<double> &)g;
   KnnObject* knn = (KnnObject*)genome.userData();
 
-  std::pair<int,int> ans = leave_one_out(knn, std::numeric_limits<int>::max(), genome());
+  std::pair<int,int> ans = leave_one_out(knn, std::numeric_limits<int>::max(), static_cast<double*>(genome));
 
   return (float)ans.first / ans.second;
 }
