Author: brane Date: Thu Jul 3 06:22:33 2025 New Revision: 1926930 URL: http://svn.apache.org/viewvc?rev=1926930&view=rev Log: SERF-206: Filter out all optimization, debugging and warning options from the output of apr-{1,2}-config and apu-1-condig. CMake was almost there, leaving only the warning options; SCons did no filtering at all.
* SConstruct: Filter the flags before sending them to env.ParseConfig. (readconfig): New, does the filtering. * build/FindAPR.cmake: Also filter -Wfoo from --cppflags and --cflags. Modified: serf/trunk/SConstruct serf/trunk/build/FindAPR.cmake Modified: serf/trunk/SConstruct URL: http://svn.apache.org/viewvc/serf/trunk/SConstruct?rev=1926930&r1=1926929&r2=1926930&view=diff ============================================================================== --- serf/trunk/SConstruct (original) +++ serf/trunk/SConstruct Thu Jul 3 06:22:33 2025 @@ -538,17 +538,26 @@ else: ### we should use --cc, but that is giving some scons error about an implicit ### dependency upon gcc. probably ParseConfig doesn't know what to do with ### the apr-1-config output - env.ParseConfig('$APR --cflags --cppflags --ldflags --includes' - ' --link-ld --libs', unique=0) + + def readconfig(cmdline): + '''Run the given command, read its output and filter out all + debugging, optimization and warning flags.''' + output = os.popen(env.subst(cmdline)).read().strip() + return re.sub(r'(^| )-[gOW][^ ]*', '', output) + + flags = readconfig('$APR --cflags --cppflags --includes' + ' --ldflags --link-ld --libs') if apr_major < 2: - env.ParseConfig('$APU --ldflags --includes --link-ld --libs', - unique=0) + flags += ' ' + readconfig('$APU --includes --ldflags --link-ld --libs') + + # Now, finally, read this into the environment. It's a pity that + env.ParseConfig('echo "%s"' % flags, unique=0) ### there is probably a better way to run/capture output. ### env.ParseConfig() may be handy for getting this stuff into the build - apr_libs = os.popen(env.subst('$APR --link-libtool --libs')).read().strip() + apr_libs = readconfig('$APR --link-libtool --libs') if apr_major < 2: - apu_libs = os.popen(env.subst('$APU --link-libtool --libs')).read().strip() + apu_libs = readconfig('$APU --link-libtool --libs') else: apu_libs = '' else: Modified: serf/trunk/build/FindAPR.cmake URL: http://svn.apache.org/viewvc/serf/trunk/build/FindAPR.cmake?rev=1926930&r1=1926929&r2=1926930&view=diff ============================================================================== --- serf/trunk/build/FindAPR.cmake (original) +++ serf/trunk/build/FindAPR.cmake Thu Jul 3 06:22:33 2025 @@ -229,7 +229,7 @@ if(NOT _apru_include_only_utilities) _apru_config(${APR_CONFIG_EXECUTABLE} ${_varname} "${_regexp}" "${ARGN}") endmacro(_apr_invoke) - _apr_invoke(APR_CFLAGS "(^| )-(g|O)[^ ]*" --cppflags --cflags) + _apr_invoke(APR_CFLAGS "(^| )-[gOW][^ ]*" --cppflags --cflags) _apr_invoke(APR_INCLUDES "(^| )-I" --includes) _apr_invoke(APR_LDFLAGS "" --ldflags) _apr_invoke(APR_LIBRARIES "" --link-ld)