*) AC_MSG_ERROR([Linux only, dude!]);;
esac
-AC_CHECK_LIB(nfnetlink, nfnl_subsys_open, AC_MSG_RESULT(found), AC_MSG_ERROR([libnfnetlink 0.0.16 or later needed]))
-AC_CHECK_HEADER([libnfnetlink/linux_nfnetlink.h], [AC_MSG_RESULT([found])], [AC_MSG_ERROR([libnfnetlink 0.0.16 or later needed])])
+dnl Dependencies
+LIBNFNETLINK_REQUIRED=0.0.16
+
+PKG_CHECK_MODULES(LIBNFNETLINK, libnfnetlink >= $LIBNFNETLINK_REQUIRED,,
+ AC_MSG_ERROR(Cannot find libnfnetlink >= $LIBNFNETLINK_REQUIRED))
+
+CFLAGS="$CFLAGS $LIBNFNETLINK_CFLAGS"
+LIBNFQUEUE_LIBS="$LIBNFNETLINK_LIBS"
+
+AC_SUBST(LIBNFQUEUE_LIBS)
dnl Output the makefiles
AC_OUTPUT(Makefile include/Makefile include/libnetfilter_queue/Makefile src/Makefile utils/Makefile libnetfilter_queue.pc)
LIBVERSION=2:0:1
INCLUDES = $(all_includes) -I$(top_srcdir)/include -I${KERNELDIR}
-AM_CFLAGS=-fPIC -Wall
-LIBS=
+AM_CFLAGS = -fPIC -Wall
+LIBS = @LIBNFQUEUE_LIBS@
lib_LTLIBRARIES = libnetfilter_queue.la libnetfilter_queue_libipq.la