I need to compile an old Apache version, 1.3, and the compilation process fails because:
mod_auth_dbm.c:77:18: fatal error: ndbm.h: File or directory not found Where is this ndbm.h file?
In ubuntu there is apt-file package that allows you to find package which contains specified file. You need to install it with
sudo apt-get install apt-file update the cache with
apt-file update and than you can to search the package you need with
apt-file search ndbm.h There is only tendra package, that contains file with such name.
Also libgdbm-dev contains /usr/include/gdbm-ndbm.h. May be it's the one you need. You can try to compile with it.
ps. Also you can use search on ubuntu site.
dbm was a "database" (really a library for handling a table of a database only, part of early Unix), which in turn was replaced by ndbm (new DBM, had some licensing issues); gdbm (GNU dbm) was written to replace both. The whole sordid story is covered by Wikipedia. Perhaps there is still a ndbm-dev package in some non-free repo? apt-file instead of just giving the answer. That file here (Fedora 18) belongs to gdbm-devel, the package containing it for Ubuntu should be named similarly. Check the dependencies for the source, you'll probably need a swath of -devel packages corresponding to each dependency.
What do you need an outdated apache, which moreover has known vulnerabilities? Why doesn't the distribution's apache work? It is probably a much better idea to port whatever requires that apache forward than to get stuck in prehistory...
libgdbm-dev that is most similar by name, unfortunately it doesn't contain ndbm.h, however it contains /usr/include/gdbm-ndbm.h. Maybe it's the one is needed, db.h is part of Berkeley DB, another project to replace DBM (currently owned by Oracle, under some non-free license). Is this perhaps the config script lloking for available DBM functionality? In that case you should just leave things be. The gdbm sources put the header files in /usr/include/gdbm. Some packaging systems (e.g. Arch Linux) put in symbolic links to those (so /usr/include/ndbm.h points to /usr/include/gdbm/ndbm.h) while at least some Debian-based systems omit the directory AND rename ndbm.h to gdbm-ndbm.h (so they have gdbm.h, dbm.h and gdbm-ndbm.h).
I assume it was to avoid some conflict with a different package, but it's a poor solution.
One way to get around such issues (especially if you don't have permissions to modify the system directories) is to create your own directory, e.g. compat, put in a link from compat/ndbm.h to /usr/include/gdbm-ndbm.h, and then tell the compiler to search your compat directory (-Icompat). Then, if it doesn't find the file in the system libraries it will find the correct name in your own directory.
Since Debian 10 and Ubuntu 18.04 (possibly earlier, but that’s the oldest supported release with this package), the relevant files are available in libgdbm-compat-dev:
apt install libgdbm-compat-dev