Re: Cache variable name for AC_CHECK_LIBS

Paul Eggert <[email protected]>
Newsgroups gmane.comp.sysutils.autoconf.bugs
Organization UCLA Computer Science Department
Message-ID <[email protected]>
On 11/27/19 3:27 AM, Bert Wesarg wrote:
> No reaction since 3.5 years. Bug still persists.

It was a confusing bug report, as there is no AC_CHECK_LIBS macro in Autoconf.
But I think I found the bug that you were thinking of, and fixed it by
installing the attached.
0001-Fix-AC_CHECK_LIB-quoting-bug.patch (text/x-patch, 1.6 KB)
From c998ae7ca5f59780f8029abdd6bf40c6581c7e49 Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email protected]>
Date: Thu, 2 Jul 2020 22:23:59 -0700
Subject: [PATCH] Fix AC_CHECK_LIB quoting bug

Problem reported by Bert Wesarg in:
https://lists.gnu.org/archive/html/autoconf/2016-04/msg00020.html
* lib/autoconf/libs.m4 (AC_CHECK_LIB): Fix quoting bug.
* tests/semantics.at (AC_CHECK_LIB): Add a test for the bug.
---
 lib/autoconf/libs.m4 | 2 +-
 tests/semantics.at   | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/autoconf/libs.m4 b/lib/autoconf/libs.m4
index f5828e40..becb2231 100644
--- a/lib/autoconf/libs.m4
+++ b/lib/autoconf/libs.m4
@@ -101,7 +101,7 @@ AC_DEFUN([AC_CHECK_LIB],
 [m4_ifval([$3], , [AH_CHECK_LIB([$1])])dnl
 AS_LITERAL_WORD_IF([$1],
 	      [AS_VAR_PUSHDEF([ac_Lib], [ac_cv_lib_$1_$2])],
-	      [AS_VAR_PUSHDEF([ac_Lib], [ac_cv_lib_$1''_$2])])dnl
+	      [AS_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"
diff --git a/tests/semantics.at b/tests/semantics.at
index 3324a230..f10a0b53 100644
--- a/tests/semantics.at
+++ b/tests/semantics.at
@@ -42,9 +42,13 @@ ac_sin=sin
 AC_CHECK_LIB(m, $ac_sin,,
       [AC_MSG_ERROR([cannot find `\$ac_sin' (= `$ac_sin') in `libm'])])
 
+AS_UNSET([ac_cv_lib_m_acos])
 ac_m=m
 AC_CHECK_LIB($ac_m, acos,,
       [AC_MSG_ERROR([cannot find `acos' in `\$ac_m' (= `$ac_m')])])
+if test "${ac_cv_lib_m_acos+set}" != set; then
+  AC_MSG_ERROR([ac_cv_lib_m_acos not set])
+fi
 
 ac_asin=asin
 AC_CHECK_LIB($ac_m, $ac_asin,,
-- 
2.17.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.