From 725c58638f5d1921ad5d4a39274edb81bc5b47e6 Mon Sep 17 00:00:00 2001
From: 99999 <PeterTonoli@users.noreply.github.com>
Date: Sat, 30 Apr 2016 23:56:19 +1000
Subject: [PATCH] nginx-upstream-fair can now be compiled as a dynamic module
Origin: other, https://github.com/gnosek/nginx-upstream-fair/pull/21

---
 config | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/config b/config
index ff351b7..d8d478b 100644
--- a/config
+++ b/config
@@ -1,3 +1,12 @@
 ngx_addon_name=ngx_http_upstream_fair_module
-HTTP_MODULES="$HTTP_MODULES ngx_http_upstream_fair_module"
-NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_addon_dir/ngx_http_upstream_fair_module.c"
+
+if test -n "$ngx_module_link"; then
+    ngx_module_type=HTTP
+    ngx_module_name=ngx_http_upstream_fair_module
+    ngx_module_srcs="$ngx_addon_dir/ngx_http_upstream_fair_module.c"
+
+    . auto/module
+else
+    HTTP_MODULES="$HTTP_MODULES ngx_http_upstream_fair_module"
+    NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_addon_dir/ngx_http_upstream_fair_module.c"
+fi
