Commit d6417f6 added inclusion of engine.h when OpenSSL is of version 1.0.0 or newer. That's good, but the conservative approach t limit the fix to OpenSSL >= 1.0.0 isn't correct. ENGINE_cleanup() and other needed symbols, which get used to HAVE-checks and need engine.h were already introduced at least in 0.9.8. I tried building curl 7.61.1 against OpenSSL 0.9.8 for testing with some old setup and building curl fails.
The following will fix it at least for 0.9.8. I have not tested with 0.9.7, so will rstrict the fix to 0.9.8. Patch: