+2010-05-07 Marcus Brinkmann <marcus@g10code.de>
+
+ * configure.ac: Check for locale.h.
+
2010-05-06 Marcus Brinkmann <marcus@g10code.de>
* configure.ac: Detect Windows CE.
# Checks for header files.
+AC_CHECK_HEADERS([locale.h])
AC_CHECK_HEADERS(sys/select.h)
AC_CHECK_HEADERS([sys/uio.h])
2010-05-07 Marcus Brinkmann <marcus@g10code.de>
+ * engine-g13.c, gpgme.c, engine-gpgsm.c, engine-gpg.c,
+ op-support.c, engine-assuan.c, gpgme-tool.c: Include <locale.h>
+ only if available with HAVE_LOCALE_H and conditionalize use of
+ LC_CTYPE on its definition.
+ * engine-gpgconf.c: Do not include <locale.h>.
+
* engine-gpgsm.c (gpgsm_new, start): Cast between int and
assuan_fd_t.
* assuan-support.c (my_pipe, my_close, my_read, my_write): Likewise.
#include <sys/types.h>
#include <assert.h>
#include <unistd.h>
+#ifdef HAVE_LOCALE_H
#include <locale.h>
+#endif
#include <errno.h>
#include "gpgme.h"
/* FIXME: If value is NULL, we need to reset the option to default.
But we can't do this. So we error out here. gpg-agent needs
support for this. */
- if (category == LC_CTYPE)
+ if (0)
+ ;
+#ifdef LC_CTYPE
+ else if (category == LC_CTYPE)
{
catstr = "lc-ctype";
if (!value && llass->lc_ctype_set)
if (value)
llass->lc_ctype_set = 1;
}
+#endif
#ifdef LC_MESSAGES
else if (category == LC_MESSAGES)
{
#include <sys/types.h>
#include <assert.h>
#include <unistd.h>
+#ifdef HAVE_LOCALE_H
#include <locale.h>
+#endif
#include <fcntl.h> /* FIXME */
#include <errno.h>
/* FIXME: If value is NULL, we need to reset the option to default.
But we can't do this. So we error out here. G13 needs support
for this. */
- if (category == LC_CTYPE)
+ if (0)
+ ;
+#ifdef LC_CTYPE
+ else if (category == LC_CTYPE)
{
catstr = "lc-ctype";
if (!value && g13->lc_ctype_set)
if (value)
g13->lc_ctype_set = 1;
}
+#endif
#ifdef LC_MESSAGES
else if (category == LC_MESSAGES)
{
#include <assert.h>
#include <errno.h>
#include <unistd.h>
+#ifdef HAVE_LOCALE_H
#include <locale.h>
+#endif
#include "gpgme.h"
#include "util.h"
{
engine_gpg_t gpg = engine;
- if (category == LC_CTYPE)
+ if (0)
+ ;
+#ifdef LC_CTYPE
+ else if (category == LC_CTYPE)
{
if (gpg->lc_ctype)
{
return gpg_error_from_syserror ();
}
}
+#endif
#ifdef LC_MESSAGES
else if (category == LC_MESSAGES)
{
#include <sys/types.h>
#include <assert.h>
#include <unistd.h>
-#include <locale.h>
#include <fcntl.h> /* FIXME */
#include <errno.h>
#include <sys/types.h>
#include <assert.h>
#include <unistd.h>
+#ifdef HAVE_LOCALE_H
#include <locale.h>
+#endif
#include <fcntl.h> /* FIXME */
#include <errno.h>
/* FIXME: If value is NULL, we need to reset the option to default.
But we can't do this. So we error out here. GPGSM needs support
for this. */
- if (category == LC_CTYPE)
+ if (0)
+ ;
+#ifdef LC_CTYPE
+ else if (category == LC_CTYPE)
{
catstr = "lc-ctype";
if (!value && gpgsm->lc_ctype_set)
if (value)
gpgsm->lc_ctype_set = 1;
}
+#endif
#ifdef LC_MESSAGES
else if (category == LC_MESSAGES)
{
#include <getopt.h>
#include <ctype.h>
#include <stdarg.h>
+#ifdef HAVE_LOCALE_H
#include <locale.h>
+#endif
#ifdef HAVE_ARGP_H
#include <argp.h>
#endif
setlocale (LC_ALL, "");
gpgme_check_version (NULL);
+#ifdef LC_CTYPE
gpgme_set_locale (NULL, LC_CTYPE, setlocale (LC_CTYPE, NULL));
+#endif
#ifdef LC_MESSAGES
gpgme_set_locale (NULL, LC_MESSAGES, setlocale (LC_MESSAGES, NULL));
#endif
+
args_init (&args);
argp_parse (&argp, argc, argv, 0, 0, &args);
#include <string.h>
#include <assert.h>
#include <errno.h>
+#ifdef HAVE_LOCALE_H
#include <locale.h>
+#endif
#include "util.h"
#include "context.h"
failed = 1; \
}
+#ifdef LC_CTYPE
PREPARE_ONE_LOCALE (ctype, CTYPE);
+#endif
#ifdef LC_MESSAGES
PREPARE_ONE_LOCALE (messages, MESSAGES);
#endif
if (!ctx)
LOCK (def_lc_lock);
+#ifdef LC_CTYPE
SET_ONE_LOCALE (ctype, CTYPE);
+#endif
#ifdef LC_MESSAGES
SET_ONE_LOCALE (messages, MESSAGES);
#endif
#include <stdlib.h>
#include <errno.h>
#include <string.h>
+#ifdef HAVE_LOCALE_H
#include <locale.h>
+#endif
#include "gpgme.h"
#include "context.h"
if (!reuse_engine)
{
+ err = 0;
+#ifdef LC_CTYPE
err = _gpgme_engine_set_locale (ctx->engine, LC_CTYPE, ctx->lc_ctype);
+#endif
#ifdef LC_MESSAGES
if (!err)
err = _gpgme_engine_set_locale (ctx->engine,