summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xBUILD/compile-darwin-mwcc54
-rw-r--r--BitKeeper/etc/logging_ok2
-rw-r--r--cmd-line-utils/libedit/config.h2
-rw-r--r--cmd-line-utils/readline/terminal.c2
-rw-r--r--configure.in23
-rw-r--r--include/my_sys.h4
-rw-r--r--mysql-test/r/ndb_restore.result1
-rw-r--r--mysql-test/r/ps.result38
-rw-r--r--mysql-test/t/ndb_restore.test6
-rw-r--r--mysql-test/t/ps.test119
-rw-r--r--ndb/test/src/NDBT_ResultRow.cpp8
-rw-r--r--sql/ha_innodb.cc10
-rw-r--r--sql/item.cc24
-rw-r--r--sql/item.h7
-rw-r--r--sql/sql_bitmap.h2
-rwxr-xr-xsupport-files/MacOSX/mwar-wrapper16
-rwxr-xr-xsupport-files/MacOSX/mwcc-wrapper48
17 files changed, 313 insertions, 53 deletions
diff --git a/BUILD/compile-darwin-mwcc b/BUILD/compile-darwin-mwcc
new file mode 100755
index 00000000000..6fd0eab7e26
--- /dev/null
+++ b/BUILD/compile-darwin-mwcc
@@ -0,0 +1,54 @@
+#! /bin/sh
+
+path=`dirname $0`
+. "$path/SETUP.sh"
+
+c_warnings=""
+cxx_warnings=""
+fast_cflags="-O3"
+base_cxxflags="-fno-handle-exceptions"
+
+# FIXME do we need to link static, not to depend on CodeWarrior libs?
+
+if [ x$MODE = x ] ; then
+ echo "You need to give an argument, 'standard', 'max', 'debug' or 'debug-max'"
+ echo "Like: MODE=standard BUILD/compile-darwin-codewarrior"
+ exit 1
+else
+ case $MODE in
+ standard|pro-gpl)
+ # FIXME pro/pro-gpl different libedit/readline
+ extra_flags="$ppc_cflags $fast_cflags"
+ ;;
+ pro)
+ # FIXME pro/pro-gpl different libedit/readline
+ extra_flags="$ppc_cflags $fast_cflags"
+ extra_configs="--with-libedit"
+ ;;
+ max)
+ extra_flags="$ppc_cflags $fast_cflags"
+ extra_configs="$max_configs"
+ ;;
+ debug)
+ extra_flags="$ppc_cflags $debug_cflags"
+ c_warnings="$c_warnings $debug_extra_warnings"
+ cxx_warnings="$cxx_warnings $debug_extra_warnings"
+ extra_configs="$debug_configs"
+ ;;
+ debug-max)
+ extra_flags="$ppc_cflags $debug_cflags $max_cflags"
+ c_warnings="$c_warnings $debug_extra_warnings"
+ cxx_warnings="$cxx_warnings $debug_extra_warnings"
+ extra_configs="$debug_configs $max_configs"
+ ;;
+ *)
+ echo "You need to give an argument, 'standard', 'max', 'debug' or 'debug-max'"
+ echo "Like: MODE=standard BUILD/compile-darwin-codewarrior"
+ exit 1
+ ;;
+ esac
+fi
+
+extra_configs="$extra_configs --with-darwin-mwcc"
+
+. "$path/FINISH.sh"
diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok
index 101e845ccf1..c7b5fa0f692 100644
--- a/BitKeeper/etc/logging_ok
+++ b/BitKeeper/etc/logging_ok
@@ -186,6 +186,7 @@ mysqldev@build.mysql2.com
mysqldev@melody.local
mysqldev@mysql.com
mysqldev@o2k.irixworld.net
+ndbdev@dl145b.mysql.com
ndbdev@eel.hemma.oreland.se
ndbdev@ndbmaster.mysql.com
ndbdev@shark.
@@ -268,6 +269,7 @@ tonu@x153.internalnet
tonu@x3.internalnet
tsmith@build.mysql.com
tulin@build.mysql.com
+tulin@dl145b.mysql.com
tulin@mysql.com
ulli@morbus.(none)
venu@hundin.mysql.fi
diff --git a/cmd-line-utils/libedit/config.h b/cmd-line-utils/libedit/config.h
index b6f002d5b9e..642123d1ddc 100644
--- a/cmd-line-utils/libedit/config.h
+++ b/cmd-line-utils/libedit/config.h
@@ -2,8 +2,10 @@
#include "my_config.h"
#include "sys.h"
+#if defined(LIBC_SCCS) && !defined(lint)
#define __RCSID(x)
#define __COPYRIGHT(x)
+#endif
#define __RENAME(x)
#define _DIAGASSERT(x)
diff --git a/cmd-line-utils/readline/terminal.c b/cmd-line-utils/readline/terminal.c
index a506fa6de09..b2bcf5f146c 100644
--- a/cmd-line-utils/readline/terminal.c
+++ b/cmd-line-utils/readline/terminal.c
@@ -346,7 +346,7 @@ get_term_capabilities (bp)
register unsigned int i;
for (i = 0; i < NUM_TC_STRINGS; i++)
-# ifdef __LCC__
+# if defined(__LCC__) || defined(__MWERKS__)
*(tc_strings[i].tc_value) = tgetstr ((char *)tc_strings[i].tc_var, bp);
# else
*(tc_strings[i].tc_value) = tgetstr (tc_strings[i].tc_var, bp);
diff --git a/configure.in b/configure.in
index 8b0a0ddeb56..62098da77fc 100644
--- a/configure.in
+++ b/configure.in
@@ -123,8 +123,25 @@ AM_SANITY_CHECK
# This is needed is SUBDIRS is set
AC_PROG_MAKE_SET
-# This is need before AC_PROG_CC
-#
+##############################################################################
+# The below section needs to be done before AC_PROG_CC
+##############################################################################
+
+# Hack for OS X/Darwin and Metrowerks CodeWarrior
+AC_ARG_WITH(darwin-mwcc,
+[ --with-darwin-mwcc Use Metrowerks CodeWarrior wrappers on OS X/Darwin],[
+ builddir=`pwd`
+ ccwrapper="$builddir/support-files/MacOSX/mwcc-wrapper"
+ arwrapper="$builddir/support-files/MacOSX/mwar-wrapper"
+ CC="$ccwrapper"
+ CXX="$ccwrapper"
+ LD="$ccwrapper"
+ AR="$arwrapper"
+ RANLIB=:
+ export CC CXX LD AR RANLIB
+ AC_SUBST(AR)
+ AC_SUBST(RANLIB)
+])
if test "x${CFLAGS-}" = x ; then
cflags_is_set=no
@@ -144,6 +161,8 @@ else
ldflags_is_set=yes
fi
+################ End of section to be done before AC_PROG_CC #################
+
# The following hack should ensure that configure doesn't add optimizing
# or debugging flags to CFLAGS or CXXFLAGS
# C_EXTRA_FLAGS are flags that are automaticly added to both
diff --git a/include/my_sys.h b/include/my_sys.h
index 8f595bfdbf0..f235b5a072e 100644
--- a/include/my_sys.h
+++ b/include/my_sys.h
@@ -179,6 +179,10 @@ extern void my_large_free(gptr ptr, myf my_flags);
#if defined(_AIX) && !defined(__GNUC__) && !defined(_AIX43)
#pragma alloca
#endif /* _AIX */
+#if defined(__MWERKS__)
+#undef alloca
+#define alloca __alloca
+#endif /* __MWERKS__ */
#if defined(__GNUC__) && !defined(HAVE_ALLOCA_H) && ! defined(alloca)
#define alloca __builtin_alloca
#endif /* GNUC */
diff --git a/mysql-test/r/ndb_restore.result b/mysql-test/r/ndb_restore.result
index 8e4449b1996..c78a4137468 100644
--- a/mysql-test/r/ndb_restore.result
+++ b/mysql-test/r/ndb_restore.result
@@ -247,3 +247,4 @@ count(*)
3
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
drop table if exists t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c;
+520093696,1
diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result
index c0f4412b3d8..c84c62442ef 100644
--- a/mysql-test/r/ps.result
+++ b/mysql-test/r/ps.result
@@ -595,3 +595,41 @@ c1 c2
200887 860
200887 200887
deallocate prepare stmt;
+drop table t1;
+create table t1 (
+id bigint(20) not null auto_increment,
+code varchar(20) character set utf8 collate utf8_bin not null default '',
+company_name varchar(250) character set utf8 collate utf8_bin default null,
+setup_mode tinyint(4) default null,
+start_date datetime default null,
+primary key (id), unique key code (code)
+);
+create table t2 (
+id bigint(20) not null auto_increment,
+email varchar(250) character set utf8 collate utf8_bin default null,
+name varchar(250) character set utf8 collate utf8_bin default null,
+t1_id bigint(20) default null,
+password varchar(250) character set utf8 collate utf8_bin default null,
+primary_contact tinyint(4) not null default '0',
+email_opt_in tinyint(4) not null default '1',
+primary key (id), unique key email (email), key t1_id (t1_id),
+constraint t2_fk1 foreign key (t1_id) references t1 (id)
+);
+insert into t1 values
+(1, 'demo', 'demo s', 0, current_date()),
+(2, 'code2', 'name 2', 0, current_date()),
+(3, 'code3', 'name 3', 0, current_date());
+insert into t2 values
+(2, 'email1', 'name1', 3, 'password1', 0, 0),
+(3, 'email2', 'name1', 1, 'password2', 1, 0),
+(5, 'email3', 'name3', 2, 'password3', 0, 0);
+prepare stmt from 'select t2.id from t2, t1 where (t1.id=? and t2.t1_id=t1.id)';
+set @a=1;
+execute stmt using @a;
+id
+3
+select t2.id from t2, t1 where (t1.id=1 and t2.t1_id=t1.id);
+id
+3
+deallocate prepare stmt;
+drop table t1, t2;
diff --git a/mysql-test/t/ndb_restore.test b/mysql-test/t/ndb_restore.test
index e3191538a22..3c7b99da25a 100644
--- a/mysql-test/t/ndb_restore.test
+++ b/mysql-test/t/ndb_restore.test
@@ -209,3 +209,9 @@ select count(*)
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
drop table if exists t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c;
--enable_warnings
+
+#
+# Test BUG#10287
+#
+
+--exec $NDB_TOOLS_DIR/ndb_select_all -d sys -D , SYSTAB_0 | grep 520093696
diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test
index 40069e5b616..b17742de2d2 100644
--- a/mysql-test/t/ps.test
+++ b/mysql-test/t/ps.test
@@ -7,8 +7,8 @@ drop table if exists t1,t2;
create table t1
(
- a int primary key,
- b char(10)
+a int primary key,
+b char(10)
);
insert into t1 values (1,'one');
insert into t1 values (2,'two');
@@ -88,7 +88,7 @@ explain prepare stmt6 from 'insert into t1 values (5,"five"); select2';
create table t2
(
- a int
+a int
);
insert into t2 values (0);
@@ -143,15 +143,15 @@ drop table t1;
#
create table t1
(
- c1 tinyint, c2 smallint, c3 mediumint, c4 int,
- c5 integer, c6 bigint, c7 float, c8 double,
- c9 double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4),
- c13 date, c14 datetime, c15 timestamp(14), c16 time,
- c17 year, c18 bit, c19 bool, c20 char,
- c21 char(10), c22 varchar(30), c23 tinyblob, c24 tinytext,
- c25 blob, c26 text, c27 mediumblob, c28 mediumtext,
- c29 longblob, c30 longtext, c31 enum('one', 'two', 'three'),
- c32 set('monday', 'tuesday', 'wednesday')
+c1 tinyint, c2 smallint, c3 mediumint, c4 int,
+c5 integer, c6 bigint, c7 float, c8 double,
+c9 double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4),
+c13 date, c14 datetime, c15 timestamp(14), c16 time,
+c17 year, c18 bit, c19 bool, c20 char,
+c21 char(10), c22 varchar(30), c23 tinyblob, c24 tinytext,
+c25 blob, c26 text, c27 mediumblob, c28 mediumtext,
+c29 longblob, c30 longtext, c31 enum('one', 'two', 'three'),
+c32 set('monday', 'tuesday', 'wednesday')
) engine = MYISAM ;
create table t2 like t1;
@@ -181,8 +181,8 @@ drop table t1;
# eq() for parameters
#
create table t1 (id int(10) unsigned NOT NULL default '0',
- name varchar(64) NOT NULL default '',
- PRIMARY KEY (id), UNIQUE KEY `name` (`name`));
+ name varchar(64) NOT NULL default '',
+ PRIMARY KEY (id), UNIQUE KEY `name` (`name`));
insert into t1 values (1,'1'),(2,'2'),(3,'3'),(4,'4'),(5,'5'),(6,'6'),(7,'7');
prepare stmt1 from 'select name from t1 where id=? or id=?';
set @id1=1,@id2=6;
@@ -368,13 +368,13 @@ insert into t1 (a) values (1), (2), (3), (4);
set @precision=10000000000;
--replace_column 1 - 3 -
select rand(),
- cast(rand(10)*@precision as unsigned integer),
- cast(rand(a)*@precision as unsigned integer) from t1;
+ cast(rand(10)*@precision as unsigned integer),
+ cast(rand(a)*@precision as unsigned integer) from t1;
prepare stmt from
"select rand(),
- cast(rand(10)*@precision as unsigned integer),
- cast(rand(a)*@precision as unsigned integer),
- cast(rand(?)*@precision as unsigned integer) from t1";
+ cast(rand(10)*@precision as unsigned integer),
+ cast(rand(a)*@precision as unsigned integer),
+ cast(rand(?)*@precision as unsigned integer) from t1";
set @var=1;
--replace_column 1 - 3 -
execute stmt using @var;
@@ -513,13 +513,13 @@ deallocate prepare stmt;
#
create table t1 (a char(3) not null, b char(3) not null,
- c char(3) not null, primary key (a, b, c));
+ c char(3) not null, primary key (a, b, c));
create table t2 like t1;
# reduced query
prepare stmt from
- "select t1.a from (t1 left outer join t2 on t2.a=1 and t1.b=t2.b)
- where t1.a=1";
+"select t1.a from (t1 left outer join t2 on t2.a=1 and t1.b=t2.b)
+where t1.a=1";
execute stmt;
execute stmt;
execute stmt;
@@ -546,19 +546,19 @@ drop table t1,t2;
#
eval SET @aux= "SELECT COUNT(*)
- FROM INFORMATION_SCHEMA.COLUMNS A,
- INFORMATION_SCHEMA.COLUMNS B
- WHERE A.TABLE_SCHEMA = B.TABLE_SCHEMA
- AND A.TABLE_NAME = B.TABLE_NAME
- AND A.COLUMN_NAME = B.COLUMN_NAME AND
- A.TABLE_NAME = 'user'";
+ FROM INFORMATION_SCHEMA.COLUMNS A,
+ INFORMATION_SCHEMA.COLUMNS B
+ WHERE A.TABLE_SCHEMA = B.TABLE_SCHEMA
+ AND A.TABLE_NAME = B.TABLE_NAME
+ AND A.COLUMN_NAME = B.COLUMN_NAME AND
+ A.TABLE_NAME = 'user'";
let $exec_loop_count= 3;
eval prepare my_stmt from @aux;
while ($exec_loop_count)
{
- eval execute my_stmt;
- dec $exec_loop_count;
+eval execute my_stmt;
+dec $exec_loop_count;
}
deallocate prepare my_stmt;
@@ -572,11 +572,11 @@ create table t1 (id int)|
insert into t1 values(1)|
create procedure p1(a int, b int)
begin
- declare c int;
- select max(id)+1 into c from t1;
- insert into t1 select a+b;
- insert into t1 select a-b;
- insert into t1 select a-c;
+declare c int;
+select max(id)+1 into c from t1;
+insert into t1 select a+b;
+insert into t1 select a-b;
+insert into t1 select a-c;
end|
set @a= 3, @b= 4|
prepare stmt from "call p1(?, ?)"|
@@ -597,7 +597,7 @@ delimiter ;|
drop table if exists t1;
create table t1 (c1 int(11) not null, c2 int(11) not null,
- primary key (c1,c2), key c2 (c2), key c1 (c1));
+ primary key (c1,c2), key c2 (c2), key c1 (c1));
insert into t1 values (200887, 860);
insert into t1 values (200887, 200887);
@@ -614,3 +614,50 @@ set @a=200887, @b=860;
execute stmt using @a, @b;
deallocate prepare stmt;
+drop table t1;
+
+#
+# Bug#9777 - another occurrence of the problem stated in Bug#9096:
+# we can not compare basic constants by their names, because a placeholder
+# is a basic constant while his name is always '?'
+#
+
+create table t1 (
+ id bigint(20) not null auto_increment,
+ code varchar(20) character set utf8 collate utf8_bin not null default '',
+ company_name varchar(250) character set utf8 collate utf8_bin default null,
+ setup_mode tinyint(4) default null,
+ start_date datetime default null,
+ primary key (id), unique key code (code)
+);
+
+create table t2 (
+ id bigint(20) not null auto_increment,
+ email varchar(250) character set utf8 collate utf8_bin default null,
+ name varchar(250) character set utf8 collate utf8_bin default null,
+ t1_id bigint(20) default null,
+ password varchar(250) character set utf8 collate utf8_bin default null,
+ primary_contact tinyint(4) not null default '0',
+ email_opt_in tinyint(4) not null default '1',
+ primary key (id), unique key email (email), key t1_id (t1_id),
+ constraint t2_fk1 foreign key (t1_id) references t1 (id)
+);
+
+insert into t1 values
+(1, 'demo', 'demo s', 0, current_date()),
+(2, 'code2', 'name 2', 0, current_date()),
+(3, 'code3', 'name 3', 0, current_date());
+
+insert into t2 values
+(2, 'email1', 'name1', 3, 'password1', 0, 0),
+(3, 'email2', 'name1', 1, 'password2', 1, 0),
+(5, 'email3', 'name3', 2, 'password3', 0, 0);
+
+prepare stmt from 'select t2.id from t2, t1 where (t1.id=? and t2.t1_id=t1.id)';
+set @a=1;
+execute stmt using @a;
+
+select t2.id from t2, t1 where (t1.id=1 and t2.t1_id=t1.id);
+
+deallocate prepare stmt;
+drop table t1, t2;
diff --git a/ndb/test/src/NDBT_ResultRow.cpp b/ndb/test/src/NDBT_ResultRow.cpp
index 8e92a57d2e4..ab8d7b07ea1 100644
--- a/ndb/test/src/NDBT_ResultRow.cpp
+++ b/ndb/test/src/NDBT_ResultRow.cpp
@@ -116,8 +116,12 @@ BaseString NDBT_ResultRow::c_str() const {
NdbOut &
operator << (NdbOut& ndbout, const NDBT_ResultRow & res) {
- for(int i = 0; i<res.cols; i++)
- ndbout << *(res.data[i]) << "\t";
+ if (res.cols != 0)
+ {
+ ndbout << *(res.data[0]);
+ for(int i = 1; i<res.cols; i++)
+ ndbout << res.ad << *(res.data[i]);
+ }
return ndbout;
}
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc
index 2039ee1498f..0c70713f0d3 100644
--- a/sql/ha_innodb.cc
+++ b/sql/ha_innodb.cc
@@ -6429,15 +6429,15 @@ ha_innobase::store_lock(
(lock_type == TL_READ || lock_type == TL_READ_NO_INSERT) &&
thd->lex->sql_command != SQLCOM_SELECT &&
thd->lex->sql_command != SQLCOM_UPDATE_MULTI &&
- thd->lex->sql_command != SQLCOM_DELETE_MULTI ) {
+ thd->lex->sql_command != SQLCOM_DELETE_MULTI &&
+ thd->lex->sql_command != SQLCOM_LOCK_TABLES) {
/* In case we have innobase_locks_unsafe_for_binlog
option set and isolation level of the transaction
is not set to serializable and MySQL is doing
- INSERT INTO...SELECT without FOR UPDATE or IN
- SHARE MODE we use consistent read for select.
- Similarly, in case of DELETE...SELECT and
- UPDATE...SELECT when these are not multi table.*/
+ INSERT INTO...SELECT or UPDATE ... = (SELECT ...)
+ without FOR UPDATE or IN SHARE MODE in select, then
+ we use consistent read for select. */
prebuilt->select_lock_type = LOCK_NONE;
prebuilt->stored_select_lock_type = LOCK_NONE;
diff --git a/sql/item.cc b/sql/item.cc
index 5a49124fc43..7d0a5fbdccc 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -1341,6 +1341,13 @@ Item_uint::Item_uint(const char *str_arg, uint length):
}
+Item_uint::Item_uint(const char *str_arg, longlong i, uint length):
+ Item_int(str_arg, i, length)
+{
+ unsigned_flag= 1;
+}
+
+
String *Item_uint::val_str(String *str)
{
// following assert is redundant, because fixed=1 assigned in constructor
@@ -2234,7 +2241,9 @@ Item_param::new_item()
case NULL_VALUE:
return new Item_null(name);
case INT_VALUE:
- return new Item_int(name, value.integer, max_length);
+ return (unsigned_flag ?
+ new Item_uint(name, value.integer, max_length) :
+ new Item_int(name, value.integer, max_length));
case REAL_VALUE:
return new Item_float(name, value.real, decimals, max_length);
case STRING_VALUE:
@@ -3517,6 +3526,19 @@ bool Item_int::eq(const Item *arg, bool binary_cmp) const
}
+Item *Item_int_with_ref::new_item()
+{
+ DBUG_ASSERT(ref->basic_const_item());
+ /*
+ We need to evaluate the constant to make sure it works with
+ parameter markers.
+ */
+ return (ref->unsigned_flag ?
+ new Item_uint(ref->name, ref->val_int(), ref->max_length) :
+ new Item_int(ref->name, ref->val_int(), ref->max_length));
+}
+
+
Item_num *Item_uint::neg()
{
Item_decimal *item= new Item_decimal(value, 0);
diff --git a/sql/item.h b/sql/item.h
index 90256503c53..96705b34a3e 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -991,6 +991,7 @@ class Item_uint :public Item_int
{
public:
Item_uint(const char *str_arg, uint length);
+ Item_uint(const char *str_arg, longlong i, uint length);
Item_uint(uint32 i) :Item_int((longlong) i, 10)
{ unsigned_flag= 1; }
double val_real()
@@ -1397,11 +1398,7 @@ public:
{
return ref->save_in_field(field, no_conversions);
}
- Item *new_item()
- {
- return (ref->unsigned_flag)? new Item_uint(ref->name, ref->max_length) :
- new Item_int(ref->name, ref->max_length);
- }
+ Item *new_item();
};
diff --git a/sql/sql_bitmap.h b/sql/sql_bitmap.h
index 5c51f3ecb67..2fd603d9381 100644
--- a/sql/sql_bitmap.h
+++ b/sql/sql_bitmap.h
@@ -91,7 +91,7 @@ template <> class Bitmap<64>
ulonglong map;
public:
Bitmap<64>() { }
-#if defined(__NETWARE__)
+#if defined(__NETWARE__) || defined(__MWERKS__)
/*
Metwork compiler gives error on Bitmap<64>
Changed to Bitmap, since in this case also it will proper construct
diff --git a/support-files/MacOSX/mwar-wrapper b/support-files/MacOSX/mwar-wrapper
new file mode 100755
index 00000000000..4bc5153e7ef
--- /dev/null
+++ b/support-files/MacOSX/mwar-wrapper
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+# This script can only create a library, not take it apart
+# again to AR files
+
+case $1 in
+ -d*|-m*|-t*|-p*|-r*|-x*|x)
+ echo "$0: can't handle arguments $*"
+ exit 1;
+ ;;
+ -c|c|cr|cru|cu)
+ shift;
+ ;;
+esac
+
+exec mwld -lib -o $*
diff --git a/support-files/MacOSX/mwcc-wrapper b/support-files/MacOSX/mwcc-wrapper
new file mode 100755
index 00000000000..914578aca1d
--- /dev/null
+++ b/support-files/MacOSX/mwcc-wrapper
@@ -0,0 +1,48 @@
+#!/bin/sh
+
+if [ -z "$CWINSTALL" ] ; then
+ echo "ERROR: You need to source 'mwvars' to set CWINSTALL and other variables"
+ exit 1
+fi
+
+if [ `expr "$MWMacOSXPPCLibraryFiles" : ".*BSD.*"` = 0 ] ; then
+ echo "ERROR: You need to source 'mwvars' with the 'bsd' argument"
+ exit 1
+fi
+
+# ==============================================================================
+
+# Extra options that don't change
+
+PREOPTS="-D__SCHAR_MAX__=127 -D__CHAR_BIT__=8 -ext o -gccinc"
+PREOPTS="$PREOPTS -wchar_t on -bool on -relax_pointers -align power_gcc"
+PREOPTS="$PREOPTS -stabs all -fno-handle-exceptions -Cpp_exceptions off"
+
+# ==============================================================================
+
+# We want the "PPC Specific" directory to be last, before the source
+# file. It is to work around a CodeWarrior/Apple bug, that we need a
+# Metrowersk header even though we have configured CodeWarrior to use
+# the BSD headers. But not to conflict, the directory has to be last.
+
+# FIXME this will probably break if one path contains space characters
+
+PREARGS=""
+for i in $* ; do
+ case "$i" in
+ -bind_at_load)
+ # This is a flag some version of libtool adds, when the host
+ # is "*darwin*". It doesn't check that it is gcc.
+ # FIXME add some flag?!
+ ;;
+ *.c|*.cc|*.cpp)
+ break
+ ;;
+ *)
+ PREARGS="$PREARGS $1"
+ ;;
+ esac
+ shift
+done
+#echo "mwcc $PREOPTS $PREARGS -I\"$CWINSTALL/MacOS X Support/Headers/PPC Specific\" $*"
+exec mwcc $PREOPTS $PREARGS -I"$CWINSTALL/MacOS X Support/Headers/PPC Specific" $*