https://gcc.gnu.org/g:8a3ad190c14789cde0b03142760b14b5675e8b39

commit r16-3114-g8a3ad190c14789cde0b03142760b14b5675e8b39
Author: Ijaz, Abdul B <abdul.b.i...@intel.com>
Date:   Sun Aug 10 08:33:30 2025 -0600

    config: Handle dash in library name for AC_LIB_LINKAGEFLAGS_BODY
    
    For a library with dash in the name like yaml-cpp the 
AC_LIB_LINKAGEFLAGS_BODY
    function generates a with_libname_type argument variable name with a dash 
but
    this results in configure error.  Since dashes are not allowed in the 
variable
    name.
    
    This change handles such cases and in case input library for the
    AC_LIB_HAVE_LINKFLAGS has dash then it replaces it with the underscore "_".
    
    Example of an error for yaml-cpp library before the change using gcc config
    scripts in gdb:
    gdb/gdb/configure: line 22868: with_libyaml-cpp_type=auto: command not found
    
    After having underscore for this variable name:
    
    checking whether to use yaml-cpp... yes
    checking for libyaml-cpp... yes
    checking how to link with libyaml-cpp... -lyaml-cpp
    
    config/ChangeLog:
    
            * lib-link.m4: Handle dash in the library name for
            AC_LIB_LINKFLAGS_BODY.

Diff:
---
 config/lib-link.m4 | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/config/lib-link.m4 b/config/lib-link.m4
index 20e281fd323a..a60a80694532 100644
--- a/config/lib-link.m4
+++ b/config/lib-link.m4
@@ -126,6 +126,7 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
 [
   define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
                                [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
+  define([Name],[translit([$1],[./-], [___])])
   dnl By default, look in $includedir and $libdir.
   use_additional=yes
   AC_LIB_WITH_FINAL_PREFIX([
@@ -152,8 +153,8 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
 ])
   AC_LIB_ARG_WITH([lib$1-type],
 [  --with-lib$1-type=TYPE     type of library to search for 
(auto/static/shared) ],
-  [ with_lib$1_type=$withval ], [ with_lib$1_type=auto ])
-  lib_type=`eval echo \$with_lib$1_type`
+  [ with_lib[]Name[]_type=$withval ], [ with_lib[]Name[]_type=auto ])
+  lib_type=`eval echo \$with_lib[]Name[]_type`
 
   dnl Search the library and its dependencies in $additional_libdir and
   dnl $LDFLAGS. Using breadth-first-seach.

Reply via email to