configure: Error when demangler is enabled, but libstdc++ support isn't

Message ID 20230215160030.45630-1-mark@klomp.org
State Committed
Headers
Series configure: Error when demangler is enabled, but libstdc++ support isn't |

Commit Message

Mark Wielaard Feb. 15, 2023, 4 p.m. UTC
  There have been a couple of cases where demangler support has been
accidentially been disabled because libstdc++ wasn't there/installed
during build. Make it an error if --disable-demangler isn't explicitly
given.

Signed-off-by: Mark Wielaard <mark@klomp.org>
---
 ChangeLog    | 5 +++++
 configure.ac | 3 ++-
 2 files changed, 7 insertions(+), 1 deletion(-)
  

Comments

Florian Weimer Feb. 16, 2023, 10:48 a.m. UTC | #1
* Mark Wielaard:

> +      [AC_MSG_ERROR([__cxa_demangle not found in libstdc++ use --disable-demangler to disable demangler support.])]),

Missing punctuation after libstdc++?

Thanks,
Florian
  
Mark Wielaard Feb. 16, 2023, 1:08 p.m. UTC | #2
Hi Florian,

On Thu, 2023-02-16 at 11:48 +0100, Florian Weimer via Elfutils-devel
wrote:
> * Mark Wielaard:
> 
> > +      [AC_MSG_ERROR([__cxa_demangle not found in libstdc++ use --disable-demangler to disable demangler support.])]),
> 
> Missing punctuation after libstdc++?

You probably mean you like to see a comma after libstdc++?
That sounds reasonable. But I had to double quote the argument to
AC_MSG_ERROR, otherwise the comma was seen as a argument separator?
Which I find slightly odd, but I don't fully grok autoconf quotes.

Does the following do what you expect?

diff --git a/configure.ac b/configure.ac
index 1ef45c0f..4c8a4c31 100644
--- a/configure.ac
+++ b/configure.ac
@@ -499,7 +499,7 @@ AC_DEFINE([USE_DEMANGLE], [1], [Defined if demangling is enabled])])
 AM_CONDITIONAL(DEMANGLE, test "x$ac_cv_lib_stdcpp___cxa_demangle" = "xyes")
 AS_IF([test "x$ac_cv_lib_stdcpp___cxa_demangle" = "xyes"],
       [enable_demangler=yes],
-      [AC_MSG_ERROR([__cxa_demangle not found in libstdc++ use --disable-demangler to disable demangler support.])]),
+      [AC_MSG_ERROR([[__cxa_demangle not found in libstdc++, use --disable-demangler to disable demangler support.]])]),
 AM_CONDITIONAL(DEMANGLE, false))
 
 AC_ARG_ENABLE([textrelcheck],

Thanks,

Mark
  
Florian Weimer Feb. 16, 2023, 5:02 p.m. UTC | #3
* Mark Wielaard:

> Hi Florian,
>
> On Thu, 2023-02-16 at 11:48 +0100, Florian Weimer via Elfutils-devel
> wrote:
>> * Mark Wielaard:
>> 
>> > +      [AC_MSG_ERROR([__cxa_demangle not found in libstdc++ use --disable-demangler to disable demangler support.])]),
>> 
>> Missing punctuation after libstdc++?
>
> You probably mean you like to see a comma after libstdc++?

Comma or semicolon.

> That sounds reasonable. But I had to double quote the argument to
> AC_MSG_ERROR, otherwise the comma was seen as a argument separator?

Ohh.  I had not consider that.

> Which I find slightly odd, but I don't fully grok autoconf quotes.
>
> Does the following do what you expect?

Yes, but even though I patched dozens of m4 files lately, I still don't
get the quoting rules.  For me, it's mostly “add […] until it breaks,
then remove one layer” …

Thanks,
Florian
  
Mark Wielaard Feb. 16, 2023, 11:09 p.m. UTC | #4
Hi Florian,

On Thu, Feb 16, 2023 at 06:02:49PM +0100, Florian Weimer via Elfutils-devel wrote:
> * Mark Wielaard:
> > Which I find slightly odd, but I don't fully grok autoconf quotes.
> >
> > Does the following do what you expect?
> 
> Yes, but even though I patched dozens of m4 files lately, I still don't
> get the quoting rules.  For me, it's mostly “add […] until it breaks,
> then remove one layer” …

Grin. That is good enough for me :)
Pushed.

Thanks,

Mark
  

Patch

diff --git a/ChangeLog b/ChangeLog
index a46cca6c..d99d837d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@ 
+2023-02-15  Mark Wielaard  <mark@klomp.org>
+
+	* configure.ac: Error out when demangler is enabled, but
+	__cxa_demangle cannot be found.
+
 2023-01-11  Frank Ch. Eigler  <fche@redhat.com>
 
 	* configure.ac: Add some rlimit/affinity checks.
diff --git a/configure.ac b/configure.ac
index 18951947..1ef45c0f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -498,7 +498,8 @@  AC_CHECK_LIB([stdc++], [__cxa_demangle], [dnl
 AC_DEFINE([USE_DEMANGLE], [1], [Defined if demangling is enabled])])
 AM_CONDITIONAL(DEMANGLE, test "x$ac_cv_lib_stdcpp___cxa_demangle" = "xyes")
 AS_IF([test "x$ac_cv_lib_stdcpp___cxa_demangle" = "xyes"],
-      [enable_demangler=yes],[enable_demangler=no]),
+      [enable_demangler=yes],
+      [AC_MSG_ERROR([__cxa_demangle not found in libstdc++ use --disable-demangler to disable demangler support.])]),
 AM_CONDITIONAL(DEMANGLE, false))
 
 AC_ARG_ENABLE([textrelcheck],