Bug #2897 mysql_config not displaying cflags options correctly
Submitted: 19 Feb 2004 21:17 Modified: 20 Feb 2004 2:42
Reporter: Michael Kruckenberg Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:4.0.18 OS:Solaris (Solaris 8)
Assigned to: Sergei Golubchik CPU Architecture:Any

[19 Feb 2004 21:17] Michael Kruckenberg
Description:
I'm using a MySQL-recommended set of gcc compiler flags for Solaris:

    -O3 -fno-omit-frame-pointer -mcpu=v8 -Wa,-xarch=v8plusa

MySQL compiles and runs fine but mysql_config --cflags outputs something different than the options specified in the configure:

    -O3 -fno-omit-frame-pointer -mcpu=v8 ,-xarch=v8plusa

mysql_config has the cflags stored correctly in a variable $cflags. However, before printing the cflag string is passed through a regex which removes some options. The regex removes the "-Wa" but leaves the ",-xarch=v8plusa":

cflags=`echo "$cflags " | sed -e 's;\(-DDBUG_OFF\|-DSAFEMALLOC\|-USAFEMALLOC\|-DSAFE_MUTEX\|-DPEDANT
IC_SAFEMALLOC\|-DUNIV_MUST_NOT_INLINE\|-DFORCE_INIT_OF_VARS\|-DEXTRA_DEBUG\|-DHAVE_purify\|-O[0-9]\|
-W[-A-Za-z]*\) *;;g' | sed -e 's; *\$;;'`

The "-W[-A-Za-z]*" is the specific section causing the problem.

How to repeat:
Compile MySQL using gcc with "-Wa,-xarch=" cflags and then use mysql_config to get cflags.

Suggested fix:
Tweak the regex that cflags is passed through to match more than A-Za-z so it will either remove the entire option or not match it at all. Not sure the ramifications of changing the cleanup regex.
[20 Feb 2004 2:42] Sergei Golubchik
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html

Additional info:

fixed in 4.0.19
thanks!