--- 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