[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: autoconf/176: AC_CHECK_LIB fails to add OTHER-LIBRARIES to LIBS
From: |
Rainer Orth |
Subject: |
Re: autoconf/176: AC_CHECK_LIB fails to add OTHER-LIBRARIES to LIBS |
Date: |
Mon, 14 May 2001 23:07:40 +0200 (MEST) |
I've just discovered that AC_SEARCH_LIBS suffers from the same problem.
This patch attempts to fix both of them. The change to AC_CHECK_LIB is a
straightforward port of Erez' AC_CHECK_LIB2 macro in am-utils 6.0.6
(aux/macros/check_lib2.m4) to the current CVS autoconf.
With those changes, make check still passes on sparc-sun-solaris2.8, and
the patches perform as expected for my testcase in the PR and a similar one
for AC_SEARCH_LIBS.
Rainer
-----------------------------------------------------------------------------
Rainer Orth, Faculty of Technology, Bielefeld University
Email: address@hidden
Mon May 14 20:14:05 2001 Rainer Orth <address@hidden>
* acgeneral.m4 (AC_SEARCH_LIBS): Try linking without
OTHER-LIBRARIES first, retry if that fails.
(LIBS): Likewise.
Index: acgeneral.m4
===================================================================
RCS file: /cvs/autoconf/acgeneral.m4,v
retrieving revision 1.722
diff -u -p -r1.722 acgeneral.m4
--- acgeneral.m4 2001/04/27 10:35:22 1.722
+++ acgeneral.m4 2001/05/14 20:19:01
@@ -2624,10 +2624,14 @@ AC_DEFUN([AC_SEARCH_LIBS],
ac_cv_search_$1=no
AC_TRY_LINK_FUNC([$1], [ac_cv_search_$1="none required"])
test "$ac_cv_search_$1" = no && for ac_lib in $2; do
-LIBS="-l$ac_lib $5 $ac_func_search_save_LIBS"
+LIBS="-l$ac_lib $ac_func_search_save_LIBS"
AC_TRY_LINK_FUNC([$1],
[ac_cv_search_$1="-l$ac_lib"
break])
+LIBS="-l$ac_lib $5 $ac_func_search_save_LIBS"
+AC_TRY_LINK_FUNC([$1],
+[ac_cv_search_$1="-l$ac_lib $5"
+break])
done
LIBS=$ac_func_search_save_LIBS])
AS_IF([test "$ac_cv_search_$1" != no],
@@ -2662,14 +2666,20 @@ AC_DEFUN([AC_CHECK_LIB],
AC_VAR_PUSHDEF([ac_Lib], [ac_cv_lib_$1_$2])dnl
AC_CACHE_CHECK([for $2 in -l$1], ac_Lib,
[ac_check_lib_save_LIBS=$LIBS
-LIBS="-l$1 $5 $LIBS"
+LIBS="-l$1 $LIBS"
AC_TRY_LINK_FUNC([$2],
- [AC_VAR_SET(ac_Lib, yes)],
+ [AC_VAR_SET(ac_Lib, "$1")],
[AC_VAR_SET(ac_Lib, no)])
-LIBS=$ac_check_lib_save_LIBS])
-AS_IF([test AC_VAR_GET(ac_Lib) = yes],
+AS_IF([test AC_VAR_GET(ac_Lib) = no],
+LIBS="-l$1 $5 $LIBS"
+AC_TRY_LINK_FUNC([$2],
+ [AC_VAR_SET(ac_Lib, "$1 $5")],
+ [AC_VAR_SET(ac_Lib, no)]))
+LIBS=$ac_check_lib2_save_LIBS])
+ac_Tmp="AC_VAR_GET(ac_Lib)"
+AS_IF([test "$ac_Tmp" != no],
[m4_default([$3], [AC_DEFINE_UNQUOTED(AC_TR_CPP(HAVE_LIB$1))
- LIBS="-l$1 $LIBS"
+ LIBS="-l$ac_Tmp $LIBS"
])],
[$4])dnl
AC_VAR_POPDEF([ac_Lib])dnl
- Re: autoconf/176: AC_CHECK_LIB fails to add OTHER-LIBRARIES to LIBS,
Rainer Orth <=