1diff --git a/shapely/geos.py b/shapely/geos.py
2index 09bf1ab..837aa98 100644
3--- a/shapely/geos.py
4+++ b/shapely/geos.py
5@@ -55,100 +55,10 @@ def load_dll(libname, fallbacks=None, mode=DEFAULT_MODE):
6 "Could not find lib {0} or load any of its variants {1}.".format(
7 libname, fallbacks or []))
8
9-_lgeos = None
10-
11-if sys.platform.startswith('linux'):
12- # Test to see if we have a wheel repaired by 'auditwheel' containing its
13- # own libgeos_c
14- geos_whl_so = glob.glob(os.path.abspath(os.path.join(os.path.dirname(
15- __file__), '.libs/libgeos_c-*.so.*')))
16- if len(geos_whl_so) == 1:
17- _lgeos = CDLL(geos_whl_so[0])
18- LOG.debug("Found GEOS DLL: %r, using it.", _lgeos)
19- else:
20- alt_paths = [
21- 'libgeos_c.so.1',
22- 'libgeos_c.so',
23- # anaconda
24- os.path.join(sys.prefix, "lib", "libgeos_c.so"),
25- ]
26- _lgeos = load_dll('geos_c', fallbacks=alt_paths)
27- free = load_dll('c').free
28- free.argtypes = [c_void_p]
29- free.restype = None
30-
31-elif sys.platform == 'darwin':
32- # Test to see if we have a delocated wheel with a GEOS dylib.
33- geos_whl_dylib = os.path.abspath(os.path.join(os.path.dirname(
34- __file__), '.dylibs/libgeos_c.1.dylib'))
35- if os.path.exists(geos_whl_dylib):
36- _lgeos = CDLL(geos_whl_dylib)
37- LOG.debug("Found GEOS DLL: %r, using it.", _lgeos)
38-
39- else:
40- if hasattr(sys, 'frozen'):
41- try:
42- # .app file from py2app
43- alt_paths = [os.path.join(
44- os.environ['RESOURCEPATH'], '..', 'Frameworks',
45- 'libgeos_c.dylib')]
46- except KeyError:
47- # binary from pyinstaller
48- alt_paths = [
49- os.path.join(sys.executable, 'libgeos_c.dylib')]
50- if hasattr(sys, '_MEIPASS'):
51- alt_paths.append(
52- os.path.join(sys._MEIPASS, 'libgeos_c.1.dylib'))
53- else:
54- alt_paths = [
55- # anaconda
56- os.path.join(sys.prefix, "lib", "libgeos_c.dylib"),
57- # The Framework build from Kyng Chaos
58- "/Library/Frameworks/GEOS.framework/Versions/Current/GEOS",
59- # macports
60- '/opt/local/lib/libgeos_c.dylib',
61- ]
62- _lgeos = load_dll('geos_c', fallbacks=alt_paths)
63-
64- free = load_dll('c').free
65- free.argtypes = [c_void_p]
66- free.restype = None
67-
68-elif sys.platform == 'win32':
69- try:
70- egg_dlls = os.path.abspath(
71- os.path.join(os.path.dirname(__file__), 'DLLs'))
72- if hasattr(sys, "frozen"):
73- wininst_dlls = os.path.normpath(
74- os.path.abspath(sys.executable + '../../DLLS'))
75- else:
76- wininst_dlls = os.path.abspath(os.__file__ + "../../../DLLs")
77- original_path = os.environ['PATH']
78- os.environ['PATH'] = "%s;%s;%s" % \
79- (egg_dlls, wininst_dlls, original_path)
80- _lgeos = load_dll("geos_c.dll", fallbacks=[
81- os.path.join(sys.prefix, "Library", "lib", "geos_c.dll"),
82- ])
83- except (ImportError, WindowsError, OSError):
84- raise
85-
86- def free(m):
87- try:
88- cdll.msvcrt.free(m)
89- except WindowsError:
90- # XXX: See http://trac.gispython.org/projects/PCL/ticket/149
91- pass
92-
93-elif sys.platform == 'sunos5':
94- _lgeos = load_dll('geos_c', fallbacks=['libgeos_c.so.1', 'libgeos_c.so'])
95- free = CDLL('libc.so.1').free
96- free.argtypes = [c_void_p]
97- free.restype = None
98-else: # other *nix systems
99- _lgeos = load_dll('geos_c', fallbacks=['libgeos_c.so.1', 'libgeos_c.so'])
100- free = load_dll('c', fallbacks=['libc.so.6']).free
101- free.argtypes = [c_void_p]
102- free.restype = None
103+_lgeos = CDLL('@libgeos_c@')
104+free = CDLL('@libc@').free
105+free.argtypes = [c_void_p]
106+free.restype = None
107
108
109 def _geos_version():