tor/Win32Build/mingw/libevent-1.1b-mingw.diff

642 lines
17 KiB
Diff
Raw Normal View History

=== Makefile.am
==================================================================
--- Makefile.am (revision 8794)
+++ Makefile.am (local)
@@ -1,6 +1,5 @@
AUTOMAKE_OPTIONS = foreign no-dependencies
-SUBDIRS = . sample test
EXTRA_DIST = acconfig.h event.h event-internal.h log.h evsignal.h event.3 \
kqueue.c epoll_sub.c epoll.c select.c rtsig.c poll.c signal.c \
@@ -20,13 +19,29 @@
lib_LTLIBRARIES = libevent.la
-libevent_la_SOURCES = event.c buffer.c evbuffer.c log.c
+if BUILD_WIN32
+
+SUBDIRS = . sample
+SYS_LIBS = -lws2_32
+SYS_SRC = WIN32-Code/misc.c WIN32-Code/win32.c
+SYS_INCLUDES = -IWIN32-Code
+
+else
+
+SUBDIRS = . sample test
+SYS_LIBS =
+SYS_SRC =
+SYS_INCLUDES =
+
+endif
+
+libevent_la_SOURCES = event.c buffer.c evbuffer.c log.c $(SYS_SRC)
libevent_la_LIBADD = @LTLIBOBJS@
libevent_la_LDFLAGS = -release @VERSION@ -version-info 1:2:0
include_HEADERS = event.h
-INCLUDES = -Icompat
+INCLUDES = -Icompat $(SYS_INCLUDES)
man_MANS = event.3
=== WIN32-Code/misc.c
==================================================================
--- WIN32-Code/misc.c (revision 8794)
+++ WIN32-Code/misc.c (local)
@@ -4,6 +4,12 @@
#include <sys/timeb.h>
#include <time.h>
+#ifdef __GNUC__
+/*our prototypes for timeval and timezone are in here, just in case the above
+ headers don't have them*/
+#include "misc.h"
+#endif
+
/****************************************************************************
*
* Function: gettimeofday(struct timeval *, struct timezone *)
=== WIN32-Code/misc.h
==================================================================
--- WIN32-Code/misc.h (revision 8794)
+++ WIN32-Code/misc.h (local)
@@ -1,6 +1,9 @@
#ifndef MISC_H
#define MISC_H
+struct timezone;
+struct timeval;
+
int gettimeofday(struct timeval *,struct timezone *);
#endif
=== WIN32-Code/win32.c
==================================================================
--- WIN32-Code/win32.c (revision 8794)
+++ WIN32-Code/win32.c (local)
@@ -60,7 +60,8 @@
/* MSDN says this is required to handle SIGFPE */
volatile double SIGFPE_REQ = 0.0f;
-int signal_handler(int sig);
+static void signal_handler(int sig);
+
void signal_process(void);
int signal_recalc(void);
@@ -205,8 +206,9 @@
}
int
-win32_insert(struct win32op *win32op, struct event *ev)
+win32_insert(void *op, struct event *ev)
{
+ struct win32op *win32op = op;
int i;
if (ev->ev_events & EV_SIGNAL) {
@@ -251,8 +253,9 @@
}
int
-win32_del(struct win32op *win32op, struct event *ev)
+win32_del(void *op, struct event *ev)
{
+ struct win32op *win32op = op;
int i, found;
if (ev->ev_events & EV_SIGNAL)
@@ -302,9 +305,10 @@
*/
int
-win32_dispatch(struct event_base *base, struct win32op *win32op,
+win32_dispatch(struct event_base *base, void *op,
struct timeval *tv)
{
+ struct win32op *win32op = op;
int res = 0;
int i;
int fd_count;
@@ -366,13 +370,11 @@
}
-static int
+static void
signal_handler(int sig)
{
evsigcaught[sig]++;
signal_caught = 1;
-
- return 0;
}
int
=== buffer.c
==================================================================
--- buffer.c (revision 8794)
+++ buffer.c (local)
@@ -197,7 +197,7 @@
u_char *data = EVBUFFER_DATA(buffer);
size_t len = EVBUFFER_LENGTH(buffer);
char *line;
- u_int i;
+ unsigned int i;
for (i = 0; i < len; i++) {
if (data[i] == '\r' || data[i] == '\n')
=== configure.in
==================================================================
--- configure.in (revision 8794)
+++ configure.in (local)
@@ -111,6 +111,22 @@
)
fi
+dnl - check if the macro WIN32 is defined on this compiler.
+dnl - (this is how we check for a windows version of GCC)
+AC_MSG_CHECKING(for WIN32)
+AC_TRY_COMPILE(,
+ [
+ #ifndef WIN32
+ #error
+ #endif
+ ],
+ bwin32=true; AC_MSG_RESULT(yes),
+ bwin32=false; AC_MSG_RESULT(no),
+)
+
+AM_CONDITIONAL(BUILD_WIN32, test x$bwin32 = xtrue)
+
+
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
=== evbuffer.c
==================================================================
--- evbuffer.c (revision 8794)
+++ evbuffer.c (local)
@@ -130,7 +130,6 @@
/* Invoke the user callback - must always be called last */
(*bufev->readcb)(bufev, bufev->cbarg);
return;
-
reschedule:
bufferevent_add(&bufev->ev_read, bufev->timeout_read);
return;
@@ -154,12 +153,20 @@
if (EVBUFFER_LENGTH(bufev->output)) {
res = evbuffer_write(bufev->output, fd);
if (res == -1) {
+#ifndef WIN32
+/*todo. evbuffer uses WriteFile when WIN32 is set. WIN32 system calls do not
+ *set errno. thus this error checking is not portable*/
if (errno == EAGAIN ||
errno == EINTR ||
errno == EINPROGRESS)
goto reschedule;
/* error case */
what |= EVBUFFER_ERROR;
+
+#else
+ goto reschedule;
+#endif
+
} else if (res == 0) {
/* eof case */
what |= EVBUFFER_EOF;
@@ -181,6 +188,7 @@
return;
reschedule:
+
if (EVBUFFER_LENGTH(bufev->output) != 0)
bufferevent_add(&bufev->ev_write, bufev->timeout_write);
return;
=== install-sh
==================================================================
--- install-sh (revision 8794)
+++ install-sh (local)
@@ -1,15 +1,27 @@
-#! /bin/sh
+#!/bin/sh
#
# install - install a program, script, or datafile
-# This comes from X11R5.
+# This comes from X11R5 (mit/util/scripts/install.sh).
#
+# Copyright 1991 by the Massachusetts Institute of Technology
+#
+# Permission to use, copy, modify, distribute, and sell this software and its
+# documentation for any purpose is hereby granted without fee, provided that
+# the above copyright notice appear in all copies and that both that
+# copyright notice and this permission notice appear in supporting
+# documentation, and that the name of M.I.T. not be used in advertising or
+# publicity pertaining to distribution of the software without specific,
+# written prior permission. M.I.T. makes no representations about the
+# suitability of this software for any purpose. It is provided "as is"
+# without express or implied warranty.
+#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
-# from scratch.
-#
+# from scratch. It can only install one file at a time, a restriction
+# shared with many OS's install programs.
# set DOITPROG to echo to test this script
@@ -29,7 +41,7 @@
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"
-tranformbasename=""
+transformbasename=""
transform_arg=""
instcmd="$mvprog"
chmodcmd="$chmodprog 0755"
@@ -97,7 +109,7 @@
echo "install: no input file specified"
exit 1
else
- true
+ :
fi
if [ x"$dir_arg" != x ]; then
@@ -106,8 +118,9 @@
if [ -d $dst ]; then
instcmd=:
+ chmodcmd=""
else
- instcmd=mkdir
+ instcmd=$mkdirprog
fi
else
@@ -115,9 +128,9 @@
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
- if [ -f $src -o -d $src ]
+ if [ -f "$src" ] || [ -d "$src" ]
then
- true
+ :
else
echo "install: $src does not exist"
exit 1
@@ -128,7 +141,7 @@
echo "install: no destination specified"
exit 1
else
- true
+ :
fi
# If destination is a directory, append the input filename; if your system
@@ -138,7 +151,7 @@
then
dst="$dst"/`basename $src`
else
- true
+ :
fi
fi
@@ -150,8 +163,8 @@
# Skip lots of stat calls in the usual case.
if [ ! -d "$dstdir" ]; then
-defaultIFS='
-'
+defaultIFS='
+ '
IFS="${IFS-${defaultIFS}}"
oIFS="${IFS}"
@@ -170,7 +183,7 @@
then
$mkdirprog "${pathcomp}"
else
- true
+ :
fi
pathcomp="${pathcomp}/"
@@ -181,10 +194,10 @@
then
$doit $instcmd $dst &&
- if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
- if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
- if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
- if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
+ if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else : ; fi &&
+ if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else : ; fi &&
+ if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else : ; fi &&
+ if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else : ; fi
else
# If we're going to rename the final executable, determine the name now.
@@ -203,7 +216,7 @@
then
dstfile=`basename $dst`
else
- true
+ :
fi
# Make a temp file name in the proper directory.
@@ -222,10 +235,10 @@
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $instcmd $src $dsttmp" command.
- if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
- if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
- if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
- if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
+ if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else :;fi &&
+ if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else :;fi &&
+ if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else :;fi &&
+ if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else :;fi &&
# Now rename the file to the real destination.
=== missing
==================================================================
--- missing (revision 8794)
+++ missing (local)
@@ -1,10 +1,6 @@
#! /bin/sh
# Common stub for a few missing GNU programs while installing.
-
-scriptversion=2003-09-02.23
-
-# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003
-# Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 1999, 2000, 2002 Free Software Foundation, Inc.
# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
# This program is free software; you can redistribute it and/or modify
@@ -42,23 +38,12 @@
configure_ac=configure.in
fi
-msg="missing on your system"
-
case "$1" in
--run)
# Try to run requested program, and just exit if it succeeds.
run=
shift
"$@" && exit 0
- # Exit code 63 means version mismatch. This often happens
- # when the user try to use an ancient version of a tool on
- # a file that requires a minimum version. In this case we
- # we should proceed has if the program had been absent, or
- # if --run hadn't been passed.
- if test $? = 63; then
- run=:
- msg="probably too old"
- fi
;;
esac
@@ -89,13 +74,11 @@
lex create \`lex.yy.c', if possible, from existing .c
makeinfo touch the output file
tar try tar, gnutar, gtar, then tar without non-portable flags
- yacc create \`y.tab.[ch]', if possible, from existing .[ch]
-
-Send bug reports to <bug-automake@gnu.org>."
+ yacc create \`y.tab.[ch]', if possible, from existing .[ch]"
;;
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
- echo "missing $scriptversion (GNU Automake)"
+ echo "missing 0.4 - GNU automake"
;;
-*)
@@ -111,7 +94,7 @@
fi
echo 1>&2 "\
-WARNING: \`$1' is $msg. You should only need it if
+WARNING: \`$1' is missing on your system. You should only need it if
you modified \`acinclude.m4' or \`${configure_ac}'. You might want
to install the \`Automake' and \`Perl' packages. Grab them from
any GNU archive site."
@@ -125,7 +108,7 @@
fi
echo 1>&2 "\
-WARNING: \`$1' is $msg. You should only need it if
+WARNING: \`$1' is missing on your system. You should only need it if
you modified \`${configure_ac}'. You might want to install the
\`Autoconf' and \`GNU m4' packages. Grab them from any GNU
archive site."
@@ -139,7 +122,7 @@
fi
echo 1>&2 "\
-WARNING: \`$1' is $msg. You should only need it if
+WARNING: \`$1' is missing on your system. You should only need it if
you modified \`acconfig.h' or \`${configure_ac}'. You might want
to install the \`Autoconf' and \`GNU m4' packages. Grab them
from any GNU archive site."
@@ -163,7 +146,7 @@
fi
echo 1>&2 "\
-WARNING: \`$1' is $msg. You should only need it if
+WARNING: \`$1' is missing on your system. You should only need it if
you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
You might want to install the \`Automake' and \`Perl' packages.
Grab them from any GNU archive site."
@@ -179,10 +162,10 @@
fi
echo 1>&2 "\
-WARNING: \`$1' is needed, but is $msg.
- You might have modified some files without having the
+WARNING: \`$1' is needed, and you do not seem to have it handy on your
+ system. You might have modified some files without having the
proper tools for further handling them.
- You can get \`$1' as part of \`Autoconf' from any GNU
+ You can get \`$1Help2man' as part of \`Autoconf' from any GNU
archive site."
file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
@@ -202,7 +185,7 @@
bison|yacc)
echo 1>&2 "\
-WARNING: \`$1' $msg. You should only need it if
+WARNING: \`$1' is missing on your system. You should only need it if
you modified a \`.y' file. You may need the \`Bison' package
in order for those modifications to take effect. You can get
\`Bison' from any GNU archive site."
@@ -232,7 +215,7 @@
lex|flex)
echo 1>&2 "\
-WARNING: \`$1' is $msg. You should only need it if
+WARNING: \`$1' is missing on your system. You should only need it if
you modified a \`.l' file. You may need the \`Flex' package
in order for those modifications to take effect. You can get
\`Flex' from any GNU archive site."
@@ -260,7 +243,7 @@
fi
echo 1>&2 "\
-WARNING: \`$1' is $msg. You should only need it if
+WARNING: \`$1' is missing on your system. You should only need it if
you modified a dependency of a manual page. You may need the
\`Help2man' package in order for those modifications to take
effect. You can get \`Help2man' from any GNU archive site."
@@ -285,7 +268,7 @@
fi
echo 1>&2 "\
-WARNING: \`$1' is $msg. You should only need it if
+WARNING: \`$1' is missing on your system. You should only need it if
you modified a \`.texi' or \`.texinfo' file, or any other file
indirectly affecting the aspect of the manual. The spurious
call might also be the consequence of using a buggy \`make' (AIX,
@@ -340,10 +323,10 @@
*)
echo 1>&2 "\
-WARNING: \`$1' is needed, and is $msg.
- You might have modified some files without having the
+WARNING: \`$1' is needed, and you do not seem to have it handy on your
+ system. You might have modified some files without having the
proper tools for further handling them. Check the \`README' file,
- it often tells you about the needed prerequisites for installing
+ it often tells you about the needed prerequirements for installing
this package. You may also peek at any GNU archive site, in case
some other package would contain this missing \`$1' program."
exit 1
@@ -351,10 +334,3 @@
esac
exit 0
-
-# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "scriptversion="
-# time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-end: "$"
-# End:
=== mkinstalldirs
==================================================================
--- mkinstalldirs (revision 8794)
+++ mkinstalldirs (local)
@@ -4,12 +4,56 @@
# Created: 1993-05-16
# Public domain
-# $Id$
-
errstatus=0
+dirmode=""
+usage="\
+Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..."
+
+# process command line arguments
+while test $# -gt 0 ; do
+ case "${1}" in
+ -h | --help | --h* ) # -h for help
+ echo "${usage}" 1>&2; exit 0 ;;
+ -m ) # -m PERM arg
+ shift
+ test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; }
+ dirmode="${1}"
+ shift ;;
+ -- ) shift; break ;; # stop option processing
+ -* ) echo "${usage}" 1>&2; exit 1 ;; # unknown option
+ * ) break ;; # first non-opt arg
+ esac
+done
+
for file
do
+ if test -d "$file"; then
+ shift
+ else
+ break
+ fi
+done
+
+case $# in
+0) exit 0 ;;
+esac
+
+case $dirmode in
+'')
+ if mkdir -p -- . 2>/dev/null; then
+ echo "mkdir -p -- $*"
+ exec mkdir -p -- "$@"
+ fi ;;
+*)
+ if mkdir -m "$dirmode" -p -- . 2>/dev/null; then
+ echo "mkdir -m $dirmode -p -- $*"
+ exec mkdir -m "$dirmode" -p -- "$@"
+ fi ;;
+esac
+
+for file
+do
set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
shift
@@ -22,13 +66,24 @@
esac
if test ! -d "$pathcomp"; then
- echo "mkdir $pathcomp"
+ echo "mkdir $pathcomp"
- mkdir "$pathcomp" || lasterr=$?
+ mkdir "$pathcomp" || lasterr=$?
- if test ! -d "$pathcomp"; then
- errstatus=$lasterr
- fi
+ if test ! -d "$pathcomp"; then
+ errstatus=$lasterr
+ else
+ if test ! -z "$dirmode"; then
+ echo "chmod $dirmode $pathcomp"
+
+ lasterr=""
+ chmod "$dirmode" "$pathcomp" || lasterr=$?
+
+ if test ! -z "$lasterr"; then
+ errstatus=$lasterr
+ fi
+ fi
+ fi
fi
pathcomp="$pathcomp/"
@@ -37,4 +92,8 @@
exit $errstatus
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 3
+# End:
# mkinstalldirs ends here