Commit Graph

189 Commits

Author SHA1 Message Date
Sergey Kandaurov cf616abc3b Merged with the default branch. 2023-03-29 11:14:25 +04:00
Maxim Dounin 9612c3c394 Win32: OpenSSL compilation for x64 targets with MSVC.
To ensure proper target selection the NGX_MACHINE variable is now set
based on the MSVC compiler output, and the OpenSSL target is set based
on it.

This is not important as long as "no-asm" is used (as in misc/GNUmakefile
and win32 build instructions), but might be beneficial if someone is trying
to build OpenSSL with assembler code.
2023-02-23 18:16:08 +03:00
Roman Arutyunyan fe0c3d7310 QUIC: OpenSSL compatibility layer.
The change allows to compile QUIC with OpenSSL which lacks BoringSSL QUIC API.

This implementation does not support 0-RTT.
2023-02-22 19:16:53 +04:00
Maxim Dounin 401702af41 Win32: disabled threads support in OpenSSL builds.
Threads are disabled during UNIX builds (see b329c0ab1a48), and also not
needed for Windows builds.

This used to be the default before OpenSSL 1.1.0.
2022-09-07 00:47:31 +03:00
Sergey Kandaurov de23dc786b Merged with the default branch. 2022-10-20 16:41:36 +04:00
Sergey Kandaurov 217bec97be Merged with the default branch. 2021-12-29 15:17:26 +03:00
Maxim Dounin cf313fe3de PCRE2 library support.
The PCRE2 library is now used by default if found, instead of the
original PCRE library.  If needed for some reason, this can be disabled
with the --without-pcre2 configure option.

To make it possible to specify paths to the library and include files
via --with-cc-opt / --with-ld-opt, the library is first tested without
any additional paths and options.  If this fails, the pcre2-config script
is used.

Similarly to the original PCRE library, it is now possible to build PCRE2
from sources with nginx configure, by using the --with-pcre= option.
It automatically detects if PCRE or PCRE2 sources are provided.

Note that compiling PCRE2 10.33 and later requires inttypes.h.  When
compiling on Windows with MSVC, inttypes.h is only available starting
with MSVC 2013.  In older versions some replacement needs to be provided
("echo '#include <stdint.h>' > pcre2-10.xx/src/inttypes.h" is good enough
for MSVC 2010).

The interface on nginx side remains unchanged.
2021-12-25 01:07:15 +03:00
Maxim Dounin c023111215 Configure: simplified PCRE compilation.
Removed ICC-specific PCRE optimizations which tried to link with PCRE
object files instead of the library.  Made compiler-specific code
minimal.
2021-12-25 01:07:14 +03:00
Ruslan Ermilov 6e1487496d Configure: fixed QUIC support test.
OpenSSL library QUIC support cannot be tested at configure time when
using the --with-openssl option so assume it's present if requested.
While here, fixed the error message in case QUIC support is missing.
2021-09-27 10:10:38 +03:00
Ruslan Ermilov d116018bf7 Configure: check for QUIC 0-RTT support at compile time. 2021-09-27 10:10:37 +03:00
Ruslan Ermilov 63f265eaa9 Configure: simplified condition. 2021-09-21 14:46:17 +03:00
Ruslan Ermilov ec9069206a Removed NGX_OPENSSL_QUIC macro, NGX_QUIC is enough. 2021-09-14 12:09:13 +03:00
Ruslan Ermilov 7372cd0fae Changed the OpenSSL QUIC support detection.
As was changed in 253cf267f95a.
2021-09-09 15:34:00 +03:00
Roman Arutyunyan 0c9a1fd9cc QUIC: added "quic" listen parameter.
The parameter allows processing HTTP/0.9-2 over QUIC.

Also, introduced ngx_http_quic_module and moved QUIC settings there
2020-07-21 23:09:22 +03:00
Sergey Kandaurov 3ff3f33fe7 Compatibility with BoringSSL master branch.
Recently BoringSSL introduced SSL_set_quic_early_data_context()
that serves as an additional constrain to enable 0-RTT in QUIC.

Relevant changes:
 * https://boringssl.googlesource.com/boringssl/+/7c52299%5E!/
 * https://boringssl.googlesource.com/boringssl/+/8519432%5E!/
2020-06-01 19:53:13 +03:00
Sergey Kandaurov 76ef3c1768 Configure: fixed static compilation with OpenSSL 1.1.1 / BoringSSL.
See 7246:04ebf29eaf5b for details.
2020-05-01 13:02:30 +03:00
Sergey Kandaurov 7a34d6e74a Configure: unbreak with old OpenSSL, --with-http_v3_module added. 2020-04-30 15:47:43 +03:00
Sergey Kandaurov 7860cca902 HTTP UDP layer, QUIC support autotest. 2020-02-28 13:09:51 +03:00
Sergey Kandaurov 3f5c3dc960 Configure: fixed compiler warnings with "-Wall -Wextra". 2018-07-24 18:46:54 +03:00
Maxim Dounin b051c9ec68 Configure: restored "no-threads" in OpenSSL builds.
This was previously used, but was incorrectly removed in 83d54192e97b
while removing old threads remnants.  Instead of using it conditionally
when threads are not used, we now set in unconditionally, as even with
thread pools enabled we never call OpenSSL functions in threads.

This fixes resulting binary when using --with-openssl with OpenSSL 1.1.0+
and without -lpthread linked (notably on FreeBSD without PCRE).
2018-03-22 15:56:07 +03:00
Maxim Dounin 519c1a1a9f Configure: fixed static compilation with OpenSSL 1.1.1.
OpenSSL now uses pthread_atfork(), and this requires -lpthread on Linux
to compile.  Introduced NGX_LIBPTHREAD to add it as appropriate, similar
to existing NGX_LIBDL.
2018-03-22 15:55:57 +03:00
Samuel Martin f142bef403 Configure: fixed PCRE requirement check by ngx_http_rewrite_module.
The http_rewrite module cannot be selected when http is disabled.
Fixed the PCRE check condition to avoid irrelevant check failure.
This is a regression from 4d874b4d82ed.

Signed-off-by: Samuel Martin <s.martin49@gmail.com>
2017-07-19 12:05:50 +03:00
Maxim Dounin ba3f002e7c Win32: compatiblity with OpenSSL 1.1.0.
OpenSSL 1.1.0 now uses normal "nmake; nmake install" instead of using
custom "ms\do_ms.bat" script and "ms\nt.mak" makefile.  And Configure
now requires --prefix to be absolute, and no longer derives --openssldir
from prefix (so it's specified explicitly).  Generated libraries are now
called "libcrypto.lib" and "libssl.lib" instead of "libeay32.lib"
and "ssleay32.lib".  Appropriate tests added to support both old and new
variants.

Additionally, openssl/lhash.h now triggers warning C4090 ('function' :
different 'const' qualifiers), so the warning was disabled.
2016-12-24 18:01:14 +03:00
Ruslan Ermilov 925d460707 Configure: detect nginx version for nginx.pm at make time. 2016-12-16 19:54:37 +03:00
Maxim Dounin 61d665c722 Perl: removed special environment handling for the perl module.
In Perl 5.8.6 the default was switched to use putenv() when used as
embedded library unless "PL_use_safe_putenv = 0" is explicitly used
in the code.  Therefore, for modern versions of Perl it is no longer
necessary to restore previous environment when calling perl_destruct().
2016-12-07 19:03:26 +03:00
Valentin Bartenev bb90853a4e Image filter: support for WebP.
In collaboration with Ivan Poluyanov.
2016-10-21 15:18:44 +03:00
Maxim Dounin 03c5053566 Configure: removed the --with-ipv6 option.
IPv6 now compiled-in automatically if support is found.  If there is a need
to disable it for some reason, --with-cc-opt="-DNGX_HAVE_INET6=0" can be used
for this.
2016-10-04 16:38:14 +03:00
Konstantin Pavlov 0c89c8bc5a Perl: pass additional linker options to perl module.
Previously flags passed by --with-ld-opt were not used when building perl
module, which meant hardening flags provided by package build systems were not
applied.
2016-09-20 22:11:23 +03:00
Piotr Sikora 854fcd66d9 Configure: remove auto/lib/test, unused since nginx-0.1.2.
Signed-off-by: Piotr Sikora <piotrsikora@google.com>
2015-10-23 18:21:33 -07:00
Maxim Dounin 44313caee5 Internal md5 and sha1 implementations are now always used.
This reduces the number of moving parts in ABI compatibility checks.
Additionally, it also allows to use OpenSSL in FIPS mode while still
using md5 for non-security tasks.
2016-06-30 18:57:39 +03:00
Maxim Dounin 8d8330a960 SSL: initialization changes for OpenSSL 1.1.0.
OPENSSL_config() deprecated in OpenSSL 1.1.0.  Additionally,
SSL_library_init(), SSL_load_error_strings() and OpenSSL_add_all_algorithms()
are no longer available if OPENSSL_API_COMPAT is set to 0x10100000L.

The OPENSSL_init_ssl() function is now used instead with appropriate
arguments to trigger the same behaviour.  The configure test changed to
use SSL_CTX_set_options().

Deinitialization now happens automatically in OPENSSL_cleanup() called
via atexit(3), so we no longer call EVP_cleanup() and ENGINE_cleanup()
directly.
2016-03-31 23:38:33 +03:00
Ruslan Ermilov 8f0bffad5a Dynamic modules: perl. 2016-02-26 14:27:04 +03:00
Sergey Kandaurov 8794197116 Configure: skip building OpenSSL documentation to conserve time.
The install_sw target first appeared in OpenSSL 0.9.7e and is documented since
OpenSSL 1.0.0 as the way to install the OpenSSL software without documentation.
2016-02-19 13:31:55 +03:00
Ruslan Ermilov 714324fd0c Configure: fixed static nginx build with OpenSSL (ticket #903).
Before 7142b04337d6, it was possible to build the OpenSSL library
along with nginx, and link nginx statically with this library
(--with-openssl=DIR --with-ld-opt=-static --with-http_ssl_module).
This was broken on Linux by not adding -ldl after -lcrypto.

The fix also makes it possible to link nginx statically on Linux
with the system OpenSSL library, which never worked before.
2016-02-18 11:39:57 +03:00
Maxim Dounin a57c77bd5e Win32: simplified and improved handling of MSVC versions.
Now we always set NGX_CC_NAME to "msvc", and additionally test compiler
version as reported by "cl" in auto/cc/msvc (the same version is also
available via the _MSC_VER define).  In particular, this approach allows
to properly check for C99 variadic macros support, which previously was
not used with MSVC versions not explicitly recognized.

Now unneeded wildcards in NGX_CC_NAME tests for msvc removed accordingly,
as well as unused wildcards for owc and icc.
2016-02-13 06:47:34 +03:00
Maxim Dounin f3e79434f5 Dynamic modules.
The auto/module script is extended to understand ngx_module_link=DYNAMIC.
When set, it links the module as a shared object rather than statically
into nginx binary.  The module can later be loaded using the "load_module"
directive.

New auto/module parameter ngx_module_order allows to define module loading
order in complex cases.  By default the order is set based on ngx_module_type.

3rd party modules can be compiled dynamically using the --add-dynamic-module
configure option, which will preset ngx_module_link to "DYNAMIC" before
calling the module config script.

Win32 support is rudimentary, and only works when using MinGW gcc (which
is able to handle exports/imports automatically).

In collaboration with Ruslan Ermilov.
2016-02-04 20:25:29 +03:00
Maxim Dounin 875356ff27 Dynamic modules: dlopen() support. 2016-02-04 18:30:21 +03:00
Ruslan Ermilov a299e7cfeb Configure: improved workaround for system perl on OS X.
The workaround from baf2816d556d stopped to work because the order of
"-arch x86_64" and "-arch i386" has changed.
2015-11-30 12:04:29 +03:00
Maxim Dounin 4c7a0d6432 Configure: fixed using OpenSSL include paths. 2015-11-23 22:48:31 +03:00
Ruslan Ermilov e62e8a0006 Configure: search OpenSSL in a bunch of standard places. 2015-06-10 12:25:45 +03:00
Ruslan Ermilov fcb4524be7 Configure: removed obsolete threads bits. 2015-03-13 19:08:27 +03:00
Piotr Sikora 011cea6337 Configure: remove outdated and unused patch.zlib.h.
Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
2014-07-31 03:52:28 -07:00
Maxim Dounin 0301ed4d6c Configure: restored "nginx/" missed in 6e4bb1d6679d. 2014-06-26 05:08:59 +04:00
Maxim Dounin 5fbb2c2c52 Configure: style. 2014-06-26 03:34:02 +04:00
Maxim Dounin 4f8d53957f Configure: workaround for system perl on OS X (ticket #576). 2014-06-17 12:07:06 +04:00
Maxim Dounin 5746750a5d Configure: typo fixed. 2014-04-30 19:16:30 +04:00
Piotr Sikora 3e5ae310c3 Configure: call "make distclean" for libatomic.
Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
2013-11-11 01:59:47 -08:00
Piotr Sikora cf2c707667 Configure: call "make clean" for OpenSSL only if Makefile exists.
This change allows to build nginx against git checkout of OpenSSL.

Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
2013-11-04 17:00:25 -08:00
Maxim Dounin 98f40476ad Win32: MinGW GCC compatibility.
Several warnings silenced, notably (ngx_socket_t) -1 is now checked
on socket operations instead of -1, as ngx_socket_t is unsigned on win32
and gcc complains on comparison.

With this patch, it's now possible to compile nginx using mingw gcc,
with options we normally compile on win32.
2013-09-04 20:48:28 +04:00
Maxim Dounin c3113c2b30 Win32: Borland C compatibility fixes.
Several false positive warnings silenced, notably W8012 "Comparing
signed and unsigned" (due to u_short values promoted to int), and
W8072 "Suspicious pointer arithmetic" (due to large type values added
to pointers).

With this patch, it's now again possible to compile nginx using bcc32,
with options we normally compile on win32 minus ipv6 and ssl.
2013-09-04 20:48:23 +04:00