configure: Add --with-elfutils and remove --with-lib{dw,elf} options

Message ID 874igfpm38.fsf@seketeli.org
State New
Headers
Series configure: Add --with-elfutils and remove --with-lib{dw,elf} options |

Commit Message

Dodji Seketeli Aug. 27, 2026, 4:25 p.m. UTC
  Hello,

It does not make sense to have --with-libdw= and --with-libelf=
options to define where to find these elfutils libraries.  Just have
one option as the prefix under which to find all elfutils makes much
more sense.

The patch introduces --with-elfutils= to specify the prefix under
which libelf.so, libdw.so and the header files are to be found.  It
thus removes the previous --with-lib{dw,elf} redundant options.

OK to apply to the multithreading branch ?  I am sending a corresponding
patch to the buildbot mainling list to adjust the CI bots accordingly.

	* configure.ac: Remove definitions and references to --with-libdw
	and --with-libelf options.  Add support for the new
	--with-elfutils.  Adjust.  Add a new configuration description
	message for the elfutils prefix that is actually used by
	Libabigail.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
---
 configure.ac | 48 +++++++++++++++++++++++++-----------------------
 1 file changed, 25 insertions(+), 23 deletions(-)
  

Comments

Dodji Seketeli Sept. 2, 2026, 8:04 a.m. UTC | #1
Hello,

Dodji Seketeli <dodji@seketeli.org> a écrit:

> Hello,
>
> It does not make sense to have --with-libdw= and --with-libelf=
> options to define where to find these elfutils libraries.  Just have
> one option as the prefix under which to find all elfutils makes much
> more sense.
>
> The patch introduces --with-elfutils= to specify the prefix under
> which libelf.so, libdw.so and the header files are to be found.  It
> thus removes the previous --with-lib{dw,elf} redundant options.
>
> OK to apply to the multithreading branch ?  I am sending a corresponding
> patch to the buildbot mainling list to adjust the CI bots accordingly.
>
> 	* configure.ac: Remove definitions and references to --with-libdw
> 	and --with-libelf options.  Add support for the new
> 	--with-elfutils.  Adjust.  Add a new configuration description
> 	message for the elfutils prefix that is actually used by
> 	Libabigail.
>
> Signed-off-by: Dodji Seketeli <dodji@redhat.com>

The sourceware builders have been updated to use this --with-elfutils=
configure option when using a custom built elfutils.

So I am applying this patch to the mainline accordingly.

[...]

Cheers,
  

Patch

diff --git a/configure.ac b/configure.ac
index 22b0bfbe..8e25b2fa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -258,19 +258,11 @@  AC_ARG_ENABLE(inlined-xxhash,
 	      ENABLE_INLINED_XXHASH=$enableval,
 	      ENABLE_INLINED_XXHASH=no)
 
-WITH_DW_LIBS_PATH=auto
-AC_ARG_WITH(libdw,
-	    AS_HELP_STRING([--with-libdw=/path/to/libdw-library/prefix],
-			   [Set the path to the libdw library prefix]),
-	    WITH_DW_LIBS_PATH=$withval,
-	    WITH_DW_LIBS_PATH=auto)
-
-WITH_ELF_LIBS_PATH=auto
-AC_ARG_WITH(libelf,
-	    AS_HELP_STRING([--with-libelf=/path/to/libelf-library/prefix],
-			   [Set the path to the libelf library prefix]),
-	    WITH_ELF_LIBS_PATH=$withval,
-	    WITH_ELF_LIBS_PATH=auto)
+AC_ARG_WITH(elfutils,
+	    AS_HELP_STRING([--with-elfutils=/path/to/elfutils/prefix],
+			   [Set the path to the prefix for elfutils libraries]),
+	    WITH_ELFUTILS_PATH=$withval,
+	    WITH_ELFUTILS_PATH=auto)
 
 WITH_LIBXML2_PATH=auto
 AC_ARG_WITH(libxml2,
@@ -358,26 +350,26 @@  dnl Those were added in version 0.165.
 dnl look for libelf
 ELF_LIBS_VERSION=0.171
 SAVED_PKG_CONFIG_PATH=$PKG_CONFIG_PATH
-if test $WITH_ELF_LIBS_PATH != xauto; then
-  export PKG_CONFIG_PATH="$WITH_ELF_LIBS_PATH/lib/pkgconfig:$PKG_CONFIG_PATH"
+if test x$WITH_ELFUTILS_PATH != xauto; then
+  export PKG_CONFIG_PATH="$WITH_ELFUTILS_PATH/lib/pkgconfig:$PKG_CONFIG_PATH"
 fi
 
-AC_MSG_NOTICE([used PKG_CONFIG_PATH=$PKG_CONFIG_PATH to check for libelf]);
+AC_MSG_NOTICE([using PKG_CONFIG_PATH=$PKG_CONFIG_PATH to check for libelf]);
 PKG_CHECK_MODULES(ELF, libelf >= $ELF_LIBS_VERSION)
-if test $WITH_ELF_LIBS_PATH != xauto; then
+if test x$WITH_ELFUTILS_PATH != xauto; then
   PKG_CONFIG_PATH=$SAVED_PKG_CONFIG_PATH
 fi
 
 dnl Look for libdw
 DW_LIBS_VERSION=0.171
 SAVED_PKG_CONFIG_PATH=$PKG_CONFIG_PATH
-if test $WITH_DW_LIBS_PATH != xauto; then
-  export PKG_CONFIG_PATH="$WITH_DW_LIBS_PATH/lib/pkgconfig:$PKG_CONFIG_PATH"
+if test x$WITH_ELFUTILS_PATH != xauto; then
+  export PKG_CONFIG_PATH="$WITH_ELFUTILS_PATH/lib/pkgconfig:$PKG_CONFIG_PATH"
 fi
 
 AC_MSG_NOTICE([used PKG_CONFIG_PATH=$PKG_CONFIG_PATH to check for libdw]);
 PKG_CHECK_MODULES(DW, libdw >= $DW_LIBS_VERSION)
-if test $WITH_DW_LIBS_PATH != xauto; then
+if test x$WITH_ELFUTILS_PATH != xauto; then
   PKG_CONFIG_PATH=$SAVED_PKG_CONFIG_PATH
 fi
 
@@ -1019,9 +1011,17 @@  AC_SUBST(HELGRIND_TRACK_DESTROY)
 
 
 ELFUTILS_HAS_THREAD_SAFETY=no
+dnl By default, look for elfutils in the default system prefix.
+eu_prefix=$prefix
+
 if test x$ENABLE_MULTITHREADING != xno; then
-saved_CPPFLAGS="$CPPFLAGS"
-CPPFLAGS="-I${prefix}/include $CPPFLAGS"
+   saved_CPPFLAGS="$CPPFLAGS"
+   
+   if test x$WITH_ELFUTILS_PATH != xauto; then
+      eu_prefix=$WITH_ELFUTILS_PATH
+   fi
+   
+   CPPFLAGS="-I$eu_prefix/include $CPPFLAGS"
    AC_CHECK_HEADER([elfutils/version.h],
 		   [HAS_ELFUTILS_VERSION=yes],
 		   [AC_MSG_NOTICE([could not find elfutils/version.h])])
@@ -1040,7 +1040,8 @@  CPPFLAGS="-I${prefix}/include $CPPFLAGS"
       AC_MSG_NOTICE([I haven't detected multithreading support in elfutils/version.h])
       ENABLE_MULTITHREADING=no
    fi
-CPPFLAGS="$saved_CPPFLAGS"
+
+   CPPFLAGS="$saved_CPPFLAGS"
 fi
 
 if test x$ENABLE_MULTITHREADING = xyes; then
@@ -1758,6 +1759,7 @@  AC_MSG_NOTICE([
     C++ Compiler		                   : ${CXX}
     GCC visibility attribute supported             : ${SUPPORTS_GCC_VISIBILITY_ATTRIBUTE}
     CXXFLAGS	   	     			   : ${CXXFLAGS}
+    ELFUTILS prefix				   : ${eu_prefix}
     ELF_LIBS					   : ${ELF_LIBS}
     ELF_CFLAGS					   : ${ELF_CFLAGS}
     DW_LIBS					   : ${DW_LIBS}