This is a little simpler than the docs/cookbook/c project, which doesn't actually have a doc yet because there was too much to explain. I think I might make that a follow-on cookbook chapter, for people who have read this simple one. I think this doc is maybe a little too long; I intended it to be "here's what you do to get started" but it turned into "here's what you do to get started, and why it works, in excruciating detail." Not quite sure how to fix. (Also updated some other parts of the docs to refer to redoconf as a real thing now instead of a "maybe someone should write this" thing.)
28 lines
452 B
C
28 lines
452 B
C
// An example of how to change code behaviour based on
|
|
// redoconf autodetection.
|
|
#include "redoconf.h"
|
|
|
|
#if HAVE_LIBSSL
|
|
|
|
#if HAVE_OPENSSL__SSL_H
|
|
#include <openssl/ssl.h>
|
|
#endif
|
|
|
|
#if HAVE_OPENSSL__OPENSSLV_H
|
|
#include <openssl/opensslv.h>
|
|
#endif
|
|
|
|
unsigned long libssl_version() {
|
|
SSL_library_init();
|
|
return OPENSSL_VERSION_NUMBER;
|
|
}
|
|
|
|
#else // HAVE_LIBSSL
|
|
|
|
unsigned long libssl_version() {
|
|
// Library not present
|
|
return 0;
|
|
}
|
|
|
|
#endif // HAVE_LIBSSL
|
|
|