Sfoglia il codice sorgente

Document some preprocessor defines

bel2125 7 anni fa
parent
commit
71a9d0e731
3 ha cambiato i file con 49 aggiunte e 51 eliminazioni
  1. 44 46
      docs/Building.md
  2. 3 3
      resources/check_defines.lua
  3. 2 2
      src/civetweb.c

+ 44 - 46
docs/Building.md

@@ -83,29 +83,26 @@ make build WITH_LUA=1
 ```
 
 
-| Make Options              | Description                               |
-| ------------------------- | ----------------------------------------- |
-| WITH_LUA=1                | build with Lua support                    |
-| WITH_DUKTAPE=1            | build with server-side JavaScript support |
-| WITH_IPV6=1               | with IPV6 support                         |
-| WITH_WEBSOCKET=1          | build with web socket support             |
-| WITH_SERVER_STATS=1       | build with support for server statistics  |
-| WITH_EXPERIMENTAL=1       | include experimental features (depending  |
-|                           | on the version)                           |
-| WITH_ALL=1                | Include all of the above features         |
-|                           |                                           |
-| WITH_DEBUG=1              | build with GDB debug support              |
-| WITH_CPP=1                | build libraries with c++ classes          |
-| CONFIG_FILE=file          | use 'file' as the config file             |
-| CONFIG_FILE2=file         | use 'file' as the backup config file      |
-| HTMLDIR=/path             | place to install initial web pages        |
-| DOCUMENT_ROOT=/path       | HTMLDIR override, config option, install  |
-|                           | nothing is installed here.                |
-| PORTS=8080                | listening ports override when installing  |
-| SSL_LIB=libssl.so.0       | use versioned SSL library                 |
-| CRYPTO_LIB=libcrypto.so.0 | system versioned CRYPTO library           |
-| PREFIX=/usr/local         | sets the install directory                |
-| COPT='-DNO_SSL'           | method to insert compile flags            |
+| Make Options                | Description                                       |
+| --------------------------- | ------------------------------------------------- |
+| `WITH_LUA=1`                | build with Lua support                            |
+| `WITH_DUKTAPE=1`            | build with server-side JavaScript support         |
+| `WITH_IPV6=1`               | with IPV6 support                                 |
+| `WITH_WEBSOCKET=1`          | build with web socket support                     |
+| `WITH_SERVER_STATS=1`       | build with support for server statistics          |
+| `WITH_EXPERIMENTAL=1`       | include experimental features (version depending) |
+| `WITH_ALL=1`                | Include all of the above features                 |
+| `WITH_DEBUG=1`              | build with GDB debug support                      |
+| `WITH_CPP=1`                | build libraries with c++ classes                  |
+| `CONFIG_FILE=file`          | use 'file' as the config file                     |
+| `CONFIG_FILE2=file`         | use 'file' as the backup config file              |
+| `HTMLDIR=/path`             | place to install initial web pages                |
+| `DOCUMENT_ROOT=/path`       | default document root                             |
+| `PORTS=8080`                | listening ports override when installing          |
+| `SSL_LIB=libssl.so.0`       | use versioned SSL library                         |
+| `CRYPTO_LIB=libcrypto.so.0` | system versioned CRYPTO library                   |
+| `PREFIX=/usr/local`         | sets the install directory                        |
+| `COPT='-DNO_SSL'`           | method to insert compile flags                    |
 
 Note that the WITH_* options used for *make* are not identical to the
 preprocessor defines in the source code - usually USE_* is used there.
@@ -146,29 +143,30 @@ Compile flags can be set using the *COPT* make option like so.
 make build COPT="-DNDEBUG -DNO_CGI"
 ```
 
-| Compile Flags              | Description                          |
-| -------------------------- | ------------------------------------ |
-| NDEBUG                     | strip off all debug code             |
-| DEBUG                      | build debug version (very noisy)     |
-|                            |                                      |
-| NO_FILES                   | do not serve files from a directory  |
-| NO_SSL                     | disable SSL functionality            |
-| NO_CGI                     | disable CGI support                  |
-| NO_CACHING                 | disable caching functionality        |
-|                            |                                      |
-| USE_IPV6                   | enable IPv6 support                  |
-| USE_WEBSOCKET              | enable websocket support             |
-| USE_LUA                    | enable Lua support                   |
-| USE_DUKTAPE                | enable server-side JavaScript        |
-|                            | support by including Duktape         |
-| USE_SERVER_STATS           | enable server statistics support     |
-| USE_ZLIB                   | enable on-the-fly compression of     |
-|                            | static content by including zlib     |
-| MG_EXPERIMENTAL_INTERFACES | include experimental interfaces      |
-|                            |                                      |
-| NO_SSL_DL                  | link against system libssl library   |
-| SQLITE_DISABLE_LFS         | disables large files (Lua only)      |
-| SSL_ALREADY_INITIALIZED    | do not initialize libcrypto          |
+| Compile Flags                | Description                                               |
+| ---------------------------- | --------------------------------------------------------- |
+| `NDEBUG`                     | strip off all debug code                                  |
+| `DEBUG`                      | build debug version (very noisy)                          |
+|                              |                                                           |
+| `NO_FILES`                   | do not serve files from a directory                       |
+| `NO_SSL`                     | disable SSL functionality                                 |
+| `NO_CGI`                     | disable CGI support                                       |
+| `NO_CACHING`                 | disable caching functionality                             |
+|                              |                                                           |
+| `USE_IPV6`                   | enable IPv6 support                                       |
+| `USE_WEBSOCKET`              | enable websocket support                                  |
+| `USE_LUA`                    | enable Lua support                                        |
+| `USE_DUKTAPE`                | enable server-side JavaScript (using Duktape library)     |
+| `USE_SERVER_STATS`           | enable server statistics support                          |
+| `USE_ZLIB`                   | enable on-the-fly compression of files (using zlib)       |
+| `MG_EXPERIMENTAL_INTERFACES` | include experimental interfaces                           |
+| `MG_LEGACY_INTERFACE`        | include obsolete interfaces (candidates for deletion)     |
+|                              |                                                           |
+| `NO_SSL_DL`                  | link against system libssl library                        |
+| `SQLITE_DISABLE_LFS`         | disables large files (Lua only)                           |
+| `SSL_ALREADY_INITIALIZED`    | do not initialize libcrypto                               |
+| `OPENSSL_API_1_1`            | Use OpenSSL V1.1.x interface                              |
+
 
 Note: If `make` is used (with this [Makefile](https://github.com/civetweb/civetweb/blob/master/Makefile)), you should not pass the `USE_<feature>` flags using `COPT`, but use the `WITH_<feature>` syntax above, since additional features may also use additional source code files.
 

+ 3 - 3
resources/check_defines.lua

@@ -47,11 +47,11 @@ function noifdef(f)
   end
 
   if changed then
-    local f = io.open(f, "w")
+    local fi = io.open(f, "w")
     for _,l in pairs(out) do
-      f:write(l .. "\n")
+      fi:write(l .. "\n")
     end
-    f:close()   
+    fi:close()   
     print(f .. " rewritten")
   end
 

+ 2 - 2
src/civetweb.c

@@ -1746,7 +1746,7 @@ typedef struct SSL_CTX SSL_CTX;
 
 #if (OPENSSL_VERSION_NUMBER >= 0x10100000L)
 /* If OpenSSL headers are included, automatically select the API version */
-#ifndef OPENSSL_API_1_1
+#if !defined(OPENSSL_API_1_1)
 #define OPENSSL_API_1_1
 #endif
 #endif
@@ -5559,7 +5559,7 @@ kill(pid_t pid, int sig_num)
 }
 
 
-#ifndef WNOHANG
+#if !defined(WNOHANG)
 #define WNOHANG (1)
 #endif