svn commit: r1933795 - subversion/trunk/build/ac-macros

[email protected]
Newsgroups gmane.comp.version-control.subversion.svn
Message-ID <177785494858.2327229.13096466285810396018@svn03-he-fi>
Author: brane
Date: Mon May  4 00:35:48 2026
New Revision: 1933795

Log:
Remove any debugging, optimization or warning flags returned from
'apr-config --cflags' to avoid interactions with our --enable-debug/optimize.

* build/ac-macros/apr.m4
  (SVN_LIB_APR): If we're using a GNU-compatible compiler, remove all
   -g*, -O*, -W* and -w options.

Modified:
   subversion/trunk/build/ac-macros/apr.m4

Modified: subversion/trunk/build/ac-macros/apr.m4
==============================================================================
--- subversion/trunk/build/ac-macros/apr.m4	Sun May  3 22:35:33 2026	(r1933794)
+++ subversion/trunk/build/ac-macros/apr.m4	Mon May  4 00:35:48 2026	(r1933795)
@@ -72,10 +72,23 @@ AC_DEFUN(SVN_LIB_APR,
     AC_MSG_ERROR([apr-config --cppflags failed])
   fi
 
-  CFLAGS="$CFLAGS `$apr_config --cflags`"
+  dnl Remove debugging, optimization and warning flags from the result of
+  dnl 'apr-config --cflags'. They're usually not present, but Homebrew on
+  dnl macOS adds '-g -O2 -Wall', for example. we don't want that to
+  dnl interact with our default flags.
+  apr_cflags="`$apr_config --cflags`"
   if test $? -ne 0; then
     AC_MSG_ERROR([apr-config --cflags failed])
   fi
+  if test "$GCC" = "yes"; then
+    saved="$apr_cflags"
+    apr_cflags=["`echo $apr_cflags' ' | $SED -e 's/-[gOW][^ ]* //g'`"]
+    apr_cflags=["`echo $apr_cflags' ' | $SED -e 's/-w //g'`"]
+    if test "$saved" != "$apr_cflags"; then
+      AC_MSG_WARN(['apr_config --cflags': [[$saved]] -> [[$apr_cflags]]])
+    fi
+  fi
+  CFLAGS="$CFLAGS $apr_cflags"
 
   apr_ldflags="`$apr_config --ldflags`"
   if test $? -ne 0; then
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.