~drizzle-trunk/drizzle/development

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
dnl In order to add new charset, you must add charset name to
dnl this CHARSETS_AVAILABLE list and sql/share/charsets/Index.xml.
dnl If the character set uses strcoll or other special handling,
dnl you must also create strings/ctype-$charset_name.c

AC_DIVERT_PUSH(0)

define(CHARSETS_AVAILABLE0,binary)
define(CHARSETS_AVAILABLE5,utf8)

DEFAULT_CHARSET=utf8
CHARSETS_AVAILABLE="CHARSETS_AVAILABLE0 CHARSETS_AVAILABLE5"
CHARSETS_COMPLEX="utf8"

AC_DIVERT_POP

AC_ARG_WITH(charset,
   [  --with-charset=CHARSET
                          Default character set, use one of: CHARSETS_AVAILABLE0 CHARSETS_AVAILABLE5],
   [default_charset="$withval"],
   [default_charset="$DEFAULT_CHARSET"])

AC_ARG_WITH(collation,
   [  --with-collation=COLLATION
                          Default collation],
   [default_collation="$withval"],
   [default_collation="default"])

AC_MSG_CHECKING("character sets")

CHARSETS="$default_charset utf8 utf8mb3"

for cs in $CHARSETS
do
  case $cs in 
    binary)
      ;;
    utf8)
      AC_DEFINE(HAVE_CHARSET_utf8mb4, 1, [Define to enable ut8])
      AC_DEFINE([USE_MB], 1, [Use multi-byte character routines])
      AC_DEFINE(USE_MB_IDENT, [1], [ ])
      ;;
    utf8mb3)
      AC_DEFINE(HAVE_CHARSET_utf8mb3, 1, [Define to enable ut8])
      AC_DEFINE([USE_MB], 1, [Use multi-byte character routines])
      AC_DEFINE(USE_MB_IDENT, 1)
      ;;
    *)
      AC_MSG_ERROR([Charset '$cs' not available. (Available are: $CHARSETS_AVAILABLE).
      See the Installation chapter in the Reference Manual.])
  esac
done


      default_charset_collations=""

case $default_charset in 
    utf8)
      default_charset_default_collation="utf8_general_ci"
      define(UTFC1, utf8_general_ci utf8_bin)
      define(UTFC2, utf8_czech_ci utf8_danish_ci)
      define(UTFC3, utf8_esperanto_ci utf8_estonian_ci utf8_icelandic_ci)
      define(UTFC4, utf8_latvian_ci utf8_lithuanian_ci)
      define(UTFC5, utf8_persian_ci utf8_polish_ci utf8_romanian_ci)
      define(UTFC6, utf8_sinhala_ci utf8_slovak_ci utf8_slovenian_ci)
      define(UTFC7, utf8_spanish2_ci utf8_spanish_ci)
      define(UTFC8, utf8_swedish_ci utf8_turkish_ci)
      define(UTFC9, utf8_unicode_ci)
      UTFC="UTFC1 UTFC2 UTFC3 UTFC4 UTFC5 UTFC6 UTFC7 UTFC8 UTFC9"
      default_charset_collations="$UTFC"
      ;;
    utf8mb3)
      default_charset_default_collation="utf8mb3_general_ci"
      if test "$default_collation" = "utf8mb3_general_cs"; then
        # For those who explicitly desire "utf8mb3_general_cs", support it,
        # and then also set the CPP switch enabling that code.
        UTFC="utf8mb3_general_cs"
        AC_DEFINE([HAVE_UTF8_GENERAL_CS], [1], [certain Japanese customer])
      else
        define(UTFC1, utf8mb3_general_ci utf8mb3_bin)
        define(UTFC2, utf8mb3_czech_ci utf8mb3_danish_ci)
        define(UTFC3, utf8mb3_esperanto_ci utf8mb3_estonian_ci utf8mb3_icelandic_ci)
        define(UTFC4, utf8mb3_latvian_ci utf8mb3_lithuanian_ci)
        define(UTFC5, utf8mb3_persian_ci utf8mb3_polish_ci utf8mb3_romanian_ci)
        define(UTFC6, utf8mb3_sinhala_ci utf8mb3_slovak_ci utf8mb3_slovenian_ci)
        define(UTFC7, utf8mb3_spanish2_ci utf8mb3_spanish_ci)
        define(UTFC8, utf8mb3_swedish_ci utf8mb3_turkish_ci)
        define(UTFC9, utf8mb3_unicode_ci)
        UTFC="UTFC1 UTFC2 UTFC3 UTFC4 UTFC5 UTFC6 UTFC7 UTFC8 UTFC9"
      fi
      default_charset_collations="$UTFC"
      ;;
    *)
      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([DRIZZLE_DEFAULT_CHARSET_NAME], ["$default_charset"],
                   [Define the default charset name])
AC_DEFINE_UNQUOTED([DRIZZLE_DEFAULT_COLLATION_NAME], ["$default_collation"],
                   [Define the default charset name])