Commit 4d04d3d7 authored by Sotirios Delimanolis's avatar Sotirios Delimanolis Committed by Facebook GitHub Bot

Add FOLLY_OPENSSL_PREREQ macro function

Summary:
This diff introduces a new macro function to resolve whether the current OpenSSL version available is greater than or equal to the given (major, minor, fix) version tuple.

We used the rules defined in the [OPENSSL_VERSION_NUMBER man page](https://www.openssl.org/docs/man1.1.1/man3/OPENSSL_VERSION_NUMBER.html), ie. nibbles for each of
```
 MNNFFPPS: major minor fix patch status
```

We choose to ignore `patch` and `status` for simplicity and because we don't expect to build against such versions.

The existing `FOLLY_OPENSSL_IS_110` variable already checks for greater than or equal to version number 1.1.0, so I didn't feel the need to modify it (nor the other variables). We can do some clean up in a future diff.

Reviewed By: yfeldblum, mingtaoy

Differential Revision: D22346692

fbshipit-source-id: 156ee69ecd619de12319d7d63239f28c323820a4
parent 3e9186f1
...@@ -60,6 +60,14 @@ ...@@ -60,6 +60,14 @@
(OPENSSL_VERSION_NUMBER >= 0x1000200fL && \ (OPENSSL_VERSION_NUMBER >= 0x1000200fL && \
OPENSSL_VERSION_NUMBER < 0x10100000L) OPENSSL_VERSION_NUMBER < 0x10100000L)
#define FOLLY_OPENSSL_IS_110 (OPENSSL_VERSION_NUMBER >= 0x10100000L) #define FOLLY_OPENSSL_IS_110 (OPENSSL_VERSION_NUMBER >= 0x10100000L)
// Defined according to version number description in
// https://www.openssl.org/docs/man1.1.1/man3/OPENSSL_VERSION_NUMBER.html
// ie. (nibbles) MNNFFPPS: major minor fix patch status
#define FOLLY_OPENSSL_CALCULATE_VERSION(major, minor, fix) \
(((major << 28) | ((minor << 20) | (fix << 12))))
#define FOLLY_OPENSSL_PREREQ(major, minor, fix) \
(OPENSSL_VERSION_NUMBER >= FOLLY_OPENSSL_CALCULATE_VERSION(major, minor, fix))
#endif #endif
#if !defined(OPENSSL_IS_BORINGSSL) && !FOLLY_OPENSSL_IS_100 && \ #if !defined(OPENSSL_IS_BORINGSSL) && !FOLLY_OPENSSL_IS_100 && \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment