Skip to content

Commit 5ae6085

Browse files
author
Tor Didriksen
committed
WL#5825 Using C++ Standard Library with MySQL code
Post-push fix: scripts/mysql_config* must distinguish between cflags and cxxflags.
1 parent 4a426b9 commit 5ae6085

File tree

3 files changed

+19
-8
lines changed

3 files changed

+19
-8
lines changed

configure.cmake

+3
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ IF(CMAKE_SYSTEM_NAME MATCHES "SunOS" AND CMAKE_C_COMPILER_ID MATCHES "SunPro")
110110
DESTINATION ${INSTALL_LIBDIR} COMPONENT Development)
111111
# Using the $ORIGIN token with the -R option to locate the libraries
112112
# on a path relative to the executable:
113+
# We need an extra backslash to pass $ORIGIN to the mysql_config script...
114+
SET(QUOTED_CMAKE_CXX_LINK_FLAGS
115+
"${CMAKE_CXX_LINK_FLAGS} -R'\\$ORIGIN/../lib' -R${STLPORT_PATH}")
113116
SET(CMAKE_CXX_LINK_FLAGS
114117
"${CMAKE_CXX_LINK_FLAGS} -R'\$ORIGIN/../lib' -R${STLPORT_PATH}")
115118
MESSAGE(STATUS "CMAKE_CXX_LINK_FLAGS ${CMAKE_CXX_LINK_FLAGS}")

scripts/mysql_config.pl.in

+10-3
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ use strict;
4444
my @exclude_cflags =
4545
qw/DDBUG_OFF DSAFE_MUTEX DFORCE_INIT_OF_VARS
4646
DEXTRA_DEBUG DHAVE_purify O O[0-9] xO[0-9] W[-A-Za-z]*
47-
Xa xstrconst xc99=none
4847
unroll2 ip mp restrict/;
4948

5049
my @exclude_libs = qw/lmtmalloc static-libcxa i-static static-intel/;
@@ -205,11 +204,10 @@ $flags->{embedded_libs} =
205204

206205
$flags->{include} = ["-I$pkgincludedir"];
207206
$flags->{cflags} = [@{$flags->{include}},split(" ",'@CFLAGS@')];
207+
$flags->{cxxflags}= [@{$flags->{include}},split(" ",'@CXXFLAGS@')];
208208

209209
# ----------------------------------------------------------------------
210210
# Remove some options that a client doesn't have to care about
211-
# FIXME until we have a --cxxflags, we need to remove -Xa
212-
# and -xstrconst to make --cflags usable for Sun Forte C++
213211
# ----------------------------------------------------------------------
214212

215213
my $filter = join("|", @exclude_cflags);
@@ -219,6 +217,12 @@ foreach my $cflag ( @tmp )
219217
{
220218
push(@{$flags->{cflags}}, $cflag) unless $cflag =~ m/^($filter)$/o;
221219
}
220+
@tmp = @{$flags->{cxxflags}}; # Copy the flag list
221+
$flags->{cxxflags} = []; # Clear it
222+
foreach my $cxxflag ( @tmp )
223+
{
224+
push(@{$flags->{cxxflags}}, $cxxflag) unless $cxxflag =~ m/^($filter)$/o;
225+
}
222226

223227
# Same for --libs(_r)
224228
$filter = join("|", @exclude_libs);
@@ -234,6 +238,7 @@ foreach my $lib_type ( "libs","libs_r","embedded_libs" )
234238

235239
my $include = quote_options(@{$flags->{include}});
236240
my $cflags = quote_options(@{$flags->{cflags}});
241+
my $cxxflags= quote_options(@{$flags->{cxxflags}});
237242
my $libs = quote_options(@{$flags->{libs}});
238243
my $libs_r = quote_options(@{$flags->{libs_r}});
239244
my $embedded_libs = quote_options(@{$flags->{embedded_libs}});
@@ -250,6 +255,7 @@ sub usage
250255
Usage: $0 [OPTIONS]
251256
Options:
252257
--cflags [$cflags]
258+
--cxxflags [$cxxflags]
253259
--include [$include]
254260
--libs [$libs]
255261
--libs_r [$libs_r]
@@ -271,6 +277,7 @@ EOF
271277

272278
GetOptions(
273279
"cflags" => sub { print "$cflags\n" },
280+
"cxxflags"=> sub { print "$cxxflags\n" },
274281
"include" => sub { print "$include\n" },
275282
"libs" => sub { print "$libs\n" },
276283
"libs_r" => sub { print "$libs_r\n" },

scripts/mysql_config.sh

+6-5
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ libs=" $ldflags -L$pkglibdir -lmysqlclient @ZLIB_DEPS@ @NON_THREADED_LIBS@"
114114
libs="$libs @openssl_libs@ @STATIC_NSS_FLAGS@ "
115115
libs_r=" $ldflags -L$pkglibdir -lmysqlclient_r @ZLIB_DEPS@ @CLIENT_LIBS@ @openssl_libs@ "
116116
embedded_libs=" $ldflags -L$pkglibdir -lmysqld @LIBDL@ @ZLIB_DEPS@ @LIBS@ @WRAPLIBS@ @openssl_libs@ "
117+
embedded_libs="$embedded_libs @QUOTED_CMAKE_CXX_LINK_FLAGS@"
117118

118119
if [ -r "$pkglibdir/libmygcc.a" ]; then
119120
# When linking against the static library with a different version of GCC
@@ -126,24 +127,22 @@ if [ -r "$pkglibdir/libmygcc.a" ]; then
126127
fi
127128

128129
cflags="-I$pkgincludedir @CFLAGS@ " #note: end space!
130+
cxxflags="-I$pkgincludedir @CXXFLAGS@ " #note: end space!
129131
include="-I$pkgincludedir"
130132

131133
# Remove some options that a client doesn't have to care about
132-
# FIXME until we have a --cxxflags, we need to remove -Xa
133-
# and -xstrconst to make --cflags usable for Sun Forte C++
134-
# FIXME until we have a --cxxflags, we need to remove -AC99
135-
# to make --cflags usable for HP C++ (aCC)
136134
for remove in DDBUG_OFF DSAFE_MUTEX DFORCE_INIT_OF_VARS \
137135
DEXTRA_DEBUG DHAVE_purify O 'O[0-9]' 'xO[0-9]' 'W[-A-Za-z]*' \
138136
'mtune=[-A-Za-z0-9]*' 'mcpu=[-A-Za-z0-9]*' 'march=[-A-Za-z0-9]*' \
139-
Xa xstrconst "xc99=none" AC99 \
140137
unroll2 ip mp restrict
141138
do
142139
# The first option we might strip will always have a space before it because
143140
# we set -I$pkgincludedir as the first option
144141
cflags=`echo "$cflags"|sed -e "s/ -$remove */ /g"`
142+
cxxflags=`echo "$cxxflags"|sed -e "s/ -$remove */ /g"`
145143
done
146144
cflags=`echo "$cflags"|sed -e 's/ *\$//'`
145+
cxxflags=`echo "$cxxflags"|sed -e 's/ *\$//'`
147146

148147
# Same for --libs(_r)
149148
for remove in lmtmalloc static-libcxa i-static static-intel
@@ -164,6 +163,7 @@ usage () {
164163
Usage: $0 [OPTIONS]
165164
Options:
166165
--cflags [$cflags]
166+
--cxxflags [$cxxflags]
167167
--include [$include]
168168
--libs [$libs]
169169
--libs_r [$libs_r]
@@ -185,6 +185,7 @@ if test $# -le 0; then usage; fi
185185
while test $# -gt 0; do
186186
case $1 in
187187
--cflags) echo "$cflags" ;;
188+
--cxxflags)echo "$cxxflags";;
188189
--include) echo "$include" ;;
189190
--libs) echo "$libs" ;;
190191
--libs_r) echo "$libs_r" ;;

0 commit comments

Comments
 (0)