examples: support libev and fix build on Fedora
Check for and prefer libev over libevent and check for the location of the event.h file, which is contained in libev/event.h on Fedora. Signed-off-by: Patrick McHardy <kaber@trash.net>
This commit is contained in:
parent
89bb432a5e
commit
292ac38165
|
@ -41,3 +41,6 @@ CFLAGS += -Waggregate-return -Wunused -Wwrite-strings
|
|||
ifeq ($(DEBUG),y)
|
||||
CFLAGS += -g -DDEBUG
|
||||
endif
|
||||
|
||||
EVENT_CFLAGS += @EVENT_CFLAGS@
|
||||
EVENT_LDFLAGS += @EVENT_LDFLAGS@
|
||||
|
|
16
configure.ac
16
configure.ac
|
@ -32,6 +32,14 @@ AC_CHECK_LIB([nl], [nl_socket_alloc], ,
|
|||
AC_CHECK_LIB([nl-dect], [nl_dect_cluster_alloc], ,
|
||||
AC_MSG_ERROR([No suitable version of libnl-dect found]))
|
||||
|
||||
AC_CHECK_LIB(ev, event_init,
|
||||
[EVENTLIB="-lev"],
|
||||
AC_CHECK_LIB(event, event_init,
|
||||
[EVENTLIB="-levent"],
|
||||
AC_ERROR(libev or libevent not found)))
|
||||
EVENT_LDFLAGS=$EVENTLIB
|
||||
AC_SUBST(EVENT_LDFLAGS)
|
||||
|
||||
# Checks for header files.
|
||||
AC_HEADER_STDC
|
||||
AC_HEADER_ASSERT
|
||||
|
@ -43,6 +51,14 @@ AC_CHECK_HEADERS([linux/dect.h linux/dect_netlink.h], ,
|
|||
AC_MSG_ERROR([DECT kernel header files not found]),
|
||||
[#include <sys/socket.h>])
|
||||
|
||||
AC_CHECK_HEADER(event.h,
|
||||
[EVENTINC="-include event.h"],
|
||||
AC_CHECK_HEADER(libev/event.h,
|
||||
[EVENTINC="-include libev/event.h"],
|
||||
AC_MSG_ERROR([event.h not found])))
|
||||
EVENT_CFLAGS=$EVENTINC
|
||||
AC_SUBST(EVENT_CFLAGS)
|
||||
|
||||
# Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_HEADER_STDBOOL
|
||||
AC_C_CONST
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
LDFLAGS += -Wl,-rpath $(PWD)/src -Lsrc -ldect -levent
|
||||
CFLAGS += $(EVENT_CFLAGS)
|
||||
LDFLAGS += -Wl,-rpath $(PWD)/src -Lsrc -ldect $(EVENT_LDFLAGS)
|
||||
PROGRAMS += cc ss mm-fp mm-pp discover hijack
|
||||
|
||||
destdir := usr/share/dect/examples
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <signal.h>
|
||||
#include <event.h>
|
||||
|
||||
#include <libdect.h>
|
||||
#include "common.h"
|
||||
|
|
Reference in New Issue