[Python-Dev] Re: making dbmmodule still broken

Skip Montanaro skip@pobox.com
Tue, 18 Jun 2002 20:58:47 -0500


    Guido> On my 2yo Mandrake 8.1 (?) system, when I do "make" in the latest
    Guido> CVS tree, I always get an error from building dbmmodule.c:

Okay, in between ringing up credit card charges I took another look at
building the dbm module.  I can't cvs diff at the moment, but here's what I
propose (and what changes I just made locally):

    * Remove the ndbm.h and gdbm/ndbm.h checks from configure.in and run
      autoconf.

    * Change the block of code in setup.py that checks for dbm libraries and
      include files to

        if platform not in ['cygwin']:
            if (self.compiler.find_library_file(lib_dirs, 'ndbm')
                and find_file("ndbm.h", inc_dirs, []) is not None):
                exts.append( Extension('dbm', ['dbmmodule.c'],
                                       define_macros=[('HAVE_NDBM_H',None)],
                                       libraries = ['ndbm'] ) )
            elif (self.compiler.find_library_file(lib_dirs, 'gdbm')
                  and find_file("gdbm/ndbm.h", inc_dirs, []) is not None):
                exts.append( Extension('dbm', ['dbmmodule.c'],
                                       define_macros=[('HAVE_GDBM_NDBM_H',None)],
                                       libraries = ['gdbm'] ) )
            elif db_incs is not None:
                exts.append( Extension('dbm', ['dbmmodule.c'],
                                       library_dirs=[dblib_dir],
                                       include_dirs=db_incs,
                                       define_macros=[('HAVE_BERKDB_H',None),
                                                      ('DB_DBM_HSEARCH',None)],
                                       libraries=dblibs))

      This does two things.  It removes the else clause which would never
      have worked (no corresponding include files would have been found).
      It also performs the two include file tests I removed from
      configure.in and defines the appropriate macros.

Building after making these changes I get gdbm.  If I mv gdbm/ndbm.h out of
the way or comment out the first elif branch I get Berkeley DB.  I don't
have an ndbm library on my system, so I can't exercise the first branch.

I think it would probably be a good idea to alert the person running make
what library the module will be linked with.  Anyone else agree?

Skip