blob: d7ca2a1ab0e9887fa1f8d16d95fde22f9646464a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
--- a/configure.in
+++ b/configure.in
@@ -95,44 +95,10 @@
AC_REPLACE_FUNCS(strlcpy strlcat strsep setproctitle daemon)
dnl Checks for libevent
-AC_MSG_CHECKING(for libevent)
-AC_ARG_WITH(libevent,
-[ --with-libevent=DIR use libevent in DIR],
-[ case "$withval" in
- yes|no)
- AC_MSG_RESULT(no)
- ;;
- *)
- AC_MSG_RESULT($withval)
- if test -f $withval/include/event.h -a -f $withval/lib/libevent.a; then
- owd=`pwd`
- if cd $withval; then withval=`pwd`; cd $owd; fi
- EVENTINC="-I$withval/include"
- EVENTLIB="-L$withval/lib -levent"
- elif test -f $withval/event.h -a -f $withval/libevent.a; then
- owd=`pwd`
- if cd $withval; then withval=`pwd`; cd $owd; fi
- EVENTINC="-I$withval"
- EVENTLIB="-L$withval -levent"
- else
- AC_ERROR(event.h or libevent.a not found in $withval)
- fi
- ;;
- esac ],
-[ if test -f ${prefix}/include/event.h -a -f ${prefix}/lib/libevent.a;
-then
- EVENTINC="-I${prefix}/include"
- EVENTLIB="-L${prefix}/lib -levent"
- elif test -f /usr/include/event.h; then
- EVENTLIB="-levent"
- else
- AC_MSG_RESULT(no)
- AC_ERROR(libevent not found)
- fi
- AC_MSG_RESULT(yes) ]
-)
-AC_SUBST(EVENTINC)
-AC_SUBST(EVENTLIB)
+PKG_CHECK_MODULES(LIBEVENT,libevent,,)
+
+AC_SUBST(LIBEVENT_CFLAGS)
+AC_SUBST(LIBEVENT_LIBS)
if test "x${sysconfdir}" = 'x${prefix}/etc'; then
csysconfdir="${prefix}/etc"
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -5,7 +5,7 @@
nylon_SOURCES = nylon.c print.c cfg.c expanda.c net.c access.c atomicio.c \
socks4.c socks5.c mirror.c cleanup.c misc.c
-AM_CFLAGS = @EVENTINC@ -Wall -g
-LDADD = @EVENTLIB@ @LIBOBJS@
+AM_CFLAGS = @LIBEVENT_CFLAGS@
+LDADD = @LIBEVENT_LIBS@ @LIBOBJS@
EXTRA_DIST = strlcpy.c strlcat.c setproctitle.c strsep.c err.c daemon.c
|