├── .hgignore ├── .hgtags ├── Android.mk ├── CHANGES.txt ├── COPYING.txt ├── Makefile.am ├── Makefile.in ├── Makefile.os2 ├── README.txt ├── SDL2_net.pc.in ├── SDL2_net.spec ├── SDL2_net.spec.in ├── SDL_net.h ├── SDLnet.c ├── SDLnetTCP.c ├── SDLnetUDP.c ├── SDLnetselect.c ├── SDLnetsys.h ├── VisualC ├── SDL_net.sln ├── SDL_net.vcxproj ├── SDL_net.vcxproj.filters ├── SDL_net_VS2008.sln ├── SDL_net_VS2008.vcproj ├── Version.rc ├── clean.sh ├── resource.h └── showinterfaces │ └── showinterfaces_VS2008.vcproj ├── Xcode-iOS └── SDL_net.xcodeproj │ └── project.pbxproj ├── Xcode ├── Info-Framework.plist ├── SDL_net.xcodeproj │ └── project.pbxproj ├── package └── pkg-support │ ├── SDL_net.info │ ├── mkpackage.sh │ └── resources │ ├── ReadMe.txt │ └── Welcome.txt ├── acinclude ├── libtool.m4 ├── ltoptions.m4 ├── ltsugar.m4 ├── ltversion.m4 ├── lt~obsolete.m4 ├── pkg.m4 └── sdl2.m4 ├── aclocal.m4 ├── autogen.sh ├── chat.cpp ├── chat.h ├── chatd.c ├── compile ├── config.guess ├── config.sub ├── configure ├── configure.in ├── debian ├── changelog ├── compat ├── control ├── copyright ├── docs ├── libsdl2-net-dev.examples ├── libsdl2-net-dev.install ├── libsdl2-net.install ├── rules ├── source │ └── format └── watch ├── depcomp ├── gcc-fat.sh ├── install-sh ├── ltmain.sh ├── missing ├── quit.bmp ├── scroll_dn.bmp ├── scroll_up.bmp ├── showinterfaces.c └── version.rc /.hgignore: -------------------------------------------------------------------------------- 1 | syntax:glob 2 | .svn 3 | autom4te* 4 | config.cache 5 | config.log 6 | config.status 7 | Makefile 8 | libtool 9 | .deps 10 | .libs 11 | *.lo 12 | *.o 13 | *.la 14 | *.lai 15 | .DS_Store 16 | xcuserdata 17 | *.xcworkspace 18 | SDL2_net.pc 19 | showinterfaces 20 | -------------------------------------------------------------------------------- /.hgtags: -------------------------------------------------------------------------------- 1 | 55c9881b16da11a385824a68066d8819df936686 release-1.2.7 2 | 8f24dd69afcbadae8622c9f9fb7126b6ccf323cb release-1.2.6 3 | 82e8eb5642712c91688a1a3e04f4627ff6a4eac6 release-1.2.8 4 | 2d6d632f9144fedc79abe291b8b8d3da589e9113 release-2.0.0 5 | c5b3c4171459541616dc3b4e4f9fd1848d88f937 release-2.0.1 6 | -------------------------------------------------------------------------------- /Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | 5 | LOCAL_MODULE := SDL2_net 6 | 7 | LOCAL_C_INCLUDES := $(LOCAL_PATH) 8 | LOCAL_CFLAGS := 9 | 10 | LOCAL_SRC_FILES := SDLnet.c SDLnetTCP.c SDLnetUDP.c SDLnetselect.c 11 | 12 | LOCAL_SHARED_LIBRARIES := SDL2 13 | 14 | LOCAL_EXPORT_C_INCLUDES += $(LOCAL_C_INCLUDES) 15 | 16 | include $(BUILD_SHARED_LIBRARY) 17 | -------------------------------------------------------------------------------- /CHANGES.txt: -------------------------------------------------------------------------------- 1 | 2.0.2: 2 | Ozkan Sezer - Mon Oct 23 11:54:16 2017 3 | * Build fixes for OS/2 4 | 5 | 2.0.1: 6 | Mārtiņš Možeiko - Fri Sep 27 23:26:33 2013 7 | * Fixed returning all IP addresses from SDLNet_GetLocalAddresses() on Windows 8 | 9 | 2.0.0: 10 | Sam Lantinga - Sat Jun 1 19:11:26 PDT 2013 11 | * Updated for SDL 2.0 release 12 | 13 | 1.2.9: 14 | Simeon Maxein - Mon Jul 2 08:02:57 EDT 2012 15 | * Made it possible to use SDL_net without SDL 16 | 17 | 1.2.8: 18 | Sam Lantinga - Sun Jan 15 01:39:35 EST 2012 19 | * Added the definition for INADDR_LOOPBACK 20 | Sam Lantinga - Thu Jan 05 22:57:56 2012 -0500 21 | * Added an Xcode project for iOS 22 | Sam Lantinga - Sat Dec 31 10:28:12 EST 2011 23 | * SDL_net is now under the zlib license 24 | Sam Lantinga - Sun Nov 20 01:29:33 EST 2011 25 | * Added SDLNet_UDP_SetPacketLoss() to simulate random packet loss 26 | Sam Lantinga - Fri Nov 04 04:52:12 2011 -0400 27 | * Added SDLNet_GetLocalAddresses() to query local interfaces 28 | Sam Lantinga - Fri Nov 4 04:05:03 EDT 2011 29 | * Removed obsolete OpenTransport code 30 | Sam Lantinga - Tue Mar 08 16:52:59 2011 -0800 31 | * Added Android.mk to build on the Android platform 32 | Sam Lantinga - Sun Feb 27 10:00:53 PST 2011 33 | * Fixed to compile cleanly with g++ 34 | C.W. Betts - Thu Feb 17 12:52:47 PST 2011 35 | * Fixed the code to use socklen_t where appropriate 36 | Evan Nemerson - Thu Feb 17 12:47:13 PST 2011 37 | * Added pkg-config support 38 | esigra - Mon Feb 16 20:59:55 PST 2009 39 | * Fixed C++ compilation with -Wold-style-cast 40 | Matthew Mondor - Fri Jan 4 08:44:22 PST 2008 41 | * Enable multicast receiving on 224.0.0.1 on Windows (already worked on UNIX) 42 | 43 | 1.2.7: 44 | Joakim L. Gilje - Sat Jul 14 22:54:37 PDT 2007 45 | * Set server TCP sockets to blocking mode on Mac OS X, Solaris, etc. 46 | 47 | 1.2.6: 48 | Sam Lantinga - Sun Apr 30 01:48:40 PDT 2006 49 | * Added gcc-fat.sh for generating Universal binaries on Mac OS X 50 | * Updated libtool support to version 1.5.22 51 | Sam Lantinga - Wed Nov 19 00:23:44 PST 2003 52 | * Updated libtool support for new mingw32 DLL build process 53 | Shard - Thu, 05 Jun 2003 09:30:20 -0500 54 | * Fixed compiling on BeOS, which may not have SO_BROADCAST 55 | Kyle Davenport - Sat, 19 Apr 2003 17:13:31 -0500 56 | * Added .la files to the development RPM, fixing RPM build on RedHat 8 57 | 58 | 1.2.5: 59 | -------------------------------------------------------------------------------- /COPYING.txt: -------------------------------------------------------------------------------- 1 | /* 2 | SDL_net: An example cross-platform network library for use with SDL 3 | Copyright (C) 1997-2021 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am for the SDL sample image loading library and viewer 2 | 3 | lib_LTLIBRARIES = libSDL2_net.la 4 | 5 | libSDL2_netincludedir = $(includedir)/SDL2 6 | libSDL2_netinclude_HEADERS = \ 7 | SDL_net.h 8 | 9 | libSDL2_net_la_SOURCES = \ 10 | SDLnet.c \ 11 | SDLnetTCP.c \ 12 | SDLnetUDP.c \ 13 | SDLnetselect.c \ 14 | SDLnetsys.h 15 | 16 | EXTRA_DIST = \ 17 | Android.mk \ 18 | debian \ 19 | version.rc \ 20 | Makefile.os2 \ 21 | VisualC \ 22 | Xcode \ 23 | Xcode-iOS \ 24 | quit.bmp \ 25 | scroll_dn.bmp \ 26 | scroll_up.bmp \ 27 | SDL2_net.spec \ 28 | SDL2_net.spec.in \ 29 | gcc-fat.sh \ 30 | autogen.sh \ 31 | $(srcdir)/*.txt 32 | 33 | if USE_VERSION_RC 34 | libSDL2_net_la_LDFLAGS = \ 35 | -no-undefined \ 36 | -release $(LT_RELEASE) \ 37 | -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) -Wl,version.o 38 | libSDL2_net_la_LIBADD = @INETLIB@ 39 | libSDL2_net_la_DEPENDENCIES = version.o 40 | else 41 | libSDL2_net_la_LDFLAGS = \ 42 | -no-undefined \ 43 | -release $(LT_RELEASE) \ 44 | -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) 45 | libSDL2_net_la_LIBADD = @INETLIB@ 46 | endif 47 | 48 | %.o : %.rc 49 | $(WINDRES) $< $@ 50 | 51 | if HAVE_GUI_LIB 52 | EXAMPLES = showinterfaces chat chatd 53 | else 54 | EXAMPLES = showinterfaces 55 | endif 56 | noinst_PROGRAMS = $(EXAMPLES) 57 | 58 | showinterfaces_SOURCES = showinterfaces.c 59 | showinterfaces_LDADD = libSDL2_net.la 60 | chat_SOURCES = chat.cpp chat.h 61 | chat_LDADD = libSDL2_net.la -lGUI 62 | chatd_SOURCES = chatd.c 63 | chatd_LDADD = libSDL2_net.la 64 | 65 | # Rule to build tar-gzipped distribution package 66 | $(PACKAGE)-$(VERSION).tar.gz: distcheck 67 | 68 | # Rule to build RPM distribution package 69 | rpm: $(PACKAGE)-$(VERSION).tar.gz 70 | rpmbuild -ta $(PACKAGE)-$(VERSION).tar.gz 71 | 72 | pkgconfigdir = $(libdir)/pkgconfig 73 | pkgconfig_DATA = SDL2_net.pc 74 | -------------------------------------------------------------------------------- /Makefile.os2: -------------------------------------------------------------------------------- 1 | # Open Watcom makefile to build SDL2net.dll for OS/2 2 | # wmake -f Makefile.os2 3 | # 4 | # Remember to edit DEPS_INC and DEPS_LIB below to meet 5 | # your own environment!. 6 | 7 | LIBNAME = SDL2net 8 | VERSION = 2.0.1 9 | 10 | TITLENAME = $(LIBNAME) $(VERSION) 11 | 12 | LIBFILE = $(LIBNAME).lib 13 | DLLFILE = $(LIBNAME).dll 14 | LNKFILE = $(LIBNAME).lnk 15 | # change DEPS_INC in order to point to the dependency headers. 16 | DEPS_INC=-IC:\SDL2DEV\h\SDL2 17 | # change DEPS_LIB in order to point to the dependency libraries. 18 | DEPS_LIB=C:\SDL2DEV\lib 19 | 20 | SRCS = SDLnetTCP.c SDLnetUDP.c SDLnetselect.c SDLnet.c 21 | 22 | OBJS = $(SRCS:.c=.obj) 23 | 24 | LIBS = SDL2.lib 25 | 26 | CFLAGS = -bt=os2 -d0 -q -bm -5s -fp5 -fpi87 -sg -oteanbmier -ei -j 27 | # warnings: 28 | CFLAGS+= -wx 29 | # to build a dll: 30 | CFLAGS+= -bd 31 | # for DECLSPEC: 32 | CFLAGS+= -DBUILD_SDL 33 | # include paths: 34 | CFLAGS+= -I$(%WATCOM)/h/os2 -I$(%WATCOM)/h 35 | CFLAGS+= -I. $(DEPS_INC) 36 | 37 | $(LIBFILE): $(DLLFILE) 38 | @echo * Create library: $@... 39 | wlib -b -n -q -c -pa -s -t -zld -ii -io $@ $(DLLFILE) 40 | 41 | $(DLLFILE): $(OBJS) $(LNKFILE) 42 | @echo * Link: $@ 43 | wlink @$(LNKFILE) 44 | 45 | $(LNKFILE): 46 | @%create $@ 47 | @%append $@ SYSTEM os2v2_dll INITINSTANCE TERMINSTANCE 48 | @%append $@ NAME $(LIBNAME) 49 | @for %i in ($(OBJS)) do @%append $@ FILE %i 50 | @%append $@ OPTION QUIET 51 | @%append $@ OPTION DESCRIPTION '@$#libsdl org:$(VERSION)$#@Simple DirectMedia Layer network library' 52 | @%append $@ LIBPATH $(DEPS_LIB) 53 | @for %i in ($(LIBS)) do @%append $@ LIB %i 54 | @%append $@ OPTION MAP=$* 55 | @%append $@ OPTION ELIMINATE 56 | @%append $@ OPTION MANYAUTODATA 57 | @%append $@ OPTION OSNAME='OS/2 and eComStation' 58 | @%append $@ OPTION SHOWDEAD 59 | 60 | .c.obj: 61 | wcc386 $(CFLAGS) -fo=$^@ $< 62 | 63 | clean: .SYMBOLIC 64 | @echo * Clean: $(TITLENAME) 65 | @if exist *.obj rm *.obj 66 | @if exist *.err rm *.err 67 | @if exist $(LNKFILE) rm $(LNKFILE) 68 | distclean: .SYMBOLIC clean 69 | @if exist $(DLLFILE) rm $(DLLFILE) 70 | @if exist $(LIBFILE) rm $(LIBFILE) 71 | @if exist *.map rm *.map 72 | -------------------------------------------------------------------------------- /README.txt: -------------------------------------------------------------------------------- 1 | 2 | SDL_net 2.0 3 | 4 | The latest version of this library is available from: 5 | http://www.libsdl.org/projects/SDL_net/ 6 | 7 | This is an example portable network library for use with SDL. 8 | It is available under the zlib license, found in the file COPYING.txt. 9 | The API can be found in the file SDL_net.h 10 | This library supports UNIX, Windows, MacOS Classic, MacOS X, 11 | BeOS and QNX. 12 | 13 | The demo program is a chat client and server. 14 | The chat client requires the sample GUI library available at: 15 | http://www.libsdl.org/projects/GUIlib/ 16 | The chat client connects to the server via TCP, registering itself. 17 | The server sends back a list of connected clients, and keeps the 18 | client updated with the status of other clients. 19 | Every line of text from a client is sent via UDP to every other client. 20 | 21 | Note that this isn't necessarily how you would want to write a chat 22 | program, but it demonstrates how to use the basic features of the 23 | network library. 24 | 25 | Enjoy! 26 | -Sam Lantinga and Roy Wood 27 | 28 | -------------------------------------------------------------------------------- /SDL2_net.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: SDL2_net 7 | Description: net library for Simple DirectMedia Layer 8 | Version: @VERSION@ 9 | Requires: sdl2 >= @SDL_VERSION@ 10 | Libs: -L${libdir} -lSDL2_net 11 | Cflags: -I${includedir}/SDL2 12 | -------------------------------------------------------------------------------- /SDL2_net.spec: -------------------------------------------------------------------------------- 1 | %define name SDL2_net 2 | %define version 2.0.1 3 | %define release 1 4 | 5 | Summary: SDL portable network library 6 | Name: %{name} 7 | Version: %{version} 8 | Release: %{release} 9 | Source0: %{name}-%{version}.tar.gz 10 | URL: http://www.libsdl.org/projects/SDL_net/ 11 | License: LGPL 12 | Group: System Environment/Libraries 13 | BuildRoot: /var/tmp/%{name}-buildroot 14 | Prefix: %{_prefix} 15 | 16 | %description 17 | This is a portable network library for use with SDL. 18 | 19 | %package devel 20 | Summary: Libraries and includes to develop SDL networked applications. 21 | Group: Development/Libraries 22 | Requires: %{name} 23 | 24 | %description devel 25 | This is a portable network library for use with SDL. 26 | 27 | This is the libraries and include files you can use to develop SDL networked applications. 28 | 29 | %prep 30 | rm -rf ${RPM_BUILD_ROOT} 31 | 32 | %setup -q 33 | 34 | %build 35 | CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%{prefix} --disable-gui 36 | make 37 | 38 | %install 39 | rm -rf $RPM_BUILD_ROOT 40 | make install prefix=$RPM_BUILD_ROOT/%{prefix} 41 | 42 | %clean 43 | rm -rf $RPM_BUILD_ROOT 44 | 45 | %files 46 | %defattr(-,root,root) 47 | %doc README.txt CHANGES.txt COPYING.txt 48 | %{prefix}/lib/lib*.so.* 49 | 50 | %files devel 51 | %defattr(-,root,root) 52 | %{prefix}/lib/lib*.a 53 | %{prefix}/lib/lib*.la 54 | %{prefix}/lib/lib*.so 55 | %{prefix}/include/*/ 56 | %{prefix}/lib/pkgconfig/*.pc 57 | 58 | %changelog 59 | * Sat Feb 3 2001 Paul S Jenner 60 | - First spec file based on SDL spec file 61 | 62 | # end of file 63 | -------------------------------------------------------------------------------- /SDL2_net.spec.in: -------------------------------------------------------------------------------- 1 | %define name @PACKAGE@ 2 | %define version @VERSION@ 3 | %define release 1 4 | 5 | Summary: SDL portable network library 6 | Name: %{name} 7 | Version: %{version} 8 | Release: %{release} 9 | Source0: %{name}-%{version}.tar.gz 10 | URL: http://www.libsdl.org/projects/SDL_net/ 11 | License: LGPL 12 | Group: System Environment/Libraries 13 | BuildRoot: /var/tmp/%{name}-buildroot 14 | Prefix: %{_prefix} 15 | 16 | %description 17 | This is a portable network library for use with SDL. 18 | 19 | %package devel 20 | Summary: Libraries and includes to develop SDL networked applications. 21 | Group: Development/Libraries 22 | Requires: %{name} 23 | 24 | %description devel 25 | This is a portable network library for use with SDL. 26 | 27 | This is the libraries and include files you can use to develop SDL networked applications. 28 | 29 | %prep 30 | rm -rf ${RPM_BUILD_ROOT} 31 | 32 | %setup -q 33 | 34 | %build 35 | CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%{prefix} --disable-gui 36 | make 37 | 38 | %install 39 | rm -rf $RPM_BUILD_ROOT 40 | make install prefix=$RPM_BUILD_ROOT/%{prefix} 41 | 42 | %clean 43 | rm -rf $RPM_BUILD_ROOT 44 | 45 | %files 46 | %defattr(-,root,root) 47 | %doc README.txt CHANGES.txt COPYING.txt 48 | %{prefix}/lib/lib*.so.* 49 | 50 | %files devel 51 | %defattr(-,root,root) 52 | %{prefix}/lib/lib*.a 53 | %{prefix}/lib/lib*.la 54 | %{prefix}/lib/lib*.so 55 | %{prefix}/include/*/ 56 | %{prefix}/lib/pkgconfig/*.pc 57 | 58 | %changelog 59 | * Sat Feb 3 2001 Paul S Jenner 60 | - First spec file based on SDL spec file 61 | 62 | # end of file 63 | -------------------------------------------------------------------------------- /SDLnet.c: -------------------------------------------------------------------------------- 1 | /* 2 | SDL_net: An example cross-platform network library for use with SDL 3 | Copyright (C) 1997-2021 Sam Lantinga 4 | Copyright (C) 2012 Simeon Maxein 5 | 6 | This software is provided 'as-is', without any express or implied 7 | warranty. In no event will the authors be held liable for any damages 8 | arising from the use of this software. 9 | 10 | Permission is granted to anyone to use this software for any purpose, 11 | including commercial applications, and to alter it and redistribute it 12 | freely, subject to the following restrictions: 13 | 14 | 1. The origin of this software must not be misrepresented; you must not 15 | claim that you wrote the original software. If you use this software 16 | in a product, an acknowledgment in the product documentation would be 17 | appreciated but is not required. 18 | 2. Altered source versions must be plainly marked as such, and must not be 19 | misrepresented as being the original software. 20 | 3. This notice may not be removed or altered from any source distribution. 21 | */ 22 | 23 | #include "SDLnetsys.h" 24 | #include "SDL_net.h" 25 | 26 | #ifdef WITHOUT_SDL 27 | #include 28 | #include 29 | #endif 30 | 31 | const SDLNet_version *SDLNet_Linked_Version(void) 32 | { 33 | static SDLNet_version linked_version; 34 | SDL_NET_VERSION(&linked_version); 35 | return(&linked_version); 36 | } 37 | 38 | /* Since the UNIX/Win32/BeOS code is so different from MacOS, 39 | we'll just have two completely different sections here. 40 | */ 41 | static int SDLNet_started = 0; 42 | 43 | #ifndef __USE_W32_SOCKETS 44 | #include 45 | #endif 46 | 47 | #ifndef __USE_W32_SOCKETS 48 | 49 | int SDLNet_GetLastError(void) 50 | { 51 | #if defined(__OS2__) && !defined(__EMX__) 52 | return sock_errno(); 53 | #else 54 | return errno; 55 | #endif 56 | } 57 | 58 | void SDLNet_SetLastError(int err) 59 | { 60 | #if defined(__OS2__) && !defined(__EMX__) 61 | (void) err; /* FIXME: OS2 doesn't have a function to reset socket errno */ 62 | #else 63 | errno = err; 64 | #endif 65 | } 66 | 67 | #endif 68 | 69 | static char errorbuf[1024]; 70 | 71 | void SDLCALL SDLNet_SetError(const char *fmt, ...) 72 | { 73 | va_list argp; 74 | va_start(argp, fmt); 75 | SDL_vsnprintf(errorbuf, sizeof(errorbuf), fmt, argp); 76 | va_end(argp); 77 | #ifndef WITHOUT_SDL 78 | SDL_SetError("%s", errorbuf); 79 | #endif 80 | } 81 | 82 | const char * SDLCALL SDLNet_GetError(void) 83 | { 84 | #ifdef WITHOUT_SDL 85 | return errorbuf; 86 | #else 87 | return SDL_GetError(); 88 | #endif 89 | } 90 | 91 | /* Initialize/Cleanup the network API */ 92 | int SDLNet_Init(void) 93 | { 94 | if ( !SDLNet_started ) { 95 | #ifdef __USE_W32_SOCKETS 96 | /* Start up the windows networking */ 97 | WORD version_wanted = MAKEWORD(1,1); 98 | WSADATA wsaData; 99 | 100 | if ( WSAStartup(version_wanted, &wsaData) != 0 ) { 101 | SDLNet_SetError("Couldn't initialize Winsock 1.1\n"); 102 | return(-1); 103 | } 104 | #elif defined(__OS2__) && !defined(__EMX__) 105 | if (sock_init() < 0) { 106 | SDLNet_SetError("Couldn't initialize IBM OS/2 sockets"); 107 | return(-1); 108 | } 109 | #else 110 | /* SIGPIPE is generated when a remote socket is closed */ 111 | void (*handler)(int); 112 | handler = signal(SIGPIPE, SIG_IGN); 113 | if ( handler != SIG_DFL ) { 114 | signal(SIGPIPE, handler); 115 | } 116 | #endif 117 | } 118 | ++SDLNet_started; 119 | return(0); 120 | } 121 | void SDLNet_Quit(void) 122 | { 123 | if ( SDLNet_started == 0 ) { 124 | return; 125 | } 126 | if ( --SDLNet_started == 0 ) { 127 | #ifdef __USE_W32_SOCKETS 128 | /* Clean up windows networking */ 129 | if ( WSACleanup() == SOCKET_ERROR ) { 130 | if ( WSAGetLastError() == WSAEINPROGRESS ) { 131 | #ifndef _WIN32_WCE 132 | WSACancelBlockingCall(); 133 | #endif 134 | WSACleanup(); 135 | } 136 | } 137 | #elif defined(__OS2__) && !defined(__EMX__) 138 | /* -- nothing */ 139 | #else 140 | /* Restore the SIGPIPE handler */ 141 | void (*handler)(int); 142 | handler = signal(SIGPIPE, SIG_DFL); 143 | if ( handler != SIG_IGN ) { 144 | signal(SIGPIPE, handler); 145 | } 146 | #endif 147 | } 148 | } 149 | 150 | /* Resolve a host name and port to an IP address in network form */ 151 | int SDLNet_ResolveHost(IPaddress *address, const char *host, Uint16 port) 152 | { 153 | int retval = 0; 154 | 155 | /* Perform the actual host resolution */ 156 | if ( host == NULL ) { 157 | address->host = INADDR_ANY; 158 | } else { 159 | address->host = inet_addr(host); 160 | if ( address->host == INADDR_NONE ) { 161 | struct hostent *hp; 162 | 163 | hp = gethostbyname(host); 164 | if ( hp ) { 165 | SDL_memcpy(&address->host,hp->h_addr,hp->h_length); 166 | } else { 167 | retval = -1; 168 | } 169 | } 170 | } 171 | address->port = SDLNet_Read16(&port); 172 | 173 | /* Return the status */ 174 | return(retval); 175 | } 176 | 177 | /* Resolve an ip address to a host name in canonical form. 178 | If the ip couldn't be resolved, this function returns NULL, 179 | otherwise a pointer to a static buffer containing the hostname 180 | is returned. Note that this function is not thread-safe. 181 | */ 182 | /* Written by Miguel Angel Blanch. 183 | * Main Programmer of Arianne RPG. 184 | * http://come.to/arianne_rpg 185 | */ 186 | const char *SDLNet_ResolveIP(const IPaddress *ip) 187 | { 188 | struct hostent *hp; 189 | struct in_addr in; 190 | 191 | hp = gethostbyaddr((const char *)&ip->host, sizeof(ip->host), AF_INET); 192 | if ( hp != NULL ) { 193 | return hp->h_name; 194 | } 195 | 196 | in.s_addr = ip->host; 197 | return inet_ntoa(in); 198 | } 199 | 200 | int SDLNet_GetLocalAddresses(IPaddress *addresses, int maxcount) 201 | { 202 | int count = 0; 203 | #ifdef SIOCGIFCONF 204 | /* Defined on Mac OS X */ 205 | #ifndef _SIZEOF_ADDR_IFREQ 206 | #define _SIZEOF_ADDR_IFREQ sizeof 207 | #endif 208 | SOCKET sock; 209 | struct ifconf conf; 210 | char data[4096]; 211 | struct ifreq *ifr; 212 | struct sockaddr_in *sock_addr; 213 | 214 | sock = socket(AF_INET, SOCK_DGRAM, 0); 215 | if ( sock == INVALID_SOCKET ) { 216 | return 0; 217 | } 218 | 219 | conf.ifc_len = sizeof(data); 220 | conf.ifc_buf = (caddr_t) data; 221 | if ( ioctl(sock, SIOCGIFCONF, &conf) < 0 ) { 222 | closesocket(sock); 223 | return 0; 224 | } 225 | 226 | ifr = (struct ifreq*)data; 227 | while ((char*)ifr < data+conf.ifc_len) { 228 | if (ifr->ifr_addr.sa_family == AF_INET) { 229 | if (count < maxcount) { 230 | sock_addr = (struct sockaddr_in*)&ifr->ifr_addr; 231 | addresses[count].host = sock_addr->sin_addr.s_addr; 232 | addresses[count].port = sock_addr->sin_port; 233 | } 234 | ++count; 235 | } 236 | ifr = (struct ifreq*)((char*)ifr + _SIZEOF_ADDR_IFREQ(*ifr)); 237 | } 238 | closesocket(sock); 239 | #elif defined(__WIN32__) 240 | PIP_ADAPTER_INFO pAdapterInfo; 241 | PIP_ADAPTER_INFO pAdapter; 242 | PIP_ADDR_STRING pAddress; 243 | DWORD dwRetVal = 0; 244 | ULONG ulOutBufLen = sizeof (IP_ADAPTER_INFO); 245 | 246 | pAdapterInfo = (IP_ADAPTER_INFO *) SDL_malloc(sizeof (IP_ADAPTER_INFO)); 247 | if (pAdapterInfo == NULL) { 248 | return 0; 249 | } 250 | 251 | if ((dwRetVal = GetAdaptersInfo(pAdapterInfo, &ulOutBufLen)) == ERROR_BUFFER_OVERFLOW) { 252 | pAdapterInfo = (IP_ADAPTER_INFO *) SDL_realloc(pAdapterInfo, ulOutBufLen); 253 | if (pAdapterInfo == NULL) { 254 | return 0; 255 | } 256 | dwRetVal = GetAdaptersInfo(pAdapterInfo, &ulOutBufLen); 257 | } 258 | 259 | if (dwRetVal == NO_ERROR) { 260 | for (pAdapter = pAdapterInfo; pAdapter; pAdapter = pAdapter->Next) { 261 | for (pAddress = &pAdapter->IpAddressList; pAddress; pAddress = pAddress->Next) { 262 | if (count < maxcount) { 263 | addresses[count].host = inet_addr(pAddress->IpAddress.String); 264 | addresses[count].port = 0; 265 | } 266 | ++count; 267 | } 268 | } 269 | } 270 | SDL_free(pAdapterInfo); 271 | #endif 272 | return count; 273 | } 274 | 275 | #if !defined(WITHOUT_SDL) && !SDL_DATA_ALIGNED /* function versions for binary compatibility */ 276 | 277 | #undef SDLNet_Write16 278 | #undef SDLNet_Write32 279 | #undef SDLNet_Read16 280 | #undef SDLNet_Read32 281 | 282 | /* Write a 16/32 bit value to network packet buffer */ 283 | extern DECLSPEC void SDLCALL SDLNet_Write16(Uint16 value, void *area); 284 | extern DECLSPEC void SDLCALL SDLNet_Write32(Uint32 value, void *area); 285 | 286 | /* Read a 16/32 bit value from network packet buffer */ 287 | extern DECLSPEC Uint16 SDLCALL SDLNet_Read16(void *area); 288 | extern DECLSPEC Uint32 SDLCALL SDLNet_Read32(const void *area); 289 | 290 | void SDLNet_Write16(Uint16 value, void *areap) 291 | { 292 | (*(Uint16 *)(areap) = SDL_SwapBE16(value)); 293 | } 294 | 295 | void SDLNet_Write32(Uint32 value, void *areap) 296 | { 297 | *(Uint32 *)(areap) = SDL_SwapBE32(value); 298 | } 299 | 300 | Uint16 SDLNet_Read16(void *areap) 301 | { 302 | return (SDL_SwapBE16(*(Uint16 *)(areap))); 303 | } 304 | 305 | Uint32 SDLNet_Read32(const void *areap) 306 | { 307 | return (SDL_SwapBE32(*(Uint32 *)(areap))); 308 | } 309 | 310 | #endif /* !defined(WITHOUT_SDL) && !SDL_DATA_ALIGNED */ 311 | -------------------------------------------------------------------------------- /SDLnetTCP.c: -------------------------------------------------------------------------------- 1 | /* 2 | SDL_net: An example cross-platform network library for use with SDL 3 | Copyright (C) 1997-2021 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | #include "SDLnetsys.h" 23 | #include "SDL_net.h" 24 | 25 | /* The network API for TCP sockets */ 26 | 27 | /* Since the UNIX/Win32/BeOS code is so different from MacOS, 28 | we'll just have two completely different sections here. 29 | */ 30 | 31 | struct _TCPsocket { 32 | int ready; 33 | SOCKET channel; 34 | IPaddress remoteAddress; 35 | IPaddress localAddress; 36 | int sflag; 37 | }; 38 | 39 | /* Open a TCP network socket 40 | If 'remote' is NULL, this creates a local server socket on the given port, 41 | otherwise a TCP connection to the remote host and port is attempted. 42 | The newly created socket is returned, or NULL if there was an error. 43 | */ 44 | TCPsocket SDLNet_TCP_Open(IPaddress *ip) 45 | { 46 | TCPsocket sock; 47 | struct sockaddr_in sock_addr; 48 | 49 | /* Allocate a TCP socket structure */ 50 | sock = (TCPsocket)SDL_malloc(sizeof(*sock)); 51 | if ( sock == NULL ) { 52 | SDLNet_SetError("Out of memory"); 53 | goto error_return; 54 | } 55 | 56 | /* Open the socket */ 57 | sock->channel = socket(AF_INET, SOCK_STREAM, 0); 58 | if ( sock->channel == INVALID_SOCKET ) { 59 | SDLNet_SetError("Couldn't create socket"); 60 | goto error_return; 61 | } 62 | 63 | /* Connect to remote, or bind locally, as appropriate */ 64 | if ( (ip->host != INADDR_NONE) && (ip->host != INADDR_ANY) ) { 65 | 66 | /* ######### Connecting to remote */ 67 | SDL_memset(&sock_addr, 0, sizeof(sock_addr)); 68 | sock_addr.sin_family = AF_INET; 69 | sock_addr.sin_addr.s_addr = ip->host; 70 | sock_addr.sin_port = ip->port; 71 | 72 | /* Connect to the remote host */ 73 | if ( connect(sock->channel, (struct sockaddr *)&sock_addr, 74 | sizeof(sock_addr)) == SOCKET_ERROR ) { 75 | SDLNet_SetError("Couldn't connect to remote host"); 76 | goto error_return; 77 | } 78 | sock->sflag = 0; 79 | } else { 80 | 81 | /* ########## Binding locally */ 82 | SDL_memset(&sock_addr, 0, sizeof(sock_addr)); 83 | sock_addr.sin_family = AF_INET; 84 | sock_addr.sin_addr.s_addr = INADDR_ANY; 85 | sock_addr.sin_port = ip->port; 86 | 87 | /* 88 | * Windows gets bad mojo with SO_REUSEADDR: 89 | * http://www.devolution.com/pipermail/sdl/2005-September/070491.html 90 | * --ryan. 91 | */ 92 | #ifndef WIN32 93 | /* allow local address reuse */ 94 | { int yes = 1; 95 | setsockopt(sock->channel, SOL_SOCKET, SO_REUSEADDR, (char*)&yes, sizeof(yes)); 96 | } 97 | #endif 98 | 99 | /* Bind the socket for listening */ 100 | if ( bind(sock->channel, (struct sockaddr *)&sock_addr, 101 | sizeof(sock_addr)) == SOCKET_ERROR ) { 102 | SDLNet_SetError("Couldn't bind to local port"); 103 | goto error_return; 104 | } 105 | if ( listen(sock->channel, 5) == SOCKET_ERROR ) { 106 | SDLNet_SetError("Couldn't listen to local port"); 107 | goto error_return; 108 | } 109 | 110 | /* Set the socket to non-blocking mode for accept() */ 111 | #if defined(__BEOS__) && defined(SO_NONBLOCK) 112 | /* On BeOS r5 there is O_NONBLOCK but it's for files only */ 113 | { 114 | long b = 1; 115 | setsockopt(sock->channel, SOL_SOCKET, SO_NONBLOCK, &b, sizeof(b)); 116 | } 117 | #elif defined(O_NONBLOCK) 118 | { 119 | fcntl(sock->channel, F_SETFL, O_NONBLOCK); 120 | } 121 | #elif defined(WIN32) 122 | { 123 | unsigned long mode = 1; 124 | ioctlsocket (sock->channel, FIONBIO, &mode); 125 | } 126 | #elif defined(__OS2__) 127 | { 128 | int dontblock = 1; 129 | ioctl(sock->channel, FIONBIO, &dontblock); 130 | } 131 | #else 132 | #warning How do we set non-blocking mode on other operating systems? 133 | #endif 134 | sock->sflag = 1; 135 | } 136 | sock->ready = 0; 137 | 138 | #ifdef TCP_NODELAY 139 | /* Set the nodelay TCP option for real-time games */ 140 | { int yes = 1; 141 | setsockopt(sock->channel, IPPROTO_TCP, TCP_NODELAY, (char*)&yes, sizeof(yes)); 142 | } 143 | #else 144 | #warning Building without TCP_NODELAY 145 | #endif /* TCP_NODELAY */ 146 | 147 | /* Fill in the channel host address */ 148 | sock->remoteAddress.host = sock_addr.sin_addr.s_addr; 149 | sock->remoteAddress.port = sock_addr.sin_port; 150 | 151 | /* The socket is ready */ 152 | return(sock); 153 | 154 | error_return: 155 | SDLNet_TCP_Close(sock); 156 | return(NULL); 157 | } 158 | 159 | /* Accept an incoming connection on the given server socket. 160 | The newly created socket is returned, or NULL if there was an error. 161 | */ 162 | TCPsocket SDLNet_TCP_Accept(TCPsocket server) 163 | { 164 | TCPsocket sock; 165 | struct sockaddr_in sock_addr; 166 | socklen_t sock_alen; 167 | 168 | /* Only server sockets can accept */ 169 | if ( ! server->sflag ) { 170 | SDLNet_SetError("Only server sockets can accept()"); 171 | return(NULL); 172 | } 173 | server->ready = 0; 174 | 175 | /* Allocate a TCP socket structure */ 176 | sock = (TCPsocket)SDL_malloc(sizeof(*sock)); 177 | if ( sock == NULL ) { 178 | SDLNet_SetError("Out of memory"); 179 | goto error_return; 180 | } 181 | 182 | /* Accept a new TCP connection on a server socket */ 183 | sock_alen = sizeof(sock_addr); 184 | sock->channel = accept(server->channel, (struct sockaddr *)&sock_addr, 185 | &sock_alen); 186 | if ( sock->channel == INVALID_SOCKET ) { 187 | SDLNet_SetError("accept() failed"); 188 | goto error_return; 189 | } 190 | #ifdef WIN32 191 | { 192 | /* passing a zero value, socket mode set to block on */ 193 | unsigned long mode = 0; 194 | ioctlsocket (sock->channel, FIONBIO, &mode); 195 | } 196 | #elif defined(O_NONBLOCK) 197 | { 198 | int flags = fcntl(sock->channel, F_GETFL, 0); 199 | fcntl(sock->channel, F_SETFL, flags & ~O_NONBLOCK); 200 | } 201 | #endif /* WIN32 */ 202 | sock->remoteAddress.host = sock_addr.sin_addr.s_addr; 203 | sock->remoteAddress.port = sock_addr.sin_port; 204 | 205 | sock->sflag = 0; 206 | sock->ready = 0; 207 | 208 | /* The socket is ready */ 209 | return(sock); 210 | 211 | error_return: 212 | SDLNet_TCP_Close(sock); 213 | return(NULL); 214 | } 215 | 216 | /* Get the IP address of the remote system associated with the socket. 217 | If the socket is a server socket, this function returns NULL. 218 | */ 219 | IPaddress *SDLNet_TCP_GetPeerAddress(TCPsocket sock) 220 | { 221 | if ( sock->sflag ) { 222 | return(NULL); 223 | } 224 | return(&sock->remoteAddress); 225 | } 226 | 227 | /* Send 'len' bytes of 'data' over the non-server socket 'sock' 228 | This function returns the actual amount of data sent. If the return value 229 | is less than the amount of data sent, then either the remote connection was 230 | closed, or an unknown socket error occurred. 231 | */ 232 | int SDLNet_TCP_Send(TCPsocket sock, const void *datap, int len) 233 | { 234 | const Uint8 *data = (const Uint8 *)datap; /* For pointer arithmetic */ 235 | int sent, left; 236 | 237 | /* Server sockets are for accepting connections only */ 238 | if ( sock->sflag ) { 239 | SDLNet_SetError("Server sockets cannot send"); 240 | return(-1); 241 | } 242 | 243 | /* Keep sending data until it's sent or an error occurs */ 244 | left = len; 245 | sent = 0; 246 | SDLNet_SetLastError(0); 247 | do { 248 | len = send(sock->channel, (const char *) data, left, 0); 249 | if ( len > 0 ) { 250 | sent += len; 251 | left -= len; 252 | data += len; 253 | } 254 | } while ( (left > 0) && ((len > 0) || (SDLNet_GetLastError() == EINTR)) ); 255 | 256 | return(sent); 257 | } 258 | 259 | /* Receive up to 'maxlen' bytes of data over the non-server socket 'sock', 260 | and store them in the buffer pointed to by 'data'. 261 | This function returns the actual amount of data received. If the return 262 | value is less than or equal to zero, then either the remote connection was 263 | closed, or an unknown socket error occurred. 264 | */ 265 | int SDLNet_TCP_Recv(TCPsocket sock, void *data, int maxlen) 266 | { 267 | int len; 268 | 269 | /* Server sockets are for accepting connections only */ 270 | if ( sock->sflag ) { 271 | SDLNet_SetError("Server sockets cannot receive"); 272 | return(-1); 273 | } 274 | 275 | SDLNet_SetLastError(0); 276 | do { 277 | len = recv(sock->channel, (char *) data, maxlen, 0); 278 | } while ( SDLNet_GetLastError() == EINTR ); 279 | 280 | sock->ready = 0; 281 | return(len); 282 | } 283 | 284 | /* Close a TCP network socket */ 285 | void SDLNet_TCP_Close(TCPsocket sock) 286 | { 287 | if ( sock != NULL ) { 288 | if ( sock->channel != INVALID_SOCKET ) { 289 | closesocket(sock->channel); 290 | } 291 | SDL_free(sock); 292 | } 293 | } 294 | -------------------------------------------------------------------------------- /SDLnetselect.c: -------------------------------------------------------------------------------- 1 | /* 2 | SDL_net: An example cross-platform network library for use with SDL 3 | Copyright (C) 1997-2021 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | #include "SDLnetsys.h" 23 | #include "SDL_net.h" 24 | 25 | /* The select() API for network sockets */ 26 | 27 | struct SDLNet_Socket { 28 | int ready; 29 | SOCKET channel; 30 | }; 31 | 32 | struct _SDLNet_SocketSet { 33 | int numsockets; 34 | int maxsockets; 35 | struct SDLNet_Socket **sockets; 36 | }; 37 | 38 | /* Allocate a socket set for use with SDLNet_CheckSockets() 39 | This returns a socket set for up to 'maxsockets' sockets, or NULL if 40 | the function ran out of memory. 41 | */ 42 | SDLNet_SocketSet SDLNet_AllocSocketSet(int maxsockets) 43 | { 44 | struct _SDLNet_SocketSet *set; 45 | int i; 46 | 47 | set = (struct _SDLNet_SocketSet *)SDL_malloc(sizeof(*set)); 48 | if ( set != NULL ) { 49 | set->numsockets = 0; 50 | set->maxsockets = maxsockets; 51 | set->sockets = (struct SDLNet_Socket **)SDL_malloc 52 | (maxsockets*sizeof(*set->sockets)); 53 | if ( set->sockets != NULL ) { 54 | for ( i=0; isockets[i] = NULL; 56 | } 57 | } else { 58 | SDL_free(set); 59 | set = NULL; 60 | } 61 | } 62 | return(set); 63 | } 64 | 65 | /* Add a socket to a set of sockets to be checked for available data */ 66 | int SDLNet_AddSocket(SDLNet_SocketSet set, SDLNet_GenericSocket sock) 67 | { 68 | if ( sock != NULL ) { 69 | if ( set->numsockets == set->maxsockets ) { 70 | SDLNet_SetError("socketset is full"); 71 | return(-1); 72 | } 73 | set->sockets[set->numsockets++] = (struct SDLNet_Socket *)sock; 74 | } 75 | return(set->numsockets); 76 | } 77 | 78 | /* Remove a socket from a set of sockets to be checked for available data */ 79 | int SDLNet_DelSocket(SDLNet_SocketSet set, SDLNet_GenericSocket sock) 80 | { 81 | int i; 82 | 83 | if ( sock != NULL ) { 84 | for ( i=0; inumsockets; ++i ) { 85 | if ( set->sockets[i] == (struct SDLNet_Socket *)sock ) { 86 | break; 87 | } 88 | } 89 | if ( i == set->numsockets ) { 90 | SDLNet_SetError("socket not found in socketset"); 91 | return(-1); 92 | } 93 | --set->numsockets; 94 | for ( ; inumsockets; ++i ) { 95 | set->sockets[i] = set->sockets[i+1]; 96 | } 97 | } 98 | return(set->numsockets); 99 | } 100 | 101 | /* This function checks to see if data is available for reading on the 102 | given set of sockets. If 'timeout' is 0, it performs a quick poll, 103 | otherwise the function returns when either data is available for 104 | reading, or the timeout in milliseconds has elapsed, which ever occurs 105 | first. This function returns the number of sockets ready for reading, 106 | or -1 if there was an error with the select() system call. 107 | */ 108 | int SDLNet_CheckSockets(SDLNet_SocketSet set, Uint32 timeout) 109 | { 110 | int i; 111 | SOCKET maxfd; 112 | int retval; 113 | struct timeval tv; 114 | fd_set mask; 115 | 116 | /* Find the largest file descriptor */ 117 | maxfd = 0; 118 | for ( i=set->numsockets-1; i>=0; --i ) { 119 | if ( set->sockets[i]->channel > maxfd ) { 120 | maxfd = set->sockets[i]->channel; 121 | } 122 | } 123 | 124 | /* Check the file descriptors for available data */ 125 | do { 126 | SDLNet_SetLastError(0); 127 | 128 | /* Set up the mask of file descriptors */ 129 | FD_ZERO(&mask); 130 | for ( i=set->numsockets-1; i>=0; --i ) { 131 | FD_SET(set->sockets[i]->channel, &mask); 132 | } 133 | 134 | /* Set up the timeout */ 135 | tv.tv_sec = timeout/1000; 136 | tv.tv_usec = (timeout%1000)*1000; 137 | 138 | /* Look! */ 139 | retval = select(maxfd+1, &mask, NULL, NULL, &tv); 140 | } while ( SDLNet_GetLastError() == EINTR ); 141 | 142 | /* Mark all file descriptors ready that have data available */ 143 | if ( retval > 0 ) { 144 | for ( i=set->numsockets-1; i>=0; --i ) { 145 | if ( FD_ISSET(set->sockets[i]->channel, &mask) ) { 146 | set->sockets[i]->ready = 1; 147 | } 148 | } 149 | } 150 | return(retval); 151 | } 152 | 153 | /* Free a set of sockets allocated by SDL_NetAllocSocketSet() */ 154 | void SDLNet_FreeSocketSet(SDLNet_SocketSet set) 155 | { 156 | if ( set ) { 157 | SDL_free(set->sockets); 158 | SDL_free(set); 159 | } 160 | } 161 | -------------------------------------------------------------------------------- /SDLnetsys.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL_net: An example cross-platform network library for use with SDL 3 | Copyright (C) 1997-2021 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /* Include normal system headers */ 23 | #ifdef __APPLE__ 24 | #define _DARWIN_C_SOURCE 25 | #endif 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | #if defined(__OS2__) && !defined(__EMX__) 32 | #include 33 | #elif !defined(_WIN32_WCE) 34 | #include 35 | #endif 36 | 37 | /* Include system network headers */ 38 | #if defined(__WIN32__) || defined(WIN32) 39 | #define __USE_W32_SOCKETS 40 | #ifdef _WIN64 41 | #include 42 | #include 43 | #else 44 | #include 45 | /* NOTE: windows socklen_t is signed 46 | * and is defined only for winsock2. */ 47 | typedef int socklen_t; 48 | #endif /* W64 */ 49 | #include 50 | #else /* UNIX */ 51 | #ifdef __OS2__ 52 | #include 53 | #endif 54 | #include 55 | #ifdef __FreeBSD__ 56 | #include 57 | #endif 58 | #include 59 | #include 60 | #include 61 | #include 62 | #include 63 | #ifndef __BEOS__ 64 | #include 65 | #endif 66 | #include 67 | #include 68 | #include 69 | #include 70 | #endif /* WIN32 */ 71 | 72 | #ifdef __OS2__ 73 | typedef int socklen_t; 74 | #elif 0 75 | /* FIXME: What platforms need this? */ 76 | typedef Uint32 socklen_t; 77 | #endif 78 | 79 | /* System-dependent definitions */ 80 | #ifndef __USE_W32_SOCKETS 81 | #ifdef __OS2__ 82 | #define closesocket soclose 83 | #else /* !__OS2__ */ 84 | #define closesocket close 85 | #endif /* __OS2__ */ 86 | #define SOCKET int 87 | #define INVALID_SOCKET -1 88 | #define SOCKET_ERROR -1 89 | #endif /* __USE_W32_SOCKETS */ 90 | 91 | #ifdef __USE_W32_SOCKETS 92 | #define SDLNet_GetLastError WSAGetLastError 93 | #define SDLNet_SetLastError WSASetLastError 94 | #ifndef EINTR 95 | #define EINTR WSAEINTR 96 | #endif 97 | #else 98 | int SDLNet_GetLastError(void); 99 | void SDLNet_SetLastError(int err); 100 | #endif 101 | 102 | -------------------------------------------------------------------------------- /VisualC/SDL_net.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2010 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL2_net", "SDL_net.vcxproj", "{8AB3504F-5E58-4910-AFE8-7A1E595AC3F4}" 5 | EndProject 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "showinterfaces", "showinterfaces\showinterfaces.vcxproj", "{7B1F60CD-2A09-4514-937C-D9DD044428FB}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Win32 = Debug|Win32 11 | Debug|x64 = Debug|x64 12 | Release|Win32 = Release|Win32 13 | Release|x64 = Release|x64 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {8AB3504F-5E58-4910-AFE8-7A1E595AC3F4}.Debug|Win32.ActiveCfg = Debug|Win32 17 | {8AB3504F-5E58-4910-AFE8-7A1E595AC3F4}.Debug|Win32.Build.0 = Debug|Win32 18 | {8AB3504F-5E58-4910-AFE8-7A1E595AC3F4}.Debug|x64.ActiveCfg = Debug|x64 19 | {8AB3504F-5E58-4910-AFE8-7A1E595AC3F4}.Debug|x64.Build.0 = Debug|x64 20 | {8AB3504F-5E58-4910-AFE8-7A1E595AC3F4}.Release|Win32.ActiveCfg = Release|Win32 21 | {8AB3504F-5E58-4910-AFE8-7A1E595AC3F4}.Release|Win32.Build.0 = Release|Win32 22 | {8AB3504F-5E58-4910-AFE8-7A1E595AC3F4}.Release|x64.ActiveCfg = Release|x64 23 | {8AB3504F-5E58-4910-AFE8-7A1E595AC3F4}.Release|x64.Build.0 = Release|x64 24 | {7B1F60CD-2A09-4514-937C-D9DD044428FB}.Debug|Win32.ActiveCfg = Debug|Win32 25 | {7B1F60CD-2A09-4514-937C-D9DD044428FB}.Debug|Win32.Build.0 = Debug|Win32 26 | {7B1F60CD-2A09-4514-937C-D9DD044428FB}.Debug|x64.ActiveCfg = Debug|x64 27 | {7B1F60CD-2A09-4514-937C-D9DD044428FB}.Debug|x64.Build.0 = Debug|x64 28 | {7B1F60CD-2A09-4514-937C-D9DD044428FB}.Release|Win32.ActiveCfg = Release|Win32 29 | {7B1F60CD-2A09-4514-937C-D9DD044428FB}.Release|Win32.Build.0 = Release|Win32 30 | {7B1F60CD-2A09-4514-937C-D9DD044428FB}.Release|x64.ActiveCfg = Release|x64 31 | {7B1F60CD-2A09-4514-937C-D9DD044428FB}.Release|x64.Build.0 = Release|x64 32 | EndGlobalSection 33 | GlobalSection(SolutionProperties) = preSolution 34 | HideSolutionNode = FALSE 35 | EndGlobalSection 36 | EndGlobal 37 | -------------------------------------------------------------------------------- /VisualC/SDL_net.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Debug 10 | x64 11 | 12 | 13 | Release 14 | Win32 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | SDL2_net 23 | {8AB3504F-5E58-4910-AFE8-7A1E595AC3F4} 24 | SDL_net 25 | 26 | 27 | 28 | DynamicLibrary 29 | 30 | 31 | DynamicLibrary 32 | 33 | 34 | DynamicLibrary 35 | 36 | 37 | DynamicLibrary 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | <_ProjectFileVersion>10.0.40219.1 61 | $(SolutionDir)\$(Platform)\$(Configuration)\ 62 | $(Platform)\$(Configuration)\ 63 | $(SolutionDir)\$(Platform)\$(Configuration)\ 64 | $(Platform)\$(Configuration)\ 65 | $(SolutionDir)\$(Platform)\$(Configuration)\ 66 | $(Platform)\$(Configuration)\ 67 | $(SolutionDir)\$(Platform)\$(Configuration)\ 68 | $(Platform)\$(Configuration)\ 69 | AllRules.ruleset 70 | 71 | 72 | AllRules.ruleset 73 | 74 | 75 | AllRules.ruleset 76 | 77 | 78 | AllRules.ruleset 79 | 80 | 81 | 82 | 83 | 84 | _DEBUG;%(PreprocessorDefinitions) 85 | true 86 | true 87 | Win32 88 | .\Debug/SDL2_net.tlb 89 | 90 | 91 | 92 | 93 | Disabled 94 | DLL_EXPORT;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) 95 | MultiThreadedDLL 96 | Level3 97 | OldStyle 98 | StreamingSIMDExtensions 99 | 100 | 101 | _DEBUG;%(PreprocessorDefinitions) 102 | 103 | 104 | wsock32.lib;iphlpapi.lib;SDL2.lib;%(AdditionalDependencies) 105 | true 106 | Windows 107 | 108 | 109 | 110 | 111 | _DEBUG;%(PreprocessorDefinitions) 112 | true 113 | true 114 | X64 115 | .\Debug/SDL2_net.tlb 116 | 117 | 118 | 119 | 120 | Disabled 121 | DLL_EXPORT;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) 122 | MultiThreadedDLL 123 | Level3 124 | OldStyle 125 | StreamingSIMDExtensions 126 | 127 | 128 | _DEBUG;%(PreprocessorDefinitions) 129 | 130 | 131 | ws2_32.lib;iphlpapi.lib;SDL2.lib;%(AdditionalDependencies) 132 | true 133 | Windows 134 | 135 | 136 | 137 | 138 | NDEBUG;%(PreprocessorDefinitions) 139 | true 140 | true 141 | Win32 142 | .\Release/SDL2_net.tlb 143 | 144 | 145 | 146 | 147 | DLL_EXPORT;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) 148 | MultiThreadedDLL 149 | Level3 150 | StreamingSIMDExtensions 151 | 152 | 153 | NDEBUG;%(PreprocessorDefinitions) 154 | 155 | 156 | wsock32.lib;iphlpapi.lib;SDL2.lib;%(AdditionalDependencies) 157 | Windows 158 | 159 | 160 | 161 | 162 | 163 | NDEBUG;%(PreprocessorDefinitions) 164 | true 165 | true 166 | X64 167 | .\Release/SDL2_net.tlb 168 | 169 | 170 | 171 | 172 | DLL_EXPORT;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) 173 | MultiThreadedDLL 174 | Level3 175 | StreamingSIMDExtensions 176 | 177 | 178 | NDEBUG;%(PreprocessorDefinitions) 179 | 180 | 181 | ws2_32.lib;iphlpapi.lib;SDL2.lib;%(AdditionalDependencies) 182 | Windows 183 | 184 | 185 | 186 | 187 | %(PreprocessorDefinitions) 188 | %(PreprocessorDefinitions) 189 | %(PreprocessorDefinitions) 190 | %(PreprocessorDefinitions) 191 | 192 | 193 | %(PreprocessorDefinitions) 194 | %(PreprocessorDefinitions) 195 | %(PreprocessorDefinitions) 196 | %(PreprocessorDefinitions) 197 | 198 | 199 | %(PreprocessorDefinitions) 200 | %(PreprocessorDefinitions) 201 | %(PreprocessorDefinitions) 202 | %(PreprocessorDefinitions) 203 | 204 | 205 | %(PreprocessorDefinitions) 206 | %(PreprocessorDefinitions) 207 | %(PreprocessorDefinitions) 208 | %(PreprocessorDefinitions) 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | %(PreprocessorDefinitions) 218 | %(PreprocessorDefinitions) 219 | %(PreprocessorDefinitions) 220 | %(PreprocessorDefinitions) 221 | 222 | 223 | 224 | 225 | 226 | -------------------------------------------------------------------------------- /VisualC/SDL_net.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {2cc01156-0219-4532-b5cc-4deb572c8d16} 6 | 7 | 8 | {64a63be2-c42b-4b99-a06a-61d4cc4efa21} 9 | 10 | 11 | 12 | 13 | Sources 14 | 15 | 16 | Sources 17 | 18 | 19 | Sources 20 | 21 | 22 | Sources 23 | 24 | 25 | 26 | 27 | Sources 28 | 29 | 30 | Public Headers 31 | 32 | 33 | 34 | 35 | Sources 36 | 37 | 38 | -------------------------------------------------------------------------------- /VisualC/SDL_net_VS2008.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 10.00 3 | # Visual Studio 2008 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL2_net", "SDL_net_VS2008.vcproj", "{8AB3504F-5E58-4910-AFE8-7A1E595AC3F4}" 5 | EndProject 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "showinterfaces", "showinterfaces\showinterfaces_VS2008.vcproj", "{7B1F60CD-2A09-4514-937C-D9DD044428FB}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Win32 = Debug|Win32 11 | Debug|x64 = Debug|x64 12 | Release|Win32 = Release|Win32 13 | Release|x64 = Release|x64 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {8AB3504F-5E58-4910-AFE8-7A1E595AC3F4}.Debug|Win32.ActiveCfg = Debug|Win32 17 | {8AB3504F-5E58-4910-AFE8-7A1E595AC3F4}.Debug|Win32.Build.0 = Debug|Win32 18 | {8AB3504F-5E58-4910-AFE8-7A1E595AC3F4}.Debug|x64.ActiveCfg = Debug|x64 19 | {8AB3504F-5E58-4910-AFE8-7A1E595AC3F4}.Debug|x64.Build.0 = Debug|x64 20 | {8AB3504F-5E58-4910-AFE8-7A1E595AC3F4}.Release|Win32.ActiveCfg = Release|Win32 21 | {8AB3504F-5E58-4910-AFE8-7A1E595AC3F4}.Release|Win32.Build.0 = Release|Win32 22 | {8AB3504F-5E58-4910-AFE8-7A1E595AC3F4}.Release|x64.ActiveCfg = Release|x64 23 | {8AB3504F-5E58-4910-AFE8-7A1E595AC3F4}.Release|x64.Build.0 = Release|x64 24 | {7B1F60CD-2A09-4514-937C-D9DD044428FB}.Debug|Win32.ActiveCfg = Debug|Win32 25 | {7B1F60CD-2A09-4514-937C-D9DD044428FB}.Debug|Win32.Build.0 = Debug|Win32 26 | {7B1F60CD-2A09-4514-937C-D9DD044428FB}.Debug|x64.ActiveCfg = Debug|x64 27 | {7B1F60CD-2A09-4514-937C-D9DD044428FB}.Debug|x64.Build.0 = Debug|x64 28 | {7B1F60CD-2A09-4514-937C-D9DD044428FB}.Release|Win32.ActiveCfg = Release|Win32 29 | {7B1F60CD-2A09-4514-937C-D9DD044428FB}.Release|Win32.Build.0 = Release|Win32 30 | {7B1F60CD-2A09-4514-937C-D9DD044428FB}.Release|x64.ActiveCfg = Release|x64 31 | {7B1F60CD-2A09-4514-937C-D9DD044428FB}.Release|x64.Build.0 = Release|x64 32 | EndGlobalSection 33 | GlobalSection(SolutionProperties) = preSolution 34 | HideSolutionNode = FALSE 35 | EndGlobalSection 36 | EndGlobal 37 | -------------------------------------------------------------------------------- /VisualC/SDL_net_VS2008.vcproj: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 14 | 17 | 18 | 19 | 20 | 21 | 30 | 33 | 36 | 39 | 42 | 51 | 60 | 63 | 67 | 70 | 76 | 79 | 82 | 85 | 88 | 91 | 94 | 97 | 98 | 107 | 110 | 113 | 116 | 119 | 128 | 137 | 140 | 144 | 147 | 153 | 156 | 159 | 162 | 165 | 168 | 171 | 174 | 175 | 184 | 187 | 190 | 193 | 196 | 205 | 212 | 215 | 219 | 222 | 227 | 230 | 233 | 236 | 239 | 242 | 245 | 248 | 249 | 258 | 261 | 264 | 267 | 270 | 279 | 286 | 289 | 293 | 296 | 301 | 304 | 307 | 310 | 313 | 316 | 319 | 322 | 323 | 324 | 325 | 326 | 327 | 330 | 333 | 336 | 340 | 341 | 344 | 348 | 349 | 352 | 356 | 357 | 360 | 364 | 365 | 366 | 369 | 372 | 376 | 377 | 380 | 384 | 385 | 388 | 392 | 393 | 396 | 400 | 401 | 402 | 405 | 406 | 409 | 412 | 416 | 417 | 420 | 424 | 425 | 428 | 432 | 433 | 436 | 440 | 441 | 442 | 445 | 448 | 452 | 453 | 456 | 460 | 461 | 464 | 468 | 469 | 472 | 476 | 477 | 478 | 481 | 484 | 488 | 489 | 492 | 496 | 497 | 500 | 504 | 505 | 508 | 512 | 513 | 514 | 515 | 518 | 521 | 522 | 523 | 524 | 525 | 526 | 527 | -------------------------------------------------------------------------------- /VisualC/Version.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDL-mirror/SDL_net/96478de8ef9d2195cd2606da5f2fb81e9e867039/VisualC/Version.rc -------------------------------------------------------------------------------- /VisualC/clean.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | find . -type f \( -name '*.user' -o -name '*.sdf' -o -name '*.ncb' -o -name '*.suo' \) -print -delete 3 | rm -rvf Win32 */Win32 x64 */x64 4 | -------------------------------------------------------------------------------- /VisualC/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Developer Studio generated include file. 3 | // Used by Version.rc 4 | // 5 | 6 | // Next default values for new objects 7 | // 8 | #ifdef APSTUDIO_INVOKED 9 | #ifndef APSTUDIO_READONLY_SYMBOLS 10 | #define _APS_NEXT_RESOURCE_VALUE 101 11 | #define _APS_NEXT_COMMAND_VALUE 40001 12 | #define _APS_NEXT_CONTROL_VALUE 1000 13 | #define _APS_NEXT_SYMED_VALUE 101 14 | #endif 15 | #endif 16 | -------------------------------------------------------------------------------- /VisualC/showinterfaces/showinterfaces_VS2008.vcproj: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 14 | 17 | 18 | 19 | 20 | 21 | 30 | 33 | 36 | 39 | 42 | 51 | 57 | 60 | 65 | 68 | 73 | 76 | 79 | 82 | 85 | 88 | 91 | 95 | 96 | 105 | 108 | 111 | 114 | 117 | 126 | 132 | 135 | 140 | 143 | 148 | 151 | 154 | 157 | 160 | 163 | 166 | 170 | 171 | 180 | 183 | 186 | 189 | 192 | 201 | 209 | 212 | 217 | 220 | 226 | 229 | 232 | 235 | 238 | 241 | 244 | 248 | 249 | 258 | 261 | 264 | 267 | 270 | 279 | 287 | 290 | 295 | 298 | 304 | 307 | 310 | 313 | 316 | 319 | 322 | 326 | 327 | 328 | 329 | 336 | 337 | 338 | 341 | 344 | 348 | 349 | 352 | 356 | 357 | 360 | 364 | 365 | 368 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | -------------------------------------------------------------------------------- /Xcode-iOS/SDL_net.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | BE48FF6707AFA9A800BB41DA /* SDLnetsys.h in Headers */ = {isa = PBXBuildFile; fileRef = 0E06A2830119C8317F000001 /* SDLnetsys.h */; }; 11 | BE48FF6907AFA9A800BB41DA /* SDLnet.c in Sources */ = {isa = PBXBuildFile; fileRef = 0E06A2810119C8317F000001 /* SDLnet.c */; }; 12 | BE48FF6A07AFA9A800BB41DA /* SDLnetselect.c in Sources */ = {isa = PBXBuildFile; fileRef = 0E06A2820119C8317F000001 /* SDLnetselect.c */; }; 13 | BE48FF6B07AFA9A800BB41DA /* SDLnetTCP.c in Sources */ = {isa = PBXBuildFile; fileRef = 0E06A2840119C8317F000001 /* SDLnetTCP.c */; }; 14 | BE48FF6C07AFA9A800BB41DA /* SDLnetUDP.c in Sources */ = {isa = PBXBuildFile; fileRef = 0E06A2850119C8317F000001 /* SDLnetUDP.c */; }; 15 | /* End PBXBuildFile section */ 16 | 17 | /* Begin PBXFileReference section */ 18 | 0E06A2810119C8317F000001 /* SDLnet.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = SDLnet.c; path = ../SDLnet.c; sourceTree = SOURCE_ROOT; }; 19 | 0E06A2820119C8317F000001 /* SDLnetselect.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = SDLnetselect.c; path = ../SDLnetselect.c; sourceTree = SOURCE_ROOT; }; 20 | 0E06A2830119C8317F000001 /* SDLnetsys.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = SDLnetsys.h; path = ../SDLnetsys.h; sourceTree = SOURCE_ROOT; }; 21 | 0E06A2840119C8317F000001 /* SDLnetTCP.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = SDLnetTCP.c; path = ../SDLnetTCP.c; sourceTree = SOURCE_ROOT; }; 22 | 0E06A2850119C8317F000001 /* SDLnetUDP.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = SDLnetUDP.c; path = ../SDLnetUDP.c; sourceTree = SOURCE_ROOT; }; 23 | 1014BAEA010A4B677F000001 /* SDL_net.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = SDL_net.h; path = ../SDL_net.h; sourceTree = SOURCE_ROOT; }; 24 | 1014BAEB010A4B677F000001 /* SDLnet.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = SDLnet.c; path = ../SDLnet.c; sourceTree = SOURCE_ROOT; }; 25 | 1014BAEC010A4B677F000001 /* SDLnetselect.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = SDLnetselect.c; path = ../SDLnetselect.c; sourceTree = SOURCE_ROOT; }; 26 | 1014BAED010A4B677F000001 /* SDLnetTCP.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = SDLnetTCP.c; path = ../SDLnetTCP.c; sourceTree = SOURCE_ROOT; }; 27 | 1014BAEE010A4B677F000001 /* SDLnetUDP.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = SDLnetUDP.c; path = ../SDLnetUDP.c; sourceTree = SOURCE_ROOT; }; 28 | BE48FF6F07AFA9A900BB41DA /* libSDL2_net.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libSDL2_net.a; sourceTree = BUILT_PRODUCTS_DIR; }; 29 | /* End PBXFileReference section */ 30 | 31 | /* Begin PBXFrameworksBuildPhase section */ 32 | BE48FF6D07AFA9A800BB41DA /* Frameworks */ = { 33 | isa = PBXFrameworksBuildPhase; 34 | buildActionMask = 2147483647; 35 | files = ( 36 | ); 37 | runOnlyForDeploymentPostprocessing = 0; 38 | }; 39 | /* End PBXFrameworksBuildPhase section */ 40 | 41 | /* Begin PBXGroup section */ 42 | 0153844A006D81B07F000001 /* Public Headers */ = { 43 | isa = PBXGroup; 44 | children = ( 45 | 1014BAEA010A4B677F000001 /* SDL_net.h */, 46 | ); 47 | name = "Public Headers"; 48 | sourceTree = ""; 49 | }; 50 | 034768DDFF38A45A11DB9C8B /* Products */ = { 51 | isa = PBXGroup; 52 | children = ( 53 | 089C1665FE841158C02AAC07 /* Resources */, 54 | BE48FF6F07AFA9A900BB41DA /* libSDL2_net.a */, 55 | ); 56 | name = Products; 57 | sourceTree = ""; 58 | }; 59 | 0867D691FE84028FC02AAC07 /* SDL_netFramework */ = { 60 | isa = PBXGroup; 61 | children = ( 62 | 0153844A006D81B07F000001 /* Public Headers */, 63 | 08FB77ACFE841707C02AAC07 /* Library Source */, 64 | 034768DDFF38A45A11DB9C8B /* Products */, 65 | ); 66 | name = SDL_netFramework; 67 | sourceTree = ""; 68 | }; 69 | 089C1665FE841158C02AAC07 /* Resources */ = { 70 | isa = PBXGroup; 71 | children = ( 72 | ); 73 | name = Resources; 74 | sourceTree = ""; 75 | }; 76 | 08FB77ACFE841707C02AAC07 /* Library Source */ = { 77 | isa = PBXGroup; 78 | children = ( 79 | 0E06A2830119C8317F000001 /* SDLnetsys.h */, 80 | 1014BAEB010A4B677F000001 /* SDLnet.c */, 81 | 1014BAEC010A4B677F000001 /* SDLnetselect.c */, 82 | 1014BAED010A4B677F000001 /* SDLnetTCP.c */, 83 | 1014BAEE010A4B677F000001 /* SDLnetUDP.c */, 84 | 0E06A2810119C8317F000001 /* SDLnet.c */, 85 | 0E06A2820119C8317F000001 /* SDLnetselect.c */, 86 | 0E06A2840119C8317F000001 /* SDLnetTCP.c */, 87 | 0E06A2850119C8317F000001 /* SDLnetUDP.c */, 88 | ); 89 | name = "Library Source"; 90 | sourceTree = ""; 91 | }; 92 | /* End PBXGroup section */ 93 | 94 | /* Begin PBXHeadersBuildPhase section */ 95 | BE48FF6607AFA9A800BB41DA /* Headers */ = { 96 | isa = PBXHeadersBuildPhase; 97 | buildActionMask = 2147483647; 98 | files = ( 99 | BE48FF6707AFA9A800BB41DA /* SDLnetsys.h in Headers */, 100 | ); 101 | runOnlyForDeploymentPostprocessing = 0; 102 | }; 103 | /* End PBXHeadersBuildPhase section */ 104 | 105 | /* Begin PBXNativeTarget section */ 106 | BE48FF6507AFA9A800BB41DA /* Static Library */ = { 107 | isa = PBXNativeTarget; 108 | buildConfigurationList = 00F072010992C7C800D99510 /* Build configuration list for PBXNativeTarget "Static Library" */; 109 | buildPhases = ( 110 | BE48FF6607AFA9A800BB41DA /* Headers */, 111 | BE48FF6807AFA9A800BB41DA /* Sources */, 112 | BE48FF6D07AFA9A800BB41DA /* Frameworks */, 113 | BE48FF6E07AFA9A800BB41DA /* Rez */, 114 | ); 115 | buildRules = ( 116 | ); 117 | dependencies = ( 118 | ); 119 | name = "Static Library"; 120 | productInstallPath = /usr/local/lib; 121 | productName = "Static Library"; 122 | productReference = BE48FF6F07AFA9A900BB41DA /* libSDL2_net.a */; 123 | productType = "com.apple.product-type.library.static"; 124 | }; 125 | /* End PBXNativeTarget section */ 126 | 127 | /* Begin PBXProject section */ 128 | 0867D690FE84028FC02AAC07 /* Project object */ = { 129 | isa = PBXProject; 130 | attributes = { 131 | LastUpgradeCheck = 0630; 132 | }; 133 | buildConfigurationList = 00F072090992C7C800D99510 /* Build configuration list for PBXProject "SDL_net" */; 134 | compatibilityVersion = "Xcode 3.2"; 135 | developmentRegion = English; 136 | hasScannedForEncodings = 1; 137 | knownRegions = ( 138 | English, 139 | Japanese, 140 | French, 141 | German, 142 | ); 143 | mainGroup = 0867D691FE84028FC02AAC07 /* SDL_netFramework */; 144 | productRefGroup = 034768DDFF38A45A11DB9C8B /* Products */; 145 | projectDirPath = ""; 146 | projectRoot = ""; 147 | targets = ( 148 | BE48FF6507AFA9A800BB41DA /* Static Library */, 149 | ); 150 | }; 151 | /* End PBXProject section */ 152 | 153 | /* Begin PBXRezBuildPhase section */ 154 | BE48FF6E07AFA9A800BB41DA /* Rez */ = { 155 | isa = PBXRezBuildPhase; 156 | buildActionMask = 2147483647; 157 | files = ( 158 | ); 159 | runOnlyForDeploymentPostprocessing = 0; 160 | }; 161 | /* End PBXRezBuildPhase section */ 162 | 163 | /* Begin PBXSourcesBuildPhase section */ 164 | BE48FF6807AFA9A800BB41DA /* Sources */ = { 165 | isa = PBXSourcesBuildPhase; 166 | buildActionMask = 2147483647; 167 | files = ( 168 | BE48FF6907AFA9A800BB41DA /* SDLnet.c in Sources */, 169 | BE48FF6A07AFA9A800BB41DA /* SDLnetselect.c in Sources */, 170 | BE48FF6B07AFA9A800BB41DA /* SDLnetTCP.c in Sources */, 171 | BE48FF6C07AFA9A800BB41DA /* SDLnetUDP.c in Sources */, 172 | ); 173 | runOnlyForDeploymentPostprocessing = 0; 174 | }; 175 | /* End PBXSourcesBuildPhase section */ 176 | 177 | /* Begin XCBuildConfiguration section */ 178 | 00F072020992C7C800D99510 /* Debug */ = { 179 | isa = XCBuildConfiguration; 180 | buildSettings = { 181 | DYLIB_COMPATIBILITY_VERSION = 1; 182 | DYLIB_CURRENT_VERSION = 1.1.0; 183 | IPHONEOS_DEPLOYMENT_TARGET = 5.1; 184 | LIBRARY_STYLE = STATIC; 185 | OTHER_LDFLAGS = ""; 186 | PRODUCT_NAME = SDL2_net; 187 | SKIP_INSTALL = YES; 188 | }; 189 | name = Debug; 190 | }; 191 | 00F072030992C7C800D99510 /* Release */ = { 192 | isa = XCBuildConfiguration; 193 | buildSettings = { 194 | DYLIB_COMPATIBILITY_VERSION = 1; 195 | DYLIB_CURRENT_VERSION = 1.1.0; 196 | IPHONEOS_DEPLOYMENT_TARGET = 5.1; 197 | LIBRARY_STYLE = STATIC; 198 | OTHER_LDFLAGS = ""; 199 | PRODUCT_NAME = SDL2_net; 200 | SKIP_INSTALL = YES; 201 | }; 202 | name = Release; 203 | }; 204 | 00F0720A0992C7C800D99510 /* Debug */ = { 205 | isa = XCBuildConfiguration; 206 | buildSettings = { 207 | GCC_OPTIMIZATION_LEVEL = 0; 208 | GCC_SYMBOLS_PRIVATE_EXTERN = YES; 209 | HEADER_SEARCH_PATHS = "\"$(SRCROOT)/../../SDL/include\""; 210 | IPHONEOS_DEPLOYMENT_TARGET = 3.0; 211 | ONLY_ACTIVE_ARCH = YES; 212 | SDKROOT = iphoneos; 213 | TARGETED_DEVICE_FAMILY = "1,2"; 214 | }; 215 | name = Debug; 216 | }; 217 | 00F0720B0992C7C800D99510 /* Release */ = { 218 | isa = XCBuildConfiguration; 219 | buildSettings = { 220 | GCC_GENERATE_DEBUGGING_SYMBOLS = NO; 221 | GCC_SYMBOLS_PRIVATE_EXTERN = YES; 222 | HEADER_SEARCH_PATHS = "\"$(SRCROOT)/../../SDL/include\""; 223 | IPHONEOS_DEPLOYMENT_TARGET = 3.0; 224 | SDKROOT = iphoneos; 225 | TARGETED_DEVICE_FAMILY = "1,2"; 226 | }; 227 | name = Release; 228 | }; 229 | /* End XCBuildConfiguration section */ 230 | 231 | /* Begin XCConfigurationList section */ 232 | 00F072010992C7C800D99510 /* Build configuration list for PBXNativeTarget "Static Library" */ = { 233 | isa = XCConfigurationList; 234 | buildConfigurations = ( 235 | 00F072020992C7C800D99510 /* Debug */, 236 | 00F072030992C7C800D99510 /* Release */, 237 | ); 238 | defaultConfigurationIsVisible = 0; 239 | defaultConfigurationName = Debug; 240 | }; 241 | 00F072090992C7C800D99510 /* Build configuration list for PBXProject "SDL_net" */ = { 242 | isa = XCConfigurationList; 243 | buildConfigurations = ( 244 | 00F0720A0992C7C800D99510 /* Debug */, 245 | 00F0720B0992C7C800D99510 /* Release */, 246 | ); 247 | defaultConfigurationIsVisible = 0; 248 | defaultConfigurationName = Debug; 249 | }; 250 | /* End XCConfigurationList section */ 251 | }; 252 | rootObject = 0867D690FE84028FC02AAC07 /* Project object */; 253 | } 254 | -------------------------------------------------------------------------------- /Xcode/Info-Framework.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | SDL2_net 9 | CFBundleIdentifier 10 | org.libsdl.SDL2-net 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | SDL2_net 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 2.0.1 19 | CFBundleVersion 20 | 2.0.1 21 | 22 | 23 | -------------------------------------------------------------------------------- /Xcode/package: -------------------------------------------------------------------------------- 1 | #! /bin/csh -ef 2 | 3 | set prog = `/usr/bin/basename $0` 4 | set usage = "Usage: $prog [-f] root-dir info-file [tiff-file] [-d dest-dir] [-r resource-dir] [-traditional | -gnutar]" 5 | set noglob 6 | 7 | if (-x /usr/bin/mkbom) then 8 | set mkbom=/usr/bin/mkbom 9 | set lsbom=/usr/bin/lsbom 10 | else 11 | set mkbom=/usr/etc/mkbom 12 | set lsbom=/usr/etc/lsbom 13 | endif 14 | 15 | if (-x /usr/bin/awk) then 16 | set awk=/usr/bin/awk 17 | else 18 | set awk=/bin/awk 19 | endif 20 | 21 | set gnutar=/usr/bin/gnutar 22 | set tar=/usr/bin/tar 23 | set pax=/bin/pax 24 | 25 | # gather parameters 26 | if ($#argv == 0) then 27 | echo $usage 28 | exit(1) 29 | endif 30 | 31 | while ( $#argv > 0 ) 32 | switch ( $argv[1] ) 33 | case -d: 34 | if ( $?destDir ) then 35 | echo ${prog}: dest-dir parameter already set to ${destDir}. 36 | echo $usage 37 | exit(1) 38 | else if ( $#argv < 2 ) then 39 | echo ${prog}: -d option requires destination directory. 40 | echo $usage 41 | exit(1) 42 | else 43 | set destDir = $argv[2] 44 | shift; shift 45 | breaksw 46 | endif 47 | case -f: 48 | if ( $?rootDir ) then 49 | echo ${prog}: root-dir parameter already set to ${rootDir}. 50 | echo $usage 51 | exit(1) 52 | else if ( $#argv < 2 ) then 53 | echo ${prog}: -f option requires package root directory. 54 | echo $usage 55 | exit(1) 56 | else 57 | set rootDir = $argv[2] 58 | set fflag 59 | shift; shift 60 | breaksw 61 | endif 62 | case -r: 63 | if ( $?resDir ) then 64 | echo ${prog}: resource-dir parameter already set to ${resDir}. 65 | echo $usage 66 | exit(1) 67 | else if ( $#argv < 2 ) then 68 | echo ${prog}: -r option requires package resource directory. 69 | echo $usage 70 | exit(1) 71 | else 72 | set resDir = $argv[2] 73 | shift; shift 74 | breaksw 75 | endif 76 | case -traditional: 77 | set usetar 78 | unset usegnutar 79 | unset usepax 80 | breaksw 81 | case -gnutar: 82 | set usegnutar 83 | unset usepax 84 | unset usetar 85 | case -B: 86 | # We got long file names, better use bigtar instead 87 | #set archiver = /NextAdmin/Installer.app/Resources/installer_bigtar 88 | echo 2>&1 ${prog}: -B flag is no longer relevant. 89 | shift 90 | breaksw 91 | case -*: 92 | echo ${prog}: Unknown option: $argv[1] 93 | echo $usage 94 | exit(1) 95 | case *.info: 96 | if ( $?info ) then 97 | echo ${prog}: info-file parameter already set to ${info}. 98 | echo $usage 99 | exit(1) 100 | else 101 | set info = "$argv[1]" 102 | shift 103 | breaksw 104 | endif 105 | case *.tiff: 106 | if ( $?tiff ) then 107 | echo ${prog}: tiff-file parameter already set to ${tiff}. 108 | echo $usage 109 | exit(1) 110 | else 111 | set tiff = "$argv[1]" 112 | shift 113 | breaksw 114 | endif 115 | default: 116 | if ( $?rootDir ) then 117 | echo ${prog}: unrecognized parameter: $argv[1] 118 | echo $usage 119 | exit(1) 120 | else 121 | set rootDir = "$argv[1]" 122 | shift 123 | breaksw 124 | endif 125 | endsw 126 | end 127 | 128 | # check for mandatory parameters 129 | if ( ! $?rootDir ) then 130 | echo ${prog}: missing root-dir parameter. 131 | echo $usage 132 | exit(1) 133 | else if ( ! $?info) then 134 | echo ${prog}: missing info-file parameter. 135 | echo $usage 136 | exit(1) 137 | endif 138 | 139 | # destDir gets default value if unset on command line 140 | if ( $?destDir ) then 141 | /bin/mkdir -p $destDir 142 | else 143 | set destDir = . 144 | endif 145 | 146 | # derive the root name for the package from the root name of the info file 147 | set root = `/usr/bin/basename $info .info` 148 | 149 | # create package directory 150 | set pkg = ${destDir}/${root}.pkg 151 | echo Generating Installer package $pkg ... 152 | if ( -e $pkg ) /bin/rm -rf $pkg 153 | /bin/mkdir -p -m 755 $pkg 154 | 155 | # (gnu)tar/pax and compress root directory to package archive 156 | echo -n " creating package archive ... " 157 | if ( $?fflag ) then 158 | set pkgTop = ${rootDir:t} 159 | set parent = ${rootDir:h} 160 | if ( "$parent" == "$pkgTop" ) set parent = "." 161 | else 162 | set parent = $rootDir 163 | set pkgTop = . 164 | endif 165 | if ( $?usetar ) then 166 | set pkgArchive = $pkg/$root.tar.Z 167 | (cd $parent; $tar -w $pkgTop) | /usr/bin/compress -f -c > $pkgArchive 168 | else if ( $?usegnutar ) then 169 | set pkgArchive = $pkg/$root.tar.gz 170 | (cd $parent; $gnutar zcf $pkgArchive $pkgTop) 171 | else 172 | set pkgArchive = $pkg/$root.pax.gz 173 | (cd $parent; $pax -w -z -x cpio $pkgTop) > $pkgArchive 174 | endif 175 | /bin/chmod 444 $pkgArchive 176 | echo done. 177 | 178 | # copy info file to package 179 | set pkgInfo = $pkg/$root.info 180 | echo -n " copying ${info:t} ... " 181 | /bin/cp $info $pkgInfo 182 | /bin/chmod 444 $pkgInfo 183 | echo done. 184 | 185 | # copy tiff file to package 186 | if ( $?tiff ) then 187 | set pkgTiff = $pkg/$root.tiff 188 | echo -n " copying ${tiff:t} ... " 189 | /bin/cp $tiff $pkgTiff 190 | /bin/chmod 444 $pkgTiff 191 | echo done. 192 | endif 193 | 194 | # copy resources to package 195 | if ( $?resDir ) then 196 | echo -n " copying ${resDir:t} ... " 197 | 198 | # don't want to see push/pop output 199 | pushd $resDir > /dev/null 200 | # get lists of resources. We'll want to change 201 | # permissions on just these things later. 202 | set directoriesInResDir = `find . -type d` 203 | set filesInResDir = `find . -type f` 204 | popd > /dev/null 205 | 206 | # copy the resource directory contents into the package directory 207 | foreach resFile (`ls $resDir`) 208 | cp -r $resDir/$resFile $pkg 209 | end 210 | 211 | pushd $pkg > /dev/null 212 | # Change all directories to +r+x, except the package 213 | # directory itself 214 | foreach resFileItem ($directoriesInResDir) 215 | if ( $resFileItem != "." ) then 216 | chmod 555 $resFileItem 217 | endif 218 | end 219 | # change all flat files to read only 220 | foreach resFileItem ($filesInResDir) 221 | chmod 444 $resFileItem 222 | end 223 | popd > /dev/null 224 | 225 | echo done. 226 | endif 227 | 228 | # generate bom file 229 | set pkgBom = $pkg/$root.bom 230 | echo -n " generating bom file ... " 231 | /bin/rm -f $pkgBom 232 | if ( $?fflag ) then 233 | $mkbom $parent $pkgBom >& /dev/null 234 | else 235 | $mkbom $rootDir $pkgBom >& /dev/null 236 | endif 237 | /bin/chmod 444 $pkgArchive 238 | echo done. 239 | 240 | # generate sizes file 241 | set pkgSizes = $pkg/$root.sizes 242 | echo -n " generating sizes file ... " 243 | 244 | # compute number of files in package 245 | set numFiles = `$lsbom -s $pkgBom | /usr/bin/wc -l` 246 | 247 | # compute package size when compressed 248 | @ compressedSize = `/usr/bin/du -k -s $pkg | $awk '{print $1}'` 249 | @ compressedSize += 3 # add 1KB each for sizes, location, status files 250 | 251 | @ infoSize = `/bin/ls -s $pkgInfo | $awk '{print $1}'` 252 | @ bomSize = `/bin/ls -s $pkgBom | $awk '{print $1}'` 253 | if ( $?tiff ) then 254 | @ tiffSize = `/bin/ls -s $pkgTiff | $awk '{print $1}'` 255 | else 256 | @ tiffSize = 0 257 | endif 258 | 259 | @ installedSize = `/usr/bin/du -k -s $rootDir | $awk '{print $1}'` 260 | @ installedSize += $infoSize + $bomSize + $tiffSize + 3 261 | 262 | # echo size parameters to sizes file 263 | echo NumFiles $numFiles > $pkgSizes 264 | echo InstalledSize $installedSize >> $pkgSizes 265 | echo CompressedSize $compressedSize >> $pkgSizes 266 | echo done. 267 | echo " ... finished generating $pkg." 268 | 269 | exit(0) 270 | 271 | # end package 272 | 273 | -------------------------------------------------------------------------------- /Xcode/pkg-support/SDL_net.info: -------------------------------------------------------------------------------- 1 | Title SDL_net 1.2.5 2 | Version 1 3 | Description SDL_net Library for Mac OS X (http://www.libsdl.org/projects/SDL_net) 4 | DefaultLocation /Library/Frameworks 5 | Diskname (null) 6 | DeleteWarning 7 | NeedsAuthorization NO 8 | DisableStop NO 9 | UseUserMask NO 10 | Application NO 11 | Relocatable YES 12 | Required NO 13 | InstallOnly NO 14 | RequiresReboot NO 15 | InstallFat NO 16 | -------------------------------------------------------------------------------- /Xcode/pkg-support/mkpackage.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Generic script to create a package with Project Builder in mind 4 | # There should only be one version of this script for all projects! 5 | 6 | FRAMEWORK="$1" 7 | VARIANT="$2" 8 | 9 | PACKAGE="$FRAMEWORK" 10 | PACKAGE_RESOURCES="pkg-support/resources" 11 | 12 | echo "Building package for $FRAMEWORK.framework" 13 | echo "Will fetch resources from $PACKAGE_RESOURCES" 14 | echo "Will create the package $PACKAGE.pkg" 15 | 16 | # create a copy of the framework 17 | mkdir -p build/pkg-tmp 18 | xcrun CpMac -r "build/$FRAMEWORK.framework" build/pkg-tmp/ 19 | 20 | ./package build/pkg-tmp "pkg-support/$PACKAGE.info" -d build -r "$PACKAGE_RESOURCES" 21 | 22 | # remove temporary files 23 | rm -rf build/pkg-tmp 24 | 25 | # compress 26 | (cd build; tar -zcvf "$PACKAGE.pkg.tar.gz" "$PACKAGE.pkg") 27 | 28 | -------------------------------------------------------------------------------- /Xcode/pkg-support/resources/ReadMe.txt: -------------------------------------------------------------------------------- 1 | SDL_net is an example portable network library for use with SDL. 2 | 3 | The source code is available from: http://www.libsdl.org/projects/SDL_net 4 | 5 | This library is distributed under the terms of the zlib license: http://www.zlib.net/zlib_license.html 6 | 7 | This packages contains the SDL2_net.framework for OS X. Conforming with Apple guidelines, this framework contains both the SDL runtime component and development header files. 8 | 9 | Requirements: 10 | You must have the SDL2.framework installed. 11 | 12 | To Install: 13 | Copy the SDL2_net.framework to /Library/Frameworks 14 | 15 | You may alternatively install it in /Library/Frameworks if your access privileges are not high enough. (Be aware that the Xcode templates we provide in the SDL Developer Extras package may require some adjustment for your system if you do this.) 16 | 17 | 18 | (Partial) History of PB/Xcode projects: 19 | 2009-09-21 - Updated for 64-bit (Snow Leopard) Universal Binaries. 20 | Switched to 10.4 minimum requirement. 21 | 22 | 2006-01-31 - First entry in history. Updated for Universal Binaries. 23 | 24 | -------------------------------------------------------------------------------- /Xcode/pkg-support/resources/Welcome.txt: -------------------------------------------------------------------------------- 1 | This package installs the SDL_net library into /Library/Frameworks. You can also install it in 2 | /Library/Frameworks if your access privileges are not high enough. 3 | 4 | -------------------------------------------------------------------------------- /acinclude/ltoptions.m4: -------------------------------------------------------------------------------- 1 | ############################################################################## 2 | # Helper functions for option handling. -*- Autoconf -*- 3 | # 4 | # Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. 5 | # Written by Gary V. Vaughan, 2004 6 | # 7 | # This file is free software; the Free Software Foundation gives 8 | # unlimited permission to copy and/or distribute it, with or without 9 | # modifications, as long as this notice is preserved. 10 | 11 | # serial 6 ltoptions.m4 12 | 13 | # This is to help aclocal find these macros, as it can't see m4_define. 14 | AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) 15 | 16 | 17 | # _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) 18 | # ------------------------------------------ 19 | m4_define([_LT_MANGLE_OPTION], 20 | [[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) 21 | 22 | 23 | # _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) 24 | # --------------------------------------- 25 | # Set option OPTION-NAME for macro MACRO-NAME, and if there is a 26 | # matching handler defined, dispatch to it. Other OPTION-NAMEs are 27 | # saved as a flag. 28 | m4_define([_LT_SET_OPTION], 29 | [m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl 30 | m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), 31 | _LT_MANGLE_DEFUN([$1], [$2]), 32 | [m4_warning([Unknown $1 option `$2'])])[]dnl 33 | ]) 34 | 35 | 36 | # _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) 37 | # ------------------------------------------------------------ 38 | # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. 39 | m4_define([_LT_IF_OPTION], 40 | [m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) 41 | 42 | 43 | # _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) 44 | # ------------------------------------------------------- 45 | # Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME 46 | # are set. 47 | m4_define([_LT_UNLESS_OPTIONS], 48 | [m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), 49 | [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), 50 | [m4_define([$0_found])])])[]dnl 51 | m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 52 | ])[]dnl 53 | ]) 54 | 55 | 56 | # _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) 57 | # ---------------------------------------- 58 | # OPTION-LIST is a space-separated list of Libtool options associated 59 | # with MACRO-NAME. If any OPTION has a matching handler declared with 60 | # LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about 61 | # the unknown option and exit. 62 | m4_defun([_LT_SET_OPTIONS], 63 | [# Set options 64 | m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), 65 | [_LT_SET_OPTION([$1], _LT_Option)]) 66 | 67 | m4_if([$1],[LT_INIT],[ 68 | dnl 69 | dnl Simply set some default values (i.e off) if boolean options were not 70 | dnl specified: 71 | _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no 72 | ]) 73 | _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no 74 | ]) 75 | dnl 76 | dnl If no reference was made to various pairs of opposing options, then 77 | dnl we run the default mode handler for the pair. For example, if neither 78 | dnl `shared' nor `disable-shared' was passed, we enable building of shared 79 | dnl archives by default: 80 | _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) 81 | _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) 82 | _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) 83 | _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], 84 | [_LT_ENABLE_FAST_INSTALL]) 85 | ]) 86 | ])# _LT_SET_OPTIONS 87 | 88 | 89 | ## --------------------------------- ## 90 | ## Macros to handle LT_INIT options. ## 91 | ## --------------------------------- ## 92 | 93 | # _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) 94 | # ----------------------------------------- 95 | m4_define([_LT_MANGLE_DEFUN], 96 | [[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) 97 | 98 | 99 | # LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) 100 | # ----------------------------------------------- 101 | m4_define([LT_OPTION_DEFINE], 102 | [m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl 103 | ])# LT_OPTION_DEFINE 104 | 105 | 106 | # dlopen 107 | # ------ 108 | LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes 109 | ]) 110 | 111 | AU_DEFUN([AC_LIBTOOL_DLOPEN], 112 | [_LT_SET_OPTION([LT_INIT], [dlopen]) 113 | AC_DIAGNOSE([obsolete], 114 | [$0: Remove this warning and the call to _LT_SET_OPTION when you 115 | put the `dlopen' option into LT_INIT's first parameter.]) 116 | ]) 117 | 118 | dnl aclocal-1.4 backwards compatibility: 119 | dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) 120 | 121 | 122 | # win32-dll 123 | # --------- 124 | # Declare package support for building win32 dll's. 125 | LT_OPTION_DEFINE([LT_INIT], [win32-dll], 126 | [enable_win32_dll=yes 127 | 128 | case $host in 129 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-cegcc*) 130 | AC_CHECK_TOOL(AS, as, false) 131 | AC_CHECK_TOOL(DLLTOOL, dlltool, false) 132 | AC_CHECK_TOOL(OBJDUMP, objdump, false) 133 | ;; 134 | esac 135 | 136 | test -z "$AS" && AS=as 137 | _LT_DECL([], [AS], [0], [Assembler program])dnl 138 | 139 | test -z "$DLLTOOL" && DLLTOOL=dlltool 140 | _LT_DECL([], [DLLTOOL], [0], [DLL creation program])dnl 141 | 142 | test -z "$OBJDUMP" && OBJDUMP=objdump 143 | _LT_DECL([], [OBJDUMP], [0], [Object dumper program])dnl 144 | ])# win32-dll 145 | 146 | AU_DEFUN([AC_LIBTOOL_WIN32_DLL], 147 | [AC_REQUIRE([AC_CANONICAL_HOST])dnl 148 | _LT_SET_OPTION([LT_INIT], [win32-dll]) 149 | AC_DIAGNOSE([obsolete], 150 | [$0: Remove this warning and the call to _LT_SET_OPTION when you 151 | put the `win32-dll' option into LT_INIT's first parameter.]) 152 | ]) 153 | 154 | dnl aclocal-1.4 backwards compatibility: 155 | dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) 156 | 157 | 158 | # _LT_ENABLE_SHARED([DEFAULT]) 159 | # ---------------------------- 160 | # implement the --enable-shared flag, and supports the `shared' and 161 | # `disable-shared' LT_INIT options. 162 | # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. 163 | m4_define([_LT_ENABLE_SHARED], 164 | [m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl 165 | AC_ARG_ENABLE([shared], 166 | [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], 167 | [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], 168 | [p=${PACKAGE-default} 169 | case $enableval in 170 | yes) enable_shared=yes ;; 171 | no) enable_shared=no ;; 172 | *) 173 | enable_shared=no 174 | # Look at the argument we got. We use all the common list separators. 175 | lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," 176 | for pkg in $enableval; do 177 | IFS="$lt_save_ifs" 178 | if test "X$pkg" = "X$p"; then 179 | enable_shared=yes 180 | fi 181 | done 182 | IFS="$lt_save_ifs" 183 | ;; 184 | esac], 185 | [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) 186 | 187 | _LT_DECL([build_libtool_libs], [enable_shared], [0], 188 | [Whether or not to build shared libraries]) 189 | ])# _LT_ENABLE_SHARED 190 | 191 | LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) 192 | LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) 193 | 194 | # Old names: 195 | AC_DEFUN([AC_ENABLE_SHARED], 196 | [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) 197 | ]) 198 | 199 | AC_DEFUN([AC_DISABLE_SHARED], 200 | [_LT_SET_OPTION([LT_INIT], [disable-shared]) 201 | ]) 202 | 203 | AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) 204 | AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) 205 | 206 | dnl aclocal-1.4 backwards compatibility: 207 | dnl AC_DEFUN([AM_ENABLE_SHARED], []) 208 | dnl AC_DEFUN([AM_DISABLE_SHARED], []) 209 | 210 | 211 | 212 | # _LT_ENABLE_STATIC([DEFAULT]) 213 | # ---------------------------- 214 | # implement the --enable-static flag, and support the `static' and 215 | # `disable-static' LT_INIT options. 216 | # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. 217 | m4_define([_LT_ENABLE_STATIC], 218 | [m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl 219 | AC_ARG_ENABLE([static], 220 | [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], 221 | [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], 222 | [p=${PACKAGE-default} 223 | case $enableval in 224 | yes) enable_static=yes ;; 225 | no) enable_static=no ;; 226 | *) 227 | enable_static=no 228 | # Look at the argument we got. We use all the common list separators. 229 | lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," 230 | for pkg in $enableval; do 231 | IFS="$lt_save_ifs" 232 | if test "X$pkg" = "X$p"; then 233 | enable_static=yes 234 | fi 235 | done 236 | IFS="$lt_save_ifs" 237 | ;; 238 | esac], 239 | [enable_static=]_LT_ENABLE_STATIC_DEFAULT) 240 | 241 | _LT_DECL([build_old_libs], [enable_static], [0], 242 | [Whether or not to build static libraries]) 243 | ])# _LT_ENABLE_STATIC 244 | 245 | LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) 246 | LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) 247 | 248 | # Old names: 249 | AC_DEFUN([AC_ENABLE_STATIC], 250 | [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) 251 | ]) 252 | 253 | AC_DEFUN([AC_DISABLE_STATIC], 254 | [_LT_SET_OPTION([LT_INIT], [disable-static]) 255 | ]) 256 | 257 | AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) 258 | AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) 259 | 260 | dnl aclocal-1.4 backwards compatibility: 261 | dnl AC_DEFUN([AM_ENABLE_STATIC], []) 262 | dnl AC_DEFUN([AM_DISABLE_STATIC], []) 263 | 264 | 265 | 266 | # _LT_ENABLE_FAST_INSTALL([DEFAULT]) 267 | # ---------------------------------- 268 | # implement the --enable-fast-install flag, and support the `fast-install' 269 | # and `disable-fast-install' LT_INIT options. 270 | # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. 271 | m4_define([_LT_ENABLE_FAST_INSTALL], 272 | [m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl 273 | AC_ARG_ENABLE([fast-install], 274 | [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], 275 | [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], 276 | [p=${PACKAGE-default} 277 | case $enableval in 278 | yes) enable_fast_install=yes ;; 279 | no) enable_fast_install=no ;; 280 | *) 281 | enable_fast_install=no 282 | # Look at the argument we got. We use all the common list separators. 283 | lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," 284 | for pkg in $enableval; do 285 | IFS="$lt_save_ifs" 286 | if test "X$pkg" = "X$p"; then 287 | enable_fast_install=yes 288 | fi 289 | done 290 | IFS="$lt_save_ifs" 291 | ;; 292 | esac], 293 | [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) 294 | 295 | _LT_DECL([fast_install], [enable_fast_install], [0], 296 | [Whether or not to optimize for fast installation])dnl 297 | ])# _LT_ENABLE_FAST_INSTALL 298 | 299 | LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) 300 | LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) 301 | 302 | # Old names: 303 | AU_DEFUN([AC_ENABLE_FAST_INSTALL], 304 | [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) 305 | AC_DIAGNOSE([obsolete], 306 | [$0: Remove this warning and the call to _LT_SET_OPTION when you put 307 | the `fast-install' option into LT_INIT's first parameter.]) 308 | ]) 309 | 310 | AU_DEFUN([AC_DISABLE_FAST_INSTALL], 311 | [_LT_SET_OPTION([LT_INIT], [disable-fast-install]) 312 | AC_DIAGNOSE([obsolete], 313 | [$0: Remove this warning and the call to _LT_SET_OPTION when you put 314 | the `disable-fast-install' option into LT_INIT's first parameter.]) 315 | ]) 316 | 317 | dnl aclocal-1.4 backwards compatibility: 318 | dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) 319 | dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) 320 | 321 | 322 | # _LT_WITH_PIC([MODE]) 323 | # -------------------- 324 | # implement the --with-pic flag, and support the `pic-only' and `no-pic' 325 | # LT_INIT options. 326 | # MODE is either `yes' or `no'. If omitted, it defaults to `both'. 327 | m4_define([_LT_WITH_PIC], 328 | [AC_ARG_WITH([pic], 329 | [AS_HELP_STRING([--with-pic], 330 | [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], 331 | [pic_mode="$withval"], 332 | [pic_mode=default]) 333 | 334 | test -z "$pic_mode" && pic_mode=m4_default([$1], [default]) 335 | 336 | _LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl 337 | ])# _LT_WITH_PIC 338 | 339 | LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) 340 | LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) 341 | 342 | # Old name: 343 | AU_DEFUN([AC_LIBTOOL_PICMODE], 344 | [_LT_SET_OPTION([LT_INIT], [pic-only]) 345 | AC_DIAGNOSE([obsolete], 346 | [$0: Remove this warning and the call to _LT_SET_OPTION when you 347 | put the `pic-only' option into LT_INIT's first parameter.]) 348 | ]) 349 | 350 | dnl aclocal-1.4 backwards compatibility: 351 | dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) 352 | 353 | ## ----------------- ## 354 | ## LTDL_INIT Options ## 355 | ## ----------------- ## 356 | 357 | m4_define([_LTDL_MODE], []) 358 | LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], 359 | [m4_define([_LTDL_MODE], [nonrecursive])]) 360 | LT_OPTION_DEFINE([LTDL_INIT], [recursive], 361 | [m4_define([_LTDL_MODE], [recursive])]) 362 | LT_OPTION_DEFINE([LTDL_INIT], [subproject], 363 | [m4_define([_LTDL_MODE], [subproject])]) 364 | 365 | m4_define([_LTDL_TYPE], []) 366 | LT_OPTION_DEFINE([LTDL_INIT], [installable], 367 | [m4_define([_LTDL_TYPE], [installable])]) 368 | LT_OPTION_DEFINE([LTDL_INIT], [convenience], 369 | [m4_define([_LTDL_TYPE], [convenience])]) 370 | 371 | -------------------------------------------------------------------------------- /acinclude/ltsugar.m4: -------------------------------------------------------------------------------- 1 | ############################################################################## 2 | # ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- 3 | # 4 | # Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. 5 | # Written by Gary V. Vaughan, 2004 6 | # 7 | # This file is free software; the Free Software Foundation gives 8 | # unlimited permission to copy and/or distribute it, with or without 9 | # modifications, as long as this notice is preserved. 10 | 11 | # serial 6 ltsugar.m4 12 | 13 | # This is to help aclocal find these macros, as it can't see m4_define. 14 | AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) 15 | 16 | 17 | # lt_join(SEP, ARG1, [ARG2...]) 18 | # ----------------------------- 19 | # Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their 20 | # associated separator. 21 | # Needed until we can rely on m4_join from Autoconf 2.62, since all earlier 22 | # versions in m4sugar had bugs. 23 | m4_define([lt_join], 24 | [m4_if([$#], [1], [], 25 | [$#], [2], [[$2]], 26 | [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) 27 | m4_define([_lt_join], 28 | [m4_if([$#$2], [2], [], 29 | [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) 30 | 31 | 32 | # lt_car(LIST) 33 | # lt_cdr(LIST) 34 | # ------------ 35 | # Manipulate m4 lists. 36 | # These macros are necessary as long as will still need to support 37 | # Autoconf-2.59 which quotes differently. 38 | m4_define([lt_car], [[$1]]) 39 | m4_define([lt_cdr], 40 | [m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], 41 | [$#], 1, [], 42 | [m4_dquote(m4_shift($@))])]) 43 | m4_define([lt_unquote], $1) 44 | 45 | 46 | # lt_append(MACRO-NAME, STRING, [SEPARATOR]) 47 | # ------------------------------------------ 48 | # Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'. 49 | # Note that neither SEPARATOR nor STRING are expanded; they are appended 50 | # to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). 51 | # No SEPARATOR is output if MACRO-NAME was previously undefined (different 52 | # than defined and empty). 53 | # 54 | # This macro is needed until we can rely on Autoconf 2.62, since earlier 55 | # versions of m4sugar mistakenly expanded SEPARATOR but not STRING. 56 | m4_define([lt_append], 57 | [m4_define([$1], 58 | m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) 59 | 60 | 61 | 62 | # lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) 63 | # ---------------------------------------------------------- 64 | # Produce a SEP delimited list of all paired combinations of elements of 65 | # PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list 66 | # has the form PREFIXmINFIXSUFFIXn. 67 | # Needed until we can rely on m4_combine added in Autoconf 2.62. 68 | m4_define([lt_combine], 69 | [m4_if(m4_eval([$# > 3]), [1], 70 | [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl 71 | [[m4_foreach([_Lt_prefix], [$2], 72 | [m4_foreach([_Lt_suffix], 73 | ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, 74 | [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) 75 | 76 | 77 | # lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) 78 | # ----------------------------------------------------------------------- 79 | # Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited 80 | # by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. 81 | m4_define([lt_if_append_uniq], 82 | [m4_ifdef([$1], 83 | [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], 84 | [lt_append([$1], [$2], [$3])$4], 85 | [$5])], 86 | [lt_append([$1], [$2], [$3])$4])]) 87 | 88 | 89 | # lt_dict_add(DICT, KEY, VALUE) 90 | # ----------------------------- 91 | m4_define([lt_dict_add], 92 | [m4_define([$1($2)], [$3])]) 93 | 94 | 95 | # lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) 96 | # -------------------------------------------- 97 | m4_define([lt_dict_add_subkey], 98 | [m4_define([$1($2:$3)], [$4])]) 99 | 100 | 101 | # lt_dict_fetch(DICT, KEY, [SUBKEY]) 102 | # ---------------------------------- 103 | m4_define([lt_dict_fetch], 104 | [m4_ifval([$3], 105 | m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), 106 | m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) 107 | 108 | 109 | # lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) 110 | # ----------------------------------------------------------------- 111 | m4_define([lt_if_dict_fetch], 112 | [m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], 113 | [$5], 114 | [$6])]) 115 | 116 | 117 | # lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) 118 | # -------------------------------------------------------------- 119 | m4_define([lt_dict_filter], 120 | [m4_if([$5], [], [], 121 | [lt_join(m4_quote(m4_default([$4], [[, ]])), 122 | lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), 123 | [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl 124 | ]) 125 | 126 | -------------------------------------------------------------------------------- /acinclude/ltversion.m4: -------------------------------------------------------------------------------- 1 | ############################################################################## 2 | # ltversion.m4 -- version numbers -*- Autoconf -*- 3 | # 4 | # Copyright (C) 2004 Free Software Foundation, Inc. 5 | # Written by Scott James Remnant, 2004 6 | # 7 | # This file is free software; the Free Software Foundation gives 8 | # unlimited permission to copy and/or distribute it, with or without 9 | # modifications, as long as this notice is preserved. 10 | 11 | # Generated from ltversion.in. 12 | 13 | # serial 3012 ltversion.m4 14 | # This file is part of GNU Libtool 15 | 16 | m4_define([LT_PACKAGE_VERSION], [2.2.6]) 17 | m4_define([LT_PACKAGE_REVISION], [1.3012]) 18 | 19 | AC_DEFUN([LTVERSION_VERSION], 20 | [macro_version='2.2.6' 21 | macro_revision='1.3012' 22 | _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) 23 | _LT_DECL(, macro_revision, 0) 24 | ]) 25 | 26 | -------------------------------------------------------------------------------- /acinclude/lt~obsolete.m4: -------------------------------------------------------------------------------- 1 | ############################################################################## 2 | # lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- 3 | # 4 | # Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc. 5 | # Written by Scott James Remnant, 2004. 6 | # 7 | # This file is free software; the Free Software Foundation gives 8 | # unlimited permission to copy and/or distribute it, with or without 9 | # modifications, as long as this notice is preserved. 10 | 11 | # serial 4 lt~obsolete.m4 12 | 13 | # These exist entirely to fool aclocal when bootstrapping libtool. 14 | # 15 | # In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN) 16 | # which have later been changed to m4_define as they aren't part of the 17 | # exported API, or moved to Autoconf or Automake where they belong. 18 | # 19 | # The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN 20 | # in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us 21 | # using a macro with the same name in our local m4/libtool.m4 it'll 22 | # pull the old libtool.m4 in (it doesn't see our shiny new m4_define 23 | # and doesn't know about Autoconf macros at all.) 24 | # 25 | # So we provide this file, which has a silly filename so it's always 26 | # included after everything else. This provides aclocal with the 27 | # AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything 28 | # because those macros already exist, or will be overwritten later. 29 | # We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. 30 | # 31 | # Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. 32 | # Yes, that means every name once taken will need to remain here until 33 | # we give up compatibility with versions before 1.7, at which point 34 | # we need to keep only those names which we still refer to. 35 | 36 | # This is to help aclocal find these macros, as it can't see m4_define. 37 | AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) 38 | 39 | m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) 40 | m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) 41 | m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) 42 | m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) 43 | m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) 44 | m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) 45 | m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) 46 | m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) 47 | m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) 48 | m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) 49 | m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) 50 | m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) 51 | m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) 52 | m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) 53 | m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) 54 | m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) 55 | m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) 56 | m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) 57 | m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) 58 | m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) 59 | m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) 60 | m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) 61 | m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) 62 | m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) 63 | m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) 64 | m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) 65 | m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) 66 | m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) 67 | m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) 68 | m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) 69 | m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) 70 | m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) 71 | m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) 72 | m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) 73 | m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) 74 | m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) 75 | m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) 76 | m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) 77 | m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) 78 | m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) 79 | m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) 80 | m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) 81 | m4_ifndef([AC_LIBTOOL_RC], [AC_DEFUN([AC_LIBTOOL_RC])]) 82 | m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) 83 | m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) 84 | m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) 85 | m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) 86 | m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) 87 | m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) 88 | m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) 89 | m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) 90 | m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) 91 | m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) 92 | m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) 93 | m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) 94 | -------------------------------------------------------------------------------- /acinclude/pkg.m4: -------------------------------------------------------------------------------- 1 | # pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- 2 | # 3 | # Copyright © 2004 Scott James Remnant . 4 | # 5 | # This program is free software; you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation; either version 2 of the License, or 8 | # (at your option) any later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, but 11 | # WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | # General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program; if not, write to the Free Software 17 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | # 19 | # As a special exception to the GNU General Public License, if you 20 | # distribute this file as part of a program that contains a 21 | # configuration script generated by Autoconf, you may include it under 22 | # the same distribution terms that you use for the rest of that program. 23 | 24 | # PKG_PROG_PKG_CONFIG([MIN-VERSION]) 25 | # ---------------------------------- 26 | AC_DEFUN([PKG_PROG_PKG_CONFIG], 27 | [m4_pattern_forbid([^_?PKG_[A-Z_]+$]) 28 | m4_pattern_allow([^PKG_CONFIG(_PATH)?$]) 29 | AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl 30 | if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then 31 | AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) 32 | fi 33 | if test -n "$PKG_CONFIG"; then 34 | _pkg_min_version=m4_default([$1], [0.9.0]) 35 | AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) 36 | if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then 37 | AC_MSG_RESULT([yes]) 38 | else 39 | AC_MSG_RESULT([no]) 40 | PKG_CONFIG="" 41 | fi 42 | 43 | fi[]dnl 44 | ])# PKG_PROG_PKG_CONFIG 45 | 46 | # PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) 47 | # 48 | # Check to see whether a particular set of modules exists. Similar 49 | # to PKG_CHECK_MODULES(), but does not set variables or print errors. 50 | # 51 | # 52 | # Similar to PKG_CHECK_MODULES, make sure that the first instance of 53 | # this or PKG_CHECK_MODULES is called, or make sure to call 54 | # PKG_CHECK_EXISTS manually 55 | # -------------------------------------------------------------- 56 | AC_DEFUN([PKG_CHECK_EXISTS], 57 | [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl 58 | if test -n "$PKG_CONFIG" && \ 59 | AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then 60 | m4_ifval([$2], [$2], [:]) 61 | m4_ifvaln([$3], [else 62 | $3])dnl 63 | fi]) 64 | 65 | 66 | # _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) 67 | # --------------------------------------------- 68 | m4_define([_PKG_CONFIG], 69 | [if test -n "$PKG_CONFIG"; then 70 | if test -n "$$1"; then 71 | pkg_cv_[]$1="$$1" 72 | else 73 | PKG_CHECK_EXISTS([$3], 74 | [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`], 75 | [pkg_failed=yes]) 76 | fi 77 | else 78 | pkg_failed=untried 79 | fi[]dnl 80 | ])# _PKG_CONFIG 81 | 82 | # _PKG_SHORT_ERRORS_SUPPORTED 83 | # ----------------------------- 84 | AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], 85 | [AC_REQUIRE([PKG_PROG_PKG_CONFIG]) 86 | if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then 87 | _pkg_short_errors_supported=yes 88 | else 89 | _pkg_short_errors_supported=no 90 | fi[]dnl 91 | ])# _PKG_SHORT_ERRORS_SUPPORTED 92 | 93 | 94 | # PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], 95 | # [ACTION-IF-NOT-FOUND]) 96 | # 97 | # 98 | # Note that if there is a possibility the first call to 99 | # PKG_CHECK_MODULES might not happen, you should be sure to include an 100 | # explicit call to PKG_PROG_PKG_CONFIG in your configure.ac 101 | # 102 | # 103 | # -------------------------------------------------------------- 104 | AC_DEFUN([PKG_CHECK_MODULES], 105 | [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl 106 | AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl 107 | AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl 108 | 109 | pkg_failed=no 110 | AC_MSG_CHECKING([for $1]) 111 | 112 | _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) 113 | _PKG_CONFIG([$1][_LIBS], [libs], [$2]) 114 | 115 | m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS 116 | and $1[]_LIBS to avoid the need to call pkg-config. 117 | See the pkg-config man page for more details.]) 118 | 119 | if test $pkg_failed = yes; then 120 | _PKG_SHORT_ERRORS_SUPPORTED 121 | if test $_pkg_short_errors_supported = yes; then 122 | $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$2"` 123 | else 124 | $1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` 125 | fi 126 | # Put the nasty error message in config.log where it belongs 127 | echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD 128 | 129 | ifelse([$4], , [AC_MSG_ERROR(dnl 130 | [Package requirements ($2) were not met: 131 | 132 | $$1_PKG_ERRORS 133 | 134 | Consider adjusting the PKG_CONFIG_PATH environment variable if you 135 | installed software in a non-standard prefix. 136 | 137 | _PKG_TEXT 138 | ])], 139 | [AC_MSG_RESULT([no]) 140 | $4]) 141 | elif test $pkg_failed = untried; then 142 | ifelse([$4], , [AC_MSG_FAILURE(dnl 143 | [The pkg-config script could not be found or is too old. Make sure it 144 | is in your PATH or set the PKG_CONFIG environment variable to the full 145 | path to pkg-config. 146 | 147 | _PKG_TEXT 148 | 149 | To get pkg-config, see .])], 150 | [$4]) 151 | else 152 | $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS 153 | $1[]_LIBS=$pkg_cv_[]$1[]_LIBS 154 | AC_MSG_RESULT([yes]) 155 | ifelse([$3], , :, [$3]) 156 | fi[]dnl 157 | ])# PKG_CHECK_MODULES 158 | -------------------------------------------------------------------------------- /acinclude/sdl2.m4: -------------------------------------------------------------------------------- 1 | # Configure paths for SDL 2 | # Sam Lantinga 9/21/99 3 | # stolen from Manish Singh 4 | # stolen back from Frank Belew 5 | # stolen from Manish Singh 6 | # Shamelessly stolen from Owen Taylor 7 | 8 | # serial 1 9 | 10 | dnl AM_PATH_SDL2([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) 11 | dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS 12 | dnl 13 | AC_DEFUN([AM_PATH_SDL2], 14 | [dnl 15 | dnl Get the cflags and libraries from the sdl2-config script 16 | dnl 17 | AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)], 18 | sdl_prefix="$withval", sdl_prefix="") 19 | AC_ARG_WITH(sdl-exec-prefix,[ --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)], 20 | sdl_exec_prefix="$withval", sdl_exec_prefix="") 21 | AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run a test SDL program], 22 | , enable_sdltest=yes) 23 | 24 | min_sdl_version=ifelse([$1], ,2.0.0,$1) 25 | 26 | if test "x$sdl_prefix$sdl_exec_prefix" = x ; then 27 | PKG_CHECK_MODULES([SDL], [sdl2 >= $min_sdl_version], 28 | [sdl_pc=yes], 29 | [sdl_pc=no]) 30 | else 31 | sdl_pc=no 32 | if test x$sdl_exec_prefix != x ; then 33 | sdl_config_args="$sdl_config_args --exec-prefix=$sdl_exec_prefix" 34 | if test x${SDL2_CONFIG+set} != xset ; then 35 | SDL2_CONFIG=$sdl_exec_prefix/bin/sdl2-config 36 | fi 37 | fi 38 | if test x$sdl_prefix != x ; then 39 | sdl_config_args="$sdl_config_args --prefix=$sdl_prefix" 40 | if test x${SDL2_CONFIG+set} != xset ; then 41 | SDL2_CONFIG=$sdl_prefix/bin/sdl2-config 42 | fi 43 | fi 44 | fi 45 | 46 | if test "x$sdl_pc" = xyes ; then 47 | no_sdl="" 48 | SDL2_CONFIG="pkg-config sdl2" 49 | else 50 | as_save_PATH="$PATH" 51 | if test "x$prefix" != xNONE && test "$cross_compiling" != yes; then 52 | PATH="$prefix/bin:$prefix/usr/bin:$PATH" 53 | fi 54 | AC_PATH_PROG(SDL2_CONFIG, sdl2-config, no, [$PATH]) 55 | PATH="$as_save_PATH" 56 | AC_MSG_CHECKING(for SDL - version >= $min_sdl_version) 57 | no_sdl="" 58 | 59 | if test "$SDL2_CONFIG" = "no" ; then 60 | no_sdl=yes 61 | else 62 | SDL_CFLAGS=`$SDL2_CONFIG $sdl_config_args --cflags` 63 | SDL_LIBS=`$SDL2_CONFIG $sdl_config_args --libs` 64 | 65 | sdl_major_version=`$SDL2_CONFIG $sdl_config_args --version | \ 66 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` 67 | sdl_minor_version=`$SDL2_CONFIG $sdl_config_args --version | \ 68 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` 69 | sdl_micro_version=`$SDL2_CONFIG $sdl_config_args --version | \ 70 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` 71 | if test "x$enable_sdltest" = "xyes" ; then 72 | ac_save_CFLAGS="$CFLAGS" 73 | ac_save_CXXFLAGS="$CXXFLAGS" 74 | ac_save_LIBS="$LIBS" 75 | CFLAGS="$CFLAGS $SDL_CFLAGS" 76 | CXXFLAGS="$CXXFLAGS $SDL_CFLAGS" 77 | LIBS="$LIBS $SDL_LIBS" 78 | dnl 79 | dnl Now check if the installed SDL is sufficiently new. (Also sanity 80 | dnl checks the results of sdl2-config to some extent 81 | dnl 82 | rm -f conf.sdltest 83 | AC_TRY_RUN([ 84 | #include 85 | #include 86 | #include 87 | #include "SDL.h" 88 | 89 | char* 90 | my_strdup (char *str) 91 | { 92 | char *new_str; 93 | 94 | if (str) 95 | { 96 | new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char)); 97 | strcpy (new_str, str); 98 | } 99 | else 100 | new_str = NULL; 101 | 102 | return new_str; 103 | } 104 | 105 | int main (int argc, char *argv[]) 106 | { 107 | int major, minor, micro; 108 | char *tmp_version; 109 | 110 | /* This hangs on some systems (?) 111 | system ("touch conf.sdltest"); 112 | */ 113 | { FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); } 114 | 115 | /* HP/UX 9 (%@#!) writes to sscanf strings */ 116 | tmp_version = my_strdup("$min_sdl_version"); 117 | if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { 118 | printf("%s, bad version string\n", "$min_sdl_version"); 119 | exit(1); 120 | } 121 | 122 | if (($sdl_major_version > major) || 123 | (($sdl_major_version == major) && ($sdl_minor_version > minor)) || 124 | (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro))) 125 | { 126 | return 0; 127 | } 128 | else 129 | { 130 | printf("\n*** 'sdl2-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version); 131 | printf("*** of SDL required is %d.%d.%d. If sdl2-config is correct, then it is\n", major, minor, micro); 132 | printf("*** best to upgrade to the required version.\n"); 133 | printf("*** If sdl2-config was wrong, set the environment variable SDL2_CONFIG\n"); 134 | printf("*** to point to the correct copy of sdl2-config, and remove the file\n"); 135 | printf("*** config.cache before re-running configure\n"); 136 | return 1; 137 | } 138 | } 139 | 140 | ],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) 141 | CFLAGS="$ac_save_CFLAGS" 142 | CXXFLAGS="$ac_save_CXXFLAGS" 143 | LIBS="$ac_save_LIBS" 144 | fi 145 | fi 146 | if test "x$no_sdl" = x ; then 147 | AC_MSG_RESULT(yes) 148 | else 149 | AC_MSG_RESULT(no) 150 | fi 151 | fi 152 | if test "x$no_sdl" = x ; then 153 | ifelse([$2], , :, [$2]) 154 | else 155 | if test "$SDL2_CONFIG" = "no" ; then 156 | echo "*** The sdl2-config script installed by SDL could not be found" 157 | echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in" 158 | echo "*** your path, or set the SDL2_CONFIG environment variable to the" 159 | echo "*** full path to sdl2-config." 160 | else 161 | if test -f conf.sdltest ; then 162 | : 163 | else 164 | echo "*** Could not run SDL test program, checking why..." 165 | CFLAGS="$CFLAGS $SDL_CFLAGS" 166 | CXXFLAGS="$CXXFLAGS $SDL_CFLAGS" 167 | LIBS="$LIBS $SDL_LIBS" 168 | AC_TRY_LINK([ 169 | #include 170 | #include "SDL.h" 171 | 172 | int main(int argc, char *argv[]) 173 | { return 0; } 174 | #undef main 175 | #define main K_and_R_C_main 176 | ], [ return 0; ], 177 | [ echo "*** The test program compiled, but did not run. This usually means" 178 | echo "*** that the run-time linker is not finding SDL or finding the wrong" 179 | echo "*** version of SDL. If it is not finding SDL, you'll need to set your" 180 | echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" 181 | echo "*** to the installed location Also, make sure you have run ldconfig if that" 182 | echo "*** is required on your system" 183 | echo "***" 184 | echo "*** If you have an old version installed, it is best to remove it, although" 185 | echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], 186 | [ echo "*** The test program failed to compile or link. See the file config.log for the" 187 | echo "*** exact error that occured. This usually means SDL was incorrectly installed" 188 | echo "*** or that you have moved SDL since it was installed. In the latter case, you" 189 | echo "*** may want to edit the sdl2-config script: $SDL2_CONFIG" ]) 190 | CFLAGS="$ac_save_CFLAGS" 191 | CXXFLAGS="$ac_save_CXXFLAGS" 192 | LIBS="$ac_save_LIBS" 193 | fi 194 | fi 195 | SDL_CFLAGS="" 196 | SDL_LIBS="" 197 | ifelse([$3], , :, [$3]) 198 | fi 199 | AC_SUBST(SDL_CFLAGS) 200 | AC_SUBST(SDL_LIBS) 201 | rm -f conf.sdltest 202 | ]) 203 | -------------------------------------------------------------------------------- /autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | aclocal -I acinclude 4 | automake --foreign --include-deps --add-missing --copy 5 | autoconf 6 | 7 | #./configure $* 8 | echo "Now you are ready to run ./configure" 9 | -------------------------------------------------------------------------------- /chat.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | CHAT: A chat client using the SDL example network and GUI libraries 3 | Copyright (C) 1997-2021 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /* Note that this isn't necessarily the way to run a chat system. 23 | This is designed to excercise the network code more than be really 24 | functional. 25 | */ 26 | 27 | #include 28 | #include 29 | #include 30 | 31 | #include "SDL_net.h" 32 | #ifdef macintosh 33 | #include "GUI.h" 34 | #include "GUI_widgets.h" 35 | #else 36 | #include 37 | #include 38 | #endif 39 | #include "chat.h" 40 | 41 | 42 | /* Global variables */ 43 | static TCPsocket tcpsock = NULL; 44 | static UDPsocket udpsock = NULL; 45 | static SDLNet_SocketSet socketset = NULL; 46 | static UDPpacket **packets = NULL; 47 | static struct { 48 | int active; 49 | Uint8 name[256+1]; 50 | } people[CHAT_MAXPEOPLE]; 51 | 52 | static GUI *gui = NULL; 53 | static GUI_TermWin *termwin; 54 | static GUI_TermWin *sendwin; 55 | enum image_names { 56 | IMAGE_QUIT, 57 | IMAGE_SCROLL_UP, 58 | IMAGE_SCROLL_DN, 59 | NUM_IMAGES 60 | }; 61 | char *image_files[NUM_IMAGES] = { 62 | "quit.bmp", "scroll_up.bmp", "scroll_dn.bmp" 63 | }; 64 | SDL_Surface *images[NUM_IMAGES]; 65 | 66 | 67 | void SendHello(char *name) 68 | { 69 | IPaddress *myip; 70 | char hello[1+1+256]; 71 | int i, n; 72 | 73 | /* No people are active at first */ 74 | for ( i=0; iAddText("Using name '%s'\n", name); 85 | 86 | /* Construct the packet */ 87 | hello[0] = CHAT_HELLO; 88 | myip = SDLNet_UDP_GetPeerAddress(udpsock, -1); 89 | memcpy(&hello[CHAT_HELLO_PORT], &myip->port, 2); 90 | if ( strlen(name) > 255 ) { 91 | n = 255; 92 | } else { 93 | n = strlen(name); 94 | } 95 | hello[CHAT_HELLO_NLEN] = n; 96 | strncpy(&hello[CHAT_HELLO_NAME], name, n); 97 | hello[CHAT_HELLO_NAME+n++] = 0; 98 | 99 | /* Send it to the server */ 100 | SDLNet_TCP_Send(tcpsock, hello, CHAT_HELLO_NAME+n); 101 | } 102 | } 103 | 104 | void SendBuf(char *buf, int len) 105 | { 106 | int i; 107 | 108 | /* Redraw the prompt and add a newline to the buffer */ 109 | sendwin->Clear(); 110 | sendwin->AddText(CHAT_PROMPT); 111 | buf[len++] = '\n'; 112 | 113 | /* Send the text to each of our active channels */ 114 | for ( i=0; i < CHAT_MAXPEOPLE; ++i ) { 115 | if ( people[i].active ) { 116 | if ( len > packets[0]->maxlen ) { 117 | len = packets[0]->maxlen; 118 | } 119 | memcpy(packets[0]->data, buf, len); 120 | packets[0]->len = len; 121 | SDLNet_UDP_Send(udpsock, i, packets[0]); 122 | } 123 | } 124 | } 125 | void SendKey(SDLKey key, Uint16 unicode) 126 | { 127 | static char keybuf[80-sizeof(CHAT_PROMPT)+1]; 128 | static int keypos = 0; 129 | unsigned char ch; 130 | 131 | /* We don't handle wide UNICODE characters yet */ 132 | if ( unicode > 255 ) { 133 | return; 134 | } 135 | ch = (unsigned char)unicode; 136 | 137 | /* Add the key to the buffer, and send it if we have a line */ 138 | switch (ch) { 139 | case '\0': 140 | break; 141 | case '\r': 142 | case '\n': 143 | /* Send our line of text */ 144 | SendBuf(keybuf, keypos); 145 | keypos = 0; 146 | break; 147 | case '\b': 148 | /* If there's data, back up over it */ 149 | if ( keypos > 0 ) { 150 | sendwin->AddText((char *)&ch, 1); 151 | --keypos; 152 | } 153 | break; 154 | default: 155 | /* If the buffer is full, send it */ 156 | if ( keypos == (sizeof(keybuf)/sizeof(keybuf[0]))-1 ) { 157 | SendBuf(keybuf, keypos); 158 | keypos = 0; 159 | } 160 | /* Add the text to our send buffer */ 161 | sendwin->AddText((char *)&ch, 1); 162 | keybuf[keypos++] = ch; 163 | break; 164 | } 165 | } 166 | 167 | int HandleServerData(Uint8 *data) 168 | { 169 | int used; 170 | 171 | switch (data[0]) { 172 | case CHAT_ADD: { 173 | Uint8 which; 174 | IPaddress newip; 175 | 176 | /* Figure out which channel we got */ 177 | which = data[CHAT_ADD_SLOT]; 178 | if ((which >= CHAT_MAXPEOPLE) || people[which].active) { 179 | /* Invalid channel?? */ 180 | break; 181 | } 182 | /* Get the client IP address */ 183 | newip.host=SDLNet_Read32(&data[CHAT_ADD_HOST]); 184 | newip.port=SDLNet_Read16(&data[CHAT_ADD_PORT]); 185 | 186 | /* Copy name into channel */ 187 | memcpy(people[which].name, &data[CHAT_ADD_NAME], 256); 188 | people[which].name[256] = 0; 189 | people[which].active = 1; 190 | 191 | /* Let the user know what happened */ 192 | termwin->AddText( 193 | "* New client on %d from %d.%d.%d.%d:%d (%s)\n", which, 194 | (newip.host>>24)&0xFF, (newip.host>>16)&0xFF, 195 | (newip.host>>8)&0xFF, newip.host&0xFF, 196 | newip.port, people[which].name); 197 | 198 | /* Put the address back in network form */ 199 | newip.host = SDL_SwapBE32(newip.host); 200 | newip.port = SDL_SwapBE16(newip.port); 201 | 202 | /* Bind the address to the UDP socket */ 203 | SDLNet_UDP_Bind(udpsock, which, &newip); 204 | } 205 | used = CHAT_ADD_NAME+data[CHAT_ADD_NLEN]; 206 | break; 207 | case CHAT_DEL: { 208 | Uint8 which; 209 | 210 | /* Figure out which channel we lost */ 211 | which = data[CHAT_DEL_SLOT]; 212 | if ( (which >= CHAT_MAXPEOPLE) || 213 | ! people[which].active ) { 214 | /* Invalid channel?? */ 215 | break; 216 | } 217 | people[which].active = 0; 218 | 219 | /* Let the user know what happened */ 220 | termwin->AddText( 221 | "* Lost client on %d (%s)\n", which, people[which].name); 222 | 223 | /* Unbind the address on the UDP socket */ 224 | SDLNet_UDP_Unbind(udpsock, which); 225 | } 226 | used = CHAT_DEL_LEN; 227 | break; 228 | case CHAT_BYE: { 229 | termwin->AddText("* Chat server full\n"); 230 | } 231 | used = CHAT_BYE_LEN; 232 | break; 233 | default: { 234 | /* Unknown packet type?? */; 235 | } 236 | used = 0; 237 | break; 238 | } 239 | return(used); 240 | } 241 | 242 | void HandleServer(void) 243 | { 244 | Uint8 data[512]; 245 | int pos, len; 246 | int used; 247 | 248 | /* Has the connection been lost with the server? */ 249 | len = SDLNet_TCP_Recv(tcpsock, (char *)data, 512); 250 | if ( len <= 0 ) { 251 | SDLNet_TCP_DelSocket(socketset, tcpsock); 252 | SDLNet_TCP_Close(tcpsock); 253 | tcpsock = NULL; 254 | termwin->AddText("Connection with server lost!\n"); 255 | } else { 256 | pos = 0; 257 | while ( len > 0 ) { 258 | used = HandleServerData(&data[pos]); 259 | pos += used; 260 | len -= used; 261 | if ( used == 0 ) { 262 | /* We might lose data here.. oh well, 263 | we got a corrupt packet from server 264 | */ 265 | len = 0; 266 | } 267 | } 268 | } 269 | } 270 | void HandleClient(void) 271 | { 272 | int n; 273 | 274 | n = SDLNet_UDP_RecvV(udpsock, packets); 275 | while ( n-- > 0 ) { 276 | if ( packets[n]->channel >= 0 ) { 277 | termwin->AddText("[%s] ", 278 | people[packets[n]->channel].name); 279 | termwin->AddText((char *)packets[n]->data, packets[n]->len); 280 | } 281 | } 282 | } 283 | 284 | GUI_status HandleNet(void) 285 | { 286 | SDLNet_CheckSockets(socketset, 0); 287 | if ( SDLNet_SocketReady(tcpsock) ) { 288 | HandleServer(); 289 | } 290 | if ( SDLNet_SocketReady(udpsock) ) { 291 | HandleClient(); 292 | } 293 | 294 | /* Redraw the screen if the window changed */ 295 | if ( termwin->Changed() ) { 296 | return(GUI_REDRAW); 297 | } else { 298 | return(GUI_PASS); 299 | } 300 | } 301 | 302 | void InitGUI(SDL_Surface *screen) 303 | { 304 | int x1, y1, y2; 305 | SDL_Rect empty_rect = { 0, 0, 0, 0 }; 306 | GUI_Widget *widget; 307 | 308 | gui = new GUI(screen); 309 | 310 | /* Chat terminal window */ 311 | termwin = new GUI_TermWin(0, 0, 80*8, 50*8, NULL,NULL,CHAT_SCROLLBACK); 312 | gui->AddWidget(termwin); 313 | 314 | /* Send-line window */ 315 | y1 = termwin->H()+2; 316 | sendwin = new GUI_TermWin(0, y1, 80*8, 1*8, NULL, SendKey, 0); 317 | sendwin->AddText(CHAT_PROMPT); 318 | gui->AddWidget(sendwin); 319 | 320 | /* Add scroll buttons for main window */ 321 | y1 += sendwin->H()+2; 322 | y2 = y1+images[IMAGE_SCROLL_UP]->h; 323 | widget = new GUI_ScrollButtons(2, y1, images[IMAGE_SCROLL_UP], 324 | empty_rect, 2, y2, images[IMAGE_SCROLL_DN], 325 | SCROLLBAR_VERTICAL, termwin); 326 | gui->AddWidget(widget); 327 | 328 | /* Add QUIT button */ 329 | x1 = (screen->w-images[IMAGE_QUIT]->w)/2; 330 | y1 = sendwin->Y()+sendwin->H()+images[IMAGE_QUIT]->h/2; 331 | widget = new GUI_Button(NULL, x1, y1, images[IMAGE_QUIT], NULL); 332 | gui->AddWidget(widget); 333 | 334 | /* That's all folks */ 335 | return; 336 | } 337 | 338 | extern "C" 339 | void cleanup(int exitcode) 340 | { 341 | int i; 342 | 343 | /* Clean up the GUI */ 344 | if ( gui ) { 345 | delete gui; 346 | gui = NULL; 347 | } 348 | /* Clean up any images we have */ 349 | for ( i=0; i\n", argv[0]); 387 | exit(1); 388 | } 389 | 390 | /* Initialize SDL */ 391 | if ( SDL_Init(SDL_INIT_VIDEO) < 0 ) { 392 | fprintf(stderr, "Couldn't initialize SDL: %s\n",SDL_GetError()); 393 | exit(1); 394 | } 395 | 396 | /* Set a 640x480 video mode -- allows 80x50 window using 8x8 font */ 397 | screen = SDL_SetVideoMode(640, 480, 0, SDL_SWSURFACE); 398 | if ( screen == NULL ) { 399 | fprintf(stderr, "Couldn't set video mode: %s\n",SDL_GetError()); 400 | SDL_Quit(); 401 | exit(1); 402 | } 403 | 404 | /* Initialize the network */ 405 | if ( SDLNet_Init() < 0 ) { 406 | fprintf(stderr, "Couldn't initialize net: %s\n", 407 | SDLNet_GetError()); 408 | SDL_Quit(); 409 | exit(1); 410 | } 411 | 412 | /* Get ready to initialize all of our data */ 413 | 414 | /* Load the display font and other images */ 415 | for ( i=0; iAddText("Connecting to %s ... ", server); 440 | gui->Display(); 441 | SDLNet_ResolveHost(&serverIP, server, CHAT_PORT); 442 | if ( serverIP.host == INADDR_NONE ) { 443 | termwin->AddText("Couldn't resolve hostname\n"); 444 | } else { 445 | /* If we fail, it's okay, the GUI shows the problem */ 446 | tcpsock = SDLNet_TCP_Open(&serverIP); 447 | if ( tcpsock == NULL ) { 448 | termwin->AddText("Connect failed\n"); 449 | } else { 450 | termwin->AddText("Connected\n"); 451 | } 452 | } 453 | /* Try ports in the range {CHAT_PORT - CHAT_PORT+10} */ 454 | for ( i=0; (udpsock == NULL) && i<10; ++i ) { 455 | udpsock = SDLNet_UDP_Open(CHAT_PORT+i); 456 | } 457 | if ( udpsock == NULL ) { 458 | SDLNet_TCP_Close(tcpsock); 459 | tcpsock = NULL; 460 | termwin->AddText("Couldn't create UDP endpoint\n"); 461 | } 462 | 463 | /* Allocate the socket set for polling the network */ 464 | socketset = SDLNet_AllocSocketSet(2); 465 | if ( socketset == NULL ) { 466 | fprintf(stderr, "Couldn't create socket set: %s\n", 467 | SDLNet_GetError()); 468 | cleanup(2); 469 | } 470 | SDLNet_TCP_AddSocket(socketset, tcpsock); 471 | SDLNet_UDP_AddSocket(socketset, udpsock); 472 | 473 | /* Run the GUI, handling network data */ 474 | SendHello(argv[2]); 475 | gui->Run(HandleNet); 476 | cleanup(0); 477 | 478 | /* Keep the compiler happy */ 479 | return(0); 480 | } 481 | -------------------------------------------------------------------------------- /chat.h: -------------------------------------------------------------------------------- 1 | /* 2 | CHAT: A chat client/server using the SDL example network library 3 | Copyright (C) 1997-2021 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /* $Id$ */ 23 | 24 | /* Convert four letters into a number */ 25 | #define MAKE_NUM(A, B, C, D) (((A+B)<<8)|(C+D)) 26 | 27 | /* Defines for the chat client */ 28 | #define CHAT_SCROLLBACK 512 /* Save 512 lines in scrollback */ 29 | #define CHAT_PROMPT "> " 30 | #define CHAT_PACKETSIZE 256 /* Maximum length of a message */ 31 | 32 | /* Defines shared between the server and client */ 33 | #define CHAT_PORT MAKE_NUM('C','H','A','T') 34 | 35 | /* The protocol between the chat client and server */ 36 | #define CHAT_HELLO 0 /* 0+Port+len+name */ 37 | #define CHAT_HELLO_PORT 1 38 | #define CHAT_HELLO_NLEN CHAT_HELLO_PORT+2 39 | #define CHAT_HELLO_NAME CHAT_HELLO_NLEN+1 40 | #define CHAT_ADD 1 /* 1+N+IP+Port+len+name */ 41 | #define CHAT_ADD_SLOT 1 42 | #define CHAT_ADD_HOST CHAT_ADD_SLOT+1 43 | #define CHAT_ADD_PORT CHAT_ADD_HOST+4 44 | #define CHAT_ADD_NLEN CHAT_ADD_PORT+2 45 | #define CHAT_ADD_NAME CHAT_ADD_NLEN+1 46 | #define CHAT_DEL 2 /* 2+N */ 47 | #define CHAT_DEL_SLOT 1 48 | #define CHAT_DEL_LEN CHAT_DEL_SLOT+1 49 | #define CHAT_BYE 255 /* 255 */ 50 | #define CHAT_BYE_LEN 1 51 | 52 | /* The maximum number of people who can talk at once */ 53 | #define CHAT_MAXPEOPLE 10 54 | -------------------------------------------------------------------------------- /chatd.c: -------------------------------------------------------------------------------- 1 | /* 2 | CHATD: A chat server using the SDL example network library 3 | Copyright (C) 1997-2021 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /* Note that this isn't necessarily the way to run a chat system. 23 | This is designed to excercise the network code more than be really 24 | functional. 25 | */ 26 | 27 | #include 28 | #include 29 | #include 30 | 31 | #include "SDL.h" 32 | #include "SDL_net.h" 33 | #include "chat.h" 34 | 35 | /* This is really easy. All we do is monitor connections */ 36 | 37 | static TCPsocket servsock = NULL; 38 | static SDLNet_SocketSet socketset = NULL; 39 | static struct { 40 | int active; 41 | TCPsocket sock; 42 | IPaddress peer; 43 | Uint8 name[256+1]; 44 | } people[CHAT_MAXPEOPLE]; 45 | 46 | 47 | void HandleServer(void) 48 | { 49 | TCPsocket newsock; 50 | int which; 51 | unsigned char data; 52 | 53 | newsock = SDLNet_TCP_Accept(servsock); 54 | if ( newsock == NULL ) { 55 | return; 56 | } 57 | 58 | /* Look for unconnected person slot */ 59 | for ( which=0; which. 8 | # 9 | # This program is free software; you can redistribute it and/or modify 10 | # it under the terms of the GNU General Public License as published by 11 | # the Free Software Foundation; either version 2, or (at your option) 12 | # any later version. 13 | # 14 | # This program is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | # GNU General Public License for more details. 18 | # 19 | # You should have received a copy of the GNU General Public License 20 | # along with this program. If not, see . 21 | 22 | # As a special exception to the GNU General Public License, if you 23 | # distribute this file as part of a program that contains a 24 | # configuration script generated by Autoconf, you may include it under 25 | # the same distribution terms that you use for the rest of that program. 26 | 27 | # This file is maintained in Automake, please report 28 | # bugs to or send patches to 29 | # . 30 | 31 | nl=' 32 | ' 33 | 34 | # We need space, tab and new line, in precisely that order. Quoting is 35 | # there to prevent tools from complaining about whitespace usage. 36 | IFS=" "" $nl" 37 | 38 | file_conv= 39 | 40 | # func_file_conv build_file lazy 41 | # Convert a $build file to $host form and store it in $file 42 | # Currently only supports Windows hosts. If the determined conversion 43 | # type is listed in (the comma separated) LAZY, no conversion will 44 | # take place. 45 | func_file_conv () 46 | { 47 | file=$1 48 | case $file in 49 | / | /[!/]*) # absolute file, and not a UNC file 50 | if test -z "$file_conv"; then 51 | # lazily determine how to convert abs files 52 | case `uname -s` in 53 | MINGW*) 54 | file_conv=mingw 55 | ;; 56 | CYGWIN*) 57 | file_conv=cygwin 58 | ;; 59 | *) 60 | file_conv=wine 61 | ;; 62 | esac 63 | fi 64 | case $file_conv/,$2, in 65 | *,$file_conv,*) 66 | ;; 67 | mingw/*) 68 | file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` 69 | ;; 70 | cygwin/*) 71 | file=`cygpath -m "$file" || echo "$file"` 72 | ;; 73 | wine/*) 74 | file=`winepath -w "$file" || echo "$file"` 75 | ;; 76 | esac 77 | ;; 78 | esac 79 | } 80 | 81 | # func_cl_dashL linkdir 82 | # Make cl look for libraries in LINKDIR 83 | func_cl_dashL () 84 | { 85 | func_file_conv "$1" 86 | if test -z "$lib_path"; then 87 | lib_path=$file 88 | else 89 | lib_path="$lib_path;$file" 90 | fi 91 | linker_opts="$linker_opts -LIBPATH:$file" 92 | } 93 | 94 | # func_cl_dashl library 95 | # Do a library search-path lookup for cl 96 | func_cl_dashl () 97 | { 98 | lib=$1 99 | found=no 100 | save_IFS=$IFS 101 | IFS=';' 102 | for dir in $lib_path $LIB 103 | do 104 | IFS=$save_IFS 105 | if $shared && test -f "$dir/$lib.dll.lib"; then 106 | found=yes 107 | lib=$dir/$lib.dll.lib 108 | break 109 | fi 110 | if test -f "$dir/$lib.lib"; then 111 | found=yes 112 | lib=$dir/$lib.lib 113 | break 114 | fi 115 | if test -f "$dir/lib$lib.a"; then 116 | found=yes 117 | lib=$dir/lib$lib.a 118 | break 119 | fi 120 | done 121 | IFS=$save_IFS 122 | 123 | if test "$found" != yes; then 124 | lib=$lib.lib 125 | fi 126 | } 127 | 128 | # func_cl_wrapper cl arg... 129 | # Adjust compile command to suit cl 130 | func_cl_wrapper () 131 | { 132 | # Assume a capable shell 133 | lib_path= 134 | shared=: 135 | linker_opts= 136 | for arg 137 | do 138 | if test -n "$eat"; then 139 | eat= 140 | else 141 | case $1 in 142 | -o) 143 | # configure might choose to run compile as 'compile cc -o foo foo.c'. 144 | eat=1 145 | case $2 in 146 | *.o | *.[oO][bB][jJ]) 147 | func_file_conv "$2" 148 | set x "$@" -Fo"$file" 149 | shift 150 | ;; 151 | *) 152 | func_file_conv "$2" 153 | set x "$@" -Fe"$file" 154 | shift 155 | ;; 156 | esac 157 | ;; 158 | -I) 159 | eat=1 160 | func_file_conv "$2" mingw 161 | set x "$@" -I"$file" 162 | shift 163 | ;; 164 | -I*) 165 | func_file_conv "${1#-I}" mingw 166 | set x "$@" -I"$file" 167 | shift 168 | ;; 169 | -l) 170 | eat=1 171 | func_cl_dashl "$2" 172 | set x "$@" "$lib" 173 | shift 174 | ;; 175 | -l*) 176 | func_cl_dashl "${1#-l}" 177 | set x "$@" "$lib" 178 | shift 179 | ;; 180 | -L) 181 | eat=1 182 | func_cl_dashL "$2" 183 | ;; 184 | -L*) 185 | func_cl_dashL "${1#-L}" 186 | ;; 187 | -static) 188 | shared=false 189 | ;; 190 | -Wl,*) 191 | arg=${1#-Wl,} 192 | save_ifs="$IFS"; IFS=',' 193 | for flag in $arg; do 194 | IFS="$save_ifs" 195 | linker_opts="$linker_opts $flag" 196 | done 197 | IFS="$save_ifs" 198 | ;; 199 | -Xlinker) 200 | eat=1 201 | linker_opts="$linker_opts $2" 202 | ;; 203 | -*) 204 | set x "$@" "$1" 205 | shift 206 | ;; 207 | *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) 208 | func_file_conv "$1" 209 | set x "$@" -Tp"$file" 210 | shift 211 | ;; 212 | *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) 213 | func_file_conv "$1" mingw 214 | set x "$@" "$file" 215 | shift 216 | ;; 217 | *) 218 | set x "$@" "$1" 219 | shift 220 | ;; 221 | esac 222 | fi 223 | shift 224 | done 225 | if test -n "$linker_opts"; then 226 | linker_opts="-link$linker_opts" 227 | fi 228 | exec "$@" $linker_opts 229 | exit 1 230 | } 231 | 232 | eat= 233 | 234 | case $1 in 235 | '') 236 | echo "$0: No command. Try '$0 --help' for more information." 1>&2 237 | exit 1; 238 | ;; 239 | -h | --h*) 240 | cat <<\EOF 241 | Usage: compile [--help] [--version] PROGRAM [ARGS] 242 | 243 | Wrapper for compilers which do not understand '-c -o'. 244 | Remove '-o dest.o' from ARGS, run PROGRAM with the remaining 245 | arguments, and rename the output as expected. 246 | 247 | If you are trying to build a whole package this is not the 248 | right script to run: please start by reading the file 'INSTALL'. 249 | 250 | Report bugs to . 251 | EOF 252 | exit $? 253 | ;; 254 | -v | --v*) 255 | echo "compile $scriptversion" 256 | exit $? 257 | ;; 258 | cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \ 259 | icl | *[/\\]icl | icl.exe | *[/\\]icl.exe ) 260 | func_cl_wrapper "$@" # Doesn't return... 261 | ;; 262 | esac 263 | 264 | ofile= 265 | cfile= 266 | 267 | for arg 268 | do 269 | if test -n "$eat"; then 270 | eat= 271 | else 272 | case $1 in 273 | -o) 274 | # configure might choose to run compile as 'compile cc -o foo foo.c'. 275 | # So we strip '-o arg' only if arg is an object. 276 | eat=1 277 | case $2 in 278 | *.o | *.obj) 279 | ofile=$2 280 | ;; 281 | *) 282 | set x "$@" -o "$2" 283 | shift 284 | ;; 285 | esac 286 | ;; 287 | *.c) 288 | cfile=$1 289 | set x "$@" "$1" 290 | shift 291 | ;; 292 | *) 293 | set x "$@" "$1" 294 | shift 295 | ;; 296 | esac 297 | fi 298 | shift 299 | done 300 | 301 | if test -z "$ofile" || test -z "$cfile"; then 302 | # If no '-o' option was seen then we might have been invoked from a 303 | # pattern rule where we don't need one. That is ok -- this is a 304 | # normal compilation that the losing compiler can handle. If no 305 | # '.c' file was seen then we are probably linking. That is also 306 | # ok. 307 | exec "$@" 308 | fi 309 | 310 | # Name of file we expect compiler to create. 311 | cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` 312 | 313 | # Create the lock directory. 314 | # Note: use '[/\\:.-]' here to ensure that we don't use the same name 315 | # that we are using for the .o file. Also, base the name on the expected 316 | # object file name, since that is what matters with a parallel build. 317 | lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d 318 | while true; do 319 | if mkdir "$lockdir" >/dev/null 2>&1; then 320 | break 321 | fi 322 | sleep 1 323 | done 324 | # FIXME: race condition here if user kills between mkdir and trap. 325 | trap "rmdir '$lockdir'; exit 1" 1 2 15 326 | 327 | # Run the compile. 328 | "$@" 329 | ret=$? 330 | 331 | if test -f "$cofile"; then 332 | test "$cofile" = "$ofile" || mv "$cofile" "$ofile" 333 | elif test -f "${cofile}bj"; then 334 | test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" 335 | fi 336 | 337 | rmdir "$lockdir" 338 | exit $ret 339 | 340 | # Local Variables: 341 | # mode: shell-script 342 | # sh-indentation: 2 343 | # eval: (add-hook 'before-save-hook 'time-stamp) 344 | # time-stamp-start: "scriptversion=" 345 | # time-stamp-format: "%:y-%02m-%02d.%02H" 346 | # time-stamp-time-zone: "UTC0" 347 | # time-stamp-end: "; # UTC" 348 | # End: 349 | -------------------------------------------------------------------------------- /configure.in: -------------------------------------------------------------------------------- 1 | dnl Process this file with autoconf to produce a configure script. 2 | AC_INIT(README.txt) 3 | 4 | dnl Set various version strings - taken gratefully from the GTk sources 5 | 6 | # Making releases: 7 | # MICRO_VERSION += 1; 8 | # INTERFACE_AGE += 1; 9 | # BINARY_AGE += 1; 10 | # if any functions have been added, set INTERFACE_AGE to 0. 11 | # if backwards compatibility has been broken, 12 | # set BINARY_AGE and INTERFACE_AGE to 0. 13 | 14 | MAJOR_VERSION=2 15 | MINOR_VERSION=0 16 | MICRO_VERSION=1 17 | INTERFACE_AGE=1 18 | BINARY_AGE=1 19 | VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION 20 | 21 | AC_SUBST(MAJOR_VERSION) 22 | AC_SUBST(MINOR_VERSION) 23 | AC_SUBST(MICRO_VERSION) 24 | AC_SUBST(INTERFACE_AGE) 25 | AC_SUBST(BINARY_AGE) 26 | AC_SUBST(VERSION) 27 | 28 | # libtool versioning 29 | LT_INIT([win32-dll]) 30 | 31 | LT_RELEASE=$MAJOR_VERSION.$MINOR_VERSION 32 | LT_CURRENT=`expr $MICRO_VERSION - $INTERFACE_AGE` 33 | LT_REVISION=$INTERFACE_AGE 34 | LT_AGE=`expr $BINARY_AGE - $INTERFACE_AGE` 35 | 36 | AC_SUBST(LT_RELEASE) 37 | AC_SUBST(LT_CURRENT) 38 | AC_SUBST(LT_REVISION) 39 | AC_SUBST(LT_AGE) 40 | 41 | dnl Detect the canonical build and host environments 42 | AC_CANONICAL_HOST 43 | 44 | dnl Setup for automake 45 | AM_INIT_AUTOMAKE(SDL2_net, $VERSION) 46 | 47 | dnl Check for tools 48 | AC_PROG_LIBTOOL 49 | AC_PROG_CC 50 | AC_PROG_CXX 51 | AC_PROG_INSTALL 52 | AC_PROG_MAKE_SET 53 | if test -z "$host_alias"; then 54 | hostaliaswindres= 55 | else 56 | hostaliaswindres="$host_alias-windres" 57 | fi 58 | AC_CHECK_PROGS(WINDRES, [windres $hostaliaswindres $host_os-windres]) 59 | 60 | case "$host" in 61 | *-*-beos*) 62 | ac_default_prefix=/boot/develop/tools/gnupro 63 | ;; 64 | *-*-cygwin* | *-*-mingw32*) 65 | if test "$build" != "$host"; then # cross-compiling 66 | # Default cross-compile location 67 | ac_default_prefix=/usr/local/cross-tools/$host 68 | else 69 | # Look for the location of the tools and install there 70 | if test "$BUILD_PREFIX" != ""; then 71 | ac_default_prefix=$BUILD_PREFIX 72 | fi 73 | fi 74 | if test x$WINDRES != x; then 75 | use_version_rc=true 76 | fi 77 | ;; 78 | esac 79 | AM_CONDITIONAL(USE_VERSION_RC, test x$use_version_rc = xtrue) 80 | 81 | dnl Figure out which networking libraries to use 82 | case "$host" in 83 | *mingw32ce*) 84 | INETLIB="-lwinsock -lws2" 85 | ;; 86 | x86_64-*-mingw32*) 87 | INETLIB="-lws2_32 -liphlpapi" 88 | ;; 89 | *-*-cygwin* | *-*-mingw32*) 90 | INETLIB="-lwsock32 -liphlpapi" 91 | ;; 92 | sparc*-*-solaris*) 93 | INETLIB="-lsocket -lnsl" 94 | ;; 95 | *-*-qnx*) 96 | INETLIB="-lsocket" 97 | ;; 98 | *-*-beos*) 99 | INETLIB="" 100 | ;; 101 | *-*-haiku*) 102 | INETLIB="-lnetwork" 103 | ;; 104 | *) 105 | INETLIB="" 106 | ;; 107 | esac 108 | AC_SUBST(INETLIB) 109 | 110 | dnl Check for SDL 111 | SDL_VERSION=2.0.0 112 | AC_SUBST(SDL_VERSION) 113 | AM_PATH_SDL2($SDL_VERSION, 114 | :, 115 | AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!]) 116 | ) 117 | CFLAGS="$CFLAGS $SDL_CFLAGS" 118 | LIBS="$LIBS $SDL_LIBS" 119 | 120 | dnl Check for GUI library for the chat client 121 | have_GUI=no 122 | AC_ARG_ENABLE(gui, 123 | [ --enable-gui Try to build the GUI test programs [default=yes]], 124 | , enable_gui=yes) 125 | if test x$enable_gui = xyes; then 126 | AC_LANG_PUSH(C++) 127 | AC_CHECK_LIB(GUI, GUI_Create, have_GUI=yes) 128 | AC_LANG_POP(C++) 129 | if test x$have_GUI != xyes; then 130 | AC_MSG_WARN([*** Can't find the GUI library - not building test programs 131 | The GUI library can be found at: 132 | http://www.libsdl.org/projects/GUIlib/ 133 | ]) 134 | fi 135 | fi 136 | AM_CONDITIONAL(HAVE_GUI_LIB, test x$have_GUI = xyes) 137 | 138 | dnl C++ flags are the same as the C flags 139 | CXXFLAGS="$CXXFLAGS $CFLAGS" 140 | 141 | AC_SUBST([WINDRES]) 142 | 143 | # Finally create all the generated files 144 | AC_OUTPUT([ 145 | Makefile SDL2_net.spec SDL2_net.pc 146 | ]) 147 | -------------------------------------------------------------------------------- /debian/changelog: -------------------------------------------------------------------------------- 1 | libsdl2-net (2.0.1) UNRELEASED; urgency=medium 2 | 3 | * Updated to version 2.0.1 4 | 5 | -- Sam Lantinga Thu, 07 Jan 2016 12:31:02 -0800 6 | 7 | libsdl2-net (2.0.0) unstable; urgency=low 8 | 9 | * Updated library version to 2.0 for consistency with SDL 2.0 10 | 11 | -- Sam Lantinga Tue, 26 Feb 2013 15:48:41 -0800 12 | 13 | libsdl2-net (1.2.9) unstable; urgency=low 14 | 15 | * sdl-net for SDL2. Initial release. 16 | 17 | -- Sam Lantinga Fri, 15 Feb 2013 13:09:44 -0800 18 | 19 | sdl-net1.2 (1.2.7-5) unstable; urgency=low 20 | 21 | * Add also 'Multi-Arch: same' to -dev package, since the headers are all 22 | architecture-independent. Thanks to Steve Langasek. (Closes: #652873) 23 | 24 | -- Manuel A. Fernandez Montecelo Wed, 21 Dec 2011 18:43:32 +0000 25 | 26 | sdl-net1.2 (1.2.7-4) unstable; urgency=low 27 | 28 | * Remove previous uploader, inactive for years 29 | * Switch to debhelper compat level v9 30 | * Build for multiarch 31 | * Quell lintian warnings: 32 | - binary-control-field-duplicates-source (remove field from binary package 33 | libsdl-net1.2) 34 | 35 | -- Manuel A. Fernandez Montecelo Mon, 19 Dec 2011 00:17:25 +0000 36 | 37 | sdl-net1.2 (1.2.7-3) unstable; urgency=low 38 | 39 | * New maintainer 40 | - Make package as part of SDL team 41 | - Add myself to uploaders, and setting DM-Upload-Allowed: yes 42 | * Incorporated changes from Roman Vasiyarov : 43 | - Added pkg-config files (Closes: #631085) 44 | * Bump Standards-Version to 3.9.2 (no changes needed) 45 | * Changed debhelper compat to level 8 (level 4 before): 46 | - Updated dependency on debhelper to (>= 8.0.0) 47 | - Simplify a lot debian/rules file by leveraging debhelper capabilities, 48 | only acting when deviating from auto behaviour 49 | * Added 'source/format', with '3.0 (quilt)' 50 | - Removed dependency on dpatch 51 | - Convert patches, documenting and refreshing them 52 | * Convert ${pkg}.dirs and ${pkg}.files into ${pkg}.install 53 | * Updating 'watch' file to version=3 54 | * Added Vcs-Git and Vcs-Browser in 'control' file 55 | * Modifications to dependencies and build options: 56 | - Depending on newer dpkg-dev 57 | - Depending on SDL >= 1.2.14 (instead of misc old versions) 58 | - Removed Conflict dependencies on libsdl-net1.1. It's very old and not 59 | present in any of the last Debian releases, long unsupported. 60 | * debian/copyright: updated and converted to DEP-5 61 | * Stop shipping .la files (Closes: #633328). The command given in the bug 62 | report to remove dependency_libs is not working, and I don't think that any 63 | Debian package use .la anyway -- 0 rdepends for the -dev package. 64 | 65 | -- Manuel A. Fernandez Montecelo Sun, 04 Dec 2011 10:12:42 +0000 66 | 67 | sdl-net1.2 (1.2.7-2) unstable; urgency=low 68 | 69 | * Fix the clean rule to check for Makefile first 70 | 71 | -- Mike Furr Thu, 30 Aug 2007 16:58:14 -0400 72 | 73 | sdl-net1.2 (1.2.7-1) unstable; urgency=low 74 | 75 | * New upstream release (Closes: #399914, #437003) 76 | * Fixed copyright file to say LGPL instead of GPL (Closes: #433475) 77 | * Fixed several lintian errors (pkg is now binNMU-safe). 78 | * Updated to latest standards version (no changes). 79 | 80 | -- Mike Furr Thu, 30 Aug 2007 16:32:29 -0400 81 | 82 | sdl-net1.2 (1.2.5-7) unstable; urgency=low 83 | 84 | * Argh, added semicolon patch to list of patches to actually apply 85 | * Hand verified resulting package has this fix! 86 | 87 | -- Mike Furr Wed, 29 Mar 2006 15:33:39 -0500 88 | 89 | sdl-net1.2 (1.2.5-6) unstable; urgency=low 90 | 91 | * Accidentally dropped semicolon patch when I switched to dpatch. 92 | Added patch back to remove ; at end of extern block in SDL_net.h 93 | (Closes: 346132) 94 | 95 | -- Mike Furr Sun, 8 Jan 2006 15:02:27 -0500 96 | 97 | sdl-net1.2 (1.2.5-5) unstable; urgency=low 98 | 99 | * Touch auto-* files so that make doesn't try to rebuild them 100 | after they are patched by the .diff.gz (Closes: 327316) 101 | 102 | -- Mike Furr Mon, 3 Oct 2005 22:17:12 -0400 103 | 104 | sdl-net1.2 (1.2.5-4) unstable; urgency=low 105 | 106 | * dpatch-ification 107 | * Added patch from Sam Hocevar which doesn't byteswap on big endian 108 | arches when SDL_DATA_ALIGNED is true 109 | * Changed comment for SDLNet_UDP_Bind to reflect implementation 110 | - Since upstream has not responded to this (and seems dead), and a fair 111 | number of packages use sdl-net, I don't want to change the behavior 112 | just for debian, only properly document the actual behavior. 113 | - (Closes: 211570) 114 | * Updated libtool for kfreebsd-gnu support (Closes: 278595) 115 | * Updated debian/copyright to say GPL is the license instead of copyright 116 | (Closes: 290202) 117 | 118 | -- Mike Furr Sat, 2 Jul 2005 17:51:00 -0400 119 | 120 | sdl-net1.2 (1.2.5-3) unstable; urgency=low 121 | 122 | * Improved the package description (Closes: 209732) 123 | * Added ARM to list in SDL_net.h of CPU's that are have data alignment 124 | issues. (Closes: 212570) [also forwared this upstream] 125 | 126 | -- Mike Furr Tue, 7 Oct 2003 23:15:39 -0400 127 | 128 | sdl-net1.2 (1.2.5-2) unstable; urgency=low 129 | 130 | * Removed illegal semicolon at end of extern "C" block 131 | in SDL_net.h. (Closes: 204186) 132 | 133 | -- Mike Furr Wed, 6 Aug 2003 21:01:30 -0400 134 | 135 | sdl-net1.2 (1.2.5-1) unstable; urgency=low 136 | 137 | * New upstream release. 138 | * Updated control's standard's version to 3.5.9 139 | * Added upstream's CHANGES files to the package. 140 | 141 | -- Mike Furr Sun, 20 Apr 2003 19:06:35 -0400 142 | 143 | sdl-net1.2 (1.2.4-3) unstable; urgency=low 144 | 145 | * New Maintainer (Closes: 188630) 146 | * control: Changed -dev package to section libdevel. 147 | * rules: updated config* handling as guided by the autotools-dev 148 | README.Debian.gz 149 | 150 | -- Mike Furr Mon, 14 Apr 2003 22:19:50 -0400 151 | 152 | sdl-net1.2 (1.2.4-2) unstable; urgency=low 153 | 154 | * rules: changed DEB_BUILD_OPTIONS to policy 3.5.7.0 155 | * control: Standards-Version: 3.5.8.0 156 | * watch: added uscan watch file 157 | * control: removed superfluous automake, autoconf and libtool dependencies 158 | 159 | -- Arthur Korn Thu, 12 Dec 2002 01:07:18 +0100 160 | 161 | sdl-net1.2 (1.2.4-1) unstable; urgency=low 162 | 163 | * New upstream release 164 | - now build depends on libsdl1.2-dev (>= 1.2.4) 165 | 166 | -- Arthur Korn Wed, 30 Oct 2002 11:25:56 +0100 167 | 168 | sdl-net1.2 (1.2.2-1) unstable; urgency=low 169 | 170 | * New upstream release 171 | 172 | -- Arthur Korn Thu, 18 Oct 2001 19:46:18 +0200 173 | 174 | sdl-net1.2 (1.2.0-5.1) unstable; urgency=low 175 | 176 | * NMU 177 | * acinclude.m4: remove AM_PATH_SDL macro 178 | * configure.in: don't add SDL_LIBS to LIBS 179 | * re-ran libtoolize --force-copy; aclocal; automake --foreign; autoconf 180 | with libsdl1.2-dev 1.2.2-3.1 installed 181 | * debian/control: update relationships with libsdl1.2-dev to (>= 1.2.2-3.1) 182 | 183 | -- Branden Robinson Mon, 15 Oct 2001 13:30:48 -0500 184 | 185 | sdl-net1.2 (1.2.0-5) unstable; urgency=low 186 | 187 | * Standards-Version 3.5.4.0, no changes necessary. 188 | 189 | -- Arthur Korn Sun, 3 Jun 2001 18:08:31 +0200 190 | 191 | sdl-net1.2 (1.2.0-4) unstable; urgency=low 192 | 193 | * [brownbag] /usr/lib symlinks to -dev, actual .so to the libsdl-net1.2 194 | * reverted that lack-of-coffeine symptom of crap I did last time with 195 | that conflict ... 196 | 197 | -- Arthur Korn Mon, 7 May 2001 23:40:49 +0200 198 | 199 | sdl-net1.2 (1.2.0-3) unstable; urgency=low 200 | 201 | * changed section off the -dev package to "devel" (override disparity). 202 | * added missing Conflicts: libsdl-net1.1 for libsdl-net1.2 203 | 204 | -- Arthur Korn Mon, 7 May 2001 23:05:12 +0200 205 | 206 | sdl-net1.2 (1.2.0-2) unstable; urgency=low 207 | 208 | * changed section to "libs", correcting override disparity. 209 | * added Conflicts and Replaces on libsdl-net1.1-dev (common files). 210 | * so this is libsdl-net1.2 then, closes: #94455. 211 | 212 | -- Arthur Korn Thu, 26 Apr 2001 16:38:04 +0200 213 | 214 | sdl-net1.2 (1.2.0-1) unstable; urgency=low 215 | 216 | * Initial Release. 217 | 218 | -- Arthur Korn Sun, 22 Apr 2001 18:07:38 +0200 219 | -------------------------------------------------------------------------------- /debian/compat: -------------------------------------------------------------------------------- 1 | 9 2 | -------------------------------------------------------------------------------- /debian/control: -------------------------------------------------------------------------------- 1 | Source: libsdl2-net 2 | Section: libs 3 | Priority: optional 4 | Maintainer: Debian SDL packages maintainers 5 | Uploaders: Manuel A. Fernandez Montecelo , 6 | Sam Lantinga 7 | Standards-Version: 3.9.2 8 | Build-Depends: debhelper (>= 8.9.0~), 9 | dh-autoreconf, 10 | dpkg-dev (>= 1.16.1~), 11 | libsdl2-dev (>= 2.0.0), 12 | Homepage: http://www.libsdl.org/projects/SDL_net/ 13 | 14 | 15 | Package: libsdl2-net 16 | Architecture: any 17 | Multi-Arch: same 18 | Pre-Depends: ${misc:Pre-Depends} 19 | Depends: ${misc:Depends}, 20 | ${shlibs:Depends} 21 | Description: Network library for Simple DirectMedia Layer 2.0 22 | This is a small, low-level, cross-platform networking library. 23 | . 24 | This package contains the shared library. 25 | 26 | Package: libsdl2-net-dev 27 | Section: libdevel 28 | Architecture: any 29 | Multi-Arch: same 30 | Depends: ${misc:Depends}, 31 | libsdl2-net (= ${binary:Version}), 32 | libc6-dev, 33 | libsdl2-dev (>= 2.0.0) 34 | Description: Network library for Simple DirectMedia Layer 2.0 35 | This is a small, low-level, cross-platform networking library. 36 | . 37 | . 38 | This package contains files needed if you wish to use the SDL net 39 | library in your own programs. 40 | -------------------------------------------------------------------------------- /debian/copyright: -------------------------------------------------------------------------------- 1 | Format: http://dep.debian.net/deps/dep5/ 2 | Upstream-Name: SDL_net 3 | Upstream-Contact: Sam Lantinga 4 | Roy Wood 5 | Source: http://www.libsdl.org/projects/SDL_net/ 6 | 7 | Files: * 8 | Copyright: 1997-2021 Sam Lantinga 9 | License: zlib/libpng 10 | 11 | Files: debian/* 12 | Copyright: 2011, Manuel A. Fernandez Montecelo 13 | 2003-2007 Mike Furr 14 | 2001, Branden Robinson 15 | 2001-2002 Arthur Korn Thu, 12 Dec 2002 01:07:18 +0100 16 | License: LGPL-2+ 17 | 18 | License: zlib/libpng 19 | This software is provided 'as-is', without any express or implied 20 | warranty. In no event will the authors be held liable for any damages 21 | arising from the use of this software. 22 | . 23 | Permission is granted to anyone to use this software for any purpose, 24 | including commercial applications, and to alter it and redistribute it 25 | freely, subject to the following restrictions: 26 | . 27 | 1. The origin of this software must not be misrepresented; you must not 28 | claim that you wrote the original software. If you use this software 29 | in a product, an acknowledgment in the product documentation would be 30 | appreciated but is not required. 31 | 2. Altered source versions must be plainly marked as such, and must not be 32 | misrepresented as being the original software. 33 | 3. This notice may not be removed or altered from any source distribution. 34 | 35 | License: LGPL-2+ 36 | This program is free software; you can redistribute it and/or modify 37 | it under the terms of the GNU Lesser General Public License as 38 | published by the Free Software Foundation; either version 2 of the 39 | License, or (at your option) any later version. 40 | . 41 | On Debian systems, the complete text of version 2 of the GNU Lesser 42 | Public License can be found in `/usr/share/common-licenses/LGPL-2'. 43 | 44 | -------------------------------------------------------------------------------- /debian/docs: -------------------------------------------------------------------------------- 1 | README.txt 2 | -------------------------------------------------------------------------------- /debian/libsdl2-net-dev.examples: -------------------------------------------------------------------------------- 1 | chat.cpp 2 | chatd.c 3 | chat.h 4 | -------------------------------------------------------------------------------- /debian/libsdl2-net-dev.install: -------------------------------------------------------------------------------- 1 | usr/include 2 | usr/lib/*/lib*.a 3 | usr/lib/*/lib*.so 4 | usr/lib/*/pkgconfig 5 | -------------------------------------------------------------------------------- /debian/libsdl2-net.install: -------------------------------------------------------------------------------- 1 | usr/lib/*/lib*.so.* 2 | -------------------------------------------------------------------------------- /debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | 3 | #export DH_VERBOSE=1 4 | 5 | 6 | export DEB_CFLAGS_MAINT_APPEND = -pipe -Wall 7 | export DEB_LDFLAGS_MAINT_APPEND = -Wl,--no-undefined -Wl,-Bsymbolic -Wl,--as-needed 8 | 9 | 10 | # according to help: speeds up one-time build 11 | confflags = --disable-dependency-tracking 12 | # GUI needed only for examples, don't even try to support it 13 | confflags += --disable-gui 14 | 15 | 16 | %: 17 | dh $@ --with autoreconf --parallel 18 | 19 | override_dh_autoreconf: 20 | dh_autoreconf ./autogen.sh 21 | 22 | override_dh_auto_configure: 23 | dh_auto_configure -- $(confflags) 24 | 25 | override_dh_auto_installchangelogs: 26 | dh_auto_installchangelogs -- CHANGES 27 | 28 | override_dh_compress: 29 | dh_compress -Xchatd.c -Xchat.cpp -Xchat.h 30 | -------------------------------------------------------------------------------- /debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (native) 2 | -------------------------------------------------------------------------------- /debian/watch: -------------------------------------------------------------------------------- 1 | version=3 2 | http://www.libsdl.org/projects/SDL_net/release/SDL_net-([\d\.]+)\.tar\..* 3 | -------------------------------------------------------------------------------- /gcc-fat.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Build Universal binaries on Mac OS X, thanks Ryan! 4 | # 5 | # Usage: ./configure CC="sh gcc-fat.sh" && make && rm -rf x86 x64 6 | 7 | DEVELOPER="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer" 8 | 9 | # Intel 32-bit compiler flags (10.6 runtime compatibility) 10 | GCC_COMPILE_X86="gcc -arch i386 -mmacosx-version-min=10.6 \ 11 | -DMAC_OS_X_VERSION_MIN_REQUIRED=1040 \ 12 | -I/usr/local/include" 13 | 14 | GCC_LINK_X86="-mmacosx-version-min=10.6" 15 | 16 | # Intel 64-bit compiler flags (10.6 runtime compatibility) 17 | GCC_COMPILE_X64="gcc -arch x86_64 -mmacosx-version-min=10.6 \ 18 | -DMAC_OS_X_VERSION_MIN_REQUIRED=1050 \ 19 | -I/usr/local/include" 20 | 21 | GCC_LINK_X64="-mmacosx-version-min=10.6" 22 | 23 | # Output both PowerPC and Intel object files 24 | args="$*" 25 | compile=yes 26 | link=yes 27 | while test x$1 != x; do 28 | case $1 in 29 | --version) exec gcc $1;; 30 | -v) exec gcc $1;; 31 | -V) exec gcc $1;; 32 | -print-prog-name=*) exec gcc $1;; 33 | -print-search-dirs) exec gcc $1;; 34 | -E) GCC_COMPILE_X86="$GCC_COMPILE_X86 -E" 35 | GCC_COMPILE_X64="$GCC_COMPILE_X64 -E" 36 | compile=no; link=no;; 37 | -c) link=no;; 38 | -o) output=$2;; 39 | *.c|*.cc|*.cpp|*.S) source=$1;; 40 | esac 41 | shift 42 | done 43 | if test x$link = xyes; then 44 | GCC_COMPILE_X86="$GCC_COMPILE_X86 $GCC_LINK_X86" 45 | GCC_COMPILE_X64="$GCC_COMPILE_X64 $GCC_LINK_X64" 46 | fi 47 | if test x"$output" = x; then 48 | if test x$link = xyes; then 49 | output=a.out 50 | elif test x$compile = xyes; then 51 | output=`echo $source | sed -e 's|.*/||' -e 's|\(.*\)\.[^\.]*|\1|'`.o 52 | fi 53 | fi 54 | 55 | # Compile X86 32-bit 56 | if test x"$output" != x; then 57 | dir=x86/`dirname $output` 58 | if test -d $dir; then 59 | : 60 | else 61 | mkdir -p $dir 62 | fi 63 | fi 64 | set -- $args 65 | while test x$1 != x; do 66 | if test -f "x86/$1" && test "$1" != "$output"; then 67 | x86_args="$x86_args x86/$1" 68 | else 69 | x86_args="$x86_args $1" 70 | fi 71 | shift 72 | done 73 | $GCC_COMPILE_X86 $x86_args || exit $? 74 | if test x"$output" != x; then 75 | cp $output x86/$output 76 | fi 77 | 78 | # Compile X86 32-bit 79 | if test x"$output" != x; then 80 | dir=x64/`dirname $output` 81 | if test -d $dir; then 82 | : 83 | else 84 | mkdir -p $dir 85 | fi 86 | fi 87 | set -- $args 88 | while test x$1 != x; do 89 | if test -f "x64/$1" && test "$1" != "$output"; then 90 | x64_args="$x64_args x64/$1" 91 | else 92 | x64_args="$x64_args $1" 93 | fi 94 | shift 95 | done 96 | $GCC_COMPILE_X64 $x64_args || exit $? 97 | if test x"$output" != x; then 98 | cp $output x64/$output 99 | fi 100 | 101 | if test x"$output" != x; then 102 | lipo -create -o $output x86/$output x64/$output 103 | fi 104 | -------------------------------------------------------------------------------- /missing: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # Common wrapper for a few potentially missing GNU programs. 3 | 4 | scriptversion=2018-03-07.03; # UTC 5 | 6 | # Copyright (C) 1996-2018 Free Software Foundation, Inc. 7 | # Originally written by Fran,cois Pinard , 1996. 8 | 9 | # This program is free software; you can redistribute it and/or modify 10 | # it under the terms of the GNU General Public License as published by 11 | # the Free Software Foundation; either version 2, or (at your option) 12 | # any later version. 13 | 14 | # This program is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | # GNU General Public License for more details. 18 | 19 | # You should have received a copy of the GNU General Public License 20 | # along with this program. If not, see . 21 | 22 | # As a special exception to the GNU General Public License, if you 23 | # distribute this file as part of a program that contains a 24 | # configuration script generated by Autoconf, you may include it under 25 | # the same distribution terms that you use for the rest of that program. 26 | 27 | if test $# -eq 0; then 28 | echo 1>&2 "Try '$0 --help' for more information" 29 | exit 1 30 | fi 31 | 32 | case $1 in 33 | 34 | --is-lightweight) 35 | # Used by our autoconf macros to check whether the available missing 36 | # script is modern enough. 37 | exit 0 38 | ;; 39 | 40 | --run) 41 | # Back-compat with the calling convention used by older automake. 42 | shift 43 | ;; 44 | 45 | -h|--h|--he|--hel|--help) 46 | echo "\ 47 | $0 [OPTION]... PROGRAM [ARGUMENT]... 48 | 49 | Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due 50 | to PROGRAM being missing or too old. 51 | 52 | Options: 53 | -h, --help display this help and exit 54 | -v, --version output version information and exit 55 | 56 | Supported PROGRAM values: 57 | aclocal autoconf autoheader autom4te automake makeinfo 58 | bison yacc flex lex help2man 59 | 60 | Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 61 | 'g' are ignored when checking the name. 62 | 63 | Send bug reports to ." 64 | exit $? 65 | ;; 66 | 67 | -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 68 | echo "missing $scriptversion (GNU Automake)" 69 | exit $? 70 | ;; 71 | 72 | -*) 73 | echo 1>&2 "$0: unknown '$1' option" 74 | echo 1>&2 "Try '$0 --help' for more information" 75 | exit 1 76 | ;; 77 | 78 | esac 79 | 80 | # Run the given program, remember its exit status. 81 | "$@"; st=$? 82 | 83 | # If it succeeded, we are done. 84 | test $st -eq 0 && exit 0 85 | 86 | # Also exit now if we it failed (or wasn't found), and '--version' was 87 | # passed; such an option is passed most likely to detect whether the 88 | # program is present and works. 89 | case $2 in --version|--help) exit $st;; esac 90 | 91 | # Exit code 63 means version mismatch. This often happens when the user 92 | # tries to use an ancient version of a tool on a file that requires a 93 | # minimum version. 94 | if test $st -eq 63; then 95 | msg="probably too old" 96 | elif test $st -eq 127; then 97 | # Program was missing. 98 | msg="missing on your system" 99 | else 100 | # Program was found and executed, but failed. Give up. 101 | exit $st 102 | fi 103 | 104 | perl_URL=https://www.perl.org/ 105 | flex_URL=https://github.com/westes/flex 106 | gnu_software_URL=https://www.gnu.org/software 107 | 108 | program_details () 109 | { 110 | case $1 in 111 | aclocal|automake) 112 | echo "The '$1' program is part of the GNU Automake package:" 113 | echo "<$gnu_software_URL/automake>" 114 | echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" 115 | echo "<$gnu_software_URL/autoconf>" 116 | echo "<$gnu_software_URL/m4/>" 117 | echo "<$perl_URL>" 118 | ;; 119 | autoconf|autom4te|autoheader) 120 | echo "The '$1' program is part of the GNU Autoconf package:" 121 | echo "<$gnu_software_URL/autoconf/>" 122 | echo "It also requires GNU m4 and Perl in order to run:" 123 | echo "<$gnu_software_URL/m4/>" 124 | echo "<$perl_URL>" 125 | ;; 126 | esac 127 | } 128 | 129 | give_advice () 130 | { 131 | # Normalize program name to check for. 132 | normalized_program=`echo "$1" | sed ' 133 | s/^gnu-//; t 134 | s/^gnu//; t 135 | s/^g//; t'` 136 | 137 | printf '%s\n' "'$1' is $msg." 138 | 139 | configure_deps="'configure.ac' or m4 files included by 'configure.ac'" 140 | case $normalized_program in 141 | autoconf*) 142 | echo "You should only need it if you modified 'configure.ac'," 143 | echo "or m4 files included by it." 144 | program_details 'autoconf' 145 | ;; 146 | autoheader*) 147 | echo "You should only need it if you modified 'acconfig.h' or" 148 | echo "$configure_deps." 149 | program_details 'autoheader' 150 | ;; 151 | automake*) 152 | echo "You should only need it if you modified 'Makefile.am' or" 153 | echo "$configure_deps." 154 | program_details 'automake' 155 | ;; 156 | aclocal*) 157 | echo "You should only need it if you modified 'acinclude.m4' or" 158 | echo "$configure_deps." 159 | program_details 'aclocal' 160 | ;; 161 | autom4te*) 162 | echo "You might have modified some maintainer files that require" 163 | echo "the 'autom4te' program to be rebuilt." 164 | program_details 'autom4te' 165 | ;; 166 | bison*|yacc*) 167 | echo "You should only need it if you modified a '.y' file." 168 | echo "You may want to install the GNU Bison package:" 169 | echo "<$gnu_software_URL/bison/>" 170 | ;; 171 | lex*|flex*) 172 | echo "You should only need it if you modified a '.l' file." 173 | echo "You may want to install the Fast Lexical Analyzer package:" 174 | echo "<$flex_URL>" 175 | ;; 176 | help2man*) 177 | echo "You should only need it if you modified a dependency" \ 178 | "of a man page." 179 | echo "You may want to install the GNU Help2man package:" 180 | echo "<$gnu_software_URL/help2man/>" 181 | ;; 182 | makeinfo*) 183 | echo "You should only need it if you modified a '.texi' file, or" 184 | echo "any other file indirectly affecting the aspect of the manual." 185 | echo "You might want to install the Texinfo package:" 186 | echo "<$gnu_software_URL/texinfo/>" 187 | echo "The spurious makeinfo call might also be the consequence of" 188 | echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" 189 | echo "want to install GNU make:" 190 | echo "<$gnu_software_URL/make/>" 191 | ;; 192 | *) 193 | echo "You might have modified some files without having the proper" 194 | echo "tools for further handling them. Check the 'README' file, it" 195 | echo "often tells you about the needed prerequisites for installing" 196 | echo "this package. You may also peek at any GNU archive site, in" 197 | echo "case some other package contains this missing '$1' program." 198 | ;; 199 | esac 200 | } 201 | 202 | give_advice "$1" | sed -e '1s/^/WARNING: /' \ 203 | -e '2,$s/^/ /' >&2 204 | 205 | # Propagate the correct exit status (expected to be 127 for a program 206 | # not found, 63 for a program that failed due to version mismatch). 207 | exit $st 208 | 209 | # Local variables: 210 | # eval: (add-hook 'before-save-hook 'time-stamp) 211 | # time-stamp-start: "scriptversion=" 212 | # time-stamp-format: "%:y-%02m-%02d.%02H" 213 | # time-stamp-time-zone: "UTC0" 214 | # time-stamp-end: "; # UTC" 215 | # End: 216 | -------------------------------------------------------------------------------- /quit.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDL-mirror/SDL_net/96478de8ef9d2195cd2606da5f2fb81e9e867039/quit.bmp -------------------------------------------------------------------------------- /scroll_dn.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDL-mirror/SDL_net/96478de8ef9d2195cd2606da5f2fb81e9e867039/scroll_dn.bmp -------------------------------------------------------------------------------- /scroll_up.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDL-mirror/SDL_net/96478de8ef9d2195cd2606da5f2fb81e9e867039/scroll_up.bmp -------------------------------------------------------------------------------- /showinterfaces.c: -------------------------------------------------------------------------------- 1 | /* 2 | showinterfaces: a simple test program to show the network interfaces 3 | Copyright (C) 1997-2021 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | #include "SDL_net.h" 22 | 23 | #define MAX_ADDRESSES 10 24 | 25 | int main(int argc, char *argv[]) 26 | { 27 | IPaddress addresses[MAX_ADDRESSES]; 28 | int i, count; 29 | 30 | count = SDLNet_GetLocalAddresses(addresses, MAX_ADDRESSES); 31 | SDL_Log("Found %d local addresses", count); 32 | for ( i = 0; i < count; ++i ) { 33 | SDL_Log("%d: %d.%d.%d.%d - %s", i+1, 34 | (addresses[i].host >> 0) & 0xFF, 35 | (addresses[i].host >> 8) & 0xFF, 36 | (addresses[i].host >> 16) & 0xFF, 37 | (addresses[i].host >> 24) & 0xFF, 38 | SDLNet_ResolveIP(&addresses[i])); 39 | } 40 | return 0; 41 | } 42 | -------------------------------------------------------------------------------- /version.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDL-mirror/SDL_net/96478de8ef9d2195cd2606da5f2fb81e9e867039/version.rc --------------------------------------------------------------------------------