summaryrefslogtreecommitdiffstats
path: root/configure.ac
diff options
context:
space:
mode:
authorKarel Zak2008-03-05 00:34:49 +0100
committerKarel Zak2008-03-20 12:25:01 +0100
commit40cc242e0204e274b012895f17dca8750001acd8 (patch)
treec37511cf3ed0aabd37382f766ba712e15747e39a /configure.ac
parentdocs: refresh TODO list (diff)
downloadkernel-qcow2-util-linux-40cc242e0204e274b012895f17dca8750001acd8.tar.gz
kernel-qcow2-util-linux-40cc242e0204e274b012895f17dca8750001acd8.tar.xz
kernel-qcow2-util-linux-40cc242e0204e274b012895f17dca8750001acd8.zip
build-sys: add VARSUFFIX to UTIL_CHECK_LIB
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@redhat.com>
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac17
1 files changed, 11 insertions, 6 deletions
diff --git a/configure.ac b/configure.ac
index bf6787fb4..50e8b6ffe 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)