aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/inet.c4
-rw-r--r--src/inet.h7
-rw-r--r--src/makefile39
3 files changed, 26 insertions, 24 deletions
diff --git a/src/inet.c b/src/inet.c
index 5bc6364..51e8cfe 100644
--- a/src/inet.c
+++ b/src/inet.c
@@ -502,7 +502,7 @@ const char *inet_trybind(p_socket ps, const char *address, const char *serv,
502* Some systems do not provide this so that we provide our own. It's not 502* Some systems do not provide this so that we provide our own. It's not
503* marvelously fast, but it works just fine. 503* marvelously fast, but it works just fine.
504\*-------------------------------------------------------------------------*/ 504\*-------------------------------------------------------------------------*/
505#ifdef INET_ATON 505#ifdef LUASOCKET_INET_ATON
506int inet_aton(const char *cp, struct in_addr *inp) 506int inet_aton(const char *cp, struct in_addr *inp)
507{ 507{
508 unsigned int a = 0, b = 0, c = 0, d = 0; 508 unsigned int a = 0, b = 0, c = 0, d = 0;
@@ -529,7 +529,7 @@ int inet_aton(const char *cp, struct in_addr *inp)
529* http://mingw-users.1079350.n2.nabble.com/IPv6-getaddrinfo-amp-inet-ntop-td5891996.html 529* http://mingw-users.1079350.n2.nabble.com/IPv6-getaddrinfo-amp-inet-ntop-td5891996.html
530\*-------------------------------------------------------------------------*/ 530\*-------------------------------------------------------------------------*/
531 531
532#ifdef INET_PTON 532#ifdef LUASOCKET_INET_PTON
533const char *inet_ntop(int af, const void *src, char *dst, socklen_t cnt) 533const char *inet_ntop(int af, const void *src, char *dst, socklen_t cnt)
534{ 534{
535 if (af == AF_INET) { 535 if (af == AF_INET) {
diff --git a/src/inet.h b/src/inet.h
index 252e293..1f1a96a 100644
--- a/src/inet.h
+++ b/src/inet.h
@@ -19,8 +19,7 @@
19#include "timeout.h" 19#include "timeout.h"
20 20
21#ifdef _WIN32 21#ifdef _WIN32
22#define INET_ATON 22#define LUASOCKET_INET_ATON
23#define INET_PTON
24#endif 23#endif
25 24
26int inet_open(lua_State *L); 25int inet_open(lua_State *L);
@@ -39,11 +38,11 @@ int inet_meth_getsockname(lua_State *L, p_socket ps, int family);
39int inet_optfamily(lua_State* L, int narg, const char* def); 38int inet_optfamily(lua_State* L, int narg, const char* def);
40int inet_optsocktype(lua_State* L, int narg, const char* def); 39int inet_optsocktype(lua_State* L, int narg, const char* def);
41 40
42#ifdef INET_ATON 41#ifdef LUASOCKET_INET_ATON
43int inet_aton(const char *cp, struct in_addr *inp); 42int inet_aton(const char *cp, struct in_addr *inp);
44#endif 43#endif
45 44
46#ifdef INET_PTON 45#ifdef LUASOCKET_INET_PTON
47const char *inet_ntop(int af, const void *src, char *dst, socklen_t cnt); 46const char *inet_ntop(int af, const void *src, char *dst, socklen_t cnt);
48int inet_pton(int af, const char *src, void *dst); 47int inet_pton(int af, const char *src, void *dst);
49#endif 48#endif
diff --git a/src/makefile b/src/makefile
index fbb26a0..c44f4ef 100644
--- a/src/makefile
+++ b/src/makefile
@@ -63,12 +63,13 @@ LDIR_mingw?=lua/$(LUAV)/lua
63# LUAINC_win32: 63# LUAINC_win32:
64# LUALIB_win32: 64# LUALIB_win32:
65# where lua headers and libraries are found for win32 builds 65# where lua headers and libraries are found for win32 builds
66LUAINC_win32?="../../lua-5.1.3/src" 66LUAINC_win32_base?=
67LUALIB_win32?=/LIBPATH:"../../lua-5.1.3" lua$(LUAV).lib 67LUAINC_win32?=$(LUAINC_win32_base)/lua/$(LUAV)
68 68PLATFORM_win32?=Release
69LUAPREFIX_win32?= 69LUAPREFIX_win32?=
70CDIR_win32?=lua/$(LUAV) 70CDIR_win32?=lua/$(LUAV)/$(PLATFORM_win32)
71LDIR_win32?=lua/$(LUAV)/lua 71LDIR_win32?=lua/$(LUAV)/$(PLATFORM_win32)/lua
72LUALIB_win32?=$(LUAPREFIX_win32)/lua/$(LUAV)/$(PLATFORM_win32)
72 73
73# prefix: /usr/local /usr /opt/local /sw 74# prefix: /usr/local /usr /opt/local /sw
74# the top of the default install tree 75# the top of the default install tree
@@ -154,8 +155,8 @@ SOCKET_linux=usocket.o
154SO_mingw=dll 155SO_mingw=dll
155O_mingw=o 156O_mingw=o
156CC_mingw=gcc 157CC_mingw=gcc
157DEF_mingw= -DLUASOCKET_$(DEBUG) -DLUA_COMPAT_MODULE -DWINVER=0x0501 \ 158DEF_mingw= -DLUASOCKET_INET_PTON -DLUASOCKET_$(DEBUG) -DLUA_COMPAT_MODULE \
158 -DLUASOCKET_API='__declspec(dllexport)' \ 159 -DWINVER=0x0501 -DLUASOCKET_API='__declspec(dllexport)' \
159 -DMIME_API='__declspec(dllexport)' 160 -DMIME_API='__declspec(dllexport)'
160CFLAGS_mingw= -I$(LUAINC) $(DEF) -pedantic -Wall -O2 -fno-common \ 161CFLAGS_mingw= -I$(LUAINC) $(DEF) -pedantic -Wall -O2 -fno-common \
161 -fvisibility=hidden 162 -fvisibility=hidden
@@ -170,23 +171,25 @@ SOCKET_mingw=wsocket.o
170SO_win32=dll 171SO_win32=dll
171O_win32=obj 172O_win32=obj
172CC_win32=cl 173CC_win32=cl
173DEF_win32= /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" \ 174DEF_win32= //D "WIN32" //D "NDEBUG" //D "_WINDOWS" //D "_USRDLL" \
174 /D "LUASOCKET_API=__declspec(dllexport)" /D "_CRT_SECURE_NO_WARNINGS" \ 175 //D "LUASOCKET_API=__declspec(dllexport)" //D "_CRT_SECURE_NO_WARNINGS" \
175 /D "_WINDLL" /D "LUA_COMPAT_MODULE" /D "MIME_API=__declspec(dllexport)" \ 176 //D "_WINDLL" //D "LUA_COMPAT_MODULE" \
176 /D "LUASOCKET_$(DEBUG)" 177 //D "MIME_API=__declspec(dllexport)" \
177CFLAGS_win32=/I "$(LUAINC)" $(DEF) /O2 /Ot /MD /W3 /nologo 178 //D "LUASOCKET_$(DEBUG)"
178LDFLAGS_win32= /nologo /link /NOLOGO /DLL /INCREMENTAL:NO \ 179CFLAGS_win32=//I "$(LUAINC)" $(DEF) //O2 //Ot //MD //W3 //nologo
179 /MANIFEST /MANIFESTFILE:"intermediate.manifest" \ 180LDFLAGS_win32= //nologo //link //NOLOGO //DLL //INCREMENTAL:NO \
180 /MANIFESTUAC:"level='asInvoker' uiAccess='false'" \ 181 //MANIFEST //MANIFESTFILE:"intermediate.manifest" \
181 /SUBSYSTEM:WINDOWS /OPT:REF /OPT:ICF /DYNAMICBASE:NO \ 182 //MANIFESTUAC:"level='asInvoker' uiAccess='false'" \
182 /MACHINE:X86 $(LUALIB) ws2_32.lib /OUT: 183 //SUBSYSTEM:WINDOWS //OPT:REF //OPT:ICF //DYNAMICBASE:NO \
184 //MACHINE:X86 /LIBPATH:"$(shell cmd //c echo $(LUALIB))" lua$(subst .,,$(LUAV)).lib \
185 wsock32.lib ws2_32.lib //OUT:
183LD_win32=cl 186LD_win32=cl
184SOCKET_win32=wsocket.obj 187SOCKET_win32=wsocket.obj
185 188
186.SUFFIXES: .obj 189.SUFFIXES: .obj
187 190
188.c.obj: 191.c.obj:
189 $(CC) $(CFLAGS) /Fo"$@" /c $< 192 $(CC) $(CFLAGS) //Fo"$@" //c $<
190 193
191#------ 194#------
192# Output file names 195# Output file names