> why we check 'libnl-3.0 >= 3.0 libnl-genl-3.0 >= 3.0' and only 'libnl-2.0',
Because for v2, it just have separated libnl-genl library, but there were no separated pkg named libnl-genl-2.0.

>+AC_SEARCH_LIBS([genl_connect], [nl-genl nl], [], [has_libnl_ver=0])
With additional 'nl' checking, It doesn't help. Failed with same error under both v3 and v2 cases for 12.04 (doesn't try others). 
If fact, genl_connect is in nl-genl both for v2 and v3. Not sure if it is some search path issue. 


2012/11/13 Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
On (11/13/12 17:06), Austin Zhang wrote:
>
>    Unfortunately, it only works in one 11.10 case, and doesn't work for
>    others. For libnl-3 case,
>    ...
>    checking for library containing genl_connect...no
>    ...
>
ok, which means that genl_connect is withing libnl.

I really would like to keep checks consistent, otherwise it's a bit unclear
why we check 'libnl-3.0 >= 3.0 libnl-genl-3.0 >= 3.0' and only 'libnl-2.0',
besides, I've a feeling that will break build on some distros (in case if
that is only Ubuntu specific, we'll end up w/o -nl-genl).

Add -nl to AC_SEARCH_LIBS.

Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>

---

 configure.ac | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/configure.ac b/configure.ac
index b8c183f..0958d73 100644
--- a/configure.ac
+++ b/configure.ac
@@ -54,15 +54,20 @@ PKG_CHECK_MODULES([PCIUTILS], [libpci],[has_libpci=1],[


 has_libnl_ver=0
-PKG_CHECK_MODULES([LIBNL], [libnl-3.0 libnl-genl-3.0], [
-       has_libnl_ver=3], [
-       AC_SEARCH_LIBS([nl_socket_alloc], [nl-3 nl-genl-3], [
-               has_libnl_ver=3], [
-               AC_SEARCH_LIBS([nl_socket_alloc], [nl], [
-                       has_libnl_ver=2], [
-                       PKG_CHECK_MODULES([LIBNL], [libnl-1], [has_libnl_ver=1], [])])])])
+
+PKG_CHECK_MODULES([LIBNL], [libnl-3.0 >= 3.0], [has_libnl_ver=3], [
+       PKG_CHECK_MODULES([LIBNL], [libnl-2.0 >= 2.0], [has_libnl_ver=2], [
+               PKG_CHECK_MODULES([LIBNL], [libnl-1.0], [has_libnl_ver=1], [has_libnl_ver=0])])])
+
+#Austin Zhang reported failed configure on Ubuntu. It turned out that ubuntu does
+#not provide genl pkg-config files, thus PKG_CHECK_MODULES fails to check for
+#libnl-genl.
+#NOTE: AC_SEARCH_LIBS append -lnl-genl to LIBS, not to LIBNL_LIBS.
+#
+AC_SEARCH_LIBS([genl_connect], [nl-genl nl], [], [has_libnl_ver=0])
+
 if (test "$has_libnl_ver" -eq 0); then
-       AC_MSG_ERROR(libnl is required but not found)
+       AC_MSG_ERROR(libnl and libnl-genl are required but were not found)
 fi
 if (test "$has_libnl_ver" -gt 1); then
        AC_DEFINE([HAVE_LIBNL20], [1], [Define if you have libnl-2.0 or higher])