Makefile.win32: Add -mno-cygwin to LDFLAGS so native Cygwin builds work.
configure.in: Look for stdint.h, localtime() and --with-win32.
src/compat.c: Remove "extern" modifiers on function definitions. Only
implement localtime_r() if we have localtime() too.
src/compat.h: Include stdint.h if we have it; define LINE_MAX if needed.
Also define NI_NUMERICHOST for the benefits of getnameinfo().
src/config.h.win32: Resynchronize with config.h.in; set WITH_IOSET_SELECT
and WITH_PROTOCOL_P10.
# CC=i586-mingw32msvc-cc
CPPFLAGS=-I$(VPATH) -Isrc
CFLAGS=-mno-cygwin -W -Wall -O2
+LDFLAGS=-mno-cygwin
EXE_EXT=.exe
LIBS=-lws2_32
$(addsuffix .o,$(addprefix src/mod-,$(MODULES)))
srvx$(EXE_EXT): src/config.h src/modules-list.h $(RX_OBJS) $(SRVX_OBJS)
- $(CC) -o $@ $(RX_OBJS) $(SRVX_OBJS) $(LIBS)
+ $(CC) -o $@ $(LDFLAGS) $(RX_OBJS) $(SRVX_OBJS) $(LIBS)
src/config.h: $(VPATH)/src/config.h.win32
cp $< $@
src/modules-list.h:
AC_STRUCT_TM
dnl Would rather not bail on headers, BSD has alot of the functions elsewhere. -Jedi
-AC_CHECK_HEADERS(fcntl.h malloc.h netdb.h arpa/inet.h netinet/in.h sys/resource.h sys/timeb.h sys/times.h sys/param.h sys/socket.h sys/time.h sys/types.h sys/wait.h unistd.h getopt.h memory.h regex.h arpa/inet.h sys/mman.h sys/stat.h dirent.h sys/epoll.h sys/event.h,,)
+AC_CHECK_HEADERS(fcntl.h malloc.h netdb.h arpa/inet.h netinet/in.h sys/resource.h sys/timeb.h sys/times.h sys/param.h sys/socket.h sys/time.h sys/types.h sys/wait.h unistd.h getopt.h memory.h regex.h arpa/inet.h sys/mman.h sys/stat.h dirent.h sys/epoll.h sys/event.h stdint.h,,)
dnl portability stuff, hurray! -Jedi
AC_CHECK_MEMBER([struct sockaddr.sa_len],
#include <netdb.h>])
dnl We have fallbacks in case these are missing, so just check for them.
-AC_CHECK_FUNCS(freeaddrinfo getaddrinfo gai_strerror getnameinfo getpagesize memcpy memset strdup strerror strsignal localtime_r setrlimit getopt getopt_long regcomp regexec regfree sysconf inet_aton epoll_create kqueue kevent select gettimeofday times GetProcessTimes mprotect,,)
+AC_CHECK_FUNCS(freeaddrinfo getaddrinfo gai_strerror getnameinfo getpagesize memcpy memset strdup strerror strsignal localtime localtime_r setrlimit getopt getopt_long regcomp regexec regfree sysconf inet_aton epoll_create kqueue kevent select gettimeofday times GetProcessTimes mprotect,,)
dnl Check for the fallbacks for functions missing above.
if test $ac_cv_func_gettimeofday = no; then
IOMUXES="$IOMUXES kevent"
fi
+AC_ARG_WITH([win32],
+[ --with-win32 Enables the Win32 I/O backend],
+[],
+[withval="no"])
+if test "x$withval" = xyes ; then
+ AC_DEFINE(WITH_IOSET_WIN32, 1, [Define if using the Win32 I/O backend])
+ MODULE_OBJS="$MODULE_OBJS ioset-win32.\$(OBJEXT)"
+ IOMUXES="$IOMUXES win32"
+fi
+
IOMUXES=`echo $IOMUXES | sed 's/^ +//'`
if test "x$IOMUXES" = "x" ; then
AC_MSG_ERROR([No supported I/O multiplexing backend found])
#endif
#if !defined(HAVE_GETTIMEOFDAY) && defined(HAVE_FTIME)
-extern int gettimeofday(struct timeval * tv, struct timezone * tz)
+int gettimeofday(struct timeval * tv, struct timezone * tz)
{
if (!tv)
{
}
#endif
-#ifndef HAVE_GETLOCALTIME_R
-extern struct tm *localtime_r(const time_t *timep, struct tm *result)
+#if !defined(HAVE_GETLOCALTIME_R) && defined(HAVE_LOCALTIME)
+struct tm *localtime_r(const time_t *timep, struct tm *result)
{
memcpy(result, localtime(timep), sizeof(*result));
return result;
#endif
#ifndef HAVE_MEMCPY
-extern void * memcpy(void * dest, void const * src, unsigned long n)
+void * memcpy(void * dest, void const * src, unsigned long n)
{
/* very slow, your fault for not having memcpy()*/
unsigned char * td=dest;
#ifndef HAVE_MEMSET
/* very slow, deal with it */
-extern void * memset(void * dest, int c, unsigned long n)
+void * memset(void * dest, int c, unsigned long n)
{
unsigned char * temp=dest;
unsigned long i;
#endif
#ifndef HAVE_STRDUP
-extern char * strdup(char const * str)
+char * strdup(char const * str)
{
char * out;
#endif
#ifndef HAVE_STRERROR
-extern char const * strerror(int errornum)
+char const * strerror(int errornum)
{
if (errornum==0)
return "No error";
return 0;
}
-/* TODO: implement fallback getnameinfo() */
-
void freeaddrinfo(struct addrinfo *res)
{
struct addrinfo *next;
free(res);
}
}
-
#endif
#ifndef HAVE_GAI_STRERROR
return "Unknown GAI_* error";
}
#endif
+
+#ifndef HAVE_GETNAMEINFO
+int getnameinfo(const struct sockaddr *sa, socklen_t salen,
+ char *host, size_t hostlen,
+ char *serv, size_t servlen, int flags)
+{
+ /* TODO: implement fallback getnameinfo() */
+}
+#endif
#include <sys/socket.h>
#endif
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
+
#ifdef HAVE_NETDB_H
#include <netdb.h>
#endif
#include <unistd.h>
#endif
+/* Cygwin (for example) doesn't define LINE_MAX, although mingw does. */
+#if !defined(LINE_MAX)
+# define LINE_MAX 2048
+#endif
+
#ifdef HAVE_VA_COPY
#define VA_COPY(DEST, SRC) va_copy(DEST, SRC)
#elif HAVE___VA_COPY
#endif /* !defined(HAVE_STRUCT_ADDRINFO) */
#ifndef HAVE_GETADDRINFO
-
int getaddrinfo(const char *node, const char *service, const struct addrinfo *hints, struct addrinfo **res);
-int getnameinfo(const struct sockaddr *sa, socklen_t salen, char *host, size_t hostlen, char *serv, size_t servlen, int flags);
void freeaddrinfo(struct addrinfo *res);
-
#endif
#ifndef HAVE_GAI_STRERROR
const char *gai_strerror(int errcode);
#endif
+#ifndef HAVE_GETNAMEINFO
+#define NI_NUMERICHOST 1
+int getnameinfo(const struct sockaddr *sa, socklen_t salen, char *host, size_t hostlen, char *serv, size_t servlen, int flags);
+#endif
+
#ifndef EINPROGRESS
# ifdef WSAEINPROGRESS
# define EINPROGRESS WSAEINPROGRESS
/* Define to 1 if you have the `ftime' function. */
#define HAVE_FTIME 1
+/* Define to 1 if you have the `gai_strerror' function. */
+#define HAVE_GAI_STRERROR 1
+
/* Define to 1 if you have the <gc/gc.h> header file. */
#undef HAVE_GC_GC_H
/* Define to 1 if you have the `getnameinfo' function. */
#define HAVE_GETNAMEINFO 1
-/* Define to 1 if you have the `getnameinfo' function. */
-#define HAVE_GAI_STRERROR 1
-
/* Define to 1 if you have the `getopt' function. */
#undef HAVE_GETOPT
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
+/* Define to 1 if you have the `kevent' function. */
+#undef HAVE_KEVENT
+
+/* Define to 1 if you have the `kqueue' function. */
+#undef HAVE_KQUEUE
+
/* Define to 1 if you have the `dl' library (-ldl). */
#undef HAVE_LIBDL
/* Define to 1 if you have the <mpatrol.h> header file. */
#undef HAVE_MPATROL_H
+/* Define to 1 if you have the `mprotect' function. */
+#undef HAVE_MPROTECT
+
/* Define to 1 if you have the <netdb.h> header file. */
#undef HAVE_NETDB_H
#undef HAVE_REGFREE
/* Define to 1 if you have the `select' function. */
-#undef HAVE_SELECT
+#define HAVE_SELECT 1
/* Define to 1 if you have the `setrlimit' function. */
#undef HAVE_SETRLIMIT
/* Define to 1 if you have the <sys/epoll.h> header file. */
#undef HAVE_SYS_EPOLL_H
+/* Define to 1 if you have the <sys/event.h> header file. */
+#undef HAVE_SYS_EVENT_H
+
/* Define to 1 if you have the <sys/mman.h> header file. */
#undef HAVE_SYS_MMAN_H
/* Version number of package */
#define VERSION 1.4
-/* Define if using the Win32 I/O backend */
-#define WITH_IOSET_WIN32 1
-
/* Define if using the epoll I/O backend */
#undef WITH_IOSET_EPOLL
+/* Define if using the kevent I/O backend */
+#undef WITH_IOSET_KEVENT
+
/* Define if using the select() I/O backend */
-#undef WITH_IOSET_SELECT
+#define WITH_IOSET_SELECT 1
+
+/* Define if using the Win32 I/O backend */
+#define WITH_IOSET_WIN32 1
/* Define if using the Boehm GC to garbage collect and check memory leaks */
#undef WITH_MALLOC_BOEHM_GC
/* Define if using the system's malloc */
#undef WITH_MALLOC_SYSTEM
+/* Define if using the Bahamut dialect of IRC */
+#undef WITH_PROTOCOL_BAHAMUT
+
+/* Define if using the P10 dialect of IRC */
+#define WITH_PROTOCOL_P10 1
+
/* Define to empty if `const' does not conform to ANSI C. */
#undef const