Build system: Check the pkg-config names "libmodbus" *and* "modbus".
authorIvo De Decker <ivo.dedecker@ugent.be>
Mon, 7 Feb 2011 07:54:55 +0000 (08:54 +0100)
committerFlorian Forster <octo@huhu.verplant.org>
Mon, 7 Feb 2011 07:57:39 +0000 (08:57 +0100)
Florian,

Attached is the updated version of the datagroup patch. The code itself didn't
change (apart from the rename dataset -> datagroup). It should apply cleanly
to the latest version of the master branch.

I also attached a patch to the configure.in script to make pkg-config check
for 'libmodbus' as well as 'modbus'. Different versions of the library use
different names.

Greetings,

Ivo De Decker

Signed-off-by: Florian Forster <octo@huhu.verplant.org>
configure.in

index 8be7965..6d9ec65 100644 (file)
@@ -2126,20 +2126,26 @@ fi
 if test "x$with_libmodbus" = "xuse_pkgconfig"
 then
        AC_MSG_NOTICE([Checking for modbus using $PKG_CONFIG])
 if test "x$with_libmodbus" = "xuse_pkgconfig"
 then
        AC_MSG_NOTICE([Checking for modbus using $PKG_CONFIG])
-       $PKG_CONFIG --exists 'modbus' 2>/dev/null
+       libmodbus_pkgconfig_name='libmodbus'
+       $PKG_CONFIG --exists $libmodbus_pkgconfig_name 2>/dev/null
        if test $? -ne 0
        then
        if test $? -ne 0
        then
-               with_libmodbus="no (pkg-config doesn't know modbus)"
+               libmodbus_pkgconfig_name='modbus'
+               $PKG_CONFIG --exists $libmodbus_pkgconfig_name 2>/dev/null
+               if test $? -ne 0
+               then
+                       with_libmodbus="no (pkg-config doesn't know modbus or libmodbus)"
+               fi
        fi
 fi
 if test "x$with_libmodbus" = "xuse_pkgconfig"
 then
        fi
 fi
 if test "x$with_libmodbus" = "xuse_pkgconfig"
 then
-       with_libmodbus_cflags="`$PKG_CONFIG --cflags 'modbus'`"
+       with_libmodbus_cflags="`$PKG_CONFIG --cflags $libmodbus_pkgconfig_name`"
        if test $? -ne 0
        then
                with_libmodbus="no ($PKG_CONFIG failed)"
        fi
        if test $? -ne 0
        then
                with_libmodbus="no ($PKG_CONFIG failed)"
        fi
-       with_libmodbus_libs="`$PKG_CONFIG --libs 'modbus'`"
+       with_libmodbus_libs="`$PKG_CONFIG --libs $libmodbus_pkgconfig_name`"
        if test $? -ne 0
        then
                with_libmodbus="no ($PKG_CONFIG failed)"
        if test $? -ne 0
        then
                with_libmodbus="no ($PKG_CONFIG failed)"