diff --git a/cmd-line-utils/libedit/makelist.sh b/cmd-line-utils/libedit/makelist.sh
index fdd3f934e150b0b61ce216b32ed176368f339d05..5d25b4776c9a29ea9bc086837122babf8d6281b9 100644
--- a/cmd-line-utils/libedit/makelist.sh
+++ b/cmd-line-utils/libedit/makelist.sh
@@ -84,7 +84,7 @@ case $FLAG in
     cat $FILES | $AWK '
 	BEGIN {
 	    printf("/* Automatically generated file, do not edit */\n");
-	    printf("#include \"sys.h\"\n#include \"el.h\"\n");
+	    printf("#include \"config.h\"\n#include \"el.h\"\n");
 	    printf("private const struct el_bindings_t el_func_help[] = {\n");
 	    low = "abcdefghijklmnopqrstuvwxyz_";
 	    high = "ABCDEFGHIJKLMNOPQRSTUVWXYZ_";
@@ -169,7 +169,7 @@ case $FLAG in
     cat $FILES | $AWK '/el_action_t/ { print $3 }' | sort | $AWK '
 	BEGIN {
 	    printf("/* Automatically generated file, do not edit */\n");
-	    printf("#include \"sys.h\"\n#include \"el.h\"\n");
+	    printf("#include \"config.h\"\n#include \"el.h\"\n");
 	    printf("private const el_func_t el_func[] = {");
 	    maxlen = 80;
 	    needn = 1;
diff --git a/cmd-line-utils/libedit/readline.c b/cmd-line-utils/libedit/readline.c
index ca8796fbd3741892f6e2eb5e3dea0b60919c1979..1f1b18c97d8cd1106c13dd1e2d78c6b5795e0e7a 100644
--- a/cmd-line-utils/libedit/readline.c
+++ b/cmd-line-utils/libedit/readline.c
@@ -51,13 +51,10 @@
 #else
 #include "np/vis.h"
 #endif
-#ifdef HAVE_ALLOCA_H
-#include <alloca.h>
-#endif
+#include "readline/readline.h"
 #include "el.h"
 #include "fcns.h"		/* for EL_NUM_FCNS */
 #include "histedit.h"
-#include "readline/readline.h"
 #include "filecomplete.h"
 
 void rl_prep_terminal(int);
diff --git a/cmd-line-utils/libedit/readline/readline.h b/cmd-line-utils/libedit/readline/readline.h
index c4806734bc5798f6c7e5ca97b70943050d5c90fd..c77b080c4399bfb02b9c469b3a2d05ec17140cd9 100644
--- a/cmd-line-utils/libedit/readline/readline.h
+++ b/cmd-line-utils/libedit/readline/readline.h
@@ -66,7 +66,7 @@ typedef KEYMAP_ENTRY *Keymap;
 
 #ifndef CTRL
 #include <sys/ioctl.h>
-#if !defined(__sun__) && !defined(__hpux__)
+#if !defined(__sun) && !defined(__hpux) && !defined(_AIX)
 #include <sys/ttydefaults.h>
 #endif
 #ifndef CTRL
diff --git a/cmd-line-utils/libedit/vi.c b/cmd-line-utils/libedit/vi.c
index 602383f323168b61971c463dfca393240af32d96..00a9f493a9b808653c34803d5a6cd006cd1c5ecb 100644
--- a/cmd-line-utils/libedit/vi.c
+++ b/cmd-line-utils/libedit/vi.c
@@ -914,14 +914,14 @@ vi_comment_out(EditLine *el, int c)
  * NB: posix implies that we should enter insert mode, however
  * this is against historical precedent...
  */
-#ifdef __weak_reference
+#if defined(__weak_reference) && !defined(__FreeBSD__)
 extern char *get_alias_text(const char *) __weak_reference(get_alias_text);
 #endif
 protected el_action_t
 /*ARGSUSED*/
 vi_alias(EditLine *el, int c)
 {
-#ifdef __weak_reference
+#if defined(__weak_reference) && !defined(__FreeBSD__)
 	char alias_name[3];
 	char *alias_text;
 
diff --git a/configure.in b/configure.in
index bdeb0f24c40341312b0b356d25d9cdbadf0b5dbc..bed74daf809d86d887facd2dfcc7a2aef2248b9e 100644
--- a/configure.in
+++ b/configure.in
@@ -36,6 +36,7 @@ MYSQL_NUMERIC_VERSION=`echo $MYSQL_NO_DASH_VERSION | sed -e "s|[[a-z]][[a-z0-9]]
 MYSQL_BASE_VERSION=`echo $MYSQL_NUMERIC_VERSION | sed -e "s|\.[[^.]]*$||"`
 MYSQL_VERSION_ID=`echo $MYSQL_NUMERIC_VERSION | \
     awk -F. '{printf "%d%0.2d%0.2d", $1, $2, $3}'`
+MYSQL_COPYRIGHT_YEAR=`date '+%Y'`
 
 # Add previous major version for debian package upgrade path
 MYSQL_PREVIOUS_BASE_VERSION=5.0
@@ -70,6 +71,7 @@ AC_SUBST(MYSQL_NO_DASH_VERSION)
 AC_SUBST(MYSQL_BASE_VERSION)
 AC_SUBST(MYSQL_VERSION_ID)
 AC_SUBST(MYSQL_PREVIOUS_BASE_VERSION)
+AC_SUBST(MYSQL_COPYRIGHT_YEAR)
 AC_SUBST(PROTOCOL_VERSION)
 AC_DEFINE_UNQUOTED([PROTOCOL_VERSION], [$PROTOCOL_VERSION],
                    [mysql client protocol version])
diff --git a/mysql-test/Makefile.am b/mysql-test/Makefile.am
index 7661cba7ba48ebd2c54c4cea9359f70d0dc509c1..5e3582d5e16e5a1e58190a50c7ac4ce8a41cc0c5 100644
--- a/mysql-test/Makefile.am
+++ b/mysql-test/Makefile.am
@@ -81,7 +81,7 @@ TEST_DIRS = t r include std_data std_data/parts collections \
 	std_data/funcs_1 \
 	extra/binlog_tests/ extra/rpl_tests \
 	suite/binlog suite/binlog/t suite/binlog/r suite/binlog/std_data \
-	suite/bugs/data suite/bugs/t suite/bugs/r \
+	suite/bugs suite/bugs/data suite/bugs/t suite/bugs/r \
 	suite/federated \
 	suite/funcs_1 suite/funcs_1/bitdata \
 	suite/funcs_1/include suite/funcs_1/lib suite/funcs_1/r \
@@ -90,7 +90,7 @@ TEST_DIRS = t r include std_data std_data/parts collections \
 	suite/funcs_2 suite/funcs_2/charset suite/funcs_2/data \
 	suite/funcs_2/include suite/funcs_2/lib suite/funcs_2/r \
 	suite/funcs_2/t \
-	suite/jp suite/jp/t suite/jp/r suite/jp/std_data \
+	suite/jp suite/jp/t suite/jp/r suite/jp/std_data suite/jp/include \
 	suite/manual/t suite/manual/r \
 	suite/ndb_team suite/ndb_team/t suite/ndb_team/r \
 	suite/rpl suite/rpl/data suite/rpl/include suite/rpl/r \
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index 89c68e02a4c391c16f1b7afa97b6bd774b05de92..cc87921c928903324a19c6b86daeaf2d8fd026fe 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -110,8 +110,8 @@ my $opt_tmpdir;                 # Path to use for tmp/ dir
 my $opt_tmpdir_pid;
 
 END {
-  if (defined $opt_tmpdir_pid and
-      $opt_tmpdir_pid == $$){
+  if ( defined $opt_tmpdir_pid and $opt_tmpdir_pid == $$ )
+  {
     # Remove the tempdir this process has created
     mtr_verbose("Removing tmpdir '$opt_tmpdir");
     rmtree($opt_tmpdir);
diff --git a/support-files/Makefile.am b/support-files/Makefile.am
index a6001e635e6141cd1c95ddc05788c249a88321d0..77eddea3227ae590b53cb7329eb2bc324bab32f3 100644
--- a/support-files/Makefile.am
+++ b/support-files/Makefile.am
@@ -119,6 +119,7 @@ SUFFIXES = .sh
 	  -e 's!@''SHARED_LIB_VERSION''@!@SHARED_LIB_VERSION@!' \
 	  -e 's!@''MYSQL_BASE_VERSION''@!@MYSQL_BASE_VERSION@!' \
 	  -e 's!@''MYSQL_NO_DASH_VERSION''@!@MYSQL_NO_DASH_VERSION@!' \
+	  -e 's!@''MYSQL_COPYRIGHT_YEAR''@!@MYSQL_COPYRIGHT_YEAR@!' \
 	  -e 's!@''MYSQL_TCP_PORT''@!@MYSQL_TCP_PORT@!' \
 	  -e 's!@''PERL_DBI_VERSION''@!@PERL_DBI_VERSION@!' \
 	  -e 's!@''PERL_DBD_VERSION''@!@PERL_DBD_VERSION@!' \
diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh
index 7c08fdf4734e92d61e3033dcc95e8bb7ce121485..778b04b30fe8885de6a0c742d7cb72eafeb527b7 100644
--- a/support-files/mysql.spec.sh
+++ b/support-files/mysql.spec.sh
@@ -41,7 +41,7 @@
 %else
 %define release 0.glibc23
 %endif
-%define license GPL
+%define mysql_license	GPL
 %define mysqld_user	mysql
 %define mysqld_group	mysql
 %define server_suffix -standard
@@ -75,7 +75,7 @@ Summary:	MySQL: a very fast and reliable SQL database server
 Group:		Applications/Databases
 Version:	@MYSQL_NO_DASH_VERSION@
 Release:	%{release}
-License:	Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.  All rights reserved.  Use is subject to license terms.  Under %{license} license as shown in the Description field.
+License:	Copyright 2000-2008 MySQL AB, @MYSQL_COPYRIGHT_YEAR@ Sun Microsystems, Inc.  All rights reserved.  Use is subject to license terms.  Under %{mysql_license} license as shown in the Description field.
 Source:		http://www.mysql.com/Downloads/MySQL-@MYSQL_BASE_VERSION@/mysql-%{mysql_version}.tar.gz
 URL:		http://www.mysql.com/
 Packager:	Sun Microsystems, Inc. Product Engineering Team <build@mysql.com>
@@ -96,7 +96,7 @@ is intended for mission-critical, heavy-load production systems as well
 as for embedding into mass-deployed software. MySQL is a trademark of
 Sun Microsystems, Inc.
 
-Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.  All rights reserved.
+Copyright 2000-2008 MySQL AB, @MYSQL_COPYRIGHT_YEAR@ Sun Microsystems, Inc.  All rights reserved.
 Use is subject to license terms.
 
 This software comes with ABSOLUTELY NO WARRANTY. This is free software,
@@ -120,7 +120,7 @@ is intended for mission-critical, heavy-load production systems as well
 as for embedding into mass-deployed software. MySQL is a trademark of
 Sun Microsystems, Inc.
 
-Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.  All rights reserved.
+Copyright 2000-2008 MySQL AB, @MYSQL_COPYRIGHT_YEAR@ Sun Microsystems, Inc.  All rights reserved.
 Use is subject to license terms.
 
 This software comes with ABSOLUTELY NO WARRANTY. This is free software,
@@ -366,7 +366,7 @@ CFLAGS="$CFLAGS" \
 CXXFLAGS="$CXXFLAGS" \
 BuildMySQL "\
 		--with-debug \
-		--with-comment=\"MySQL Community Server - Debug (%{license})\"")
+		--with-comment=\"MySQL Community Server - Debug (%{mysql_license})\"")
 
 # We might want to save the config log file
 if test -n "$MYSQL_DEBUGCONFLOG_DEST"
@@ -387,7 +387,7 @@ CFLAGS="$CFLAGS" \
 CXXFLAGS="$CXXFLAGS" \
 BuildMySQL "\
 		--with-embedded-server \
-		--with-comment=\"MySQL Community Server (%{license})\"")
+		--with-comment=\"MySQL Community Server (%{mysql_license})\"")
 # We might want to save the config log file
 if test -n "$MYSQL_CONFLOG_DEST"
 then