From 40cc242e0204e274b012895f17dca8750001acd8 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Wed, 5 Mar 2008 00:34:49 +0100 Subject: [PATCH] build-sys: add VARSUFFIX to UTIL_CHECK_LIB The UTIL_CHECK_LIB macro follows the default autoconf behaviour and generates have_ and HAVE_LIB 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_ and HAVE_LIB. 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 --- configure.ac | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/configure.ac b/configure.ac index bf6787fb..50e8b6ff 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) -- 2.39.5