Commit 81c2337f authored by unknown's avatar unknown

--with-collation argument for configure. Now one can for example use this:

./configure --with-charset=latin1 --with-collation=latin1_danish_ci
parent 7c2c03b9
...@@ -19,7 +19,10 @@ ...@@ -19,7 +19,10 @@
#undef CRAY_STACKSEG_END #undef CRAY_STACKSEG_END
/* Define the default charset name */ /* Define the default charset name */
#undef DEFAULT_CHARSET_NAME #undef MYSQL_DEFAULT_CHARSET_NAME
/* Define the default charset name */
#undef MYSQL_DEFAULT_COLLATION_NAME
/* Version of .frm files */ /* Version of .frm files */
#undef DOT_FRM_VERSION #undef DOT_FRM_VERSION
......
...@@ -139,7 +139,7 @@ static my_string opt_mysql_unix_port=0; ...@@ -139,7 +139,7 @@ static my_string opt_mysql_unix_port=0;
static int connect_flag=CLIENT_INTERACTIVE; static int connect_flag=CLIENT_INTERACTIVE;
static char *current_host,*current_db,*current_user=0,*opt_password=0, static char *current_host,*current_db,*current_user=0,*opt_password=0,
*current_prompt=0, *delimiter_str= 0, *current_prompt=0, *delimiter_str= 0,
*default_charset= (char*) MYSQL_CHARSET; *default_charset= (char*) MYSQL_DEFAULT_CHARSET_NAME;
static char *histfile; static char *histfile;
static String glob_buffer,old_buffer; static String glob_buffer,old_buffer;
static String processed_prompt; static String processed_prompt;
......
...@@ -38,7 +38,8 @@ static my_bool opt_alldbs = 0, opt_check_only_changed = 0, opt_extended = 0, ...@@ -38,7 +38,8 @@ static my_bool opt_alldbs = 0, opt_check_only_changed = 0, opt_extended = 0,
static uint verbose = 0, opt_mysql_port=0; static uint verbose = 0, opt_mysql_port=0;
static my_string opt_mysql_unix_port = 0; static my_string opt_mysql_unix_port = 0;
static char *opt_password = 0, *current_user = 0, static char *opt_password = 0, *current_user = 0,
*default_charset = (char *)MYSQL_CHARSET, *current_host = 0; *default_charset = (char *)MYSQL_DEFAULT_CHARSET_NAME,
*current_host = 0;
static int first_error = 0; static int first_error = 0;
DYNAMIC_ARRAY tables4repair; DYNAMIC_ARRAY tables4repair;
#ifdef HAVE_SMEM #ifdef HAVE_SMEM
......
...@@ -85,7 +85,7 @@ static MYSQL mysql_connection,*sock=0; ...@@ -85,7 +85,7 @@ static MYSQL mysql_connection,*sock=0;
static char insert_pat[12 * 1024],*opt_password=0,*current_user=0, static char insert_pat[12 * 1024],*opt_password=0,*current_user=0,
*current_host=0,*path=0,*fields_terminated=0, *current_host=0,*path=0,*fields_terminated=0,
*lines_terminated=0, *enclosed=0, *opt_enclosed=0, *escaped=0, *lines_terminated=0, *enclosed=0, *opt_enclosed=0, *escaped=0,
*where=0, *default_charset= (char *)MYSQL_CHARSET, *where=0, *default_charset= (char *)MYSQL_DEFAULT_CHARSET_NAME,
*opt_compatible_mode_str= 0, *opt_compatible_mode_str= 0,
*err_ptr= 0; *err_ptr= 0;
static ulong opt_compatible_mode= 0; static ulong opt_compatible_mode= 0;
......
...@@ -44,7 +44,7 @@ static char *opt_password=0, *current_user=0, ...@@ -44,7 +44,7 @@ static char *opt_password=0, *current_user=0,
*current_host=0, *current_db=0, *fields_terminated=0, *current_host=0, *current_db=0, *fields_terminated=0,
*lines_terminated=0, *enclosed=0, *opt_enclosed=0, *lines_terminated=0, *enclosed=0, *opt_enclosed=0,
*escaped=0, *opt_columns=0, *escaped=0, *opt_columns=0,
*default_charset= (char*) MYSQL_CHARSET; *default_charset= (char*) MYSQL_DEFAULT_CHARSET_NAME;
static uint opt_mysql_port=0; static uint opt_mysql_port=0;
static my_string opt_mysql_unix_port=0; static my_string opt_mysql_unix_port=0;
static my_string opt_ignore_lines=0; static my_string opt_ignore_lines=0;
......
...@@ -2255,6 +2255,12 @@ AC_ARG_WITH(charset, ...@@ -2255,6 +2255,12 @@ AC_ARG_WITH(charset,
[default_charset="$withval"], [default_charset="$withval"],
[default_charset="$DEFAULT_CHARSET"]) [default_charset="$DEFAULT_CHARSET"])
AC_ARG_WITH(collation,
[ --with-collation=COLLATION
Default collation],
[default_collation="$withval"],
[default_collation="default"])
AC_ARG_WITH(extra-charsets, AC_ARG_WITH(extra-charsets,
[ --with-extra-charsets=CHARSET[,CHARSET,...] [ --with-extra-charsets=CHARSET[,CHARSET,...]
...@@ -2281,7 +2287,6 @@ else ...@@ -2281,7 +2287,6 @@ else
CHARSETS="$CHARSETS $EXTRA_CHARSETS" CHARSETS="$CHARSETS $EXTRA_CHARSETS"
fi fi
for cs in $CHARSETS for cs in $CHARSETS
do do
case $cs in case $cs in
...@@ -2404,11 +2409,169 @@ do ...@@ -2404,11 +2409,169 @@ do
done done
AC_SUBST(default_charset) default_charset_collations=""
AC_DEFINE_UNQUOTED(DEFAULT_CHARSET_NAME,"$default_charset")
AC_MSG_RESULT([default: $default_charset; compiled in: $CHARSETS]) case $default_charset in
armscii8)
default_charset_default_collation="armscii8_general_ci"
default_charset_collations="armscii8_general_ci armscii_bin"
;;
ascii)
default_charset_default_collation="ascii_general_ci"
default_charset_collations="ascii_general_ci ascii_bin"
;;
big5)
default_charset_default_collation="big5_chinese_ci"
default_charset_collations="big5_chinese_ci big5_bin"
;;
cp1250)
default_charset_default_collation="cp1250_general_ci"
default_charset_collations="cp1250_general_ci cp1250_czech_ci cp1250_bin"
;;
cp1251)
default_charset_default_collation="cp1251_general_ci"
default_charset_collations="cp1251_general_ci cp1251_general_cs cp1251_bin cp1251_bulgarian_ci cp1251_ukrainian_ci"
;;
cp1256)
default_charset_default_collation="cp1256_general_ci"
default_charset_collations="cp1256_general_ci cp1256_bin"
;;
cp1257)
default_charset_default_collation="cp1257_general_ci"
default_charset_collations="cp1257_general_ci cp1257_lithuanian_ci cp1257_bin"
;;
cp850)
default_charset_default_collation="cp850_general_ci"
default_charset_collations="cp850_general_ci cp850_bin"
;;
cp852)
default_charset_default_collation="cp852_general_ci"
default_charset_collations="cp852_general_ci cp852_bin"
;;
cp866)
default_charset_default_collation="cp866_general_ci"
default_charset_collations="cp866_general_ci cp866_bin"
;;
dec8)
default_charset_default_collation="dec8_swedish_ci"
default_charset_collations="dec8_swedish_ci dec8_bin"
;;
euckr)
default_charset_default_collation="euckr_korean_ci"
default_charset_collations="euckr_korean_ci euckr_bin"
;;
gb2312)
default_charset_default_collation="gb2312_chinese_ci"
default_charset_collations="gb2312_chinese_ci gb2312_bin"
;;
gbk)
default_charset_default_collation="gbk_chinese_ci"
default_charset_collations="gbk_chinese_ci gbk_bin"
;;
greek)
default_charset_default_collation="greek_general_ci"
default_charset_collations="greek_general_ci greek_bin"
;;
hebrew)
default_charset_default_collation="hebrew_general_ci"
default_charset_collations="hebrew_general_ci hebrew_bin"
;;
hp8)
default_charset_default_collation="hp8_english_ci"
default_charset_collations="hp8_english_ci hp8_bin"
;;
keybcs2)
default_charset_default_collation="keybcs2_general_ci"
default_charset_collations="keybcs2_general_ci keybcs2_bin"
;;
koi8r)
default_charset_default_collation="koi8r_general_ci"
default_charset_collations="koi8r_general_ci koi8r_bin"
;;
koi8u)
default_charset_default_collation="koi8u_general_ci"
default_charset_collations="koi8u_general_ci koi8u_bin"
;;
latin1)
default_charset_default_collation="latin1_swedish_ci"
default_charset_collations="latin1_general_ci latin1_general_cs latin1_bin latin1_german1_ci latin1_german2_ci latin1_danish_ci latin1_swedish_ci"
;;
latin2)
default_charset_default_collation="latin2_general_ci"
default_charset_collations="latin2_general_ci latin2_bin latin2_czech_ci latin2_hungarian_ci latin2_croatian_ci"
;;
latin5)
default_charset_default_collation="latin5_turkish_ci"
default_charset_collations="latin5_turkish_ci latin5_bin"
;;
latin7)
default_charset_default_collation="latin7_general_ci"
default_charset_collations="latin7_general_ci latin7_general_cs latin7_bin latin7_estonian_cs"
;;
macce)
default_charset_default_collation="macce_general_ci"
default_charset_collations="macce_general_ci macce_bin"
;;
macroman)
default_charset_default_collation="macroman_general_ci"
default_charset_collations="macroman_general_ci macroman_bin"
;;
sjis)
default_charset_default_collation="sjis_japanese_ci"
default_charset_collations="sjis_japanese_ci sjis_bin"
;;
swe7)
default_charset_default_collation="swe7_swedish_ci"
default_charset_collations="swe7_swedish_ci swe7_bin"
;;
tis620)
default_charset_default_collation="tis620_thai_ci"
default_charset_collations="tis620_thai_ci tis620_bin"
;;
ucs2)
default_charset_default_collation="ucs2_general_ci"
default_charset_collations="ucs2_general_ci ucs2_bin"
;;
ujis)
default_charset_default_collation="ujis_japanese_ci"
default_charset_collations="ujis_japanese_ci ujis_bin"
;;
utf8)
default_charset_default_collation="utf8_general_ci"
default_charset_collations="utf8_general_ci utf8_bin"
;;
*)
AC_MSG_ERROR([Charset $cs not available. (Available are: $CHARSETS_AVAILABLE).
See the Installation chapter in the Reference Manual.]);
esac
if test "$default_collation" = default; then
default_collation=$default_charset_default_collation
fi
valid_default_collation=no
for cl in $default_charset_collations
do
if test x"$cl" = x"$default_collation"
then
valid_default_collation=yes
break
fi
done
if test x$valid_default_collation = xyes
then
AC_MSG_RESULT([default: $default_charset, collation: $default_collation; compiled in: $CHARSETS])
else
AC_MSG_ERROR([
Collation $default_collation is not valid for character set $default_charset.
Valid collations are: $default_charset_collations.
See the Installation chapter in the Reference Manual.
]);
fi
AC_DEFINE_UNQUOTED(MYSQL_DEFAULT_CHARSET_NAME,"$default_charset")
AC_DEFINE_UNQUOTED(MYSQL_DEFAULT_COLLATION_NAME,"$default_collation")
MYSQL_CHECK_ISAM MYSQL_CHECK_ISAM
MYSQL_CHECK_BDB MYSQL_CHECK_BDB
......
...@@ -20,8 +20,5 @@ ...@@ -20,8 +20,5 @@
#define MYSQL_CONFIG_NAME "my" #define MYSQL_CONFIG_NAME "my"
/* mysqld compile time options */ /* mysqld compile time options */
#ifndef MYSQL_CHARSET
#define MYSQL_CHARSET "@default_charset@"
#endif /* MYSQL_CHARSET */
#endif /* _CUSTOMCONFIG_ */ #endif /* _CUSTOMCONFIG_ */
#endif /* _mysql_version_h */ #endif /* _mysql_version_h */
...@@ -4642,7 +4642,7 @@ static void mysql_init_variables(void) ...@@ -4642,7 +4642,7 @@ static void mysql_init_variables(void)
pidfile_name_ptr= pidfile_name; pidfile_name_ptr= pidfile_name;
log_error_file_ptr= log_error_file; log_error_file_ptr= log_error_file;
language_ptr= language; language_ptr= language;
default_collation_name= 0; default_collation_name= (char*) MYSQL_DEFAULT_COLLATION_NAME;
mysql_data_home= mysql_real_data_home; mysql_data_home= mysql_real_data_home;
thd_startup_options= (OPTION_UPDATE_LOG | OPTION_AUTO_IS_NULL | thd_startup_options= (OPTION_UPDATE_LOG | OPTION_AUTO_IS_NULL |
OPTION_BIN_LOG | OPTION_QUOTE_SHOW_CREATE); OPTION_BIN_LOG | OPTION_QUOTE_SHOW_CREATE);
...@@ -4681,7 +4681,7 @@ static void mysql_init_variables(void) ...@@ -4681,7 +4681,7 @@ static void mysql_init_variables(void)
/* Variables in libraries */ /* Variables in libraries */
charsets_dir= 0; charsets_dir= 0;
sys_charset.value= (char*) MYSQL_CHARSET; sys_charset.value= (char*) MYSQL_DEFAULT_CHARSET_NAME;
sys_charset_system.value= (char*) system_charset_info->csname; sys_charset_system.value= (char*) system_charset_info->csname;
/* Set default values for some option variables */ /* Set default values for some option variables */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment