aboutsummaryrefslogtreecommitdiff
blob: 9fc103152df716835a017b38db794c54c249984c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
--- setup.py
+++ setup.py
@@ -1137,16 +1137,11 @@
 
         # The standard Unix dbm module:
         if platform not in ['cygwin']:
-            if find_file("ndbm.h", inc_dirs, []) is not None:
-                # Some systems have -lndbm, others don't
-                if self.compiler.find_library_file(lib_dirs, 'ndbm'):
-                    ndbm_libs = ['ndbm']
-                else:
-                    ndbm_libs = []
-                exts.append( Extension('dbm', ['dbmmodule.c'],
-                                       define_macros=[('HAVE_NDBM_H',None)],
-                                       libraries = ndbm_libs ) )
-            elif self.compiler.find_library_file(lib_dirs, 'gdbm'):
+            # To prevent automagic dependencies check for relevant modules in
+            # disabled_module_list.
+            if (self.compiler.find_library_file(lib_dirs, 'gdbm')
+                    and find_file("gdbm/ndbm.h", inc_dirs, []) is not None
+                    and 'gdbm' not in disabled_module_list):
                 gdbm_libs = ['gdbm']
                 if self.compiler.find_library_file(lib_dirs, 'gdbm_compat'):
                     gdbm_libs.append('gdbm_compat')
@@ -1162,7 +1157,7 @@
                         libraries = gdbm_libs ) )
                 else:
                     missing.append('dbm')
-            elif db_incs is not None:
+            elif db_incs is not None and 'bsddb' not in disabled_module_list:
                 exts.append( Extension('dbm', ['dbmmodule.c'],
                                        library_dirs=dblib_dir,
                                        runtime_library_dirs=dblib_dir,
@@ -1170,6 +1165,18 @@
                                        define_macros=[('HAVE_BERKDB_H',None),
                                                       ('DB_DBM_HSEARCH',None)],
                                        libraries=dblibs))
+            # Check for ndbm.h here after checking berkdb because ndbm.h is
+            # only provided by db-1*
+            elif (find_file("ndbm.h", inc_dirs, []) is not None
+                     and 'bsddb' not in disabled_module_list):
+                # Some systems have -lndbm, others don't
+                if self.compiler.find_library_file(lib_dirs, 'ndbm'):
+                    ndbm_libs = ['ndbm']
+                else:
+                    ndbm_libs = []
+                exts.append( Extension('dbm', ['dbmmodule.c'],
+                                        define_macros=[('HAVE_NDBM_H',None)],
+                                        libraries = ndbm_libs ) )
             else:
                 missing.append('dbm')