If we somehow manage to find libnl version 2 or 3, but don't manage to

find the corresponding libnl-genl or libnl-route libraries, act as if we
didn't find libnl.

If we didn't find libnl version 2 or 3, don't check whether it's version
2 or 3.

svn path=/trunk/; revision=48742
This commit is contained in:
Guy Harris 2013-04-04 21:09:10 +00:00
parent 5312d37e93
commit 9bd43d3c28
1 changed files with 16 additions and 7 deletions

View File

@ -3,7 +3,7 @@
#
# Find the native netlink includes and library
#
# If they exist, differentiate between versions 1,2 and 3.
# If they exist, differentiate between versions 1, 2 and 3.
# Version 1 does not have netlink/version.h
# Version 3 does have the major version number as a suffix
# to the libnl name (libnl-3)
@ -56,12 +56,21 @@ ELSE (NL_LIBRARIES AND NL_INCLUDE_DIRS )
PATHS
$(SEARCHPATHS)
)
STRING(REGEX REPLACE ".*nl-([^.,;]*).*" "\\1" NLSUFFIX ${NL_LIBRARY})
IF ( NLSUFFIX )
SET( HAVE_LIBNL3 1 )
ELSE ( NLSUFFIX )
SET( HAVE_LIBNL2 1 )
ENDIF (NLSUFFIX )
#
# If we don't have all of those libraries, we can't use libnl.
#
IF ( NOT NLGENL_LIBRARY AND NOT NLROUTE_LIBRARY )
SET( NL_LIBRARY NOTFOUND )
ENDIF ( NOT NLGENL_LIBRARY AND NOT NLROUTE_LIBRARY )
IF( NL_LIBRARY )
STRING(REGEX REPLACE ".*nl-([^.,;]*).*" "\\1" NLSUFFIX ${NL_LIBRARY})
IF ( NLSUFFIX )
SET( HAVE_LIBNL3 1 )
ELSE ( NLSUFFIX )
SET( HAVE_LIBNL2 1 )
ENDIF (NLSUFFIX )
SET( HAVE_LIBNL 1 )
ENDIF( NL_LIBRARY )
ELSE( NL_INCLUDE_DIR )
# NL version 1 ?
FIND_PATH( NL_INCLUDE_DIR