From e18a033b921d0d79fa8278f853548e6125b93e0c Mon Sep 17 00:00:00 2001 From: Konstantin Ananyev Date: Tue, 31 Oct 2017 12:40:17 +0000 Subject: Integrate TLDK with NGINX Created a clone of nginx (from https://github.com/nginx/nginx) to demonstrate and benchmark TLDK library integrated with real world application. A new nginx module is created and and BSD socket-like API is implemented on top of native TLDK API. Note, that right now only minimalistic subset of socket-like API is provided: - accept - close - readv - recv - writev so only limited nginx functionality is available for a moment. Change-Id: Ie1efe9349a0538da4348a48fb8306cbf636b5a92 Signed-off-by: Mohammad Abdul Awal Signed-off-by: Reshma Pattan Signed-off-by: Remy Horton Signed-off-by: Konstantin Ananyev --- app/nginx/auto/lib/conf | 54 ++++++++ app/nginx/auto/lib/geoip/conf | 97 +++++++++++++++ app/nginx/auto/lib/google-perftools/conf | 61 ++++++++++ app/nginx/auto/lib/libatomic/conf | 43 +++++++ app/nginx/auto/lib/libatomic/make | 16 +++ app/nginx/auto/lib/libgd/conf | 93 ++++++++++++++ app/nginx/auto/lib/libxslt/conf | 165 +++++++++++++++++++++++++ app/nginx/auto/lib/make | 24 ++++ app/nginx/auto/lib/openssl/conf | 135 ++++++++++++++++++++ app/nginx/auto/lib/openssl/make | 62 ++++++++++ app/nginx/auto/lib/openssl/makefile.bcc | 18 +++ app/nginx/auto/lib/openssl/makefile.msvc | 21 ++++ app/nginx/auto/lib/pcre/conf | 203 +++++++++++++++++++++++++++++++ app/nginx/auto/lib/pcre/make | 64 ++++++++++ app/nginx/auto/lib/pcre/makefile.bcc | 27 ++++ app/nginx/auto/lib/pcre/makefile.msvc | 23 ++++ app/nginx/auto/lib/pcre/makefile.owc | 25 ++++ app/nginx/auto/lib/perl/conf | 83 +++++++++++++ app/nginx/auto/lib/perl/make | 46 +++++++ app/nginx/auto/lib/zlib/conf | 79 ++++++++++++ app/nginx/auto/lib/zlib/make | 135 ++++++++++++++++++++ app/nginx/auto/lib/zlib/makefile.bcc | 17 +++ app/nginx/auto/lib/zlib/makefile.msvc | 17 +++ app/nginx/auto/lib/zlib/makefile.owc | 14 +++ 24 files changed, 1522 insertions(+) create mode 100644 app/nginx/auto/lib/conf create mode 100644 app/nginx/auto/lib/geoip/conf create mode 100644 app/nginx/auto/lib/google-perftools/conf create mode 100644 app/nginx/auto/lib/libatomic/conf create mode 100644 app/nginx/auto/lib/libatomic/make create mode 100644 app/nginx/auto/lib/libgd/conf create mode 100644 app/nginx/auto/lib/libxslt/conf create mode 100644 app/nginx/auto/lib/make create mode 100644 app/nginx/auto/lib/openssl/conf create mode 100644 app/nginx/auto/lib/openssl/make create mode 100644 app/nginx/auto/lib/openssl/makefile.bcc create mode 100644 app/nginx/auto/lib/openssl/makefile.msvc create mode 100644 app/nginx/auto/lib/pcre/conf create mode 100644 app/nginx/auto/lib/pcre/make create mode 100644 app/nginx/auto/lib/pcre/makefile.bcc create mode 100644 app/nginx/auto/lib/pcre/makefile.msvc create mode 100644 app/nginx/auto/lib/pcre/makefile.owc create mode 100644 app/nginx/auto/lib/perl/conf create mode 100644 app/nginx/auto/lib/perl/make create mode 100644 app/nginx/auto/lib/zlib/conf create mode 100644 app/nginx/auto/lib/zlib/make create mode 100644 app/nginx/auto/lib/zlib/makefile.bcc create mode 100644 app/nginx/auto/lib/zlib/makefile.msvc create mode 100644 app/nginx/auto/lib/zlib/makefile.owc (limited to 'app/nginx/auto/lib') diff --git a/app/nginx/auto/lib/conf b/app/nginx/auto/lib/conf new file mode 100644 index 0000000..0b8545a --- /dev/null +++ b/app/nginx/auto/lib/conf @@ -0,0 +1,54 @@ + +# Copyright (C) Igor Sysoev +# Copyright (C) Nginx, Inc. + + +if [ $USE_PCRE = YES -o $PCRE != NONE ]; then + . auto/lib/pcre/conf + +else + if [ $USE_PCRE = DISABLED -a $HTTP_REWRITE = YES ]; then + +cat << END + +$0: error: the HTTP rewrite module requires the PCRE library. +You can either disable the module by using --without-http_rewrite_module +option or you have to enable the PCRE support. + +END + exit 1 + fi +fi + + +if [ $USE_OPENSSL = YES ]; then + . auto/lib/openssl/conf +fi + +if [ $USE_ZLIB = YES ]; then + . auto/lib/zlib/conf +fi + +if [ $USE_LIBXSLT != NO ]; then + . auto/lib/libxslt/conf +fi + +if [ $USE_LIBGD != NO ]; then + . auto/lib/libgd/conf +fi + +if [ $USE_PERL != NO ]; then + . auto/lib/perl/conf +fi + +if [ $USE_GEOIP != NO ]; then + . auto/lib/geoip/conf +fi + +if [ $NGX_GOOGLE_PERFTOOLS = YES ]; then + . auto/lib/google-perftools/conf +fi + +if [ $NGX_LIBATOMIC != NO ]; then + . auto/lib/libatomic/conf +fi diff --git a/app/nginx/auto/lib/geoip/conf b/app/nginx/auto/lib/geoip/conf new file mode 100644 index 0000000..8302aae --- /dev/null +++ b/app/nginx/auto/lib/geoip/conf @@ -0,0 +1,97 @@ + +# Copyright (C) Igor Sysoev +# Copyright (C) Nginx, Inc. + + + ngx_feature="GeoIP library" + ngx_feature_name= + ngx_feature_run=no + ngx_feature_incs="#include " + ngx_feature_path= + ngx_feature_libs="-lGeoIP" + ngx_feature_test="GeoIP_open(NULL, 0)" + . auto/feature + + +if [ $ngx_found = no ]; then + + # FreeBSD port + + ngx_feature="GeoIP library in /usr/local/" + ngx_feature_path="/usr/local/include" + + if [ $NGX_RPATH = YES ]; then + ngx_feature_libs="-R/usr/local/lib -L/usr/local/lib -lGeoIP" + else + ngx_feature_libs="-L/usr/local/lib -lGeoIP" + fi + + . auto/feature +fi + + +if [ $ngx_found = no ]; then + + # NetBSD port + + ngx_feature="GeoIP library in /usr/pkg/" + ngx_feature_path="/usr/pkg/include" + + if [ $NGX_RPATH = YES ]; then + ngx_feature_libs="-R/usr/pkg/lib -L/usr/pkg/lib -lGeoIP" + else + ngx_feature_libs="-L/usr/pkg/lib -lGeoIP" + fi + + . auto/feature +fi + + +if [ $ngx_found = no ]; then + + # MacPorts + + ngx_feature="GeoIP library in /opt/local/" + ngx_feature_path="/opt/local/include" + + if [ $NGX_RPATH = YES ]; then + ngx_feature_libs="-R/opt/local/lib -L/opt/local/lib -lGeoIP" + else + ngx_feature_libs="-L/opt/local/lib -lGeoIP" + fi + + . auto/feature +fi + + +if [ $ngx_found = yes ]; then + + CORE_INCS="$CORE_INCS $ngx_feature_path" + + if [ $USE_GEOIP = YES ]; then + CORE_LIBS="$CORE_LIBS $ngx_feature_libs" + fi + + NGX_LIB_GEOIP=$ngx_feature_libs + + ngx_feature="GeoIP IPv6 support" + ngx_feature_name="NGX_HAVE_GEOIP_V6" + ngx_feature_run=no + ngx_feature_incs="#include + #include " + #ngx_feature_path= + #ngx_feature_libs= + ngx_feature_test="printf(\"%d\", GEOIP_CITY_EDITION_REV0_V6);" + . auto/feature + +else + +cat << END + +$0: error: the GeoIP module requires the GeoIP library. +You can either do not enable the module or install the library. + +END + + exit 1 +fi diff --git a/app/nginx/auto/lib/google-perftools/conf b/app/nginx/auto/lib/google-perftools/conf new file mode 100644 index 0000000..5d5ddae --- /dev/null +++ b/app/nginx/auto/lib/google-perftools/conf @@ -0,0 +1,61 @@ + +# Copyright (C) Igor Sysoev +# Copyright (C) Nginx, Inc. + + + ngx_feature="Google perftools" + ngx_feature_name= + ngx_feature_run=no + ngx_feature_incs= + ngx_feature_path= + ngx_feature_libs="-lprofiler" + ngx_feature_test="ProfilerStop()" + . auto/feature + + +if [ $ngx_found = no ]; then + + # FreeBSD port + + ngx_feature="Google perftools in /usr/local/" + + if [ $NGX_RPATH = YES ]; then + ngx_feature_libs="-R/usr/local/lib -L/usr/local/lib -lprofiler" + else + ngx_feature_libs="-L/usr/local/lib -lprofiler" + fi + + . auto/feature +fi + + +if [ $ngx_found = no ]; then + + # MacPorts + + ngx_feature="Google perftools in /opt/local/" + + if [ $NGX_RPATH = YES ]; then + ngx_feature_libs="-R/opt/local/lib -L/opt/local/lib -lprofiler" + else + ngx_feature_libs="-L/opt/local/lib -lprofiler" + fi + + . auto/feature +fi + + +if [ $ngx_found = yes ]; then + CORE_LIBS="$CORE_LIBS $ngx_feature_libs" + +else + +cat << END + +$0: error: the Google perftools module requires the Google perftools +library. You can either do not enable the module or install the library. + +END + + exit 1 +fi diff --git a/app/nginx/auto/lib/libatomic/conf b/app/nginx/auto/lib/libatomic/conf new file mode 100644 index 0000000..d1e484a --- /dev/null +++ b/app/nginx/auto/lib/libatomic/conf @@ -0,0 +1,43 @@ + +# Copyright (C) Igor Sysoev +# Copyright (C) Nginx, Inc. + + +if [ $NGX_LIBATOMIC != YES ]; then + + have=NGX_HAVE_LIBATOMIC . auto/have + CORE_INCS="$CORE_INCS $NGX_LIBATOMIC/src" + LINK_DEPS="$LINK_DEPS $NGX_LIBATOMIC/src/libatomic_ops.a" + CORE_LIBS="$CORE_LIBS $NGX_LIBATOMIC/src/libatomic_ops.a" + +else + + ngx_feature="atomic_ops library" + ngx_feature_name=NGX_HAVE_LIBATOMIC + ngx_feature_run=yes + ngx_feature_incs="#define AO_REQUIRE_CAS + #include " + ngx_feature_path= + ngx_feature_libs="-latomic_ops" + ngx_feature_test="long n = 0; + if (!AO_compare_and_swap(&n, 0, 1)) + return 1; + if (AO_fetch_and_add(&n, 1) != 1) + return 1; + if (n != 2) + return 1; + AO_nop();" + . auto/feature + + if [ $ngx_found = yes ]; then + CORE_LIBS="$CORE_LIBS $ngx_feature_libs" + else + +cat << END + +$0: error: libatomic_ops library was not found. + +END + exit 1 + fi +fi diff --git a/app/nginx/auto/lib/libatomic/make b/app/nginx/auto/lib/libatomic/make new file mode 100644 index 0000000..c90318e --- /dev/null +++ b/app/nginx/auto/lib/libatomic/make @@ -0,0 +1,16 @@ + +# Copyright (C) Igor Sysoev +# Copyright (C) Nginx, Inc. + + + cat << END >> $NGX_MAKEFILE + +$NGX_LIBATOMIC/src/libatomic_ops.a: $NGX_LIBATOMIC/Makefile + cd $NGX_LIBATOMIC && \$(MAKE) + +$NGX_LIBATOMIC/Makefile: $NGX_MAKEFILE + cd $NGX_LIBATOMIC \\ + && if [ -f Makefile ]; then \$(MAKE) distclean; fi \\ + && ./configure + +END diff --git a/app/nginx/auto/lib/libgd/conf b/app/nginx/auto/lib/libgd/conf new file mode 100644 index 0000000..87761f1 --- /dev/null +++ b/app/nginx/auto/lib/libgd/conf @@ -0,0 +1,93 @@ + +# Copyright (C) Igor Sysoev +# Copyright (C) Nginx, Inc. + + + ngx_feature="GD library" + ngx_feature_name= + ngx_feature_run=no + ngx_feature_incs="#include " + ngx_feature_path= + ngx_feature_libs="-lgd" + ngx_feature_test="gdImagePtr img = gdImageCreateFromGifPtr(1, NULL);" + . auto/feature + + +if [ $ngx_found = no ]; then + + # FreeBSD port + + ngx_feature="GD library in /usr/local/" + ngx_feature_path="/usr/local/include" + + if [ $NGX_RPATH = YES ]; then + ngx_feature_libs="-R/usr/local/lib -L/usr/local/lib -lgd" + else + ngx_feature_libs="-L/usr/local/lib -lgd" + fi + + . auto/feature +fi + + +if [ $ngx_found = no ]; then + + # NetBSD port + + ngx_feature="GD library in /usr/pkg/" + ngx_feature_path="/usr/pkg/include" + + if [ $NGX_RPATH = YES ]; then + ngx_feature_libs="-R/usr/pkg/lib -L/usr/pkg/lib -lgd" + else + ngx_feature_libs="-L/usr/pkg/lib -lgd" + fi + + . auto/feature +fi + + +if [ $ngx_found = no ]; then + + # MacPorts + + ngx_feature="GD library in /opt/local/" + ngx_feature_path="/opt/local/include" + + if [ $NGX_RPATH = YES ]; then + ngx_feature_libs="-R/opt/local/lib -L/opt/local/lib -lgd" + else + ngx_feature_libs="-L/opt/local/lib -lgd" + fi + + . auto/feature +fi + + +if [ $ngx_found = yes ]; then + + CORE_INCS="$CORE_INCS $ngx_feature_path" + + if [ $USE_LIBGD = YES ]; then + CORE_LIBS="$CORE_LIBS $ngx_feature_libs" + fi + + NGX_LIB_LIBGD=$ngx_feature_libs + + ngx_feature="GD WebP support" + ngx_feature_name="NGX_HAVE_GD_WEBP" + ngx_feature_test="gdImagePtr img = gdImageCreateFromWebpPtr(1, NULL);" + . auto/feature + +else + +cat << END + +$0: error: the HTTP image filter module requires the GD library. +You can either do not enable the module or install the libraries. + +END + + exit 1 + +fi diff --git a/app/nginx/auto/lib/libxslt/conf b/app/nginx/auto/lib/libxslt/conf new file mode 100644 index 0000000..3a0f37b --- /dev/null +++ b/app/nginx/auto/lib/libxslt/conf @@ -0,0 +1,165 @@ + +# Copyright (C) Igor Sysoev +# Copyright (C) Nginx, Inc. + + + ngx_feature="libxslt" + ngx_feature_name= + ngx_feature_run=no + ngx_feature_incs="#include + #include + #include + #include + #include + #include " + ngx_feature_path="/usr/include/libxml2" + ngx_feature_libs="-lxml2 -lxslt" + ngx_feature_test="xmlParserCtxtPtr ctxt = NULL; + xsltStylesheetPtr sheet = NULL; + xmlDocPtr doc; + doc = xmlParseChunk(ctxt, NULL, 0, 0); + xsltApplyStylesheet(sheet, doc, NULL);" + . auto/feature + + +if [ $ngx_found = no ]; then + + # FreeBSD port + + ngx_feature="libxslt in /usr/local/" + ngx_feature_path="/usr/local/include/libxml2 /usr/local/include" + + if [ $NGX_RPATH = YES ]; then + ngx_feature_libs="-R/usr/local/lib -L/usr/local/lib -lxml2 -lxslt" + else + ngx_feature_libs="-L/usr/local/lib -lxml2 -lxslt" + fi + + . auto/feature +fi + + +if [ $ngx_found = no ]; then + + # NetBSD port + + ngx_feature="libxslt in /usr/pkg/" + ngx_feature_path="/usr/pkg/include/libxml2 /usr/pkg/include" + + if [ $NGX_RPATH = YES ]; then + ngx_feature_libs="-R/usr/pkg/lib -L/usr/pkg/lib -lxml2 -lxslt" + else + ngx_feature_libs="-L/usr/pkg/lib -lxml2 -lxslt" + fi + + . auto/feature +fi + + +if [ $ngx_found = no ]; then + + # MacPorts + + ngx_feature="libxslt in /opt/local/" + ngx_feature_path="/opt/local/include/libxml2 /opt/local/include" + + if [ $NGX_RPATH = YES ]; then + ngx_feature_libs="-R/opt/local/lib -L/opt/local/lib -lxml2 -lxslt" + else + ngx_feature_libs="-L/opt/local/lib -lxml2 -lxslt" + fi + + . auto/feature +fi + + +if [ $ngx_found = yes ]; then + + CORE_INCS="$CORE_INCS $ngx_feature_path" + + if [ $USE_LIBXSLT = YES ]; then + CORE_LIBS="$CORE_LIBS $ngx_feature_libs" + fi + + NGX_LIB_LIBXSLT=$ngx_feature_libs + +else + +cat << END + +$0: error: the HTTP XSLT module requires the libxml2/libxslt +libraries. You can either do not enable the module or install the libraries. + +END + + exit 1 +fi + + + ngx_feature="libexslt" + ngx_feature_name=NGX_HAVE_EXSLT + ngx_feature_run=no + ngx_feature_incs="#include " + ngx_feature_path="/usr/include/libxml2" + ngx_feature_libs="-lexslt" + ngx_feature_test="exsltRegisterAll();" + . auto/feature + +if [ $ngx_found = no ]; then + + # FreeBSD port + + ngx_feature="libexslt in /usr/local/" + ngx_feature_path="/usr/local/include/libxml2 /usr/local/include" + + if [ $NGX_RPATH = YES ]; then + ngx_feature_libs="-R/usr/local/lib -L/usr/local/lib -lexslt" + else + ngx_feature_libs="-L/usr/local/lib -lexslt" + fi + + . auto/feature +fi + + +if [ $ngx_found = no ]; then + + # NetBSD port + + ngx_feature="libexslt in /usr/pkg/" + ngx_feature_path="/usr/pkg/include/libxml2 /usr/local/include" + + if [ $NGX_RPATH = YES ]; then + ngx_feature_libs="-R/usr/pkg/lib -L/usr/pkg/lib -lexslt" + else + ngx_feature_libs="-L/usr/pkg/lib -lexslt" + fi + + . auto/feature +fi + + +if [ $ngx_found = no ]; then + + # MacPorts + + ngx_feature="libexslt in /opt/local/" + ngx_feature_path="/opt/local/include/libxml2 /opt/local/include" + + if [ $NGX_RPATH = YES ]; then + ngx_feature_libs="-R/opt/local/lib -L/opt/local/lib -lexslt" + else + ngx_feature_libs="-L/opt/local/lib -lexslt" + fi + + . auto/feature +fi + + +if [ $ngx_found = yes ]; then + if [ $USE_LIBXSLT = YES ]; then + CORE_LIBS="$CORE_LIBS -lexslt" + fi + + NGX_LIB_LIBXSLT="$NGX_LIB_LIBXSLT -lexslt" +fi diff --git a/app/nginx/auto/lib/make b/app/nginx/auto/lib/make new file mode 100644 index 0000000..b64e329 --- /dev/null +++ b/app/nginx/auto/lib/make @@ -0,0 +1,24 @@ + +# Copyright (C) Igor Sysoev +# Copyright (C) Nginx, Inc. + + +if [ $PCRE != NONE -a $PCRE != NO -a $PCRE != YES ]; then + . auto/lib/pcre/make +fi + +if [ $OPENSSL != NONE -a $OPENSSL != NO -a $OPENSSL != YES ]; then + . auto/lib/openssl/make +fi + +if [ $ZLIB != NONE -a $ZLIB != NO -a $ZLIB != YES ]; then + . auto/lib/zlib/make +fi + +if [ $NGX_LIBATOMIC != NO -a $NGX_LIBATOMIC != YES ]; then + . auto/lib/libatomic/make +fi + +if [ $USE_PERL != NO ]; then + . auto/lib/perl/make +fi diff --git a/app/nginx/auto/lib/openssl/conf b/app/nginx/auto/lib/openssl/conf new file mode 100644 index 0000000..e7d3795 --- /dev/null +++ b/app/nginx/auto/lib/openssl/conf @@ -0,0 +1,135 @@ + +# Copyright (C) Igor Sysoev +# Copyright (C) Nginx, Inc. + + +if [ $OPENSSL != NONE ]; then + + case "$CC" in + + cl | bcc32) + have=NGX_OPENSSL . auto/have + have=NGX_SSL . auto/have + + CFLAGS="$CFLAGS -DNO_SYS_TYPES_H" + + CORE_INCS="$CORE_INCS $OPENSSL/openssl/include" + CORE_DEPS="$CORE_DEPS $OPENSSL/openssl/include/openssl/ssl.h" + + if [ -f $OPENSSL/ms/do_ms.bat ]; then + # before OpenSSL 1.1.0 + CORE_LIBS="$CORE_LIBS $OPENSSL/openssl/lib/ssleay32.lib" + CORE_LIBS="$CORE_LIBS $OPENSSL/openssl/lib/libeay32.lib" + else + # OpenSSL 1.1.0+ + CORE_LIBS="$CORE_LIBS $OPENSSL/openssl/lib/libssl.lib" + CORE_LIBS="$CORE_LIBS $OPENSSL/openssl/lib/libcrypto.lib" + fi + + # libeay32.lib requires gdi32.lib + CORE_LIBS="$CORE_LIBS gdi32.lib" + # OpenSSL 1.0.0 requires crypt32.lib + CORE_LIBS="$CORE_LIBS crypt32.lib" + ;; + + *) + have=NGX_OPENSSL . auto/have + have=NGX_SSL . auto/have + + CORE_INCS="$CORE_INCS $OPENSSL/.openssl/include" + CORE_DEPS="$CORE_DEPS $OPENSSL/.openssl/include/openssl/ssl.h" + CORE_LIBS="$CORE_LIBS $OPENSSL/.openssl/lib/libssl.a" + CORE_LIBS="$CORE_LIBS $OPENSSL/.openssl/lib/libcrypto.a" + CORE_LIBS="$CORE_LIBS $NGX_LIBDL" + + if [ "$NGX_PLATFORM" = win32 ]; then + CORE_LIBS="$CORE_LIBS -lgdi32 -lcrypt32 -lws2_32" + fi + ;; + esac + +else + + if [ "$NGX_PLATFORM" != win32 ]; then + + OPENSSL=NO + + ngx_feature="OpenSSL library" + ngx_feature_name="NGX_OPENSSL" + ngx_feature_run=no + ngx_feature_incs="#include " + ngx_feature_path= + ngx_feature_libs="-lssl -lcrypto $NGX_LIBDL" + ngx_feature_test="SSL_CTX_set_options(NULL, 0)" + . auto/feature + + if [ $ngx_found = no ]; then + + # FreeBSD port + + ngx_feature="OpenSSL library in /usr/local/" + ngx_feature_path="/usr/local/include" + + if [ $NGX_RPATH = YES ]; then + ngx_feature_libs="-R/usr/local/lib -L/usr/local/lib -lssl -lcrypto $NGX_LIBDL" + else + ngx_feature_libs="-L/usr/local/lib -lssl -lcrypto $NGX_LIBDL" + fi + + . auto/feature + fi + + if [ $ngx_found = no ]; then + + # NetBSD port + + ngx_feature="OpenSSL library in /usr/pkg/" + ngx_feature_path="/usr/pkg/include" + + if [ $NGX_RPATH = YES ]; then + ngx_feature_libs="-R/usr/pkg/lib -L/usr/pkg/lib -lssl -lcrypto $NGX_LIBDL" + else + ngx_feature_libs="-L/usr/pkg/lib -lssl -lcrypto $NGX_LIBDL" + fi + + . auto/feature + fi + + if [ $ngx_found = no ]; then + + # MacPorts + + ngx_feature="OpenSSL library in /opt/local/" + ngx_feature_path="/opt/local/include" + + if [ $NGX_RPATH = YES ]; then + ngx_feature_libs="-R/opt/local/lib -L/opt/local/lib -lssl -lcrypto $NGX_LIBDL" + else + ngx_feature_libs="-L/opt/local/lib -lssl -lcrypto $NGX_LIBDL" + fi + + . auto/feature + fi + + if [ $ngx_found = yes ]; then + have=NGX_SSL . auto/have + CORE_INCS="$CORE_INCS $ngx_feature_path" + CORE_LIBS="$CORE_LIBS $ngx_feature_libs" + OPENSSL=YES + fi + fi + + if [ $OPENSSL != YES ]; then + +cat << END + +$0: error: SSL modules require the OpenSSL library. +You can either do not enable the modules, or install the OpenSSL library +into the system, or build the OpenSSL library statically from the source +with nginx by using --with-openssl= option. + +END + exit 1 + fi + +fi diff --git a/app/nginx/auto/lib/openssl/make b/app/nginx/auto/lib/openssl/make new file mode 100644 index 0000000..a6090c6 --- /dev/null +++ b/app/nginx/auto/lib/openssl/make @@ -0,0 +1,62 @@ + +# Copyright (C) Igor Sysoev +# Copyright (C) Nginx, Inc. + + +case "$CC" in + + cl) + + cat << END >> $NGX_MAKEFILE + +$OPENSSL/openssl/include/openssl/ssl.h: $NGX_MAKEFILE + \$(MAKE) -f auto/lib/openssl/makefile.msvc \ + OPENSSL="$OPENSSL" OPENSSL_OPT="$OPENSSL_OPT" + +END + + ;; + + bcc32) + + ngx_opt=`echo "-DOPENSSL=\"$OPENSSL\" -DOPENSSL_OPT=\"$OPENSSL_OPT\"" \ + | sed -e "s/\//$ngx_regex_dirsep/g"` + + cat << END >> $NGX_MAKEFILE + +`echo "$OPENSSL\\openssl\\lib\\libeay32.lib: \ + $OPENSSL\\openssl\\include\\openssl\\ssl.h" \ + | sed -e "s/\//$ngx_regex_dirsep/g"` + +`echo "$OPENSSL\\openssl\\lib\\ssleay32.lib: \ + $OPENSSL\\openssl\\include\\openssl\\ssl.h" \ + | sed -e "s/\//$ngx_regex_dirsep/g"` + +`echo "$OPENSSL\\openssl\\include\\openssl\\ssl.h: $NGX_MAKEFILE" \ + | sed -e "s/\//$ngx_regex_dirsep/g"` + \$(MAKE) -f auto/lib/openssl/makefile.bcc $ngx_opt + +END + + ;; + + *) + case $OPENSSL in + /*) ngx_prefix="$OPENSSL/.openssl" ;; + *) ngx_prefix="$PWD/$OPENSSL/.openssl" ;; + esac + + cat << END >> $NGX_MAKEFILE + +$OPENSSL/.openssl/include/openssl/ssl.h: $NGX_MAKEFILE + cd $OPENSSL \\ + && if [ -f Makefile ]; then \$(MAKE) clean; fi \\ + && ./config --prefix=$ngx_prefix no-shared $OPENSSL_OPT \\ + && \$(MAKE) \\ + && \$(MAKE) install_sw LIBDIR=lib + +END + + ;; + +esac diff --git a/app/nginx/auto/lib/openssl/makefile.bcc b/app/nginx/auto/lib/openssl/makefile.bcc new file mode 100644 index 0000000..6a94ff7 --- /dev/null +++ b/app/nginx/auto/lib/openssl/makefile.bcc @@ -0,0 +1,18 @@ + +# Copyright (C) Igor Sysoev +# Copyright (C) Nginx, Inc. + + +all: + cd $(OPENSSL) + + perl Configure BC-32 no-shared --prefix=openssl $(OPENSSL_OPT) + + ms\do_nasm + + $(MAKE) -f ms\bcb.mak + $(MAKE) -f ms\bcb.mak install + + # Borland's make does not expand "[ch]" in + # copy "inc32\openssl\*.[ch]" "openssl\include\openssl" + copy inc32\openssl\*.h openssl\include\openssl diff --git a/app/nginx/auto/lib/openssl/makefile.msvc b/app/nginx/auto/lib/openssl/makefile.msvc new file mode 100644 index 0000000..5b90dcb --- /dev/null +++ b/app/nginx/auto/lib/openssl/makefile.msvc @@ -0,0 +1,21 @@ + +# Copyright (C) Igor Sysoev +# Copyright (C) Nginx, Inc. + + +all: + cd $(OPENSSL) + + perl Configure VC-WIN32 no-shared \ + --prefix="%cd%/openssl" \ + --openssldir="%cd%/openssl/ssl" \ + $(OPENSSL_OPT) + + if exist ms\do_ms.bat ( \ + ms\do_ms \ + && $(MAKE) -f ms\nt.mak \ + && $(MAKE) -f ms\nt.mak install \ + ) else ( \ + $(MAKE) \ + && $(MAKE) install_sw \ + ) diff --git a/app/nginx/auto/lib/pcre/conf b/app/nginx/auto/lib/pcre/conf new file mode 100644 index 0000000..5e3960f --- /dev/null +++ b/app/nginx/auto/lib/pcre/conf @@ -0,0 +1,203 @@ + +# Copyright (C) Igor Sysoev +# Copyright (C) Nginx, Inc. + + +if [ $PCRE != NONE ]; then + CORE_INCS="$CORE_INCS $PCRE" + + case "$NGX_CC_NAME" in + + msvc | owc | bcc) + have=NGX_PCRE . auto/have + have=PCRE_STATIC . auto/have + CORE_DEPS="$CORE_DEPS $PCRE/pcre.h" + LINK_DEPS="$LINK_DEPS $PCRE/pcre.lib" + CORE_LIBS="$CORE_LIBS $PCRE/pcre.lib" + ;; + + icc) + have=NGX_PCRE . auto/have + CORE_DEPS="$CORE_DEPS $PCRE/pcre.h" + + LINK_DEPS="$LINK_DEPS $PCRE/.libs/libpcre.a" + + echo $ngx_n "checking for PCRE library ...$ngx_c" + + if [ -f $PCRE/pcre.h ]; then + ngx_pcre_ver=`grep PCRE_MAJOR $PCRE/pcre.h \ + | sed -e 's/^.*PCRE_MAJOR.* \(.*\)$/\1/'` + + else if [ -f $PCRE/configure.in ]; then + ngx_pcre_ver=`grep PCRE_MAJOR= $PCRE/configure.in \ + | sed -e 's/^.*=\(.*\)$/\1/'` + + else + ngx_pcre_ver=`grep pcre_major, $PCRE/configure.ac \ + | sed -e 's/^.*pcre_major,.*\[\(.*\)\].*$/\1/'` + fi + fi + + echo " $ngx_pcre_ver major version found" + + # to allow -ipo optimization we link with the *.o but not library + + case "$ngx_pcre_ver" in + 4|5) + CORE_LIBS="$CORE_LIBS $PCRE/pcre.o" + ;; + + 6) + CORE_LIBS="$CORE_LIBS $PCRE/pcre_chartables.o" + CORE_LIBS="$CORE_LIBS $PCRE/pcre_compile.o" + CORE_LIBS="$CORE_LIBS $PCRE/pcre_exec.o" + CORE_LIBS="$CORE_LIBS $PCRE/pcre_fullinfo.o" + CORE_LIBS="$CORE_LIBS $PCRE/pcre_globals.o" + CORE_LIBS="$CORE_LIBS $PCRE/pcre_tables.o" + CORE_LIBS="$CORE_LIBS $PCRE/pcre_try_flipped.o" + ;; + + *) + CORE_LIBS="$CORE_LIBS $PCRE/pcre_chartables.o" + CORE_LIBS="$CORE_LIBS $PCRE/pcre_compile.o" + CORE_LIBS="$CORE_LIBS $PCRE/pcre_exec.o" + CORE_LIBS="$CORE_LIBS $PCRE/pcre_fullinfo.o" + CORE_LIBS="$CORE_LIBS $PCRE/pcre_globals.o" + CORE_LIBS="$CORE_LIBS $PCRE/pcre_tables.o" + CORE_LIBS="$CORE_LIBS $PCRE/pcre_try_flipped.o" + CORE_LIBS="$CORE_LIBS $PCRE/pcre_newline.o" + ;; + + esac + ;; + + *) + have=NGX_PCRE . auto/have + + if [ "$NGX_PLATFORM" = win32 ]; then + have=PCRE_STATIC . auto/have + fi + + CORE_DEPS="$CORE_DEPS $PCRE/pcre.h" + LINK_DEPS="$LINK_DEPS $PCRE/.libs/libpcre.a" + CORE_LIBS="$CORE_LIBS $PCRE/.libs/libpcre.a" + ;; + + esac + + + if [ $PCRE_JIT = YES ]; then + have=NGX_HAVE_PCRE_JIT . auto/have + PCRE_CONF_OPT="$PCRE_CONF_OPT --enable-jit" + fi + +else + + if [ "$NGX_PLATFORM" != win32 ]; then + + PCRE=NO + + ngx_feature="PCRE library" + ngx_feature_name="NGX_PCRE" + ngx_feature_run=no + ngx_feature_incs="#include " + ngx_feature_path= + ngx_feature_libs="-lpcre" + ngx_feature_test="pcre *re; + re = pcre_compile(NULL, 0, NULL, 0, NULL); + if (re == NULL) return 1" + . auto/feature + + if [ $ngx_found = no ]; then + + # FreeBSD port + + ngx_feature="PCRE library in /usr/local/" + ngx_feature_path="/usr/local/include" + + if [ $NGX_RPATH = YES ]; then + ngx_feature_libs="-R/usr/local/lib -L/usr/local/lib -lpcre" + else + ngx_feature_libs="-L/usr/local/lib -lpcre" + fi + + . auto/feature + fi + + if [ $ngx_found = no ]; then + + # RedHat RPM, Solaris package + + ngx_feature="PCRE library in /usr/include/pcre/" + ngx_feature_path="/usr/include/pcre" + ngx_feature_libs="-lpcre" + + . auto/feature + fi + + if [ $ngx_found = no ]; then + + # NetBSD port + + ngx_feature="PCRE library in /usr/pkg/" + ngx_feature_path="/usr/pkg/include" + + if [ $NGX_RPATH = YES ]; then + ngx_feature_libs="-R/usr/pkg/lib -L/usr/pkg/lib -lpcre" + else + ngx_feature_libs="-L/usr/pkg/lib -lpcre" + fi + + . auto/feature + fi + + if [ $ngx_found = no ]; then + + # MacPorts + + ngx_feature="PCRE library in /opt/local/" + ngx_feature_path="/opt/local/include" + + if [ $NGX_RPATH = YES ]; then + ngx_feature_libs="-R/opt/local/lib -L/opt/local/lib -lpcre" + else + ngx_feature_libs="-L/opt/local/lib -lpcre" + fi + + . auto/feature + fi + + if [ $ngx_found = yes ]; then + CORE_INCS="$CORE_INCS $ngx_feature_path" + CORE_LIBS="$CORE_LIBS $ngx_feature_libs" + PCRE=YES + fi + + if [ $PCRE = YES ]; then + ngx_feature="PCRE JIT support" + ngx_feature_name="NGX_HAVE_PCRE_JIT" + ngx_feature_test="int jit = 0; + pcre_free_study(NULL); + pcre_config(PCRE_CONFIG_JIT, &jit); + if (jit != 1) return 1;" + . auto/feature + + if [ $ngx_found = yes ]; then + PCRE_JIT=YES + fi + fi + fi + + if [ $PCRE != YES ]; then +cat << END + +$0: error: the HTTP rewrite module requires the PCRE library. +You can either disable the module by using --without-http_rewrite_module +option, or install the PCRE library into the system, or build the PCRE library +statically from the source with nginx by using --with-pcre= option. + +END + exit 1 + fi + +fi diff --git a/app/nginx/auto/lib/pcre/make b/app/nginx/auto/lib/pcre/make new file mode 100644 index 0000000..97c9f3b --- /dev/null +++ b/app/nginx/auto/lib/pcre/make @@ -0,0 +1,64 @@ + +# Copyright (C) Igor Sysoev +# Copyright (C) Nginx, Inc. + + +case "$NGX_CC_NAME" in + + msvc) + ngx_makefile=makefile.msvc + ngx_opt="CPU_OPT=\"$CPU_OPT\" LIBC=$LIBC" + ngx_pcre="PCRE=\"$PCRE\"" + ;; + + owc) + ngx_makefile=makefile.owc + ngx_opt="CPU_OPT=\"$CPU_OPT\"" + ngx_pcre=`echo PCRE=\"$PCRE\" | sed -e "s/\//$ngx_regex_dirsep/g"` + ;; + + bcc) + ngx_makefile=makefile.bcc + ngx_opt="-DCPU_OPT=\"$CPU_OPT\"" + ngx_pcre=`echo \-DPCRE=\"$PCRE\" | sed -e "s/\//$ngx_regex_dirsep/g"` + ;; + + *) + ngx_makefile= + ;; + +esac + + +if [ -n "$ngx_makefile" ]; then + + cat << END >> $NGX_MAKEFILE + +`echo "$PCRE/pcre.lib: $PCRE/pcre.h $NGX_MAKEFILE" \ + | sed -e "s/\//$ngx_regex_dirsep/g"` + \$(MAKE) -f auto/lib/pcre/$ngx_makefile $ngx_pcre $ngx_opt + +`echo "$PCRE/pcre.h:" | sed -e "s/\//$ngx_regex_dirsep/g"` + \$(MAKE) -f auto/lib/pcre/$ngx_makefile $ngx_pcre pcre.h + +END + +else + + cat << END >> $NGX_MAKEFILE + +$PCRE/pcre.h: $PCRE/Makefile + +$PCRE/Makefile: $NGX_MAKEFILE + cd $PCRE \\ + && if [ -f Makefile ]; then \$(MAKE) distclean; fi \\ + && CC="\$(CC)" CFLAGS="$PCRE_OPT" \\ + ./configure --disable-shared $PCRE_CONF_OPT + +$PCRE/.libs/libpcre.a: $PCRE/Makefile + cd $PCRE \\ + && \$(MAKE) libpcre.la + +END + +fi diff --git a/app/nginx/auto/lib/pcre/makefile.bcc b/app/nginx/auto/lib/pcre/makefile.bcc new file mode 100644 index 0000000..7a0f2be --- /dev/null +++ b/app/nginx/auto/lib/pcre/makefile.bcc @@ -0,0 +1,27 @@ + +# Copyright (C) Igor Sysoev +# Copyright (C) Nginx, Inc. + + +CFLAGS = -q -O2 -tWM -w-8004 $(CPU_OPT) +PCREFLAGS = -DHAVE_CONFIG_H -DPCRE_STATIC -DPOSIX_MALLOC_THRESHOLD=10 \ + -DSUPPORT_PCRE8 -DHAVE_MEMMOVE + + +pcre.lib: + cd $(PCRE) + + bcc32 -c $(CFLAGS) -I. $(PCREFLAGS) pcre_*.c + + copy /y nul pcre.lst + for %n in (*.obj) do @echo +%n ^^& >> pcre.lst + echo + >> pcre.lst + + tlib pcre.lib @pcre.lst + +pcre.h: + cd $(PCRE) + + copy /y pcre.h.generic pcre.h + copy /y config.h.generic config.h + copy /y pcre_chartables.c.dist pcre_chartables.c diff --git a/app/nginx/auto/lib/pcre/makefile.msvc b/app/nginx/auto/lib/pcre/makefile.msvc new file mode 100644 index 0000000..07fd9a2 --- /dev/null +++ b/app/nginx/auto/lib/pcre/makefile.msvc @@ -0,0 +1,23 @@ + +# Copyright (C) Igor Sysoev +# Copyright (C) Nginx, Inc. + + +CFLAGS = -O2 -Ob1 -Oi -Gs $(LIBC) $(CPU_OPT) +PCREFLAGS = -DHAVE_CONFIG_H -DPCRE_STATIC -DPOSIX_MALLOC_THRESHOLD=10 \ + -DSUPPORT_PCRE8 -DHAVE_MEMMOVE + + +pcre.lib: + cd $(PCRE) + + cl -nologo -c $(CFLAGS) -I . $(PCREFLAGS) pcre_*.c + + link -lib -out:pcre.lib -verbose:lib pcre_*.obj + +pcre.h: + cd $(PCRE) + + copy /y pcre.h.generic pcre.h + copy /y config.h.generic config.h + copy /y pcre_chartables.c.dist pcre_chartables.c diff --git a/app/nginx/auto/lib/pcre/makefile.owc b/app/nginx/auto/lib/pcre/makefile.owc new file mode 100644 index 0000000..122fd5b --- /dev/null +++ b/app/nginx/auto/lib/pcre/makefile.owc @@ -0,0 +1,25 @@ + +# Copyright (C) Igor Sysoev +# Copyright (C) Nginx, Inc. + + +CFLAGS = -c -zq -bt=nt -ot -op -oi -oe -s -bm $(CPU_OPT) +PCREFLAGS = -DHAVE_CONFIG_H -DPCRE_STATIC -DPOSIX_MALLOC_THRESHOLD=10 & + -DSUPPORT_PCRE8 -DHAVE_MEMMOVE + + +pcre.lib: + cd $(PCRE) + + wcl386 $(CFLAGS) -i=. $(PCREFLAGS) pcre_*.c + + dir /b *.obj > pcre.lst + + wlib -n pcre.lib @pcre.lst + +pcre.h: + cd $(PCRE) + + copy /y pcre.h.generic pcre.h + copy /y config.h.generic config.h + copy /y pcre_chartables.c.dist pcre_chartables.c diff --git a/app/nginx/auto/lib/perl/conf b/app/nginx/auto/lib/perl/conf new file mode 100644 index 0000000..e16a1bc --- /dev/null +++ b/app/nginx/auto/lib/perl/conf @@ -0,0 +1,83 @@ + +# Copyright (C) Igor Sysoev +# Copyright (C) Nginx, Inc. + + +echo "checking for perl" + + +NGX_PERL_VER=`$NGX_PERL -v 2>&1 | grep '^This is perl' 2>&1 \ + | sed -e 's/^This is perl, \(.*\)/\1/'` + +if test -n "$NGX_PERL_VER"; then + echo " + perl version: $NGX_PERL_VER" + + if [ "`$NGX_PERL -e 'use 5.008006; print "OK"'`" != "OK" ]; then + echo + echo "$0: error: perl 5.8.6 or higher is required" + echo + + exit 1; + fi + + if [ "`$NGX_PERL -MExtUtils::Embed -e 'print "OK"'`" != "OK" ]; then + echo + echo "$0: error: perl module ExtUtils::Embed is required" + echo + + exit 1; + fi + + NGX_PM_CFLAGS=`$NGX_PERL -MExtUtils::Embed -e ccopts` + NGX_PM_LDFLAGS=`$NGX_PERL -MConfig -e 'print $Config{lddlflags}'` + + NGX_PERL_CFLAGS="$CFLAGS `$NGX_PERL -MExtUtils::Embed -e ccopts`" + + # gcc 4.1/4.2 warn about unused values in pTHX_ + NGX_PERL_CFLAGS=`echo $NGX_PERL_CFLAGS \ + | sed -e 's/-Wunused-value/-Wno-unused-value/'` + # icc8 warns 'declaration hides parameter "my_perl"' in ENTER and LEAVE + NGX_PERL_CFLAGS=`echo $NGX_PERL_CFLAGS \ + | sed -e 's/-wd171/-wd171 -wd1599/'` + + ngx_perl_ldopts=`$NGX_PERL -MExtUtils::Embed -e ldopts` + + ngx_perl_dlext=`$NGX_PERL -MConfig -e 'print $Config{dlext}'` + ngx_perl_libdir="src/http/modules/perl/blib/arch/auto" + ngx_perl_module="$ngx_perl_libdir/nginx/nginx.$ngx_perl_dlext" + + if $NGX_PERL -V:usemultiplicity | grep define > /dev/null; then + have=NGX_HAVE_PERL_MULTIPLICITY . auto/have + echo " + perl interpreter multiplicity found" + fi + + if $NGX_PERL -V:useithreads | grep undef > /dev/null; then + # FreeBSD port wants to link with -pthread non-threaded perl + ngx_perl_ldopts=`echo $ngx_perl_ldopts | sed 's/ -pthread//'` + fi + + if [ "$NGX_SYSTEM" = "Darwin" ]; then + # OS X system perl wants to link universal binaries + ngx_perl_ldopts=`echo $ngx_perl_ldopts \ + | sed -e 's/-arch i386//' -e 's/-arch x86_64//'` + fi + + if [ $USE_PERL = YES ]; then + CORE_LINK="$CORE_LINK $ngx_perl_ldopts" + fi + + NGX_LIB_PERL="$ngx_perl_ldopts" + + if test -n "$NGX_PERL_MODULES"; then + have=NGX_PERL_MODULES value="(u_char *) \"$NGX_PERL_MODULES\"" + . auto/define + NGX_PERL_MODULES_MAN=$NGX_PERL_MODULES/man3 + fi + +else + echo + echo "$0: error: perl 5.8.6 or higher is required" + echo + + exit 1; +fi diff --git a/app/nginx/auto/lib/perl/make b/app/nginx/auto/lib/perl/make new file mode 100644 index 0000000..74e0f3a --- /dev/null +++ b/app/nginx/auto/lib/perl/make @@ -0,0 +1,46 @@ + +# Copyright (C) Igor Sysoev +# Copyright (C) Nginx, Inc. + + +cat << END >> $NGX_MAKEFILE + +$NGX_OBJS/src/http/modules/perl/ngx_http_perl_module.o: \\ + $NGX_OBJS/$ngx_perl_module + +$NGX_OBJS/$ngx_perl_module: \\ + \$(CORE_DEPS) \$(HTTP_DEPS) \\ + src/http/modules/perl/ngx_http_perl_module.h \\ + $NGX_OBJS/src/http/modules/perl/Makefile + cd $NGX_OBJS/src/http/modules/perl && \$(MAKE) + + rm -rf $NGX_OBJS/install_perl + + +$NGX_OBJS/src/http/modules/perl/Makefile: \\ + $NGX_AUTO_CONFIG_H \\ + src/core/nginx.h \\ + src/http/modules/perl/Makefile.PL \\ + src/http/modules/perl/nginx.pm \\ + src/http/modules/perl/nginx.xs \\ + src/http/modules/perl/typemap + grep 'define NGINX_VERSION' src/core/nginx.h \\ + | sed -e 's/^.*"\(.*\)".*/\1/' > \\ + $NGX_OBJS/src/http/modules/perl/version + sed "s/%%VERSION%%/\`cat $NGX_OBJS/src/http/modules/perl/version\`/" \\ + src/http/modules/perl/nginx.pm > \\ + $NGX_OBJS/src/http/modules/perl/nginx.pm + cp -p src/http/modules/perl/nginx.xs $NGX_OBJS/src/http/modules/perl/ + cp -p src/http/modules/perl/typemap $NGX_OBJS/src/http/modules/perl/ + cp -p src/http/modules/perl/Makefile.PL $NGX_OBJS/src/http/modules/perl/ + + cd $NGX_OBJS/src/http/modules/perl \\ + && NGX_PM_CFLAGS="\$(NGX_PM_CFLAGS) -g $NGX_CC_OPT" \\ + NGX_PM_LDFLAGS="$NGX_LD_OPT \$(NGX_PM_LDFLAGS)" \\ + NGX_INCS="$CORE_INCS $NGX_OBJS $HTTP_INCS" \\ + NGX_DEPS="\$(CORE_DEPS) \$(HTTP_DEPS)" \\ + $NGX_PERL Makefile.PL \\ + LIB=$NGX_PERL_MODULES \\ + INSTALLSITEMAN3DIR=$NGX_PERL_MODULES_MAN + +END diff --git a/app/nginx/auto/lib/zlib/conf b/app/nginx/auto/lib/zlib/conf new file mode 100644 index 0000000..239592e --- /dev/null +++ b/app/nginx/auto/lib/zlib/conf @@ -0,0 +1,79 @@ + +# Copyright (C) Igor Sysoev +# Copyright (C) Nginx, Inc. + + +if [ $ZLIB != NONE ]; then + CORE_INCS="$CORE_INCS $ZLIB" + + case "$NGX_CC_NAME" in + + msvc | owc | bcc) + have=NGX_ZLIB . auto/have + LINK_DEPS="$LINK_DEPS $ZLIB/zlib.lib" + CORE_LIBS="$CORE_LIBS $ZLIB/zlib.lib" + ;; + + icc) + have=NGX_ZLIB . auto/have + LINK_DEPS="$LINK_DEPS $ZLIB/libz.a" + + # to allow -ipo optimization we link with the *.o but not library + CORE_LIBS="$CORE_LIBS $ZLIB/adler32.o" + CORE_LIBS="$CORE_LIBS $ZLIB/crc32.o" + CORE_LIBS="$CORE_LIBS $ZLIB/deflate.o" + CORE_LIBS="$CORE_LIBS $ZLIB/trees.o" + CORE_LIBS="$CORE_LIBS $ZLIB/zutil.o" + CORE_LIBS="$CORE_LIBS $ZLIB/compress.o" + + if [ $ZLIB_ASM != NO ]; then + CORE_LIBS="$CORE_LIBS $ZLIB/match.o" + fi + ;; + + *) + have=NGX_ZLIB . auto/have + LINK_DEPS="$LINK_DEPS $ZLIB/libz.a" + CORE_LIBS="$CORE_LIBS $ZLIB/libz.a" + #CORE_LIBS="$CORE_LIBS -L $ZLIB -lz" + ;; + + esac + +else + + if [ "$NGX_PLATFORM" != win32 ]; then + ZLIB=NO + + # FreeBSD, Solaris, Linux + + ngx_feature="zlib library" + ngx_feature_name="NGX_ZLIB" + ngx_feature_run=no + ngx_feature_incs="#include " + ngx_feature_path= + ngx_feature_libs="-lz" + ngx_feature_test="z_stream z; deflate(&z, Z_NO_FLUSH)" + . auto/feature + + + if [ $ngx_found = yes ]; then + CORE_LIBS="$CORE_LIBS $ngx_feature_libs" + ZLIB=YES + ngx_found=no + fi + fi + + if [ $ZLIB != YES ]; then +cat << END + +$0: error: the HTTP gzip module requires the zlib library. +You can either disable the module by using --without-http_gzip_module +option, or install the zlib library into the system, or build the zlib library +statically from the source with nginx by using --with-zlib= option. + +END + exit 1 + fi + +fi diff --git a/app/nginx/auto/lib/zlib/make b/app/nginx/auto/lib/zlib/make new file mode 100644 index 0000000..0082ad5 --- /dev/null +++ b/app/nginx/auto/lib/zlib/make @@ -0,0 +1,135 @@ + +# Copyright (C) Igor Sysoev +# Copyright (C) Nginx, Inc. + + +case "$NGX_CC_NAME" in + + msvc) + ngx_makefile=makefile.msvc + ngx_opt="CPU_OPT=\"$CPU_OPT\" LIBC=$LIBC" + ngx_zlib="ZLIB=\"$ZLIB\"" + + ;; + + owc) + ngx_makefile=makefile.owc + ngx_opt="CPU_OPT=\"$CPU_OPT\"" + ngx_zlib=`echo ZLIB=\"$ZLIB\" | sed -e "s/\//$ngx_regex_dirsep/g"` + ;; + + bcc) + ngx_makefile=makefile.bcc + ngx_opt="-DCPU_OPT=\"$CPU_OPT\"" + ngx_zlib=`echo \-DZLIB=\"$ZLIB\" | sed -e "s/\//$ngx_regex_dirsep/g"` + ;; + + *) + ngx_makefile= + ;; + +esac + + +done=NO + + +case "$NGX_PLATFORM" in + + win32) + + if [ -n "$ngx_makefile" ]; then + cat << END >> $NGX_MAKEFILE + +`echo "$ZLIB/zlib.lib: $NGX_MAKEFILE" | sed -e "s/\//$ngx_regex_dirsep/g"` + \$(MAKE) -f auto/lib/zlib/$ngx_makefile $ngx_opt $ngx_zlib + +END + + else + + cat << END >> $NGX_MAKEFILE + +$ZLIB/libz.a: $NGX_MAKEFILE + cd $ZLIB \\ + && \$(MAKE) distclean \\ + && \$(MAKE) -f win32/Makefile.gcc \\ + CFLAGS="$ZLIB_OPT" CC="\$(CC)" \\ + libz.a + +END + + fi + + done=YES + ;; + + # FreeBSD: i386 + # Linux: i686 + + *:i386 | *:i686) + case $ZLIB_ASM in + pentium) + + cat << END >> $NGX_MAKEFILE + +$ZLIB/libz.a: $NGX_MAKEFILE + cd $ZLIB \\ + && \$(MAKE) distclean \\ + && cp contrib/asm586/match.S . \\ + && CFLAGS="$ZLIB_OPT -DASMV" CC="\$(CC)" \\ + ./configure \\ + && \$(MAKE) OBJA=match.o libz.a + +END + + done=YES + ;; + + pentiumpro) + + cat << END >> $NGX_MAKEFILE + +$ZLIB/libz.a: $NGX_MAKEFILE + cd $ZLIB \\ + && \$(MAKE) distclean \\ + && cp contrib/asm686/match.S . \\ + && CFLAGS="$ZLIB_OPT -DASMV" CC="\$(CC)" \\ + ./configure \\ + && \$(MAKE) OBJA=match.o libz.a + +END + + done=YES + ;; + + NO) + ;; + + *) + echo "$0: error: invalid --with-zlib-asm=$ZLIB_ASM option." + echo "The valid values are \"pentium\" and \"pentiumpro\" only". + echo + + exit 1; + ;; + esac + ;; + +esac + + +if [ $done = NO ]; then + + cat << END >> $NGX_MAKEFILE + +$ZLIB/libz.a: $NGX_MAKEFILE + cd $ZLIB \\ + && \$(MAKE) distclean \\ + && CFLAGS="$ZLIB_OPT" CC="\$(CC)" \\ + ./configure \\ + && \$(MAKE) libz.a + +END + +fi diff --git a/app/nginx/auto/lib/zlib/makefile.bcc b/app/nginx/auto/lib/zlib/makefile.bcc new file mode 100644 index 0000000..97a30ea --- /dev/null +++ b/app/nginx/auto/lib/zlib/makefile.bcc @@ -0,0 +1,17 @@ + +# Copyright (C) Igor Sysoev +# Copyright (C) Nginx, Inc. + + +CFLAGS = -q -O2 -tWM -w-8004 -w-8012 $(CPU_OPT) + +zlib.lib: + cd $(ZLIB) + + bcc32 -c $(CFLAGS) adler32.c crc32.c deflate.c \ + trees.c zutil.c compress.c \ + inflate.c inffast.c inftrees.c + + tlib zlib.lib +adler32.obj +crc32.obj +deflate.obj \ + +trees.obj +zutil.obj +compress.obj \ + +inflate.obj +inffast.obj +inftrees.obj diff --git a/app/nginx/auto/lib/zlib/makefile.msvc b/app/nginx/auto/lib/zlib/makefile.msvc new file mode 100644 index 0000000..6fbd691 --- /dev/null +++ b/app/nginx/auto/lib/zlib/makefile.msvc @@ -0,0 +1,17 @@ + +# Copyright (C) Igor Sysoev +# Copyright (C) Nginx, Inc. + + +CFLAGS = -nologo -O2 -Ob1 -Oi -Gs $(LIBC) $(CPU_OPT) + +zlib.lib: + cd $(ZLIB) + + cl -c $(CFLAGS) adler32.c crc32.c deflate.c \ + trees.c zutil.c compress.c \ + inflate.c inffast.c inftrees.c + + link -lib -out:zlib.lib adler32.obj crc32.obj deflate.obj \ + trees.obj zutil.obj compress.obj \ + inflate.obj inffast.obj inftrees.obj diff --git a/app/nginx/auto/lib/zlib/makefile.owc b/app/nginx/auto/lib/zlib/makefile.owc new file mode 100644 index 0000000..9e123be --- /dev/null +++ b/app/nginx/auto/lib/zlib/makefile.owc @@ -0,0 +1,14 @@ + +# Copyright (C) Igor Sysoev +# Copyright (C) Nginx, Inc. + + +CFLAGS = -zq -bt=nt -ot -op -oi -oe -s -bm $(CPU_OPT) + +zlib.lib: + cd $(ZLIB) + + wcl386 -c $(CFLAGS) adler32.c crc32.c deflate.c trees.c zutil.c & + compress.c inflate.c inffast.c inftrees.c + wlib -n zlib.lib adler32.obj crc32.obj deflate.obj trees.obj & + zutil.obj compress.obj inflate.obj inffast.obj inftrees.obj -- cgit 1.2.3-korg