mirror of
https://github.com/libevent/libevent.git
synced 2025-01-31 09:12:55 +08:00
Merge remote-tracking branch 'joakimsoderberg/new_cmake'
Conflicts: sample/https-client.c
This commit is contained in:
commit
4cb44fdf56
1050
CMakeLists.txt
Normal file
1050
CMakeLists.txt
Normal file
File diff suppressed because it is too large
Load Diff
@ -146,7 +146,7 @@ if BUILD_WIN32
|
||||
SYS_LIBS = -lws2_32 -lshell32 -ladvapi32
|
||||
SYS_SRC = win32select.c evthread_win32.c buffer_iocp.c event_iocp.c \
|
||||
bufferevent_async.c
|
||||
SYS_INCLUDES = -IWIN32-Code
|
||||
SYS_INCLUDES = -IWIN32-Code -IWIN32-Code/nmake
|
||||
|
||||
else
|
||||
|
||||
@ -247,8 +247,8 @@ libevent_openssl_la_CPPFLAGS = $(AM_CPPFLAGS) $(OPENSSL_INCS)
|
||||
endif
|
||||
|
||||
noinst_HEADERS += \
|
||||
WIN32-Code/evconfig-private.h \
|
||||
WIN32-Code/event2/event-config.h \
|
||||
WIN32-Code/nmake/evconfig-private.h \
|
||||
WIN32-Code/nmake/event2/event-config.h \
|
||||
WIN32-Code/tree.h \
|
||||
bufferevent-internal.h \
|
||||
changelist-internal.h \
|
||||
|
@ -20,7 +20,7 @@ SSL_CFLAGS=
|
||||
!ENDIF
|
||||
|
||||
# Needed for correctness
|
||||
CFLAGS=/IWIN32-Code /Iinclude /Icompat /DHAVE_CONFIG_H /I. $(SSL_CFLAGS)
|
||||
CFLAGS=/IWIN32-Code /IWIN32-Code/nmake /Iinclude /Icompat /DHAVE_CONFIG_H /I. $(SSL_CFLAGS)
|
||||
|
||||
# For optimization and warnings
|
||||
CFLAGS=$(CFLAGS) /Ox /W3 /wd4996 /nologo
|
||||
|
225
README
225
README
@ -1,225 +0,0 @@
|
||||
0. BUILDING AND INSTALLATION (Briefly)
|
||||
|
||||
$ ./configure
|
||||
$ make
|
||||
$ make verify # (optional)
|
||||
$ sudo make install
|
||||
|
||||
1. BUILDING AND INSTALLATION (In Depth)
|
||||
|
||||
To build libevent, type
|
||||
|
||||
$ ./configure && make
|
||||
|
||||
(If you got libevent from the git repository, you will
|
||||
first need to run the included "autogen.sh" script in order to
|
||||
generate the configure script.)
|
||||
|
||||
You can run the regression tests by running
|
||||
|
||||
$ make verify
|
||||
|
||||
Install as root via
|
||||
|
||||
# make install
|
||||
|
||||
Before reporting any problems, please run the regression tests.
|
||||
|
||||
To enable the low-level tracing build the library as:
|
||||
|
||||
CFLAGS=-DUSE_DEBUG ./configure [...]
|
||||
|
||||
Standard configure flags should work. In particular, see:
|
||||
|
||||
--disable-shared Only build static libraries
|
||||
--prefix Install all files relative to this directory.
|
||||
|
||||
|
||||
The configure script also supports the following flags:
|
||||
|
||||
--enable-gcc-warnings Enable extra compiler checking with GCC.
|
||||
--disable-malloc-replacement
|
||||
Don't let applications replace our memory
|
||||
management functions
|
||||
--disable-openssl Disable support for OpenSSL encryption.
|
||||
--disable-thread-support Don't support multithreaded environments.
|
||||
|
||||
2. USEFUL LINKS:
|
||||
|
||||
For the latest released version of Libevent, see the official website at
|
||||
http://libevent.org/ .
|
||||
|
||||
There's a pretty good work-in-progress manual up at
|
||||
http://www.wangafu.net/~nickm/libevent-book/ .
|
||||
|
||||
For the latest development versions of Libevent, access our Git repository
|
||||
via
|
||||
"git clone git://levent.git.sourceforge.net/gitroot/levent/libevent"
|
||||
|
||||
You can browse the git repository online at
|
||||
http://levent.git.sourceforge.net/git/gitweb-index.cgi .
|
||||
|
||||
To report bugs, request features, or submit patches to Libevent,
|
||||
use the Sourceforge trackers at
|
||||
https://sourceforge.net/tracker/?group_id=50884 .
|
||||
|
||||
There's also a libevent-users mailing list for talking about Libevent
|
||||
use and development: http://archives.seul.org/libevent/users/
|
||||
|
||||
3. ACKNOWLEDGMENTS
|
||||
|
||||
The following people have helped with suggestions, ideas, code or
|
||||
fixing bugs:
|
||||
|
||||
Samy Al Bahra
|
||||
Jacob Appelbaum
|
||||
Arno Bakker
|
||||
Weston Andros Adamson
|
||||
William Ahern
|
||||
Ivan Andropov
|
||||
Sergey Avseyev
|
||||
Avi Bab
|
||||
Joachim Bauch
|
||||
Gilad Benjamini
|
||||
Stas Bekman
|
||||
Denis Bilenko
|
||||
Julien Blache
|
||||
Kevin Bowling
|
||||
Tomash Brechko
|
||||
Kelly Brock
|
||||
Ralph Castain
|
||||
Adrian Chadd
|
||||
Lawnstein Chan
|
||||
Shuo Chen
|
||||
Ka-Hing Cheung
|
||||
Andrew Cox
|
||||
Paul Croome
|
||||
George Danchev
|
||||
Andrew Danforth
|
||||
Ed Day
|
||||
Christopher Davis
|
||||
Mike Davis
|
||||
Antony Dovgal
|
||||
Mihai Draghicioiu
|
||||
Alexander Drozdov
|
||||
Mark Ellzey
|
||||
Shie Erlich
|
||||
Leonid Evdokimov
|
||||
Juan Pablo Fernandez
|
||||
Christophe Fillot
|
||||
Mike Frysinger
|
||||
Remi Gacogne
|
||||
Artem Germanov
|
||||
Alexander von Gernler
|
||||
Artur Grabowski
|
||||
Diwaker Gupta
|
||||
Sebastian Hahn
|
||||
Dave Hart
|
||||
Greg Hazel
|
||||
Nicholas Heath
|
||||
Michael Herf
|
||||
Sebastian Hahn
|
||||
Savg He
|
||||
Mark Heily
|
||||
Maxime Henrion
|
||||
Michael Herf
|
||||
Greg Hewgill
|
||||
Andrew Hochhaus
|
||||
Aaron Hopkins
|
||||
Tani Hosokawa
|
||||
Jamie Iles
|
||||
Xiuqiang Jiang
|
||||
Claudio Jeker
|
||||
Evan Jones
|
||||
George Kadianakis
|
||||
Phua Keat
|
||||
Azat Khuzhin
|
||||
Alexander Klauer
|
||||
Kevin Ko
|
||||
Brian Koehmstedt
|
||||
Marko Kreen
|
||||
Valery Kyholodov
|
||||
Ross Lagerwall
|
||||
Scott Lamb
|
||||
Christopher Layne
|
||||
Adam Langley
|
||||
Graham Leggett
|
||||
Volker Lendecke
|
||||
Philip Lewis
|
||||
Zhou Li
|
||||
David Libenzi
|
||||
Yan Lin
|
||||
Moshe Litvin
|
||||
Simon Liu
|
||||
Mitchell Livingston
|
||||
Hagne Mahre
|
||||
Lubomir Marinov
|
||||
Abilio Marques
|
||||
Abel Mathew
|
||||
Nick Mathewson
|
||||
James Mansion
|
||||
Nicholas Marriott
|
||||
Andrey Matveev
|
||||
Caitlin Mercer
|
||||
Dagobert Michelsen
|
||||
Andrea Montefusco
|
||||
Mansour Moufid
|
||||
Mina Naguib
|
||||
Felix Nawothnig
|
||||
Trond Norbye
|
||||
Linus Nordberg
|
||||
Richard Nyberg
|
||||
Jon Oberheide
|
||||
Phil Oleson
|
||||
Dave Pacheco
|
||||
Derrick Pallas
|
||||
Tassilo von Parseval
|
||||
Catalin Patulea
|
||||
Patrick Pelletier
|
||||
Simon Perreault
|
||||
Dan Petro
|
||||
Pierre Phaneuf
|
||||
Amarin Phaosawasdi
|
||||
Ryan Phillips
|
||||
Dimitre Piskyulev
|
||||
Pavel Plesov
|
||||
Jon Poland
|
||||
Roman Puls
|
||||
Nate R
|
||||
Robert Ransom
|
||||
Bert JW Regeer
|
||||
Nate Rosenblum
|
||||
Peter Rosin
|
||||
Maseeb Abdul Qadir
|
||||
Wang Qin
|
||||
Alex S
|
||||
Gyepi Sam
|
||||
Hanna Schroeter
|
||||
Ralf Schmitt
|
||||
Mike Smellie
|
||||
Kevin Springborn
|
||||
Nir Soffer
|
||||
Harlan Stenn
|
||||
Steve Snyder
|
||||
Dug Song
|
||||
Dongsheng Song
|
||||
Hannes Sowa
|
||||
Ferenc Szalai
|
||||
Brodie Thiesfield
|
||||
Jason Toffaletti
|
||||
Gisle Vanem
|
||||
Bas Verhoeven
|
||||
Constantine Verutin
|
||||
Colin Watt
|
||||
Zack Weinberg
|
||||
Jardel Weyrich
|
||||
Jay R. Wren
|
||||
Zack Weinberg
|
||||
Alejo
|
||||
Alex
|
||||
Taral
|
||||
propanbutan
|
||||
mmadia
|
||||
yangacer
|
||||
|
||||
If we have forgotten your name, please contact us.
|
295
README.md
Normal file
295
README.md
Normal file
@ -0,0 +1,295 @@
|
||||
# 0. BUILDING AND INSTALLATION (Briefly)
|
||||
|
||||
## Autoconf
|
||||
|
||||
$ ./configure
|
||||
$ make
|
||||
$ make verify # (optional)
|
||||
$ sudo make install
|
||||
|
||||
## CMake (Windows)
|
||||
|
||||
Install CMake: <http://www.cmake.org>
|
||||
|
||||
|
||||
$ md build && cd build
|
||||
$ cmake -G "Visual Studio 10" .. # Or whatever generator you want to use cmake --help for a list.
|
||||
$ start libevent.sln
|
||||
|
||||
## CMake (Unix)
|
||||
|
||||
$ mkdir build && cd build
|
||||
$ cmake .. # Default to Unix Makefiles.
|
||||
$ make
|
||||
$ make verify # (optional)
|
||||
|
||||
|
||||
# 1. BUILDING AND INSTALLATION (In Depth)
|
||||
|
||||
## Autoconf
|
||||
|
||||
To build libevent, type
|
||||
|
||||
$ ./configure && make
|
||||
|
||||
|
||||
(If you got libevent from the git repository, you will
|
||||
first need to run the included "autogen.sh" script in order to
|
||||
generate the configure script.)
|
||||
|
||||
You can run the regression tests by running
|
||||
|
||||
$ make verify
|
||||
|
||||
Install as root via
|
||||
|
||||
$ make install
|
||||
|
||||
Before reporting any problems, please run the regression tests.
|
||||
|
||||
To enable the low-level tracing build the library as:
|
||||
|
||||
$ CFLAGS=-DUSE_DEBUG ./configure [...]
|
||||
|
||||
Standard configure flags should work. In particular, see:
|
||||
|
||||
--disable-shared Only build static libraries
|
||||
--prefix Install all files relative to this directory.
|
||||
|
||||
|
||||
The configure script also supports the following flags:
|
||||
|
||||
--enable-gcc-warnings Enable extra compiler checking with GCC.
|
||||
--disable-malloc-replacement
|
||||
Don't let applications replace our memory
|
||||
management functions
|
||||
--disable-openssl Disable support for OpenSSL encryption.
|
||||
--disable-thread-support Don't support multithreaded environments.
|
||||
|
||||
## CMake (Windows)
|
||||
|
||||
First of all install <http://www.cmake.org>.
|
||||
|
||||
To build libevent using Microsoft Visual studio open the "Visual Studio Command prompt" and type:
|
||||
|
||||
```
|
||||
$ cd <libevent source dir>
|
||||
$ mkdir build && cd build
|
||||
$ cmake -G "Visual Studio 10" .. # Or whatever generator you want to use cmake --help for a list.
|
||||
$ start libevent.sln
|
||||
```
|
||||
|
||||
In the above, the ".." refers to the dir containing the Libevent source code.
|
||||
You can build multiple versions (with different compile time settings) from the same source tree
|
||||
by creating other build directories.
|
||||
|
||||
It is highly recommended to build "out of source" when using
|
||||
CMake instead of "in source" like the normal behaviour of autoconf for this reason.
|
||||
|
||||
The "NMake Makefiles" CMake generator can be used to build entirely via the command line.
|
||||
|
||||
To get a list of settings available for the project you can type:
|
||||
|
||||
```
|
||||
$ cmake -LH ..
|
||||
```
|
||||
|
||||
### GUI
|
||||
|
||||
CMake also provides a GUI that lets you specify the source directory and output (binary) directory
|
||||
that the build should be placed in.
|
||||
|
||||
### OpenSSL support
|
||||
|
||||
To build Libevent with OpenSSL support you will need to have OpenSSL binaries available when building,
|
||||
these can be found here: <http://www.openssl.org/related/binaries.html>
|
||||
|
||||
# 2. USEFUL LINKS:
|
||||
|
||||
For the latest released version of Libevent, see the official website at
|
||||
<http://libevent.org/> .
|
||||
|
||||
There's a pretty good work-in-progress manual up at
|
||||
<http://www.wangafu.net/~nickm/libevent-book/> .
|
||||
|
||||
For the latest development versions of Libevent, access our Git repository
|
||||
via
|
||||
|
||||
```
|
||||
$ git clone git://levent.git.sourceforge.net/gitroot/levent/libevent
|
||||
```
|
||||
|
||||
You can browse the git repository online at:
|
||||
|
||||
<http://levent.git.sourceforge.net/git/gitweb-index.cgi>
|
||||
|
||||
<https://github.com/libevent/Libevent>
|
||||
|
||||
To report bugs, request features, or submit patches to Libevent,
|
||||
use the Sourceforge trackers at
|
||||
|
||||
<https://sourceforge.net/tracker/?group_id=50884>
|
||||
|
||||
There's also a libevent-users mailing list for talking about Libevent
|
||||
use and development:
|
||||
|
||||
<http://archives.seul.org/libevent/users/>
|
||||
|
||||
# 3. ACKNOWLEDGMENTS
|
||||
|
||||
The following people have helped with suggestions, ideas, code or
|
||||
fixing bugs:
|
||||
|
||||
* Samy Al Bahra
|
||||
* Jacob Appelbaum
|
||||
* Arno Bakker
|
||||
* Weston Andros Adamson
|
||||
* William Ahern
|
||||
* Ivan Andropov
|
||||
* Sergey Avseyev
|
||||
* Avi Bab
|
||||
* Joachim Bauch
|
||||
* Gilad Benjamini
|
||||
* Stas Bekman
|
||||
* Denis Bilenko
|
||||
* Julien Blache
|
||||
* Kevin Bowling
|
||||
* Tomash Brechko
|
||||
* Kelly Brock
|
||||
* Ralph Castain
|
||||
* Adrian Chadd
|
||||
* Lawnstein Chan
|
||||
* Shuo Chen
|
||||
* Ka-Hing Cheung
|
||||
* Andrew Cox
|
||||
* Paul Croome
|
||||
* George Danchev
|
||||
* Andrew Danforth
|
||||
* Ed Day
|
||||
* Christopher Davis
|
||||
* Mike Davis
|
||||
* Antony Dovgal
|
||||
* Mihai Draghicioiu
|
||||
* Alexander Drozdov
|
||||
* Mark Ellzey
|
||||
* Shie Erlich
|
||||
* Leonid Evdokimov
|
||||
* Juan Pablo Fernandez
|
||||
* Christophe Fillot
|
||||
* Mike Frysinger
|
||||
* Remi Gacogne
|
||||
* Artem Germanov
|
||||
* Alexander von Gernler
|
||||
* Artur Grabowski
|
||||
* Diwaker Gupta
|
||||
* Sebastian Hahn
|
||||
* Dave Hart
|
||||
* Greg Hazel
|
||||
* Nicholas Heath
|
||||
* Michael Herf
|
||||
* Sebastian Hahn
|
||||
* Savg He
|
||||
* Mark Heily
|
||||
* Maxime Henrion
|
||||
* Michael Herf
|
||||
* Greg Hewgill
|
||||
* Andrew Hochhaus
|
||||
* Aaron Hopkins
|
||||
* Tani Hosokawa
|
||||
* Jamie Iles
|
||||
* Xiuqiang Jiang
|
||||
* Claudio Jeker
|
||||
* Evan Jones
|
||||
* George Kadianakis
|
||||
* Phua Keat
|
||||
* Azat Khuzhin
|
||||
* Alexander Klauer
|
||||
* Kevin Ko
|
||||
* Brian Koehmstedt
|
||||
* Marko Kreen
|
||||
* Valery Kyholodov
|
||||
* Ross Lagerwall
|
||||
* Scott Lamb
|
||||
* Christopher Layne
|
||||
* Adam Langley
|
||||
* Graham Leggett
|
||||
* Volker Lendecke
|
||||
* Philip Lewis
|
||||
* Zhou Li
|
||||
* David Libenzi
|
||||
* Yan Lin
|
||||
* Moshe Litvin
|
||||
* Simon Liu
|
||||
* Mitchell Livingston
|
||||
* Hagne Mahre
|
||||
* Lubomir Marinov
|
||||
* Abilio Marques
|
||||
* Abel Mathew
|
||||
* Nick Mathewson
|
||||
* James Mansion
|
||||
* Nicholas Marriott
|
||||
* Andrey Matveev
|
||||
* Caitlin Mercer
|
||||
* Dagobert Michelsen
|
||||
* Andrea Montefusco
|
||||
* Mansour Moufid
|
||||
* Mina Naguib
|
||||
* Felix Nawothnig
|
||||
* Trond Norbye
|
||||
* Linus Nordberg
|
||||
* Richard Nyberg
|
||||
* Jon Oberheide
|
||||
* Phil Oleson
|
||||
* Dave Pacheco
|
||||
* Derrick Pallas
|
||||
* Tassilo von Parseval
|
||||
* Catalin Patulea
|
||||
* Patrick Pelletier
|
||||
* Simon Perreault
|
||||
* Dan Petro
|
||||
* Pierre Phaneuf
|
||||
* Amarin Phaosawasdi
|
||||
* Ryan Phillips
|
||||
* Dimitre Piskyulev
|
||||
* Pavel Plesov
|
||||
* Jon Poland
|
||||
* Roman Puls
|
||||
* Nate R
|
||||
* Robert Ransom
|
||||
* Bert JW Regeer
|
||||
* Nate Rosenblum
|
||||
* Peter Rosin
|
||||
* Maseeb Abdul Qadir
|
||||
* Wang Qin
|
||||
* Alex S
|
||||
* Gyepi Sam
|
||||
* Hanna Schroeter
|
||||
* Ralf Schmitt
|
||||
* Mike Smellie
|
||||
* Kevin Springborn
|
||||
* Nir Soffer
|
||||
* Harlan Stenn
|
||||
* Steve Snyder
|
||||
* Dug Song
|
||||
* Dongsheng Song
|
||||
* Hannes Sowa
|
||||
* Joakim Soderberg
|
||||
* Ferenc Szalai
|
||||
* Brodie Thiesfield
|
||||
* Jason Toffaletti
|
||||
* Gisle Vanem
|
||||
* Bas Verhoeven
|
||||
* Constantine Verutin
|
||||
* Colin Watt
|
||||
* Zack Weinberg
|
||||
* Jardel Weyrich
|
||||
* Jay R. Wren
|
||||
* Zack Weinberg
|
||||
* Alejo
|
||||
* Alex
|
||||
* Taral
|
||||
* propanbutan
|
||||
* mmadia
|
||||
* yangacer
|
||||
|
||||
If we have forgotten your name, please contact us.
|
149
WIN32-Code/getopt.c
Normal file
149
WIN32-Code/getopt.c
Normal file
@ -0,0 +1,149 @@
|
||||
/* $NetBSD: getopt.c,v 1.16 1999/12/02 13:15:56 kleink Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1987, 1993, 1994, 1995
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the names of the copyright holders nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
|
||||
* IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)getopt.c 8.3 (Berkeley) 4/27/95";
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#define __P(x) x
|
||||
#define _DIAGASSERT(x) assert(x)
|
||||
|
||||
#ifdef __weak_alias
|
||||
__weak_alias(getopt,_getopt);
|
||||
#endif
|
||||
|
||||
|
||||
int opterr = 1, /* if error message should be printed */
|
||||
optind = 1, /* index into parent argv vector */
|
||||
optopt, /* character checked for validity */
|
||||
optreset; /* reset getopt */
|
||||
char *optarg; /* argument associated with option */
|
||||
|
||||
static char * _progname __P((char *));
|
||||
int getopt_internal __P((int, char * const *, const char *));
|
||||
|
||||
static char *
|
||||
_progname(nargv0)
|
||||
char * nargv0;
|
||||
{
|
||||
char * tmp;
|
||||
|
||||
_DIAGASSERT(nargv0 != NULL);
|
||||
|
||||
tmp = strrchr(nargv0, '/');
|
||||
if (tmp)
|
||||
tmp++;
|
||||
else
|
||||
tmp = nargv0;
|
||||
return(tmp);
|
||||
}
|
||||
|
||||
#define BADCH (int)'?'
|
||||
#define BADARG (int)':'
|
||||
#define EMSG ""
|
||||
|
||||
/*
|
||||
* getopt --
|
||||
* Parse argc/argv argument vector.
|
||||
*/
|
||||
int
|
||||
getopt(nargc, nargv, ostr)
|
||||
int nargc;
|
||||
char * const nargv[];
|
||||
const char *ostr;
|
||||
{
|
||||
static char *__progname = 0;
|
||||
static char *place = EMSG; /* option letter processing */
|
||||
char *oli; /* option letter list index */
|
||||
__progname = __progname?__progname:_progname(*nargv);
|
||||
|
||||
_DIAGASSERT(nargv != NULL);
|
||||
_DIAGASSERT(ostr != NULL);
|
||||
|
||||
if (optreset || !*place) { /* update scanning pointer */
|
||||
optreset = 0;
|
||||
if (optind >= nargc || *(place = nargv[optind]) != '-') {
|
||||
place = EMSG;
|
||||
return (-1);
|
||||
}
|
||||
if (place[1] && *++place == '-' /* found "--" */
|
||||
&& place[1] == '\0') {
|
||||
++optind;
|
||||
place = EMSG;
|
||||
return (-1);
|
||||
}
|
||||
} /* option letter okay? */
|
||||
if ((optopt = (int)*place++) == (int)':' ||
|
||||
!(oli = strchr(ostr, optopt))) {
|
||||
/*
|
||||
* if the user didn't specify '-' as an option,
|
||||
* assume it means -1.
|
||||
*/
|
||||
if (optopt == (int)'-')
|
||||
return (-1);
|
||||
if (!*place)
|
||||
++optind;
|
||||
if (opterr && *ostr != ':')
|
||||
(void)fprintf(stderr,
|
||||
"%s: illegal option -- %c\n", __progname, optopt);
|
||||
return (BADCH);
|
||||
}
|
||||
if (*++oli != ':') { /* don't need argument */
|
||||
optarg = NULL;
|
||||
if (!*place)
|
||||
++optind;
|
||||
}
|
||||
else { /* need an argument */
|
||||
if (*place) /* no white space */
|
||||
optarg = place;
|
||||
else if (nargc <= ++optind) { /* no arg */
|
||||
place = EMSG;
|
||||
if (*ostr == ':')
|
||||
return (BADARG);
|
||||
if (opterr)
|
||||
(void)fprintf(stderr,
|
||||
"%s: option requires an argument -- %c\n",
|
||||
__progname, optopt);
|
||||
return (BADCH);
|
||||
}
|
||||
else /* white space */
|
||||
optarg = nargv[optind];
|
||||
place = EMSG;
|
||||
++optind;
|
||||
}
|
||||
return (optopt); /* dump back option letter */
|
||||
}
|
||||
|
33
WIN32-Code/getopt.h
Normal file
33
WIN32-Code/getopt.h
Normal file
@ -0,0 +1,33 @@
|
||||
#ifndef __GETOPT_H__
|
||||
#define __GETOPT_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern int opterr; /* if error message should be printed */
|
||||
extern int optind; /* index into parent argv vector */
|
||||
extern int optopt; /* character checked for validity */
|
||||
extern int optreset; /* reset getopt */
|
||||
extern char *optarg; /* argument associated with option */
|
||||
|
||||
struct option
|
||||
{
|
||||
const char *name;
|
||||
int has_arg;
|
||||
int *flag;
|
||||
int val;
|
||||
};
|
||||
|
||||
#define no_argument 0
|
||||
#define required_argument 1
|
||||
#define optional_argument 2
|
||||
|
||||
int getopt(int, char**, char*);
|
||||
int getopt_long(int, char**, char*, struct option*, int*);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __GETOPT_H__ */
|
233
WIN32-Code/getopt_long.c
Normal file
233
WIN32-Code/getopt_long.c
Normal file
@ -0,0 +1,233 @@
|
||||
|
||||
/*
|
||||
* Copyright (c) 1987, 1993, 1994, 1996
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the names of the copyright holders nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
|
||||
* IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "getopt.h"
|
||||
|
||||
extern int opterr; /* if error message should be printed */
|
||||
extern int optind; /* index into parent argv vector */
|
||||
extern int optopt; /* character checked for validity */
|
||||
extern int optreset; /* reset getopt */
|
||||
extern char *optarg; /* argument associated with option */
|
||||
|
||||
#define __P(x) x
|
||||
#define _DIAGASSERT(x) assert(x)
|
||||
|
||||
static char * __progname __P((char *));
|
||||
int getopt_internal __P((int, char * const *, const char *));
|
||||
|
||||
static char *
|
||||
__progname(nargv0)
|
||||
char * nargv0;
|
||||
{
|
||||
char * tmp;
|
||||
|
||||
_DIAGASSERT(nargv0 != NULL);
|
||||
|
||||
tmp = strrchr(nargv0, '/');
|
||||
if (tmp)
|
||||
tmp++;
|
||||
else
|
||||
tmp = nargv0;
|
||||
return(tmp);
|
||||
}
|
||||
|
||||
#define BADCH (int)'?'
|
||||
#define BADARG (int)':'
|
||||
#define EMSG ""
|
||||
|
||||
/*
|
||||
* getopt --
|
||||
* Parse argc/argv argument vector.
|
||||
*/
|
||||
int
|
||||
getopt_internal(nargc, nargv, ostr)
|
||||
int nargc;
|
||||
char * const *nargv;
|
||||
const char *ostr;
|
||||
{
|
||||
static char *place = EMSG; /* option letter processing */
|
||||
char *oli; /* option letter list index */
|
||||
|
||||
_DIAGASSERT(nargv != NULL);
|
||||
_DIAGASSERT(ostr != NULL);
|
||||
|
||||
if (optreset || !*place) { /* update scanning pointer */
|
||||
optreset = 0;
|
||||
if (optind >= nargc || *(place = nargv[optind]) != '-') {
|
||||
place = EMSG;
|
||||
return (-1);
|
||||
}
|
||||
if (place[1] && *++place == '-') { /* found "--" */
|
||||
/* ++optind; */
|
||||
place = EMSG;
|
||||
return (-2);
|
||||
}
|
||||
} /* option letter okay? */
|
||||
if ((optopt = (int)*place++) == (int)':' ||
|
||||
!(oli = strchr(ostr, optopt))) {
|
||||
/*
|
||||
* if the user didn't specify '-' as an option,
|
||||
* assume it means -1.
|
||||
*/
|
||||
if (optopt == (int)'-')
|
||||
return (-1);
|
||||
if (!*place)
|
||||
++optind;
|
||||
if (opterr && *ostr != ':')
|
||||
(void)fprintf(stderr,
|
||||
"%s: illegal option -- %c\n", __progname(nargv[0]), optopt);
|
||||
return (BADCH);
|
||||
}
|
||||
if (*++oli != ':') { /* don't need argument */
|
||||
optarg = NULL;
|
||||
if (!*place)
|
||||
++optind;
|
||||
} else { /* need an argument */
|
||||
if (*place) /* no white space */
|
||||
optarg = place;
|
||||
else if (nargc <= ++optind) { /* no arg */
|
||||
place = EMSG;
|
||||
if ((opterr) && (*ostr != ':'))
|
||||
(void)fprintf(stderr,
|
||||
"%s: option requires an argument -- %c\n",
|
||||
__progname(nargv[0]), optopt);
|
||||
return (BADARG);
|
||||
} else /* white space */
|
||||
optarg = nargv[optind];
|
||||
place = EMSG;
|
||||
++optind;
|
||||
}
|
||||
return (optopt); /* dump back option letter */
|
||||
}
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* getopt --
|
||||
* Parse argc/argv argument vector.
|
||||
*/
|
||||
int
|
||||
getopt2(nargc, nargv, ostr)
|
||||
int nargc;
|
||||
char * const *nargv;
|
||||
const char *ostr;
|
||||
{
|
||||
int retval;
|
||||
|
||||
if ((retval = getopt_internal(nargc, nargv, ostr)) == -2) {
|
||||
retval = -1;
|
||||
++optind;
|
||||
}
|
||||
return(retval);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* getopt_long --
|
||||
* Parse argc/argv argument vector.
|
||||
*/
|
||||
int
|
||||
getopt_long(nargc, nargv, options, long_options, index)
|
||||
int nargc;
|
||||
char ** nargv;
|
||||
char * options;
|
||||
struct option * long_options;
|
||||
int * index;
|
||||
{
|
||||
int retval;
|
||||
|
||||
_DIAGASSERT(nargv != NULL);
|
||||
_DIAGASSERT(options != NULL);
|
||||
_DIAGASSERT(long_options != NULL);
|
||||
/* index may be NULL */
|
||||
|
||||
if ((retval = getopt_internal(nargc, nargv, options)) == -2) {
|
||||
char *current_argv = nargv[optind++] + 2, *has_equal;
|
||||
int i, current_argv_len, match = -1;
|
||||
|
||||
if (*current_argv == '\0') {
|
||||
return(-1);
|
||||
}
|
||||
if ((has_equal = strchr(current_argv, '=')) != NULL) {
|
||||
current_argv_len = has_equal - current_argv;
|
||||
has_equal++;
|
||||
} else
|
||||
current_argv_len = strlen(current_argv);
|
||||
|
||||
for (i = 0; long_options[i].name; i++) {
|
||||
if (strncmp(current_argv, long_options[i].name, current_argv_len))
|
||||
continue;
|
||||
|
||||
if (strlen(long_options[i].name) == (unsigned)current_argv_len) {
|
||||
match = i;
|
||||
break;
|
||||
}
|
||||
if (match == -1)
|
||||
match = i;
|
||||
}
|
||||
if (match != -1) {
|
||||
if (long_options[match].has_arg == required_argument ||
|
||||
long_options[match].has_arg == optional_argument) {
|
||||
if (has_equal)
|
||||
optarg = has_equal;
|
||||
else
|
||||
optarg = nargv[optind++];
|
||||
}
|
||||
if ((long_options[match].has_arg == required_argument)
|
||||
&& (optarg == NULL)) {
|
||||
/*
|
||||
* Missing argument, leading :
|
||||
* indicates no error should be generated
|
||||
*/
|
||||
if ((opterr) && (*options != ':'))
|
||||
(void)fprintf(stderr,
|
||||
"%s: option requires an argument -- %s\n",
|
||||
__progname(nargv[0]), current_argv);
|
||||
return (BADARG);
|
||||
}
|
||||
} else { /* No matching argument */
|
||||
if ((opterr) && (*options != ':'))
|
||||
(void)fprintf(stderr,
|
||||
"%s: illegal option -- %s\n", __progname(nargv[0]), current_argv);
|
||||
return (BADCH);
|
||||
}
|
||||
if (long_options[match].flag) {
|
||||
*long_options[match].flag = long_options[match].val;
|
||||
retval = 0;
|
||||
} else
|
||||
retval = long_options[match].val;
|
||||
if (index)
|
||||
*index = match;
|
||||
}
|
||||
return(retval);
|
||||
}
|
@ -24,6 +24,11 @@
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
// Get rid of OSX 10.7 and greater deprecation warnings.
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
|
||||
#include "event2/event-config.h"
|
||||
#include "evconfig-private.h"
|
||||
|
||||
|
22
cmake/COPYING-CMAKE-SCRIPTS
Normal file
22
cmake/COPYING-CMAKE-SCRIPTS
Normal file
@ -0,0 +1,22 @@
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
3. The name of the author may not be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
14
cmake/CheckFileOffsetBits.c
Normal file
14
cmake/CheckFileOffsetBits.c
Normal file
@ -0,0 +1,14 @@
|
||||
#include <sys/types.h>
|
||||
|
||||
#define KB ((off_t)1024)
|
||||
#define MB ((off_t)1024 * KB)
|
||||
#define GB ((off_t)1024 * MB)
|
||||
#define TB ((off_t)1024 * GB)
|
||||
int t2[(((64 * GB -1) % 671088649) == 268434537)
|
||||
&& (((TB - (64 * GB -1) + 255) % 1792151290) == 305159546)? 1: -1];
|
||||
|
||||
int main()
|
||||
{
|
||||
;
|
||||
return 0;
|
||||
}
|
43
cmake/CheckFileOffsetBits.cmake
Normal file
43
cmake/CheckFileOffsetBits.cmake
Normal file
@ -0,0 +1,43 @@
|
||||
# - Check if _FILE_OFFSET_BITS macro needed for large files
|
||||
# CHECK_FILE_OFFSET_BITS ()
|
||||
#
|
||||
# The following variables may be set before calling this macro to
|
||||
# modify the way the check is run:
|
||||
#
|
||||
# CMAKE_REQUIRED_FLAGS = string of compile command line flags
|
||||
# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
|
||||
# CMAKE_REQUIRED_INCLUDES = list of include directories
|
||||
# Copyright (c) 2009, Michihiro NAKAJIMA
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
|
||||
#INCLUDE(CheckCSourceCompiles)
|
||||
|
||||
GET_FILENAME_COMPONENT(_selfdir_CheckFileOffsetBits
|
||||
"${CMAKE_CURRENT_LIST_FILE}" PATH)
|
||||
|
||||
MACRO (CHECK_FILE_OFFSET_BITS)
|
||||
IF(NOT DEFINED _FILE_OFFSET_BITS)
|
||||
MESSAGE(STATUS "Cheking _FILE_OFFSET_BITS for large files")
|
||||
TRY_COMPILE(__WITHOUT_FILE_OFFSET_BITS_64
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${_selfdir_CheckFileOffsetBits}/CheckFileOffsetBits.c
|
||||
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS})
|
||||
IF(NOT __WITHOUT_FILE_OFFSET_BITS_64)
|
||||
TRY_COMPILE(__WITH_FILE_OFFSET_BITS_64
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${_selfdir_CheckFileOffsetBits}/CheckFileOffsetBits.c
|
||||
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} -D_FILE_OFFSET_BITS=64)
|
||||
ENDIF(NOT __WITHOUT_FILE_OFFSET_BITS_64)
|
||||
|
||||
IF(NOT __WITHOUT_FILE_OFFSET_BITS_64 AND __WITH_FILE_OFFSET_BITS_64)
|
||||
SET(_FILE_OFFSET_BITS 64 CACHE INTERNAL "_FILE_OFFSET_BITS macro needed for large files")
|
||||
MESSAGE(STATUS "Cheking _FILE_OFFSET_BITS for large files - needed")
|
||||
ELSE(NOT __WITHOUT_FILE_OFFSET_BITS_64 AND __WITH_FILE_OFFSET_BITS_64)
|
||||
SET(_FILE_OFFSET_BITS "" CACHE INTERNAL "_FILE_OFFSET_BITS macro needed for large files")
|
||||
MESSAGE(STATUS "Cheking _FILE_OFFSET_BITS for large files - not needed")
|
||||
ENDIF(NOT __WITHOUT_FILE_OFFSET_BITS_64 AND __WITH_FILE_OFFSET_BITS_64)
|
||||
ENDIF(NOT DEFINED _FILE_OFFSET_BITS)
|
||||
|
||||
ENDMACRO (CHECK_FILE_OFFSET_BITS)
|
30
cmake/CheckFunctionExistsEx.c
Normal file
30
cmake/CheckFunctionExistsEx.c
Normal file
@ -0,0 +1,30 @@
|
||||
#ifdef CHECK_FUNCTION_EXISTS
|
||||
|
||||
#ifndef _WIN32
|
||||
char CHECK_FUNCTION_EXISTS();
|
||||
#endif
|
||||
|
||||
#ifdef __CLASSIC_C__
|
||||
int main(){
|
||||
int ac;
|
||||
char*av[];
|
||||
#else
|
||||
int main(int ac, char*av[]){
|
||||
#endif
|
||||
#ifdef _WIN32
|
||||
void * p = &CHECK_FUNCTION_EXISTS;
|
||||
#else
|
||||
CHECK_FUNCTION_EXISTS();
|
||||
#endif
|
||||
if(ac > 1000)
|
||||
{
|
||||
return *av[0];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else /* CHECK_FUNCTION_EXISTS */
|
||||
|
||||
# error "CHECK_FUNCTION_EXISTS has to specify the function"
|
||||
|
||||
#endif /* CHECK_FUNCTION_EXISTS */
|
69
cmake/CheckFunctionExistsEx.cmake
Normal file
69
cmake/CheckFunctionExistsEx.cmake
Normal file
@ -0,0 +1,69 @@
|
||||
# - Check if a C function can be linked
|
||||
# CHECK_FUNCTION_EXISTS(<function> <variable>)
|
||||
#
|
||||
# Check that the <function> is provided by libraries on the system and
|
||||
# store the result in a <variable>. This does not verify that any
|
||||
# system header file declares the function, only that it can be found
|
||||
# at link time (considure using CheckSymbolExists).
|
||||
#
|
||||
# The following variables may be set before calling this macro to
|
||||
# modify the way the check is run:
|
||||
#
|
||||
# CMAKE_REQUIRED_FLAGS = string of compile command line flags
|
||||
# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
|
||||
# CMAKE_REQUIRED_INCLUDES = list of include directories
|
||||
# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2002-2011 Kitware, Inc.
|
||||
#
|
||||
# Distributed under the OSI-approved BSD License (the "License");
|
||||
# see accompanying file Copyright.txt for details.
|
||||
#
|
||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the License for more information.
|
||||
#=============================================================================
|
||||
# (To distribute this file outside of CMake, substitute the full
|
||||
# License text for the above reference.)
|
||||
|
||||
MACRO(CHECK_FUNCTION_EXISTS_EX FUNCTION VARIABLE)
|
||||
IF("${VARIABLE}" MATCHES "^${VARIABLE}$")
|
||||
SET(MACRO_CHECK_FUNCTION_DEFINITIONS
|
||||
"-DCHECK_FUNCTION_EXISTS=${FUNCTION} ${CMAKE_REQUIRED_FLAGS}")
|
||||
MESSAGE(STATUS "Looking for ${FUNCTION}")
|
||||
IF(CMAKE_REQUIRED_LIBRARIES)
|
||||
SET(CHECK_FUNCTION_EXISTS_ADD_LIBRARIES
|
||||
"-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}")
|
||||
ELSE(CMAKE_REQUIRED_LIBRARIES)
|
||||
SET(CHECK_FUNCTION_EXISTS_ADD_LIBRARIES)
|
||||
ENDIF(CMAKE_REQUIRED_LIBRARIES)
|
||||
IF(CMAKE_REQUIRED_INCLUDES)
|
||||
SET(CHECK_FUNCTION_EXISTS_ADD_INCLUDES
|
||||
"-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}")
|
||||
ELSE(CMAKE_REQUIRED_INCLUDES)
|
||||
SET(CHECK_FUNCTION_EXISTS_ADD_INCLUDES)
|
||||
ENDIF(CMAKE_REQUIRED_INCLUDES)
|
||||
TRY_COMPILE(${VARIABLE}
|
||||
${CMAKE_BINARY_DIR}
|
||||
${PROJECT_SOURCE_DIR}/cmake/CheckFunctionExistsEx.c
|
||||
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
|
||||
CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS}
|
||||
"${CHECK_FUNCTION_EXISTS_ADD_LIBRARIES}"
|
||||
"${CHECK_FUNCTION_EXISTS_ADD_INCLUDES}"
|
||||
OUTPUT_VARIABLE OUTPUT)
|
||||
IF(${VARIABLE})
|
||||
SET(${VARIABLE} 1 CACHE INTERNAL "Have function ${FUNCTION}")
|
||||
MESSAGE(STATUS "Looking for ${FUNCTION} - found")
|
||||
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
|
||||
"Determining if the function ${FUNCTION} exists passed with the following output:\n"
|
||||
"${OUTPUT}\n\n")
|
||||
ELSE(${VARIABLE})
|
||||
MESSAGE(STATUS "Looking for ${FUNCTION} - not found")
|
||||
SET(${VARIABLE} "" CACHE INTERNAL "Have function ${FUNCTION}")
|
||||
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
|
||||
"Determining if the function ${FUNCTION} exists failed with the following output:\n"
|
||||
"${OUTPUT}\n\n")
|
||||
ENDIF(${VARIABLE})
|
||||
ENDIF("${VARIABLE}" MATCHES "^${VARIABLE}$")
|
||||
ENDMACRO(CHECK_FUNCTION_EXISTS_EX)
|
29
cmake/CheckPrototypeDefinition.c.in
Normal file
29
cmake/CheckPrototypeDefinition.c.in
Normal file
@ -0,0 +1,29 @@
|
||||
@CHECK_PROTOTYPE_DEFINITION_HEADER@
|
||||
|
||||
static void cmakeRequireSymbol(int dummy, ...) {
|
||||
(void) dummy;
|
||||
}
|
||||
|
||||
static void checkSymbol(void) {
|
||||
#ifndef @CHECK_PROTOTYPE_DEFINITION_SYMBOL@
|
||||
cmakeRequireSymbol(0, &@CHECK_PROTOTYPE_DEFINITION_SYMBOL@);
|
||||
#endif
|
||||
}
|
||||
|
||||
@CHECK_PROTOTYPE_DEFINITION_PROTO@ {
|
||||
return @CHECK_PROTOTYPE_DEFINITION_RETURN@;
|
||||
}
|
||||
|
||||
#ifdef __CLASSIC_C__
|
||||
int main() {
|
||||
int ac;
|
||||
char*av[];
|
||||
#else
|
||||
int main(int ac, char *av[]) {
|
||||
#endif
|
||||
checkSymbol();
|
||||
if (ac > 1000) {
|
||||
return *av[0];
|
||||
}
|
||||
return 0;
|
||||
}
|
85
cmake/CheckPrototypeDefinition.cmake
Normal file
85
cmake/CheckPrototypeDefinition.cmake
Normal file
@ -0,0 +1,85 @@
|
||||
# - Check if the protoype we expect is correct.
|
||||
# check_prototype_definition(FUNCTION PROTOTYPE RETURN HEADER VARIABLE)
|
||||
#
|
||||
# FUNCTION - The name of the function (used to check if prototype exists)
|
||||
# PROTOTYPE- The prototype to check.
|
||||
# RETURN - The return value of the function.
|
||||
# HEADER - The header files required.
|
||||
# VARIABLE - The variable to store the result.
|
||||
#
|
||||
# Example:
|
||||
#
|
||||
# check_prototype_definition(getpwent_r
|
||||
# "struct passwd *getpwent_r(struct passwd *src, char *buf, int buflen)"
|
||||
# "NULL"
|
||||
# "unistd.h;pwd.h"
|
||||
# SOLARIS_GETPWENT_R)
|
||||
#
|
||||
# The following variables may be set before calling this macro to
|
||||
# modify the way the check is run:
|
||||
#
|
||||
# CMAKE_REQUIRED_FLAGS = string of compile command line flags
|
||||
# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
|
||||
# CMAKE_REQUIRED_INCLUDES = list of include directories
|
||||
# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
|
||||
|
||||
|
||||
function(CHECK_PROTOTYPE_DEFINITION _FUNCTION _PROTOTYPE _RETURN _HEADER _VARIABLE)
|
||||
|
||||
if ("${_VARIABLE}" MATCHES "^${_VARIABLE}$")
|
||||
set(CHECK_PROTOTYPE_DEFINITION_CONTENT "/* */\n")
|
||||
|
||||
set(CHECK_PROTOTYPE_DEFINITION_FLAGS ${CMAKE_REQUIRED_FLAGS})
|
||||
if (CMAKE_REQUIRED_LIBRARIES)
|
||||
set(CHECK_PROTOTYPE_DEFINITION_LIBS
|
||||
"-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}")
|
||||
else(CMAKE_REQUIRED_LIBRARIES)
|
||||
set(CHECK_PROTOTYPE_DEFINITION_LIBS)
|
||||
endif(CMAKE_REQUIRED_LIBRARIES)
|
||||
if (CMAKE_REQUIRED_INCLUDES)
|
||||
set(CMAKE_SYMBOL_EXISTS_INCLUDES
|
||||
"-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}")
|
||||
else(CMAKE_REQUIRED_INCLUDES)
|
||||
set(CMAKE_SYMBOL_EXISTS_INCLUDES)
|
||||
endif(CMAKE_REQUIRED_INCLUDES)
|
||||
|
||||
foreach(_FILE ${_HEADER})
|
||||
set(CHECK_PROTOTYPE_DEFINITION_HEADER
|
||||
"${CHECK_PROTOTYPE_DEFINITION_HEADER}#include <${_FILE}>\n")
|
||||
endforeach(_FILE)
|
||||
|
||||
set(CHECK_PROTOTYPE_DEFINITION_SYMBOL ${_FUNCTION})
|
||||
set(CHECK_PROTOTYPE_DEFINITION_PROTO ${_PROTOTYPE})
|
||||
set(CHECK_PROTOTYPE_DEFINITION_RETURN ${_RETURN})
|
||||
|
||||
# TODO: Fix this. If the Module path has more than one entry, the below will fail.
|
||||
configure_file("${CMAKE_MODULE_PATH}/CheckPrototypeDefinition.c.in"
|
||||
"${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckPrototypeDefinition.c" @ONLY)
|
||||
|
||||
file(READ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckPrototypeDefinition.c _SOURCE)
|
||||
|
||||
try_compile(${_VARIABLE}
|
||||
${CMAKE_BINARY_DIR}
|
||||
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckPrototypeDefinition.c
|
||||
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
|
||||
CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${CHECK_PROTOTYPE_DEFINITION_FLAGS}
|
||||
"${CHECK_PROTOTYPE_DEFINITION_LIBS}"
|
||||
"${CMAKE_SYMBOL_EXISTS_INCLUDES}"
|
||||
OUTPUT_VARIABLE OUTPUT)
|
||||
|
||||
if (${_VARIABLE})
|
||||
set(${_VARIABLE} 1 CACHE INTERNAL "Have correct prototype for ${_FUNCTION}")
|
||||
message(STATUS "Checking prototype ${_FUNCTION} for ${_VARIABLE} - True")
|
||||
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
|
||||
"Determining if the prototype ${_FUNCTION} exists for ${_VARIABLE} passed with the following output:\n"
|
||||
"${OUTPUT}\n\n")
|
||||
else (${_VARIABLE})
|
||||
message(STATUS "Checking prototype ${_FUNCTION} for ${_VARIABLE} - False")
|
||||
set(${_VARIABLE} 0 CACHE INTERNAL "Have correct prototype for ${_FUNCTION}")
|
||||
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
|
||||
"Determining if the prototype ${_FUNCTION} exists for ${_VARIABLE} failed with the following output:\n"
|
||||
"${OUTPUT}\n\n${_SOURCE}\n\n")
|
||||
endif (${_VARIABLE})
|
||||
endif("${_VARIABLE}" MATCHES "^${_VARIABLE}$")
|
||||
|
||||
endfunction(CHECK_PROTOTYPE_DEFINITION)
|
52
cmake/CheckWorkingKqueue.cmake
Normal file
52
cmake/CheckWorkingKqueue.cmake
Normal file
@ -0,0 +1,52 @@
|
||||
include(CheckCSourceRuns)
|
||||
|
||||
check_c_source_runs(
|
||||
"
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/event.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
int kq;
|
||||
int n;
|
||||
int fd[2];
|
||||
struct kevent ev;
|
||||
struct timespec ts;
|
||||
char buf[8000];
|
||||
|
||||
if (pipe(fd) == -1)
|
||||
exit(1);
|
||||
if (fcntl(fd[1], F_SETFL, O_NONBLOCK) == -1)
|
||||
exit(1);
|
||||
|
||||
while ((n = write(fd[1], buf, sizeof(buf))) == sizeof(buf))
|
||||
;
|
||||
|
||||
if ((kq = kqueue()) == -1)
|
||||
exit(1);
|
||||
|
||||
memset(&ev, 0, sizeof(ev));
|
||||
ev.ident = fd[1];
|
||||
ev.filter = EVFILT_WRITE;
|
||||
ev.flags = EV_ADD | EV_ENABLE;
|
||||
n = kevent(kq, &ev, 1, NULL, 0, NULL);
|
||||
if (n == -1)
|
||||
exit(1);
|
||||
|
||||
read(fd[0], buf, sizeof(buf));
|
||||
|
||||
ts.tv_sec = 0;
|
||||
ts.tv_nsec = 0;
|
||||
n = kevent(kq, NULL, 0, &ev, 1, &ts);
|
||||
if (n == -1 || n == 0)
|
||||
exit(1);
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
" EVENT__HAVE_WORKING_KQUEUE)
|
162
cmake/CodeCoverage.cmake
Normal file
162
cmake/CodeCoverage.cmake
Normal file
@ -0,0 +1,162 @@
|
||||
#
|
||||
# Boost Software License - Version 1.0 - August 17th, 2003
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person or organization
|
||||
# obtaining a copy of the software and accompanying documentation covered by
|
||||
# this license (the "Software") to use, reproduce, display, distribute,
|
||||
# execute, and transmit the Software, and to prepare derivative works of the
|
||||
# Software, and to permit third-parties to whom the Software is furnished to
|
||||
# do so, all subject to the following:
|
||||
#
|
||||
# The copyright notices in the Software and this entire statement, including
|
||||
# the above license grant, this restriction and the following disclaimer,
|
||||
# must be included in all copies of the Software, in whole or in part, and
|
||||
# all derivative works of the Software, unless such copies or derivative
|
||||
# works are solely in the form of machine-executable object code generated by
|
||||
# a source language processor.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
# SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
# FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
# DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
# 2012-01-31, Lars Bilke
|
||||
# - Enable Code Coverage
|
||||
#
|
||||
# 2013-09-17, Joakim Söderberg
|
||||
# - Added support for Clang.
|
||||
# - Some additional usage instructions.
|
||||
#
|
||||
# USAGE:
|
||||
# 1. Copy this file into your cmake modules path.
|
||||
#
|
||||
# 2. Add the following line to your CMakeLists.txt:
|
||||
# INCLUDE(CodeCoverage)
|
||||
#
|
||||
# 3. Set compiler flags to turn off optimization and enable coverage:
|
||||
# SET(CMAKE_CXX_FLAGS "-g -O0 -fprofile-arcs -ftest-coverage")
|
||||
# SET(CMAKE_C_FLAGS "-g -O0 -fprofile-arcs -ftest-coverage")
|
||||
#
|
||||
# 3. Use the function SETUP_TARGET_FOR_COVERAGE to create a custom make target
|
||||
# which runs your test executable and produces a lcov code coverage report:
|
||||
# Example:
|
||||
# SETUP_TARGET_FOR_COVERAGE(
|
||||
# my_coverage_target # Name for custom target.
|
||||
# test_driver # Name of the test driver executable that runs the tests.
|
||||
# # NOTE! This should always have a ZERO as exit code
|
||||
# # otherwise the coverage generation will not complete.
|
||||
# coverage # Name of output directory.
|
||||
# )
|
||||
#
|
||||
# 4. Build a Debug build:
|
||||
# cmake -DCMAKE_BUILD_TYPE=Debug ..
|
||||
# make
|
||||
# make my_coverage_target
|
||||
#
|
||||
#
|
||||
|
||||
# Check prereqs
|
||||
FIND_PROGRAM( GCOV_PATH gcov )
|
||||
FIND_PROGRAM( LCOV_PATH lcov )
|
||||
FIND_PROGRAM( GENHTML_PATH genhtml )
|
||||
FIND_PROGRAM( GCOVR_PATH gcovr PATHS ${CMAKE_SOURCE_DIR}/tests)
|
||||
|
||||
IF(NOT GCOV_PATH)
|
||||
MESSAGE(FATAL_ERROR "gcov not found! Aborting...")
|
||||
ENDIF() # NOT GCOV_PATH
|
||||
|
||||
IF(NOT CMAKE_COMPILER_IS_GNUCC AND NOT CMAKE_COMPILER_IS_GNUCXX)
|
||||
# Clang version 3.0.0 and greater now supports gcov as well.
|
||||
MESSAGE(WARNING "Compiler is not GNU gcc! Clang Version 3.0.0 and greater supports gcov as well, but older versions don't.")
|
||||
|
||||
IF(NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
MESSAGE(FATAL_ERROR "Compiler is not GNU gcc! Aborting...")
|
||||
ENDIF()
|
||||
ENDIF() # NOT CMAKE_COMPILER_IS_GNUCC
|
||||
|
||||
IF ( NOT CMAKE_BUILD_TYPE STREQUAL "Debug" )
|
||||
MESSAGE( WARNING "Code coverage results with an optimized (non-Debug) build may be misleading" )
|
||||
ENDIF() # NOT CMAKE_BUILD_TYPE STREQUAL "Debug"
|
||||
|
||||
|
||||
# Param _targetname The name of new the custom make target
|
||||
# Param _testrunner The name of the target which runs the tests.
|
||||
# MUST return ZERO always, even on errors.
|
||||
# If not, no coverage report will be created!
|
||||
# Param _outputname lcov output is generated as _outputname.info
|
||||
# HTML report is generated in _outputname/index.html
|
||||
# Optional fourth parameter is passed as arguments to _testrunner
|
||||
# Pass them in list form, e.g.: "-j;2" for -j 2
|
||||
FUNCTION(SETUP_TARGET_FOR_COVERAGE _targetname _testrunner _outputname)
|
||||
|
||||
IF(NOT LCOV_PATH)
|
||||
MESSAGE(FATAL_ERROR "lcov not found! Aborting...")
|
||||
ENDIF() # NOT LCOV_PATH
|
||||
|
||||
IF(NOT GENHTML_PATH)
|
||||
MESSAGE(FATAL_ERROR "genhtml not found! Aborting...")
|
||||
ENDIF() # NOT GENHTML_PATH
|
||||
|
||||
# Setup target
|
||||
ADD_CUSTOM_TARGET(${_targetname}
|
||||
|
||||
# Cleanup lcov
|
||||
${LCOV_PATH} --directory . --zerocounters
|
||||
|
||||
# Run tests
|
||||
COMMAND ${_testrunner} ${ARGV3}
|
||||
|
||||
# Capturing lcov counters and generating report
|
||||
COMMAND ${LCOV_PATH} --directory . --capture --output-file ${_outputname}.info
|
||||
COMMAND ${LCOV_PATH} --remove ${_outputname}.info 'tests/*' '/usr/*' --output-file ${_outputname}.info.cleaned
|
||||
COMMAND ${GENHTML_PATH} -o ${_outputname} ${_outputname}.info.cleaned
|
||||
COMMAND ${CMAKE_COMMAND} -E remove ${_outputname}.info ${_outputname}.info.cleaned
|
||||
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
COMMENT "Resetting code coverage counters to zero.\nProcessing code coverage counters and generating report."
|
||||
)
|
||||
|
||||
# Show info where to find the report
|
||||
ADD_CUSTOM_COMMAND(TARGET ${_targetname} POST_BUILD
|
||||
COMMAND ;
|
||||
COMMENT "Open ./${_outputname}/index.html in your browser to view the coverage report."
|
||||
)
|
||||
|
||||
ENDFUNCTION() # SETUP_TARGET_FOR_COVERAGE
|
||||
|
||||
# Param _targetname The name of new the custom make target
|
||||
# Param _testrunner The name of the target which runs the tests
|
||||
# Param _outputname cobertura output is generated as _outputname.xml
|
||||
# Optional fourth parameter is passed as arguments to _testrunner
|
||||
# Pass them in list form, e.g.: "-j;2" for -j 2
|
||||
FUNCTION(SETUP_TARGET_FOR_COVERAGE_COBERTURA _targetname _testrunner _outputname)
|
||||
|
||||
IF(NOT PYTHON_EXECUTABLE)
|
||||
MESSAGE(FATAL_ERROR "Python not found! Aborting...")
|
||||
ENDIF() # NOT PYTHON_EXECUTABLE
|
||||
|
||||
IF(NOT GCOVR_PATH)
|
||||
MESSAGE(FATAL_ERROR "gcovr not found! Aborting...")
|
||||
ENDIF() # NOT GCOVR_PATH
|
||||
|
||||
ADD_CUSTOM_TARGET(${_targetname}
|
||||
|
||||
# Run tests
|
||||
${_testrunner} ${ARGV3}
|
||||
|
||||
# Running gcovr
|
||||
COMMAND ${GCOVR_PATH} -x -r ${CMAKE_SOURCE_DIR} -e '${CMAKE_SOURCE_DIR}/tests/' -o ${_outputname}.xml
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
COMMENT "Running gcovr to produce Cobertura code coverage report."
|
||||
)
|
||||
|
||||
# Show info where to find the report
|
||||
ADD_CUSTOM_COMMAND(TARGET ${_targetname} POST_BUILD
|
||||
COMMAND ;
|
||||
COMMENT "Cobertura code coverage report saved in ${_outputname}.xml."
|
||||
)
|
||||
|
||||
ENDFUNCTION() # SETUP_TARGET_FOR_COVERAGE_COBERTURA
|
57
cmake/Copyright.txt
Normal file
57
cmake/Copyright.txt
Normal file
@ -0,0 +1,57 @@
|
||||
CMake - Cross Platform Makefile Generator
|
||||
Copyright 2000-2013 Kitware, Inc.
|
||||
Copyright 2000-2011 Insight Software Consortium
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the names of Kitware, Inc., the Insight Software Consortium,
|
||||
nor the names of their contributors may be used to endorse or promote
|
||||
products derived from this software without specific prior written
|
||||
permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
The above copyright and license notice applies to distributions of
|
||||
CMake in source and binary form. Some source files contain additional
|
||||
notices of original copyright by their contributors; see each source
|
||||
for details. Third-party software packages supplied with CMake under
|
||||
compatible licenses provide their own copyright notices documented in
|
||||
corresponding subdirectories.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
CMake was initially developed by Kitware with the following sponsorship:
|
||||
|
||||
* National Library of Medicine at the National Institutes of Health
|
||||
as part of the Insight Segmentation and Registration Toolkit (ITK).
|
||||
|
||||
* US National Labs (Los Alamos, Livermore, Sandia) ASC Parallel
|
||||
Visualization Initiative.
|
||||
|
||||
* National Alliance for Medical Image Computing (NAMIC) is funded by the
|
||||
National Institutes of Health through the NIH Roadmap for Medical Research,
|
||||
Grant U54 EB005149.
|
||||
|
||||
* Kitware, Inc.
|
17
cmake/LibeventConfig.cmake.in
Normal file
17
cmake/LibeventConfig.cmake.in
Normal file
@ -0,0 +1,17 @@
|
||||
# - Config file for the Libevent package
|
||||
# It defines the following variables
|
||||
# LIBEVENT_INCLUDE_DIRS - include directories for FooBar
|
||||
# LIBEVENT_LIBRARIES - libraries to link against
|
||||
|
||||
# Get the path of the current file.
|
||||
get_filename_component(LIBEVENT_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
||||
|
||||
# Set the include directories.
|
||||
set(LIBEVENT_INCLUDE_DIRS "@EVENT__INCLUDE_DIRS@")
|
||||
|
||||
# Include the project Targets file, this contains definitions for IMPORTED targets.
|
||||
include(${LIBEVENT_CMAKE_DIR}/LibeventTargets.cmake)
|
||||
|
||||
# IMPORTED targets from LibeventTargets.cmake
|
||||
set(LIBEVENT_LIBRARIES event event_core event_extras)
|
||||
|
11
cmake/LibeventConfigVersion.cmake.in
Normal file
11
cmake/LibeventConfigVersion.cmake.in
Normal file
@ -0,0 +1,11 @@
|
||||
set(PACKAGE_VERSION "@EVENT_PACKAGE_VERSION@")
|
||||
|
||||
# Check whether the requested PACKAGE_FIND_VERSION is compatible
|
||||
if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")
|
||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
else()
|
||||
set(PACKAGE_VERSION_COMPATIBLE TRUE)
|
||||
if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}")
|
||||
set(PACKAGE_VERSION_EXACT TRUE)
|
||||
endif()
|
||||
endif()
|
35
evconfig-private.h.cmake
Normal file
35
evconfig-private.h.cmake
Normal file
@ -0,0 +1,35 @@
|
||||
|
||||
#ifndef EVCONFIG_PRIVATE_H_INCLUDED_
|
||||
#define EVCONFIG_PRIVATE_H_INCLUDED_
|
||||
|
||||
/* Enable extensions on AIX 3, Interix. */
|
||||
#cmakedefine _ALL_SOURCE
|
||||
|
||||
/* Enable GNU extensions on systems that have them. */
|
||||
#cmakedefine _GNU_SOURCE 1
|
||||
|
||||
/* Enable threading extensions on Solaris. */
|
||||
#cmakedefine _POSIX_PTHREAD_SEMANTICS 1
|
||||
|
||||
/* Enable extensions on HP NonStop. */
|
||||
#cmakedefine _TANDEM_SOURCE 1
|
||||
|
||||
/* Enable general extensions on Solaris. */
|
||||
#cmakedefine __EXTENSIONS__
|
||||
|
||||
/* Number of bits in a file offset, on hosts where this is settable. */
|
||||
#cmakedefine _FILE_OFFSET_BITS 1
|
||||
/* Define for large files, on AIX-style hosts. */
|
||||
#cmakedefine _LARGE_FILES 1
|
||||
|
||||
/* Define to 1 if on MINIX. */
|
||||
#cmakedefine _MINIX 1
|
||||
|
||||
/* Define to 2 if the system does not provide POSIX.1 features except with
|
||||
this defined. */
|
||||
#cmakedefine _POSIX_1_SOURCE 1
|
||||
|
||||
/* Define to 1 if you need to in order for `stat' and other things to work. */
|
||||
#cmakedefine _POSIX_SOURCE 1
|
||||
|
||||
#endif
|
500
event-config.h.cmake
Normal file
500
event-config.h.cmake
Normal file
@ -0,0 +1,500 @@
|
||||
/* event-config.h
|
||||
*
|
||||
* This file was generated by cmake when the makefiles were generated.
|
||||
*
|
||||
* DO NOT EDIT THIS FILE.
|
||||
*
|
||||
* Do not rely on macros in this file existing in later versions.
|
||||
*/
|
||||
#ifndef EVENT2_EVENT_CONFIG_H_INCLUDED_
|
||||
#define EVENT2_EVENT_CONFIG_H_INCLUDED_
|
||||
|
||||
/* Numeric representation of the version */
|
||||
#define EVENT__NUMERIC_VERSION @EVENT_NUMERIC_VERSION@
|
||||
|
||||
#define EVENT__PACKAGE_VERSION @EVENT_PACKAGE_VERSION@
|
||||
|
||||
/* Version number of package */
|
||||
#define EVENT__VERSION "@EVENT_VERSION@"
|
||||
|
||||
/* Name of package */
|
||||
#define EVENT__PACKAGE "libevent"
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#define EVENT__PACKAGE_BUGREPORT ""
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#define EVENT__PACKAGE_NAME ""
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#define EVENT__PACKAGE_STRING ""
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#define EVENT__PACKAGE_TARNAME ""
|
||||
|
||||
/* Define if libevent should build without support for a debug mode */
|
||||
#cmakedefine EVENT__DISABLE_DEBUG_MODE 0
|
||||
|
||||
/* Define if libevent should not allow replacing the mm functions */
|
||||
#cmakedefine EVENT__DISABLE_MM_REPLACEMENT 0
|
||||
|
||||
/* Define if libevent should not be compiled with thread support */
|
||||
#cmakedefine EVENT__DISABLE_THREAD_SUPPORT 0
|
||||
|
||||
/* Define to 1 if you have the `accept4' function. */
|
||||
#cmakedefine EVENT__HAVE_ACCEPT4 1
|
||||
|
||||
/* Define to 1 if you have the `arc4random' function. */
|
||||
#cmakedefine EVENT__HAVE_ARC4RANDOM 1
|
||||
|
||||
/* Define to 1 if you have the `arc4random_buf' function. */
|
||||
#cmakedefine EVENT__HAVE_ARC4RANDOM_BUF 1
|
||||
|
||||
/* Define if clock_gettime is available in libc */
|
||||
#cmakedefine EVENT__DNS_USE_CPU_CLOCK_FOR_ID 1
|
||||
|
||||
/* Define is no secure id variant is available */
|
||||
#cmakedefine EVENT__DNS_USE_GETTIMEOFDAY_FOR_ID 1
|
||||
#cmakedefine EVENT__DNS_USE_FTIME_FOR_ID 1
|
||||
|
||||
/* Define to 1 if you have the <arpa/inet.h> header file. */
|
||||
#cmakedefine EVENT__HAVE_ARPA_INET_H 1
|
||||
|
||||
/* Define to 1 if you have the `clock_gettime' function. */
|
||||
#cmakedefine EVENT__HAVE_CLOCK_GETTIME 1
|
||||
|
||||
/* Define to 1 if you have the declaration of `CTL_KERN'. */
|
||||
#cmakedefine EVENT__HAVE_DECL_CTL_KERN 1
|
||||
|
||||
/* Define to 1 if you have the declaration of `KERN_ARND'. */
|
||||
#cmakedefine EVENT__HAVE_DECL_KERN_ARND 0
|
||||
|
||||
/* Define to 1 if you have the declaration of `KERN_RANDOM'. */
|
||||
#cmakedefine EVENT__HAVE_DECL_KERN_RANDOM 1
|
||||
|
||||
/* Define if /dev/poll is available */
|
||||
#cmakedefine EVENT__HAVE_DEVPOLL 1
|
||||
|
||||
/* Define to 1 if you have the <netdb.h> header file. */
|
||||
#cmakedefine EVENT__HAVE_NETDB_H 1
|
||||
|
||||
/* Define to 1 if fd_mask type is defined */
|
||||
#cmakedefine EVENT__HAVE_FD_MASK 1
|
||||
|
||||
/* Define to 1 if the <sys/queue.h> header file defines TAILQ_FOREACH. */
|
||||
#cmakedefine EVENT__HAVE_TAILQFOREACH 1
|
||||
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
#cmakedefine EVENT__HAVE_DLFCN_H 1
|
||||
|
||||
/* Define if your system supports the epoll system calls */
|
||||
#cmakedefine EVENT__HAVE_EPOLL 1
|
||||
|
||||
/* Define to 1 if you have the `epoll_create1' function. */
|
||||
#cmakedefine EVENT__HAVE_EPOLL_CREATE1 1
|
||||
|
||||
/* Define to 1 if you have the `epoll_ctl' function. */
|
||||
#cmakedefine EVENT__HAVE_EPOLL_CTL 1
|
||||
|
||||
/* Define to 1 if you have the `eventfd' function. */
|
||||
#cmakedefine EVENT__HAVE_EVENTFD 1
|
||||
|
||||
/* Define if your system supports event ports */
|
||||
#cmakedefine EVENT__HAVE_EVENT_PORTS 1
|
||||
|
||||
/* Define to 1 if you have the `fcntl' function. */
|
||||
#cmakedefine EVENT__HAVE_FCNTL 1
|
||||
|
||||
/* Define to 1 if you have the <fcntl.h> header file. */
|
||||
#cmakedefine EVENT__HAVE_FCNTL_H 1
|
||||
|
||||
/* Define to 1 if you have the `getaddrinfo' function. */
|
||||
#cmakedefine EVENT__HAVE_GETADDRINFO 1
|
||||
|
||||
/* Define to 1 if you have the `getegid' function. */
|
||||
#cmakedefine EVENT__HAVE_GETEGID 1
|
||||
|
||||
/* Define to 1 if you have the `geteuid' function. */
|
||||
#cmakedefine EVENT__HAVE_GETEUID 1
|
||||
|
||||
/* TODO: Check for different gethostname argument counts. CheckPrototypeDefinition.cmake can be used. */
|
||||
/* Define this if you have any gethostbyname_r() */
|
||||
#cmakedefine EVENT__HAVE_GETHOSTBYNAME_R 1
|
||||
|
||||
/* Define this if gethostbyname_r takes 3 arguments */
|
||||
#cmakedefine EVENT__HAVE_GETHOSTBYNAME_R_3_ARG 1
|
||||
|
||||
/* Define this if gethostbyname_r takes 5 arguments */
|
||||
#cmakedefine EVENT__HAVE_GETHOSTBYNAME_R_5_ARG 1
|
||||
|
||||
/* Define this if gethostbyname_r takes 6 arguments */
|
||||
#cmakedefine EVENT__HAVE_GETHOSTBYNAME_R_6_ARG 1
|
||||
|
||||
/* Define to 1 if you have the `getifaddrs' function. */
|
||||
#cmakedefine EVENT__HAVE_GETIFADDRS 1
|
||||
|
||||
/* Define to 1 if you have the `getnameinfo' function. */
|
||||
#cmakedefine EVENT__HAVE_GETNAMEINFO 1
|
||||
|
||||
/* Define to 1 if you have the `getprotobynumber' function. */
|
||||
#cmakedefine EVENT__HAVE_GETPROTOBYNUMBER 1
|
||||
|
||||
/* Define to 1 if you have the `getservbyname' function. */
|
||||
#cmakedefine EVENT__HAVE_GETSERVBYNAME 1
|
||||
|
||||
/* Define to 1 if you have the `gettimeofday' function. */
|
||||
#cmakedefine EVENT__HAVE_GETTIMEOFDAY 1
|
||||
|
||||
/* Define to 1 if you have the <ifaddrs.h> header file. */
|
||||
#cmakedefine EVENT__HAVE_IFADDRS_H 1
|
||||
|
||||
/* Define to 1 if you have the `inet_aton' function. */
|
||||
#cmakedefine EVENT__HAVE_INET_ATON 1
|
||||
|
||||
/* Define to 1 if you have the `inet_ntop' function. */
|
||||
#cmakedefine EVENT__HAVE_INET_NTOP 1
|
||||
|
||||
/* Define to 1 if you have the `inet_pton' function. */
|
||||
#cmakedefine EVENT__HAVE_INET_PTON 1
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#cmakedefine EVENT__HAVE_INTTYPES_H 1
|
||||
|
||||
/* Define to 1 if you have the `issetugid' function. */
|
||||
#cmakedefine EVENT__HAVE_ISSETUGID 1
|
||||
|
||||
/* Define to 1 if you have the `kqueue' function. */
|
||||
#cmakedefine EVENT__HAVE_KQUEUE 1
|
||||
|
||||
/* Define if the system has zlib */
|
||||
#cmakedefine EVENT__HAVE_LIBZ 1
|
||||
|
||||
/* Define to 1 if you have the `mach_absolute_time' function. */
|
||||
#cmakedefine EVENT__HAVE_MACH_ABSOLUTE_TIME 1
|
||||
|
||||
/* Define to 1 if you have the <mach/mach_time.h> header file. */
|
||||
#cmakedefine EVENT__HAVE_MACH_MACH_TIME_H 1
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#cmakedefine EVENT__HAVE_MEMORY_H 1
|
||||
|
||||
/* Define to 1 if you have the `mmap' function. */
|
||||
#cmakedefine EVENT__HAVE_MMAP 1
|
||||
|
||||
/* Define to 1 if you have the `nanosleep' function. */
|
||||
#cmakedefine EVENT__HAVE_NANOSLEEP 1
|
||||
|
||||
/* Define to 1 if you have the `usleep' function. */
|
||||
#cmakedefine EVENT__HAVE_USLEEP 1
|
||||
|
||||
/* Define to 1 if you have the <netdb.h> header file. */
|
||||
#cmakedefine EVENT__HAVE_NETDB_H 1
|
||||
|
||||
/* Define to 1 if you have the <netinet/in6.h> header file. */
|
||||
#cmakedefine EVENT__HAVE_NETINET_IN6_H 1
|
||||
|
||||
/* Define to 1 if you have the <netinet/in.h> header file. */
|
||||
#cmakedefine EVENT__HAVE_NETINET_IN_H 1
|
||||
|
||||
/* Define to 1 if you have the <netinet/tcp.h> header file. */
|
||||
#cmakedefine EVENT__HAVE_NETINET_TCP_H 1
|
||||
|
||||
/* Define if the system has openssl */
|
||||
#cmakedefine EVENT__HAVE_OPENSSL 1
|
||||
|
||||
/* Defines if the system has zlib */
|
||||
#cmakedefine EVENT__HAVE_ZLIB 1
|
||||
|
||||
/* Define to 1 if you have the `pipe' function. */
|
||||
#cmakedefine EVENT__HAVE_PIPE 1
|
||||
|
||||
/* Define to 1 if you have the `pipe2' function. */
|
||||
#cmakedefine EVENT__HAVE_PIPE2 1
|
||||
|
||||
/* Define to 1 if you have the `poll' function. */
|
||||
#cmakedefine EVENT__HAVE_POLL 1
|
||||
|
||||
/* Define to 1 if you have the <poll.h> header file. */
|
||||
#cmakedefine EVENT__HAVE_POLL_H 1
|
||||
|
||||
/* Define to 1 if you have the `port_create' function. */
|
||||
#cmakedefine EVENT__HAVE_PORT_CREATE 1
|
||||
|
||||
/* Define to 1 if you have the <port.h> header file. */
|
||||
#cmakedefine EVENT__HAVE_PORT_H 1
|
||||
|
||||
/* Define if you have POSIX threads libraries and header files. */
|
||||
#cmakedefine EVENT__HAVE_PTHREAD 1
|
||||
|
||||
/* Define if we have pthreads on this system */
|
||||
#cmakedefine EVENT__HAVE_PTHREADS 1
|
||||
|
||||
/* Define to 1 if you have the `putenv' function. */
|
||||
#cmakedefine EVENT__HAVE_PUTENV 1
|
||||
|
||||
/* Define to 1 if the system has the type `sa_family_t'. */
|
||||
#cmakedefine EVENT__HAVE_SA_FAMILY_T 1
|
||||
|
||||
/* Define to 1 if you have the `select' function. */
|
||||
#cmakedefine EVENT__HAVE_SELECT 1
|
||||
|
||||
/* Define to 1 if you have the `setenv' function. */
|
||||
#cmakedefine EVENT__HAVE_SETENV 1
|
||||
|
||||
/* Define if F_SETFD is defined in <fcntl.h> */
|
||||
#cmakedefine EVENT__HAVE_SETFD 1
|
||||
|
||||
/* Define to 1 if you have the `setrlimit' function. */
|
||||
#cmakedefine EVENT__HAVE_SETRLIMIT 1
|
||||
|
||||
/* Define to 1 if you have the `sendfile' function. */
|
||||
#cmakedefine EVENT__HAVE_SENDFILE 1
|
||||
|
||||
/* Define if F_SETFD is defined in <fcntl.h> */
|
||||
#cmakedefine EVENT__HAVE_SETFD 1
|
||||
|
||||
/* Define to 1 if you have the `sigaction' function. */
|
||||
#cmakedefine EVENT__HAVE_SIGACTION 1
|
||||
|
||||
/* Define to 1 if you have the `signal' function. */
|
||||
#cmakedefine EVENT__HAVE_SIGNAL 1
|
||||
|
||||
/* Define to 1 if you have the `splice' function. */
|
||||
#cmakedefine EVENT__HAVE_SPLICE 1
|
||||
|
||||
/* Define to 1 if you have the <stdarg.h> header file. */
|
||||
#cmakedefine EVENT__HAVE_STDARG_H 1
|
||||
|
||||
/* Define to 1 if you have the <stddef.h> header file. */
|
||||
#cmakedefine EVENT__HAVE_STDDEF_H 1
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#cmakedefine EVENT__HAVE_STDINT_H 1
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#cmakedefine EVENT__HAVE_STDLIB_H 1
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#cmakedefine EVENT__HAVE_STRINGS_H 1
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#cmakedefine EVENT__HAVE_STRING_H 1
|
||||
|
||||
/* Define to 1 if you have the `strlcpy' function. */
|
||||
#cmakedefine EVENT__HAVE_STRLCPY 1
|
||||
|
||||
/* Define to 1 if you have the `strsep' function. */
|
||||
#cmakedefine EVENT__HAVE_STRSEP 1
|
||||
|
||||
/* Define to 1 if you have the `strtok_r' function. */
|
||||
#cmakedefine EVENT__HAVE_STRTOK_R 1
|
||||
|
||||
/* Define to 1 if you have the `strtoll' function. */
|
||||
#cmakedefine EVENT__HAVE_STRTOLL 1
|
||||
|
||||
/* Define to 1 if the system has the type `struct addrinfo'. */
|
||||
#cmakedefine EVENT__HAVE_STRUCT_ADDRINFO 1
|
||||
|
||||
/* Define to 1 if the system has the type `struct in6_addr'. */
|
||||
#cmakedefine EVENT__HAVE_STRUCT_IN6_ADDR 1
|
||||
|
||||
/* Define to 1 if `s6_addr16' is member of `struct in6_addr'. */
|
||||
#cmakedefine EVENT__HAVE_STRUCT_IN6_ADDR_S6_ADDR16 1
|
||||
|
||||
/* Define to 1 if `s6_addr32' is member of `struct in6_addr'. */
|
||||
#cmakedefine EVENT__HAVE_STRUCT_IN6_ADDR_S6_ADDR32 1
|
||||
|
||||
/* Define to 1 if the system has the type `struct sockaddr_in6'. */
|
||||
#cmakedefine EVENT__HAVE_STRUCT_SOCKADDR_IN6 1
|
||||
|
||||
/* Define to 1 if `sin6_len' is member of `struct sockaddr_in6'. */
|
||||
#cmakedefine EVENT__HAVE_STRUCT_SOCKADDR_IN6_SIN6_LEN 1
|
||||
|
||||
/* Define to 1 if `sin_len' is member of `struct sockaddr_in'. */
|
||||
#cmakedefine EVENT__HAVE_STRUCT_SOCKADDR_IN_SIN_LEN 1
|
||||
|
||||
/* Define to 1 if the system has the type `struct sockaddr_storage'. */
|
||||
#cmakedefine EVENT__HAVE_STRUCT_SOCKADDR_STORAGE 1
|
||||
|
||||
/* Define to 1 if `ss_family' is a member of `struct sockaddr_storage'. */
|
||||
#cmakedefine EVENT__HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY 1
|
||||
|
||||
/* Define to 1 if `__ss_family' is a member of `struct sockaddr_storage'. */
|
||||
#cmakedefine EVENT__HAVE_STRUCT_SOCKADDR_STORAGE___SS_FAMILY 1
|
||||
|
||||
/* Define to 1 if you have the `sysctl' function. */
|
||||
#cmakedefine EVENT__HAVE_SYSCTL 1
|
||||
|
||||
/* Define to 1 if you have the <sys/devpoll.h> header file. */
|
||||
#cmakedefine EVENT__HAVE_SYS_DEVPOLL_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/epoll.h> header file. */
|
||||
#cmakedefine EVENT__HAVE_SYS_EPOLL_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/eventfd.h> header file. */
|
||||
#cmakedefine EVENT__HAVE_SYS_EVENTFD_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/event.h> header file. */
|
||||
#cmakedefine EVENT__HAVE_SYS_EVENT_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/ioctl.h> header file. */
|
||||
#cmakedefine EVENT__HAVE_SYS_IOCTL_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/mman.h> header file. */
|
||||
#cmakedefine EVENT__HAVE_SYS_MMAN_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/param.h> header file. */
|
||||
#cmakedefine EVENT__HAVE_SYS_PARAM_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/queue.h> header file. */
|
||||
#cmakedefine EVENT__HAVE_SYS_QUEUE_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/resource.h> header file. */
|
||||
#cmakedefine EVENT__HAVE_SYS_RESOURCE_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/select.h> header file. */
|
||||
#cmakedefine EVENT__HAVE_SYS_SELECT_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/sendfile.h> header file. */
|
||||
#cmakedefine EVENT__HAVE_SYS_SENDFILE_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/socket.h> header file. */
|
||||
#cmakedefine EVENT__HAVE_SYS_SOCKET_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#cmakedefine EVENT__HAVE_SYS_STAT_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/sysctl.h> header file. */
|
||||
#cmakedefine EVENT__HAVE_SYS_SYSCTL_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/timerfd.h> header file. */
|
||||
#cmakedefine EVENT__HAVE_SYS_TIMERFD_H */
|
||||
|
||||
/* Define to 1 if you have the <sys/time.h> header file. */
|
||||
#cmakedefine EVENT__HAVE_SYS_TIME_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#cmakedefine EVENT__HAVE_SYS_TYPES_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/uio.h> header file. */
|
||||
#cmakedefine EVENT__HAVE_SYS_UIO_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/wait.h> header file. */
|
||||
#cmakedefine EVENT__HAVE_SYS_WAIT_H 1
|
||||
|
||||
/* Define if TAILQ_FOREACH is defined in <sys/queue.h> */
|
||||
#cmakedefine EVENT__HAVE_TAILQFOREACH 1
|
||||
|
||||
/* Define if timeradd is defined in <sys/time.h> */
|
||||
#cmakedefine EVENT__HAVE_TIMERADD 1
|
||||
|
||||
/* Define if timerclear is defined in <sys/time.h> */
|
||||
#cmakedefine EVENT__HAVE_TIMERCLEAR 1
|
||||
|
||||
/* Define if timercmp is defined in <sys/time.h> */
|
||||
#cmakedefine EVENT__HAVE_TIMERCMP 1
|
||||
|
||||
/* Define to 1 if you have the `timerfd_create' function. */
|
||||
#cmakedefine EVENT__HAVE_TIMERFD_CREATE 1
|
||||
|
||||
/* Define if timerisset is defined in <sys/time.h> */
|
||||
#cmakedefine EVENT__HAVE_TIMERISSET 1
|
||||
|
||||
/* Define to 1 if the system has the type `uint8_t'. */
|
||||
#cmakedefine EVENT__HAVE_UINT8_T 1
|
||||
|
||||
/* Define to 1 if the system has the type `uint16_t'. */
|
||||
#cmakedefine EVENT__HAVE_UINT16_T 1
|
||||
|
||||
/* Define to 1 if the system has the type `uint32_t'. */
|
||||
#cmakedefine EVENT__HAVE_UINT32_T 1
|
||||
|
||||
/* Define to 1 if the system has the type `uint64_t'. */
|
||||
#cmakedefine EVENT__HAVE_UINT64_T 1
|
||||
|
||||
/* Define to 1 if the system has the type `uintptr_t'. */
|
||||
#cmakedefine EVENT__HAVE_UINTPTR_T 1
|
||||
|
||||
/* Define to 1 if you have the `umask' function. */
|
||||
#cmakedefine EVENT__HAVE_UMASK 1
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#cmakedefine EVENT__HAVE_UNISTD_H 1
|
||||
|
||||
/* Define to 1 if you have the `unsetenv' function. */
|
||||
#cmakedefine EVENT__HAVE_UNSETENV 1
|
||||
|
||||
/* Define to 1 if you have the `vasprintf' function. */
|
||||
#cmakedefine EVENT__HAVE_VASPRINTF 1
|
||||
|
||||
/* Define if kqueue works correctly with pipes */
|
||||
#cmakedefine EVENT__HAVE_WORKING_KQUEUE 1
|
||||
|
||||
/* Define to necessary symbol if this constant uses a non-standard name on
|
||||
your system. */
|
||||
#cmakedefine EVENT__PTHREAD_CREATE_JOINABLE ${EVENT__PTHREAD_CREATE_JOINABLE}
|
||||
|
||||
/* The size of `pthread_t', as computed by sizeof. */
|
||||
#cmakedefine EVENT__SIZEOF_PTHREAD_T ${EVENT__SIZEOF_PTHREAD_T}
|
||||
|
||||
/* The size of a `int', as computed by sizeof. */
|
||||
#cmakedefine EVENT__SIZEOF_INT ${EVENT__SIZEOF_INT}
|
||||
|
||||
/* The size of a `long', as computed by sizeof. */
|
||||
#cmakedefine EVENT__SIZEOF_LONG ${EVENT__SIZEOF_LONG}
|
||||
|
||||
/* The size of a `long long', as computed by sizeof. */
|
||||
#cmakedefine EVENT__SIZEOF_LONG_LONG ${EVENT__SIZEOF_LONG_LONG}
|
||||
|
||||
/* The size of `off_t', as computed by sizeof. */
|
||||
#cmakedefine EVENT__SIZEOF_OFF_T ${EVENT__SIZEOF_OFF_T}
|
||||
|
||||
/* The size of a `short', as computed by sizeof. */
|
||||
#cmakedefine EVENT__SIZEOF_SHORT ${EVENT__SIZEOF_SHORT}
|
||||
|
||||
/* The size of `size_t', as computed by sizeof. */
|
||||
#cmakedefine EVENT__SIZEOF_SIZE_T ${EVENT__SIZEOF_SIZE_T}
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#cmakedefine EVENT__STDC_HEADERS ${EVENT__STDC_HEADERS}
|
||||
|
||||
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
|
||||
#cmakedefine EVENT__TIME_WITH_SYS_TIME ${EVENT__TIME_WITH_SYS_TIME}
|
||||
|
||||
/* The size of `socklen_t', as computed by sizeof. */
|
||||
#cmakedefine EVENT__SIZEOF_SOCKLEN_T ${EVENT__SIZEOF_SOCKLEN_T}
|
||||
|
||||
/* The size of 'void *', as computer by sizeof */
|
||||
#cmakedefine EVENT__SIZEOF_VOID_P ${EVENT__SIZEOF_VOID_P}
|
||||
|
||||
/* Define to appropriate substitute if compiler doesnt have __func__ */
|
||||
#cmakedefine EVENT____func__ ${EVENT____func__}
|
||||
|
||||
/* Number of bits in a file offset, on hosts where this is settable. */
|
||||
#cmakedefine EVENT___FILE_OFFSET_BITS ${EVENT___FILE_OFFSET_BITS}
|
||||
|
||||
/* Define for large files, on AIX-style hosts. */
|
||||
/* #undef _LARGE_FILES */
|
||||
|
||||
/* Define to empty if `const' does not conform to ANSI C. */
|
||||
/* #undef EVENT__const */
|
||||
|
||||
/* Define to `__inline__' or `__inline' if that's what the C compiler
|
||||
calls it, or to nothing if 'inline' is not supported under any name. */
|
||||
#ifndef __cplusplus
|
||||
#cmakedefine EVENT__inline ${EVENT__inline}
|
||||
#endif
|
||||
|
||||
/* Define to `int' if <sys/types.h> does not define. */
|
||||
#cmakedefine EVENT__pid_t ${EVENT__pid_t}
|
||||
|
||||
/* Define to `unsigned' if <sys/types.h> does not define. */
|
||||
#cmakedefine EVENT__size_t ${EVENT__size_t}
|
||||
|
||||
/* Define to unsigned int if you dont have it */
|
||||
#cmakedefine EVENT__socklen_t ${EVENT__socklen_t}
|
||||
|
||||
/* Define to `int' if <sys/types.h> does not define. */
|
||||
#cmakedefine EVENT__ssize_t ${EVENT__ssize_t}
|
||||
|
||||
#endif
|
2
evutil.c
2
evutil.c
@ -1794,7 +1794,7 @@ evutil_vsnprintf(char *buf, size_t buflen, const char *format, va_list ap)
|
||||
int r;
|
||||
if (!buflen)
|
||||
return 0;
|
||||
#if defined(_MSC_VER) || defined(WIN32)
|
||||
#if defined(_MSC_VER) || defined(_WIN32)
|
||||
r = _vsnprintf(buf, buflen, format, ap);
|
||||
if (r < 0)
|
||||
r = _vscprintf(format, ap);
|
||||
|
@ -10,6 +10,11 @@
|
||||
Loosely based on le-proxy.c.
|
||||
*/
|
||||
|
||||
// Get rid of OSX 10.7 and greater deprecation warnings.
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
@ -19,6 +24,9 @@
|
||||
#ifdef _WIN32
|
||||
#include <winsock2.h>
|
||||
#include <ws2tcpip.h>
|
||||
|
||||
#define snprintf _snprintf
|
||||
#define strcasecmp _stricmp
|
||||
#else
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
@ -222,6 +230,22 @@ main(int argc, char **argv)
|
||||
syntax();
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
{
|
||||
WORD wVersionRequested;
|
||||
WSADATA wsaData;
|
||||
int err;
|
||||
|
||||
wVersionRequested = MAKEWORD(2, 2);
|
||||
|
||||
err = WSAStartup(wVersionRequested, &wsaData);
|
||||
if (err != 0) {
|
||||
printf("WSAStartup failed with error: %d\n", err);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
#endif // _WIN32
|
||||
|
||||
http_uri = evhttp_uri_parse(url);
|
||||
if (http_uri == NULL) {
|
||||
die("malformed url");
|
||||
@ -274,6 +298,9 @@ main(int argc, char **argv)
|
||||
if (!ssl_ctx)
|
||||
die_openssl("SSL_CTX_new");
|
||||
|
||||
#ifndef _WIN32
|
||||
/* TODO: Add certificate loading on Windows as well */
|
||||
|
||||
/* Attempt to use the system's trusted root certificates.
|
||||
* (This path is only valid for Debian-based systems.) */
|
||||
if (1 != SSL_CTX_load_verify_locations(ssl_ctx,
|
||||
@ -304,6 +331,7 @@ main(int argc, char **argv)
|
||||
* "wrapping" OpenSSL's routine, not replacing it. */
|
||||
SSL_CTX_set_cert_verify_callback (ssl_ctx, cert_verify_callback,
|
||||
(void *) host);
|
||||
#endif // not _WIN32
|
||||
|
||||
// Create event base
|
||||
base = event_base_new();
|
||||
@ -390,5 +418,9 @@ main(int argc, char **argv)
|
||||
evhttp_connection_free(evcon);
|
||||
event_base_free(base);
|
||||
|
||||
#ifdef _WIN32
|
||||
WSACleanup();
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -5,6 +5,11 @@
|
||||
XXX It's a little ugly and should probably be cleaned up.
|
||||
*/
|
||||
|
||||
// Get rid of OSX 10.7 and greater deprecation warnings.
|
||||
#if defined(__APPLE__) && defined(__clang__)
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -34,6 +34,10 @@ SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
// Get rid of OSX 10.7 and greater deprecation warnings.
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
|
||||
#include <openssl/x509v3.h>
|
||||
#include <openssl/ssl.h>
|
||||
|
@ -10,7 +10,7 @@ SSL_OBJS=
|
||||
SSL_LIBS=
|
||||
!ENDIF
|
||||
|
||||
CFLAGS=/I.. /I../WIN32-Code /I../include /I../compat /DHAVE_CONFIG_H /DTINYTEST_LOCAL $(SSL_CFLAGS)
|
||||
CFLAGS=/I.. /I../WIN32-Code /I../WIN32-Code/nmake /I../include /I../compat /DHAVE_CONFIG_H /DTINYTEST_LOCAL $(SSL_CFLAGS)
|
||||
|
||||
CFLAGS=$(CFLAGS) /Ox /W3 /wd4996 /nologo
|
||||
|
||||
|
@ -57,6 +57,10 @@
|
||||
#endif
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <getopt.h>
|
||||
#endif
|
||||
|
||||
#include <event.h>
|
||||
#include <evutil.h>
|
||||
|
||||
|
@ -48,7 +48,7 @@
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <errno.h>
|
||||
|
||||
#include <getopt.h>
|
||||
#include <event.h>
|
||||
#include <evutil.h>
|
||||
|
||||
@ -84,8 +84,8 @@ run_once(int num_pipes)
|
||||
evutil_socket_t *cp;
|
||||
static struct timeval ts, te, tv_timeout;
|
||||
|
||||
events = calloc(num_pipes, sizeof(struct event));
|
||||
pipes = calloc(num_pipes * 2, sizeof(evutil_socket_t));
|
||||
events = (struct event *)calloc(num_pipes, sizeof(struct event));
|
||||
pipes = (evutil_socket_t *)calloc(num_pipes * 2, sizeof(evutil_socket_t));
|
||||
|
||||
if (events == NULL || pipes == NULL) {
|
||||
perror("malloc");
|
||||
@ -126,8 +126,8 @@ run_once(int num_pipes)
|
||||
|
||||
for (cp = pipes, i = 0; i < num_pipes; i++, cp += 2) {
|
||||
event_del(&events[i]);
|
||||
close(cp[0]);
|
||||
close(cp[1]);
|
||||
evutil_closesocket(cp[0]);
|
||||
evutil_closesocket(cp[1]);
|
||||
}
|
||||
|
||||
free(pipes);
|
||||
@ -146,6 +146,11 @@ main(int argc, char **argv)
|
||||
struct timeval *tv;
|
||||
|
||||
int num_pipes = 100;
|
||||
#ifdef _WIN32
|
||||
WSADATA WSAData;
|
||||
WSAStartup(0x101, &WSAData);
|
||||
#endif
|
||||
|
||||
while ((c = getopt(argc, argv, "n:")) != -1) {
|
||||
switch (c) {
|
||||
case 'n':
|
||||
@ -175,5 +180,9 @@ main(int argc, char **argv)
|
||||
tv->tv_sec * 1000000L + tv->tv_usec);
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
WSACleanup();
|
||||
#endif
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
@ -186,6 +186,10 @@ main(int argc, char **argv)
|
||||
#endif
|
||||
event_base_dispatch(base);
|
||||
|
||||
#ifdef _WIN32
|
||||
WSACleanup();
|
||||
#endif
|
||||
|
||||
/* NOTREACHED */
|
||||
return (0);
|
||||
}
|
||||
|
@ -616,7 +616,7 @@ close_socket_cb(evutil_socket_t fd, short what, void *arg)
|
||||
static void
|
||||
test_bufferevent_connect_fail(void *arg)
|
||||
{
|
||||
struct basic_test_data *data = arg;
|
||||
struct basic_test_data *data = (struct basic_test_data *)arg;
|
||||
struct bufferevent *bev=NULL;
|
||||
struct sockaddr_in localhost;
|
||||
struct sockaddr *sa = (struct sockaddr*)&localhost;
|
||||
|
@ -24,6 +24,11 @@
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
// Get rid of OSX 10.7 and greater deprecation warnings.
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <winsock2.h>
|
||||
#include <windows.h>
|
||||
|
@ -183,7 +183,8 @@ main(int argc, char **argv)
|
||||
return (1);
|
||||
|
||||
/* Initalize the event library */
|
||||
base = event_base_new();
|
||||
if (!(base = event_base_new()))
|
||||
return (1);
|
||||
|
||||
/* Initalize a timeout to terminate the test */
|
||||
timeout = evtimer_new(base,timeout_cb,&timeout);
|
||||
|
Loading…
x
Reference in New Issue
Block a user