~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to m4/character_sets.m4

  • Committer: Monty Taylor
  • Date: 2008-12-17 04:54:32 UTC
  • mto: (685.1.38 devel) (713.1.1 devel)
  • mto: This revision was merged to the branch mainline in revision 713.
  • Revision ID: monty@inaugust.com-20081217045432-dw4425razy7do46i
Fixed bool. No more sql_mode.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
dnl In order to add new charset, you must add charset name to
 
2
dnl this CHARSETS_AVAILABLE list and sql/share/charsets/Index.xml.
 
3
dnl If the character set uses strcoll or other special handling,
 
4
dnl you must also create strings/ctype-$charset_name.c
 
5
 
 
6
AC_DIVERT_PUSH(0)
 
7
 
 
8
define(CHARSETS_AVAILABLE0,binary)
 
9
define(CHARSETS_AVAILABLE5,utf8)
 
10
 
 
11
DEFAULT_CHARSET=utf8
 
12
CHARSETS_AVAILABLE="CHARSETS_AVAILABLE0 CHARSETS_AVAILABLE5"
 
13
CHARSETS_COMPLEX="utf8"
 
14
 
 
15
AC_DIVERT_POP
 
16
 
 
17
AC_ARG_WITH(charset,
 
18
   [  --with-charset=CHARSET
 
19
                          Default character set, use one of: CHARSETS_AVAILABLE0 CHARSETS_AVAILABLE5],
 
20
   [default_charset="$withval"],
 
21
   [default_charset="$DEFAULT_CHARSET"])
 
22
 
 
23
AC_ARG_WITH(collation,
 
24
   [  --with-collation=COLLATION
 
25
                          Default collation],
 
26
   [default_collation="$withval"],
 
27
   [default_collation="default"])
 
28
 
 
29
AC_MSG_CHECKING("character sets")
 
30
 
 
31
CHARSETS="$default_charset utf8 utf8mb3"
 
32
 
 
33
for cs in $CHARSETS
 
34
do
 
35
  case $cs in 
 
36
    binary)
 
37
      ;;
 
38
    utf8)
 
39
      AC_DEFINE(HAVE_CHARSET_utf8mb4, 1, [Define to enable ut8])
 
40
      AC_DEFINE([USE_MB], 1, [Use multi-byte character routines])
 
41
      AC_DEFINE(USE_MB_IDENT, [1], [ ])
 
42
      ;;
 
43
    utf8mb3)
 
44
      AC_DEFINE(HAVE_CHARSET_utf8mb3, 1, [Define to enable ut8])
 
45
      AC_DEFINE([USE_MB], 1, [Use multi-byte character routines])
 
46
      AC_DEFINE(USE_MB_IDENT, 1)
 
47
      ;;
 
48
    *)
 
49
      AC_MSG_ERROR([Charset '$cs' not available. (Available are: $CHARSETS_AVAILABLE).
 
50
      See the Installation chapter in the Reference Manual.])
 
51
  esac
 
52
done
 
53
 
 
54
 
 
55
      default_charset_collations=""
 
56
 
 
57
case $default_charset in 
 
58
    utf8)
 
59
      default_charset_default_collation="utf8_general_ci"
 
60
      define(UTFC1, utf8_general_ci utf8_bin)
 
61
      define(UTFC2, utf8_czech_ci utf8_danish_ci)
 
62
      define(UTFC3, utf8_esperanto_ci utf8_estonian_ci utf8_icelandic_ci)
 
63
      define(UTFC4, utf8_latvian_ci utf8_lithuanian_ci)
 
64
      define(UTFC5, utf8_persian_ci utf8_polish_ci utf8_romanian_ci)
 
65
      define(UTFC6, utf8_sinhala_ci utf8_slovak_ci utf8_slovenian_ci)
 
66
      define(UTFC7, utf8_spanish2_ci utf8_spanish_ci)
 
67
      define(UTFC8, utf8_swedish_ci utf8_turkish_ci)
 
68
      define(UTFC9, utf8_unicode_ci)
 
69
      UTFC="UTFC1 UTFC2 UTFC3 UTFC4 UTFC5 UTFC6 UTFC7 UTFC8 UTFC9"
 
70
      default_charset_collations="$UTFC"
 
71
      ;;
 
72
    utf8mb3)
 
73
      default_charset_default_collation="utf8mb3_general_ci"
 
74
      if test "$default_collation" = "utf8mb3_general_cs"; then
 
75
        # For those who explicitly desire "utf8mb3_general_cs", support it,
 
76
        # and then also set the CPP switch enabling that code.
 
77
        UTFC="utf8mb3_general_cs"
 
78
        AC_DEFINE([HAVE_UTF8_GENERAL_CS], [1], [certain Japanese customer])
 
79
      else
 
80
        define(UTFC1, utf8mb3_general_ci utf8mb3_bin)
 
81
        define(UTFC2, utf8mb3_czech_ci utf8mb3_danish_ci)
 
82
        define(UTFC3, utf8mb3_esperanto_ci utf8mb3_estonian_ci utf8mb3_icelandic_ci)
 
83
        define(UTFC4, utf8mb3_latvian_ci utf8mb3_lithuanian_ci)
 
84
        define(UTFC5, utf8mb3_persian_ci utf8mb3_polish_ci utf8mb3_romanian_ci)
 
85
        define(UTFC6, utf8mb3_sinhala_ci utf8mb3_slovak_ci utf8mb3_slovenian_ci)
 
86
        define(UTFC7, utf8mb3_spanish2_ci utf8mb3_spanish_ci)
 
87
        define(UTFC8, utf8mb3_swedish_ci utf8mb3_turkish_ci)
 
88
        define(UTFC9, utf8mb3_unicode_ci)
 
89
        UTFC="UTFC1 UTFC2 UTFC3 UTFC4 UTFC5 UTFC6 UTFC7 UTFC8 UTFC9"
 
90
      fi
 
91
      default_charset_collations="$UTFC"
 
92
      ;;
 
93
    *)
 
94
      AC_MSG_ERROR([Charset $cs not available. (Available are: $CHARSETS_AVAILABLE).
 
95
      See the Installation chapter in the Reference Manual.])
 
96
esac
 
97
 
 
98
if test "$default_collation" = default; then
 
99
  default_collation=$default_charset_default_collation
 
100
fi
 
101
 
 
102
valid_default_collation=no
 
103
for cl in $default_charset_collations
 
104
do
 
105
  if test x"$cl" = x"$default_collation"
 
106
  then
 
107
    valid_default_collation=yes
 
108
    break
 
109
  fi
 
110
done
 
111
 
 
112
if test x$valid_default_collation = xyes
 
113
then
 
114
  AC_MSG_RESULT([default: $default_charset, collation: $default_collation; compiled in: $CHARSETS])
 
115
else
 
116
  AC_MSG_ERROR([
 
117
      Collation $default_collation is not valid for character set $default_charset.
 
118
      Valid collations are: $default_charset_collations.
 
119
      See the Installation chapter in the Reference Manual.
 
120
  ])
 
121
fi
 
122
 
 
123
AC_DEFINE_UNQUOTED([DRIZZLE_DEFAULT_CHARSET_NAME], ["$default_charset"],
 
124
                   [Define the default charset name])
 
125
AC_DEFINE_UNQUOTED([DRIZZLE_DEFAULT_COLLATION_NAME], ["$default_collation"],
 
126
                   [Define the default charset name])