### 15.5 iconv configuration ¶

To enable an encoding, the –enable-newlib-iconv-encodings configure script option should be used. This option accepts a comma-separated list of encodings that should be enabled. The option enables each encoding in both ("to" and "from") directions.

The `--enable-newlib-iconv-from-encodings` configure script option enables "from" support for each encoding that was passed to it.

The `--enable-newlib-iconv-to-encodings` configure script option enables "to" support for each encoding that was passed to it.

Example: if user plans only the "KOI8-R -> UTF-8", "UTF-8 -> ISO-8859-5" and "KOI8-R -> UCS-2" conversions, the most optimal way (minimal iconv code and data will be linked) is to configure Newlib with the following options:
`--enable-newlib-iconv-encodings=UTF-8 --enable-newlib-iconv-from-encodings=KOI8-R --enable-newlib-iconv-to-encodings=UCS-2,ISO-8859-5`
which is the same as
`--enable-newlib-iconv-from-encodings=KOI8-R,UTF-8 --enable-newlib-iconv-to-encodings=UCS-2,ISO-8859-5,UTF-8`
User may also just use the
`--enable-newlib-iconv-encodings=KOI8-R,ISO-8859-5,UTF-8,UCS-2`
configure script option, but it isn’t so optimal since there will be some unneeded data and code.

The `--enable-newlib-iconv-external-ccs` option enables iconv’s capabilities to work with the external CCS files.

The `--enable-target-optspace` Newlib configure script option also affects the iconv library. If this option is present, the library uses the size optimized CCS tables. This means, that only the size-optimized CCS tables will be linked or, if the `--enable-newlib-iconv-external-ccs` configure script option was used, the iconv library will load the size-optimized tables. If the `--enable-target-optspace`configure script option is disabled, the speed-optimized CCS tables are used.

Note: .cct files are searched by iconv_open in the $NLSPATH/iconv_data/ directory. Thus, the NLSPATH environment variable should be set.