diff mbox series

[PING] : [PATCH 1/1] config: Handle dash in library name for AC_LIB_LINKAGEFLAGS_BODY

Message ID SA1PR11MB684637DFEEE92A57E389F186CB6F2@SA1PR11MB6846.namprd11.prod.outlook.com
State New
Headers show
Series [PING] : [PATCH 1/1] config: Handle dash in library name for AC_LIB_LINKAGEFLAGS_BODY | expand

Commit Message

Ijaz, Abdul B Sept. 23, 2024, 8:22 a.m. UTC
https://gcc.gnu.org/pipermail/gcc-patches/2024-July/656541.html

Best Regards
Abdul Basit

-----Original Message-----
From: Ijaz, Abdul B <abdul.b.ijaz@intel.com> 
Sent: Sunday, July 7, 2024 9:45 PM
To: Ijaz, Abdul B <abdul.b.ijaz@intel.com>
Subject: [PATCH 1/1] config: Handle dash in library name for AC_LIB_LINKAGEFLAGS_BODY

From: "Ijaz, Abdul B" <abdul.b.ijaz@intel.com>

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.

2024-07-03 Ijaz, Abdul B <abdul.b.ijaz@intel.com>
---
 config/lib-link.m4 | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

 ])
   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.
--
2.34.1

Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Sean Fennelly, Jeffrey Schneiderman, Tiffany Doon Silva
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928
diff mbox series

Patch

diff --git a/config/lib-link.m4 b/config/lib-link.m4 index 20e281fd323..a60a8069453 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],