[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: AC_SEARCH_LIBS with OTHER-LIBRARIES
From: |
NIIBE Yutaka |
Subject: |
Re: AC_SEARCH_LIBS with OTHER-LIBRARIES |
Date: |
Mon, 26 Apr 2010 12:11:36 +0900 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.9) Gecko/20100411 Icedove/3.0.4 |
Ralf Wildenhues wrote:
The semantics are that OTHER-LIBRARIES are libraries needed by the
library in SEARCH_LIBS.
Thanks for the clarification.
I had thought that it were possible for users of AC_SEARCH_LIBS to
expect FUNCTION to be linked to OTHER-LIBRARIES with no library.
Well, let me give my example.
The code I wrote:
------------------
AC_SEARCH_LIBS(openpty, util,
[AC_DEFINE(HAVE_OPENPTY, 1, [Define if you have openpty])
LIBS=$ac_func_search_save_LIBS
test "$ac_res" = "none required" || TERMIOSLIB="$ac_res"])
AC_SEARCH_LIBS(forkpty, util,
[AC_DEFINE(HAVE_FORKPTY, 1, [Define if you have forkpty])
LIBS=$ac_func_search_save_LIBS
test "$ac_res" = "none required" || TERMIOSLIB="$ac_res"], , $TERMIOSLIB)
AC_SUBST(TERMIOSLIB)
------------------
I have wanted to write code which is equivalent to following but smaller:
------------------
ac_termios_save_LIBS=$LIBS
AC_CHECK_FUNC(openpty, , [AC_CHECK_LIB(util, openpty)])
if test "x$ac_cv_func_openpty" = xyes -o "x$ac_cv_lib_util_openpty" = xyes; then
AC_DEFINE(HAVE_OPENPTY, 1, [Define if you have openpty])
fi
AC_CHECK_FUNC(forkpty, , [AC_CHECK_LIB(util, forkpty)])
if test "x$ac_cv_func_forkpty" = xyes -o "x$ac_cv_lib_util_forkpty" = xyes; then
AC_DEFINE(HAVE_FORKPTY, 1, [Define if you have forkpty])
fi
if test "x$ac_cv_lib_util_openpty" = xyes -o "x$ac_cv_lib_util_forkpty" = xyes;
then
TERMIOSLIB="-lutil"
fi
LIBS=$ac_termios_save_LIBS
AC_SUBST(TERMIOSLIB)
------------------
Thanks.
--