Improve threadutil

Remove "dereference NULL return" errors and implicit conversions to
double or enum types.
(cherry picked from commit 77c73884b81c887e24c2069d9528706c6caf3235)
Optimisation of --disable-webserver

Do not compile webserver.c if --disable-webserver is used.
(cherry picked from commit 7aef73d7eb0206db0d07744ef258f7d04e206f0e)
More compilaton optimisation

Do not compile most of service_table.c and client_table.c if
--disable-gena is used.
Do not compile urlconfig.c if --disable-webserver is used.
Adding new UPNP_HAVE_xxx variables in upnpconfig.h and upnpconfig.h.in.

(forward port of commit bb140000c042b670211d5113bc54dd4e50e93c0e)
fix missing assignment in commit e722d8c375dc50b855b41cd56e2fc3d70af4201e
(cherry picked from commit 18bf3b1c9c33fe3885d798a017af5892a0ff5cc2)
Synchronize autoconfig.h with upnpconfig.h.

It fixes WIN32 build where configure is not invoked.
(cherry picked from commit a54d6e7e835e600805fd8a23c139c1b2dc905dde)
Fix buffer size for strncpy in UpnpAddVirtualDir()

Since 1st argument precedes the beginning of the buffer,
it is necessary to reduce the value of 3rd argument.
(cherry picked from commit b78eaf4e4374684847c4b5e1d62cb5a0a2541d9a)
Handle allocation error in strndup to avoid access violation.

Return NULL before calling strncpy.
Platforms with HAVE_STRNDUP are not affected.
(cherry picked from commit 194397b6d62b0a9910075ec07ecb77df6929abc8)
Add assertion and narrow variable scope in resolve_rel_url().

I've confirmed enough buffer is allocated for output.
(cherry picked from commit 87d1d3c3ec1c5609bd004c48c69c4a7349563230)
Do not clear buffer before snprintf.

It had no effect since snprintf can overwrite whole buffer.
(cherry picked from commit a0dc3482dc17e19a7b89bff27c3801405b5a4a64)
Treat large argument as error in UpnpAddVirtualDir.
(cherry picked from commit e4678168fa8564e788293ef764dc3265f89484bc)
For inet_ntop, use buffer with size INET6_ADDRSTRLEN or INET_ADDRSTRLEN.
(cherry picked from commit bd7f83feb549cb85d18763b45f580c8bdce253dd)
Clarify the last argument of GetDescDocumentAndURL has size LINE_SIZE.
(cherry picked from commit 19a23dafbad2e3354219c852e0e34bed08139623)
Detect overflow in CreateClientRequestPacket(UlaGua).

Pass output buffer size to CreateClientRequestPacket(UlaGua)
from SearchByTarget and detect overflow.
Handle SearchByTarget error in UpnpSearchAsync.
(cherry picked from commit ff635f92c08cf8f7ebca973450bd79feacb2e0b1)
Detect overflow in addrToString called from configure_urlbase.

Pass output buffer size to addrToString and detect overflow.
Handle addrToString error in configure_urlbase.
(cherry picked from commit 56b44fee914738eb9e8bddc5fce768e2dbc4db12)
Handle overflow in http_SendMessage.
(cherry picked from commit d952ebfb4448ae9052b4dac859bb2cfcd20ad915)
Respect unique_service_name error in ssdp_request_type.

Respect unique_service_name error in ssdp_request_type
so as not to touch non-terminated buffer under Evt.
(cherry picked from commit 5944960e172a797a9fcc196291f4046cafa7f6ec)
Use strncpy with the standard way in readFromSSDPSocket.
(cherry picked from commit 04e5767ea0d5a8e1c02fa1c5a3a7e66a599cae40)
Exclude IPv6 stuff in SearchByTarget when UPNP_ENABLE_IPV6 is not defined.
(cherry picked from commit 41412c16ef23fc63abbfc83cca8d4a901035ef91)
Improve ixml

Remove "implicit integer conversions" and
"dereference NULL return value" errors in ixml part.
(cherry picked from commit 06660b6383c438e4e2c9ca9854077cecc4da9e5d)
Remove lock in ThreadPoolInit

If ThreadPoolInit returned EAGAIN, tp->lock was not freed.
(cherry picked from commit d45f3c28cfb9e1fe167bea66ef0fdd0d0b218bb3)