[PATCH] build-sys: add VARSUFFIX to UTIL_CHECK_LIB

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The UTIL_CHECK_LIB macro follows the default autoconf behaviour and
generates have_<libname> and HAVE_LIB<LIBNAME> variables.

Some libraries are substitutional (e.g. ncurses and ncursesw). It would be
nice to generate for that libraries the same HAVE_ variables independently
on a library name.

This patch adds optional VARSUFFIX option to UTIL_CHECK_LIB, so the final
variables are have_<varsuffix> and HAVE_LIB<VARSUFFIX>.

For example:

    UTIL_CHECK_LIB(yyy, func)      generates have_yyy and HAVE_LIBYYY
    UTIL_CHECK_LIB(yyy, func, xxx) generates have_xxx and HAVE_LIBXXX

Signed-off-by: Karel Zak <kzak@xxxxxxxxxx>
---
 configure.ac |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/configure.ac b/configure.ac
index bf6787f..50e8b6f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -116,14 +116,19 @@ m4_foreach([UTIL_PRG], m4_defn([UTIL_STATIC_PROGRAMS]), [
 ])
 
 
-dnl UTIL_CHECK_LIB(LIBRARY, FUNCTION)
+
+dnl UTIL_CHECK_LIB(LIBRARY, FUNCTION, [VARSUFFIX = $1]))
+dnl The VARSUFFIX is optional and overrides the default behaviour. For example:
+dnl     UTIL_CHECK_LIB(yyy, func, xxx) generates have_xxx and HAVE_LIBXXX
+dnl     UTIL_CHECK_LIB(yyy, func)      generates have_yyy and HAVE_LIBYYY
 dnl ---------------------------------
 AC_DEFUN([UTIL_CHECK_LIB], [
-  dnl The trick is to keep the third argument to AC_CHECK_LIB empty,
-  dnl and thus keep the default action.
-  have_$1=yes
-  AC_CHECK_LIB([$1], [$2], [], [have_$1=no])
-  AM_CONDITIONAL(AS_TR_CPP(HAVE_$1), [test $have_$1 = yes])
+  m4_define([suffix], m4_default([$3],$1))
+  [have_]suffix=yes
+  m4_ifdef([$3],
+    [AC_CHECK_LIB([$1], [$2], [AC_DEFINE(AS_TR_CPP([HAVE_LIB]suffix), 1)], [[have_]suffix=no])],
+    [AC_CHECK_LIB([$1], [$2], [], [[have_]suffix=no])])
+  AM_CONDITIONAL(AS_TR_CPP([HAVE_]suffix), [test [$have_]suffix = yes])
 ])
 
 UTIL_CHECK_LIB(uuid, uuid_is_null)
-- 
1.5.3.8

--
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux