49 Commits

Author SHA1 Message Date
Azat Khuzhin
da11217544
build: struct sockaddr_un detection (sys/un.h, afunix.h)
- On UNIX:     sys/un.h
- Since win10: afunix.h

And windows has AF_UNIX but do not have sockaddr_un (before windows
build 17061 [1]), hence the sockaddr_un detection.

  [1]: https://devblogs.microsoft.com/commandline/af_unix-comes-to-windows/
2019-05-12 18:17:53 +03:00
Azat Khuzhin
d5b24cc0c8
sample/becat: bufferevent cat, ncat/nc/telnet analog 2019-03-16 17:40:20 +03:00
Enji Cooper
91dad75f7d Fix typos: warnigns -> warnings
Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
2019-02-28 17:48:10 -08:00
Enji Cooper
5f87be42f0
Define _GNU_SOURCE properly/consistently per autoconf
Although `_GNU_SOURCE` can be defined as an arbitrary #define per the
glibc docs [1], it's best to define it in a manner consistent with the way
that autoconf defines it, i.e., `1`.

While this shouldn't matter in most cases, it does when the headers from
other projects follow the poorly defined GNU convention implemented by
autoconf and are included after the libevent's util.h header. An example
failure with clang, similar to the failure I encountered, is as follows:
```
$ printf "#define _GNU_SOURCE\n#define _GNU_SOURCE 1" | clang -c -x c -
<stdin>:2:9: warning: '_GNU_SOURCE' macro redefined [-Wmacro-redefined]
        ^
<stdin>:1:9: note: previous definition is here
        ^
1 warning generated.
```

This happened when compiling python [2] with a stale homebrew util.h file from
libevent (which admittedly would not happen in a correct libevent install, as the
header should be installed under /usr/local/include/event2/util.h). However, if
both headers had been combined (which is more likely), it would have failed as
shown above.

Removing the ad hoc definition unbreaks compiling python's pyconfig.h.in header
when included after util.h from libevent.

1. http://www.gnu.org/software/libc/manual/html_node/Feature-Test-Macros.html
2. https://github.com/python/cpython/blob/master/configure.ac#L126

Closes: #773 (cherry-picked)

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
2019-02-27 23:18:12 +03:00
Azat Khuzhin
006c528a21
autotools: do not add warnings that is included into -Wall already
Plus remove duplicates
2018-10-27 16:52:56 +03:00
Azat Khuzhin
e85818d248
Cleanup __func__ detection
First of all __func__ is not a macro, it is char[] array, so the code
that we had before in cmake, was incorrect, i.e.:
  #if defined (__func__)
  #define EVENT____func__ __func__
  #elif defined(__FUNCTION__)
  #define EVENT____func__  __FUNCTION__
  #else
  #define EVENT____func__ __FILE__
  #endif

So just detect do we have __func__/__FUNCTION__ in configure/cmake
before build and define EVENT__HAVE___func__/EVENT__HAVE___FUNCTION__
to use the later to choose which should be used as a __func__ (if it is
not presented).

Closes: #644
2018-08-02 02:50:48 +03:00
Azat Khuzhin
4728ffed86
autotools: include win32 specific headers for socklen_t detection on win32/mingw
The [1] removes EVENT__ prefix, and now if we will incorrectly detect
that "foobar" (or socklen_t in our case) type is not available, but
somewhere later it will be available then we will get next error [2]:
  error: two or more data types in declaration specifiers

According to [3]:
- Compile something in Cygwin and you are compiling it for Cygwin.
- Compile something in MinGW and you are compiling it for Windows.
  And I can confirm this, since there is _WIN32 defined (according to [4])

And since according to [5] our image in appveyour (Visual Studion 2015)
has mingw (and we use it, not cygwin) we need ws2tcpip.h (over
sys/socket.h -- which does not exist in win32) header to detect
socklen_t existence.

[1]: 587e9f5828c4eb3c6e79e9eb29f174e4ae0c05bd ("config.h can't be prefixed unconditionally")
[2]: https://ci.appveyor.com/project/nmathewson/libevent/build/job/yonukoc5q3tr3e5e#L372
[3]: https://stackoverflow.com/questions/771756/what-is-the-difference-between-cygwin-and-mingw
[4]: https://www.appveyor.com/docs/build-environment/#mingw-msys-cygwin
[5]: https://ci.appveyor.com/project/nmathewson/libevent/build/job/yonukoc5q3tr3e5e#L164

Fixes: #649
2018-08-01 09:30:54 +03:00
Carlo Marcelo Arenas Belón
1dfec8a970 configure: avoid false positive in DragonFlyBSD
by default, the max buffer size is 16K and histeresis is at 50%, so
a bigger read is needed to unlock writes than you would expect from
other BSD (512 bytes)

this doesn't introduce any regression on FreeBSD 11.1, OpenBSD 6.1, NetBSD 7.1,
macOS 10.12.6 and of course DragonFlyBSD 4.8.1, and most of them show
a max pipe size of 64K, so the read call should drain them all regardless
of how conservative they are on the free pipe space they will require
(usually 512 bytes) before kevent reports the fd as ready for write.

I couldn't find a reference to which bug this code was trying to look for
and it seems to be there from the beginning of git history so it might be
no longer relevant.

Issue: #548
2017-09-11 01:48:35 +03:00
Carlo Marcelo Arenas Belón
63c4bf78d6 test: fix 32bit linux regress 2017-09-01 15:50:36 -07:00
Redfoxmoon
94e5cc84d5 Add configure check for midipix
Fixes: #540
2017-08-15 12:10:33 +03:00
Marek Sebera
6541168d70 Detect arch4random_addrandom() existence
Refs: #370
Refs: #475
2017-03-08 13:31:55 +03:00
Azat Khuzhin
66a4eb0c3a Check for WNOWAIT in waitpid() in runtime (not in cmake/configure)
Because checking in cmake breaks cross-compiling.

Introduced-in: 43eb56c7c738e3642f0981e3dd6ab9e082eec798.
Fixes: #482
Fixes: #462
Refs: #475

v2: use waitid() with WNOWAIT
v3: use WNOWAIT only if it available in waitpid(), because not all netbsd
    supports it
2017-03-08 13:31:55 +03:00
Pierce Lopez
5d18d87916 Do not check for ERR_remove_thread_state() (do not link ssl into every library)
This reverts commit c4e9d9bd662de7f575f2172c160795d452ebe709
("sample/https-client: check for ERR_remove_thread_state() existence").

Calling AC_SEARCH_LIBS() modifies LIBS - -lcrypto incorrectly
ends up in LIBS, and thus linked to by libevent_core.so.

Checking for ERR_remove_thread_state should no longer be needed
because it was introduced in openssl 1.0.0, and the previous line
0.9.8 had support discontinued at the end of 2015.

Fixes: #473
2017-03-06 01:39:29 +03:00
Jan Beich
d9118c8daa test/bench_httpclient: restore SO_LINGER usage after 0dda56a48e94 2017-01-29 23:02:41 +03:00
Azat Khuzhin
efcfa046ae Bump version in master to 2.2.0-alpha-dev
And according to f8d80a285cf941505277d9060d0357b5b7e543d2 ("Bump version
to 2.1.3-alpha-dev") numeric version have 1 at the end, since it means
"-dev".
2017-01-29 20:33:55 +03:00
Azat Khuzhin
9b63b5d410 Bump version to 2.1.8-stable everywhere
P.S. in referenced commit I made a mistake and instead of *-rc* I wrote
*-beta*.

See-also: f4489b8323cda0bf8eed7c1353911a852d7a947c ("Bump version to
2.1.7-beta everywhere")
2017-01-26 02:36:00 +03:00
Azat Khuzhin
a7513cc968 automake: do not use serial-tests if parallel-test-harness available
Revert: 61179dec7716975a151c6dae4524ae504d05780e ("automake: define
serial-tests only if automake have this option") Revert:
Revert: 44d755e00e249c09914cf35089c16735df82e270 ("test/automake: don't
use paralell test harness (since automake 1.12)")
2017-01-22 02:58:02 +03:00
Azat Khuzhin
f4489b8323 Bump version to 2.1.7-beta everywhere
- cmake basic
- cmake detecting from git -- event_fuzzy_version_from_git()
- autotools
- win32
- appveyor
2016-11-04 23:05:20 +03:00
Vlad Shcherban
adc402ba5f Adding option to ignore clock_gettime: --disable-clock-gettime
macOS 10.12 introduced `clock_gettime` to libsystem. This means, built
on OS X 10.12 application would crash on earlier versions of OS X
because it will try to call clock_gettime. This options is useful to
make backwards compatible macOS apps.

Fixes: #398
Fixes: #399
Fixes: #400
2016-10-03 03:16:20 +03:00
Azat Khuzhin
51019e9460 Bump version to 2.1.6-beta everywhere
- cmake basic
- cmake detecting from git -- event_fuzzy_version_from_git()
- autotools
- win32
- appveyor
2016-08-27 01:28:36 +03:00
Azat Khuzhin
43eb56c7c7 tests: use waitpid(..., WNOWAIT) to fix failing of main/fork under solaris
According to solaris docs:
  "One instance of a SIGCHLD signal is queued for each child process whose
  status has changed. If waitpid() returns because the status of a child
  process is available, and WNOWAIT was not specified in options, any pending
  SIGCHLD signal associated with the process ID of that child process is
  discarded. Any other pending SIGCHLD signals remain pending."

And interesting thing that it works if you add sleep(1) before waitpid(), and
also if you run with --verbose (some race or what).

But linux doesn't support WNOWAIT in waitpid() so add detection into
cmake/autotools.

Fixes: #387
Link: https://bugzilla.redhat.com/show_bug.cgi?id=840782
2016-08-11 17:08:35 +03:00
Azat Khuzhin
671a24f29b autotools/win32: fix searching ssl library 2016-08-09 15:47:58 +03:00
Azat Khuzhin
bb09535bda autoconf: fix --disable-thread-support build under win32
Fixes: https://ci.appveyor.com/project/azat/libevent/build/job/gvud4tcqsd5bnarl
Fixes: https://ci.appveyor.com/project/azat/libevent/build/2.1.6.80/job/5frnb1c3n4quxxqy
Fixes: https://ci.appveyor.com/project/azat/libevent/build/2.1.6.80/job/3wdahbrew7setmoa
2016-08-09 15:47:58 +03:00
Mark Ellzey
303161777d
[#372] check for errno.h 2016-06-28 10:37:24 -07:00
Rainer Keller
b5ca365626 For non GCC/clang on OSX the -Wno-deprecated-declarations may not be valid
Closes: nmathewson/Libevent#129
2016-06-08 14:31:29 +03:00
Azat Khuzhin
61179dec77 automake: define serial-tests only if automake have this option
P.S. I did try a lot of other ways, but seems that this is the only one that
will work.

Fixes: automake 1.11
Travis-CI: https://travis-ci.org/azat/libevent/jobs/129398265
2016-05-11 16:47:46 +03:00
Jan Heylen
b8d7c6211a libevent_core and libevent_extra also deserve a pkgconfig file 2016-04-20 07:39:42 +02:00
Azat Khuzhin
f29f59e811 Replace -Wswitch-enum with -Wswitch, and add it into cmake rules too
According to https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html:
  -Wswitch-enum
  Warn whenever a switch statement has an index of enumerated type and lacks a
  case for one or more of the named codes of that enumeration. case labels
  outside the enumeration range also provoke warnings when this option is used.
  The only difference between -Wswitch and this option is that this option
  gives a warning about an omitted enumeration code even if there is a *default
  label*.
2016-03-10 00:48:09 +03:00
Azat Khuzhin
959a4c208c autotools: fix getservbyname() detection
The mentioned commit adds this check under-the-else of the previous condition
between getaddrinfo()/gethostbyname_r(), so this check is triggered only when
we don't have getaddrinfo() which is wrong, fix this by move it upper.

Fixes [CI] since it uses getservbyname() and it failed with autotools only
(cmake detection is ok).

CI: https://travis-ci.org/libevent/libevent/builds/93125954
Fixes: af08a94085e49e6942835b4c6b50a774536d5b5b ("Check for getservbyname even
if not on win32.")
2015-11-25 18:16:29 +03:00
Azat Khuzhin
c4e9d9bd66 sample/https-client: check for ERR_remove_thread_state() existence
Fixes: freebsd 9.2 build
2015-11-24 01:19:25 +03:00
Nick Mathewson
683f5568ab Increment version to 2.1.5-beta 2015-01-05 09:16:12 -05:00
Mike Frysinger
0c492b33f9 add a --disable-samples configure flag
For people building & installing libevent in a distro, building all these
sample apps are not useful.  Add a flag to turn them off.
2014-06-13 17:19:50 -04:00
Nick Mathewson
de268feb67 Increment version to 2.1.4-alpha-dev 2014-03-21 13:20:34 -04:00
Nick Mathewson
d08273eca8 Increment version to 2.1.4-alpha 2014-03-16 12:09:24 -04:00
Nick Mathewson
cbfa8da179 Merge remote-tracking branch 'origin/patches-2.0' 2014-03-03 11:23:55 -05:00
Trond Norbye
b56611d705 Add -Qunused-arguments for clang on macos
The clang compiler provided with macosx emits warnings like:

  CC       bufferevent.lo
clang: warning: argument unused during compilation: '-I .'
clang: warning: argument unused during compilation: '-I ./compat'
clang: warning: argument unused during compilation: '-I ./include'
clang: warning: argument unused during compilation: '-I ./include'

for each file being compiled. This generates a lot of noise during
compilation making it hard to see "real" errors. This patch mute
those warnings.
2014-03-03 11:05:41 -05:00
Nick Mathewson
f665d5cb27 Stop checking for inet_aton; we don't use it.
We had cmake and autoconf tests for the inet_aton function... but we
never actually use it any more.

(The autoconf tests still use the callability of inet_aton to decide
whether we need to link against -lresolv)

Reported by Harlan Stenn.
2014-02-24 10:33:16 -05:00
Nick Mathewson
f8d80a285c Bump version to 2.1.3-alpha-dev 2013-05-01 23:12:08 -04:00
Nick Mathewson
dd4be76f83 Incremement version to 2.1.3-alpha 2013-04-30 12:02:49 -04:00
Nick Mathewson
6b94ffcec5 Merge remote-tracking branch 'origin/patches-2.0'
Conflicts:
	configure.ac
2013-04-25 13:54:19 -04:00
Nick Mathewson
66dacfa2a5 Merge remote-tracking branch 'origin/pr/36' into patches-2.0 2013-04-25 13:43:49 -04:00
Nick Mathewson
4914620025 Do not build strlcpy.c when it will have no code. 2013-03-31 14:05:26 -04:00
Nick Mathewson
ebf278b28d Use AC_CONFIG_HEADERS in place of AM_CONFIG_HEADERS for autmake 1.13 compat
Patch from cazfi.
2013-02-08 22:09:56 -05:00
Nick Mathewson
0c79787a97 Rename configure.in to configure.ac to appease newer autoconfs 2013-02-08 22:07:47 -05:00
Nicholas Heath
0dda56a48e Preliminary changes for Minix3. 2013-02-04 13:21:05 -05:00
Nick Mathewson
40b95ae26d Increment version to 2.1.2-alpha-dev 2012-11-19 10:53:25 -05:00
Nick Mathewson
ffdad1dcbc Bump versions to 2.1.2-alpha 2012-11-18 10:53:52 -05:00
Patrick Pelletier
09098f70a2 fix a few trivial documentation typos 2012-10-23 22:09:45 -07:00
Ross Lagerwall
b3fea67385 Rename configure.in to configure.ac.
".ac" is the preferred extension.
2012-09-03 08:37:25 +02:00