diff options
author | Werner Koch <wk@gnupg.org> | 2010-01-22 15:52:40 +0000 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2010-01-22 15:52:40 +0000 |
commit | 6403ba9b779a8d4b77a50199f0e3300c0d1a8e0e (patch) | |
tree | 967bab642e5a5089e880966e614726118f3aa64d | |
parent | 4f05e4cc4e6f74d0c8273abf588636b93cccd760 (diff) | |
download | libassuan-6403ba9b779a8d4b77a50199f0e3300c0d1a8e0e.tar.gz |
Prepare for a port to WindowsCE.
-rw-r--r-- | ChangeLog | 12 | ||||
-rw-r--r-- | NEWS | 2 | ||||
-rwxr-xr-x | autogen.sh | 43 | ||||
-rw-r--r-- | configure.ac | 12 | ||||
-rwxr-xr-x | ltmain.sh | 8 | ||||
-rw-r--r-- | src/ChangeLog | 7 | ||||
-rw-r--r-- | src/assuan-buffer.c | 2 | ||||
-rw-r--r-- | src/assuan-handler.c | 2 | ||||
-rw-r--r-- | src/assuan-logging.c | 2 | ||||
-rw-r--r-- | src/assuan-socket.c | 34 | ||||
-rw-r--r-- | src/assuan-uds.c | 4 | ||||
-rw-r--r-- | src/debug.c | 2 | ||||
-rw-r--r-- | src/system.c | 38 |
13 files changed, 114 insertions, 54 deletions
@@ -1,3 +1,15 @@ +2010-01-22 Werner Koch <wk@g10code.com> + + * (libtool): + + * configure.ac: Require libgpg-error 1.8. + (HAVE_W32CE_SYSTEM): New am_defines and am_conditionals. + + * ltmain.sh (wrappers_required): Don't set for mingw32ce. + + * autogen.sh: Add option --build-w32ce. Remove --disable-shared + from --build-w32. + 2010-01-08 Marcus Brinkmann <marcus@g10code.de> Released 2.0.0. @@ -3,6 +3,8 @@ Noteworthy changes in version 2.0.1 (unreleased) * Under development. + * Support for WindowsCE. + Noteworthy changes in version 2.0.0 (2010-01-08) ------------------------------------------------ @@ -36,10 +36,28 @@ if test x"$1" = x"--force"; then shift fi +# Convenience option to use certain configure options for some hosts. +myhost="" +myhostsub="" +case "$1" in + --build-w32) + myhost="w32" + ;; + --build-w32ce) + myhost="w32" + myhostsub="ce" + ;; + --build-amd64) + myhost="amd64" + ;; + *) + ;; +esac + # ***** W32 build script ******* # Used to cross-compile for Windows. -if test "$1" = "--build-w32"; then +if [ "$myhost" = "w32" ]; then tmp=`dirname $0` tsdir=`cd "$tmp"; pwd` shift @@ -49,11 +67,20 @@ if test "$1" = "--build-w32"; then fi build=`$tsdir/config.guess` - [ -z "$w32root" ] && w32root="$HOME/w32root" + case $myhostsub in + ce) + [ -z "$w32root" ] && w32root="$HOME/w32ce_root" + toolprefixes="arm-mingw32ce" + ;; + *) + [ -z "$w32root" ] && w32root="$HOME/w32root" + toolprefixes="i586-mingw32msvc i386-mingw32msvc" + ;; + esac echo "Using $w32root as standard install directory" >&2 crossbindir= - for host in i586-mingw32msvc i386-mingw32msvc mingw32; do + for host in $toolprefixes; do if ${host}-gcc --version >/dev/null 2>&1 ; then crossbindir=/usr/${host}/bin conf_CC="CC=${host}-gcc" @@ -62,8 +89,10 @@ if test "$1" = "--build-w32"; then done if [ -z "$crossbindir" ]; then echo "Cross compiler kit not installed" >&2 - echo "Under Debian GNU/Linux, you may install it using" >&2 - echo " apt-get install mingw32 mingw32-runtime mingw32-binutils" >&2 + if [ -z "$sub" ]; then + echo "Under Debian GNU/Linux, you may install it using" >&2 + echo " apt-get install mingw32 mingw32-runtime mingw32-binutils" >&2 + fi echo "Stop." >&2 exit 1 fi @@ -77,7 +106,7 @@ if test "$1" = "--build-w32"; then ./configure --enable-maintainer-mode --prefix=${w32root} \ --host=${host} --build=${build} \ - --disable-shared + --with-gpg-error-prefix=${w32root} "$@" exit $? fi @@ -86,7 +115,7 @@ fi # ***** AMD64 cross build script ******* # Used to cross-compile for AMD64 (for testing) -if test "$1" = "--build-amd64"; then +if [ "$myhost" = "amd64" ]; then tmp=`dirname $0` tsdir=`cd "$tmp"; pwd` shift diff --git a/configure.ac b/configure.ac index df69b2d..89d9dd5 100644 --- a/configure.ac +++ b/configure.ac @@ -138,12 +138,18 @@ fi # have_dosish_system=no have_w32_system=no +have_w32ce_system=no case "${host}" in *-linux*) if test "$GCC" = yes; then CFLAGS="$CFLAGS -fPIC -DPIC" fi ;; + *-mingw32de*) + have_dosish_system=yes + have_w32_system=yes + have_w32ce_system=yes + ;; *-mingw32*) have_dosish_system=yes have_w32_system=yes @@ -165,6 +171,9 @@ dnl AM_CONDITIONAL(HAVE_DOSISH_SYSTEM, test "$have_dosish_system" = yes) if test "$have_w32_system" = yes; then AC_DEFINE(HAVE_W32_SYSTEM,1,[Defined if we run on a W32 API based system]) + if test "$have_w32ce_system" = yes; then + AC_DEFINE(HAVE_W32CE_SYSTEM,1,[Defined if we run on WindowsCE]) + fi BUILD_TIMESTAMP=`date --iso-8601=minutes` AC_SUBST(BUILD_TIMESTAMP) changequote(,)dnl @@ -181,6 +190,7 @@ AC_SUBST(BUILD_REVISION) AC_SUBST(BUILD_TIMESTAMP) AC_SUBST(BUILD_FILEVERSION) AM_CONDITIONAL(HAVE_W32_SYSTEM, test "$have_w32_system" = yes) +AM_CONDITIONAL(HAVE_W32CE_SYSTEM, test "$have_w32ce_system" = yes) # Check for network libraries. They are needed for tests. @@ -247,7 +257,7 @@ AM_CONDITIONAL(USE_DESCRIPTOR_PASSING, test "$use_descriptor_passing" = "yes") # Checking for libgpg-error. -AM_PATH_GPG_ERROR(1.4,, AC_MSG_ERROR([libgpg-error was not found])) +AM_PATH_GPG_ERROR(1.8,, AC_MSG_ERROR([libgpg-error was not found])) # # Checks for library functions. @@ -7680,15 +7680,15 @@ EOF wrappers_required=yes case $host in + *cegcc | *mingw32ce*) + # Disable wrappers for cegcc/mingw32ce, we are cross compiling anyway. + wrappers_required=no + ;; *cygwin* | *mingw* ) if test "$build_libtool_libs" != yes; then wrappers_required=no fi ;; - *cegcc) - # Disable wrappers for cegcc, we are cross compiling anyway. - wrappers_required=no - ;; *) if test "$need_relink" = no || test "$build_libtool_libs" != yes; then wrappers_required=no diff --git a/src/ChangeLog b/src/ChangeLog index 33df124..d7df666 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2010-01-22 Werner Koch <wk@g10code.com> + + * assuan-socket.c (read_port_and_nonce): Replace ENOFILE by a + proper ENOENT. + + Replace all assignments to ERRNO by a call to gpg_err_set_errno. + 2010-01-14 Werner Koch <wk@g10code.com> * debug.c (_assuan_debug, _assuan_debug_begin) diff --git a/src/assuan-buffer.c b/src/assuan-buffer.c index 1fd394b..db65e66 100644 --- a/src/assuan-buffer.c +++ b/src/assuan-buffer.c @@ -155,7 +155,7 @@ _assuan_read_line (assuan_context_t ctx) ctx->inbound.attic.linelen = atticlen + nread; } - errno = saved_errno; + gpg_err_set_errno (saved_errno); return _assuan_error (ctx, gpg_err_code_from_syserror ()); } if (!nread) diff --git a/src/assuan-handler.c b/src/assuan-handler.c index a9cc2bd..f77d59b 100644 --- a/src/assuan-handler.c +++ b/src/assuan-handler.c @@ -864,7 +864,7 @@ assuan_get_data_fp (assuan_context_t ctx) ctx->outbound.data.error = 0; return ctx->outbound.data.fp; #else - errno = ENOSYS; + gpg_err_set_errno (ENOSYS); return NULL; #endif } diff --git a/src/assuan-logging.c b/src/assuan-logging.c index 5d9d488..13af63a 100644 --- a/src/assuan-logging.c +++ b/src/assuan-logging.c @@ -137,7 +137,7 @@ _assuan_log_handler (assuan_context_t ctx, void *hook, unsigned int cat, with a LF. */ if (msg && *msg && msg[strlen (msg) - 1] == '\n') fflush (fp); - errno = saved_errno; + gpg_err_set_errno (saved_errno); return 0; } diff --git a/src/assuan-socket.c b/src/assuan-socket.c index 1d20109..6a8954d 100644 --- a/src/assuan-socket.c +++ b/src/assuan-socket.c @@ -89,11 +89,11 @@ get_nonce (char *buffer, size_t nbytes) if (!CryptAcquireContext (&prov, NULL, NULL, PROV_RSA_FULL, (CRYPT_VERIFYCONTEXT|CRYPT_SILENT)) ) - errno = ENODEV; + gpg_err_set_errno (ENODEV); else { if (!CryptGenRandom (prov, nbytes, (unsigned char *) buffer)) - errno = ENODEV; + gpg_err_set_errno (ENODEV); else ret = 0; CryptReleaseContext (prov, 0); @@ -119,14 +119,14 @@ read_port_and_nonce (const char *fname, unsigned short *port, char *nonce) fclose (fp); if (!nread) { - errno = ENOFILE; + gpg_err_set_errno (ENOENT); return -1; } buffer[nread] = 0; aval = atoi (buffer); if (aval < 1 || aval > 65535) { - errno = EINVAL; + gpg_err_set_errno (EINVAL); return -1; } *port = (unsigned int)aval; @@ -134,7 +134,7 @@ read_port_and_nonce (const char *fname, unsigned short *port, char *nonce) ; if (*p != '\n' || nread != 17) { - errno = EINVAL; + gpg_err_set_errno (EINVAL); return -1; } p++; nread--; @@ -156,7 +156,7 @@ _assuan_sock_new (assuan_context_t ctx, int domain, int type, int proto) domain = AF_INET; res = SOCKET2HANDLE(socket (domain, type, proto)); if (res == ASSUAN_INVALID_FD) - errno = _assuan_sock_wsa2errno (WSAGetLastError ()); + gpg_err_set_errno (_assuan_sock_wsa2errno (WSAGetLastError ())); return res; #else return socket (domain, type, proto); @@ -198,7 +198,7 @@ _assuan_sock_connect (assuan_context_t ctx, assuan_fd_t sockfd, ret = _assuan_write (ctx, sockfd, nonce, 16); if (ret >= 0 && ret != 16) { - errno = EIO; + gpg_err_set_errno (EIO); ret = -1; } } @@ -209,7 +209,7 @@ _assuan_sock_connect (assuan_context_t ctx, assuan_fd_t sockfd, int res; res = connect (HANDLE2SOCKET (sockfd), addr, addrlen); if (res < 0) - errno = _assuan_sock_wsa2errno (WSAGetLastError ()); + gpg_err_set_errno (_assuan_sock_wsa2errno (WSAGetLastError ())); return res; } #else @@ -248,7 +248,7 @@ _assuan_sock_bind (assuan_context_t ctx, assuan_fd_t sockfd, if (filefd == -1) { if (errno == EEXIST) - errno = WSAEADDRINUSE; + gpg_err_set_errno (WSAEADDRINUSE); return -1; } fp = fdopen (filefd, "wb"); @@ -256,7 +256,7 @@ _assuan_sock_bind (assuan_context_t ctx, assuan_fd_t sockfd, { int save_e = errno; close (filefd); - errno = save_e; + gpg_err_set_errno (save_e); return -1; } @@ -269,7 +269,7 @@ _assuan_sock_bind (assuan_context_t ctx, assuan_fd_t sockfd, int save_e = errno; fclose (fp); remove (unaddr->sun_path); - errno = save_e; + gpg_err_set_errno (save_e); return rc; } fprintf (fp, "%d\n", ntohs (myaddr.sin_port)); @@ -282,7 +282,7 @@ _assuan_sock_bind (assuan_context_t ctx, assuan_fd_t sockfd, { int res = bind (HANDLE2SOCKET(sockfd), addr, addrlen); if (res < 0) - errno = _assuan_sock_wsa2errno (WSAGetLastError ()); + gpg_err_set_errno ( _assuan_sock_wsa2errno (WSAGetLastError ())); return res; } #else @@ -303,7 +303,7 @@ _assuan_sock_get_nonce (assuan_context_t ctx, struct sockaddr *addr, if (sizeof nonce->nonce != 16) { - errno = EINVAL; + gpg_err_set_errno (EINVAL); return -1; } nonce->length = 16; @@ -336,7 +336,7 @@ _assuan_sock_check_nonce (assuan_context_t ctx, assuan_fd_t fd, if (sizeof nonce->nonce != 16) { - errno = EINVAL; + gpg_err_set_errno (EINVAL); return -1; } @@ -345,7 +345,7 @@ _assuan_sock_check_nonce (assuan_context_t ctx, assuan_fd_t fd, if (nonce->length != 16) { - errno = EINVAL; + gpg_err_set_errno (EINVAL); return -1; } @@ -362,7 +362,7 @@ _assuan_sock_check_nonce (assuan_context_t ctx, assuan_fd_t fd, return -1; else if (!n) { - errno = EIO; + gpg_err_set_errno (EIO); return -1; } else @@ -373,7 +373,7 @@ _assuan_sock_check_nonce (assuan_context_t ctx, assuan_fd_t fd, } if (memcmp (buffer, nonce->nonce, 16)) { - errno = EACCES; + gpg_err_set_errno (EACCES); return -1; } #else diff --git a/src/assuan-uds.c b/src/assuan-uds.c index ffa940a..2e0f821 100644 --- a/src/assuan-uds.c +++ b/src/assuan-uds.c @@ -136,7 +136,7 @@ uds_reader (assuan_context_t ctx, void *buf, size_t buflen) #else /*HAVE_W32_SYSTEM*/ int res = recvfrom (HANDLE2SOCKET(ctx->inbound.fd), buf, buflen, 0, NULL, NULL); if (res < 0) - errno = _assuan_sock_wsa2errno (WSAGetLastError ()); + gpg_err_set_errno (_assuan_sock_wsa2errno (WSAGetLastError ())); return res; #endif /*HAVE_W32_SYSTEM*/ } @@ -168,7 +168,7 @@ uds_writer (assuan_context_t ctx, const void *buf, size_t buflen) (struct sockaddr *)&ctx->serveraddr, sizeof (struct sockaddr_in)); if (res < 0) - errno = _assuan_sock_wsa2errno (WSAGetLastError ()); + gpg_err_set_errno ( _assuan_sock_wsa2errno (WSAGetLastError ())); return res; #endif /*HAVE_W32_SYSTEM*/ } diff --git a/src/debug.c b/src/debug.c index 1b654b7..8c286e8 100644 --- a/src/debug.c +++ b/src/debug.c @@ -60,7 +60,7 @@ _assuan_debug (assuan_context_t ctx, unsigned int cat, const char *format, ...) return; ctx->log_cb (ctx, ctx->log_cb_data, cat, msg); free (msg); - errno = saved_errno; + gpg_err_set_errno (saved_errno); } diff --git a/src/system.c b/src/system.c index 22019fb..9e9f5cf 100644 --- a/src/system.c +++ b/src/system.c @@ -57,7 +57,7 @@ assuan_fdopen (int fd) GetCurrentProcess(), &ofd, 0, TRUE, DUPLICATE_SAME_ACCESS)) { - errno = EIO; + gpg_err_set_errno (EIO); return ASSUAN_INVALID_FD; } return ofd; @@ -92,7 +92,7 @@ _assuan_calloc (assuan_context_t ctx, size_t cnt, size_t elsize) /* Check for overflow. */ if (elsize && nbytes / elsize != cnt) { - errno = ENOMEM; + gpg_err_set_errno (ENOMEM); return NULL; } @@ -203,7 +203,7 @@ __assuan_pipe (assuan_context_t ctx, assuan_fd_t fd[2], int inherit_idx) { TRACE1 (ctx, ASSUAN_LOG_SYSIO, "__assuan_pipe", ctx, "CreatePipe failed: %s", _assuan_w32_strerror (ctx, -1)); - errno = EIO; + gpg_err_set_errno (EIO); return -1; } @@ -215,7 +215,7 @@ __assuan_pipe (assuan_context_t ctx, assuan_fd_t fd[2], int inherit_idx) "DuplicateHandle failed: %s", _assuan_w32_strerror (ctx, -1)); CloseHandle (rh); CloseHandle (wh); - errno = EIO; + gpg_err_set_errno (EIO); return -1; } if (inherit_idx == 0) @@ -264,13 +264,13 @@ __assuan_close (assuan_context_t ctx, assuan_fd_t fd) #ifdef HAVE_W32_SYSTEM int rc = closesocket (HANDLE2SOCKET(fd)); if (rc) - errno = _assuan_sock_wsa2errno (WSAGetLastError ()); + gpg_err_set_errno ( _assuan_sock_wsa2errno (WSAGetLastError ()) ); if (rc && WSAGetLastError () == WSAENOTSOCK) { rc = CloseHandle (fd); if (rc) /* FIXME. */ - errno = EIO; + gpg_err_set_errno (EIO); } return rc; #else @@ -315,11 +315,11 @@ __assuan_read (assuan_context_t ctx, assuan_fd_t fd, void *buffer, size_t size) switch (GetLastError ()) { case ERROR_BROKEN_PIPE: - errno = EPIPE; + gpg_err_set_errno (EPIPE); break; default: - errno = EIO; + gpg_err_set_errno (EIO); } res = -1; } @@ -329,15 +329,15 @@ __assuan_read (assuan_context_t ctx, assuan_fd_t fd, void *buffer, size_t size) break; case WSAEWOULDBLOCK: - errno = EAGAIN; + gpg_err_set_errno (EAGAIN); break; case ERROR_BROKEN_PIPE: - errno = EPIPE; + gpg_err_set_errno (EPIPE); break; default: - errno = EIO; + gpg_err_set_errno (EIO); break; } } @@ -385,11 +385,11 @@ __assuan_write (assuan_context_t ctx, assuan_fd_t fd, const void *buffer, { case ERROR_BROKEN_PIPE: case ERROR_NO_DATA: - errno = EPIPE; + gpg_err_set_errno (EPIPE); break; default: - errno = EIO; + gpg_err_set_errno (EIO); break; } res = -1; @@ -425,7 +425,7 @@ __assuan_recvmsg (assuan_context_t ctx, assuan_fd_t fd, assuan_msghdr_t msg, int flags) { #ifdef HAVE_W32_SYSTEM - errno = ENOSYS; + gpg_err_set_errno (ENOSYS); return -1; #else int ret; @@ -477,7 +477,7 @@ __assuan_sendmsg (assuan_context_t ctx, assuan_fd_t fd, assuan_msghdr_t msg, int flags) { #ifdef HAVE_W32_SYSTEM - errno = ENOSYS; + gpg_err_set_errno (ENOSYS); return -1; #else int ret; @@ -640,7 +640,7 @@ __assuan_spawn (assuan_context_t ctx, pid_t *r_pid, const char *name, TRACE1 (ctx, ASSUAN_LOG_SYSIO, "__assuan_spawn", ctx, "can't open `nul': %s", _assuan_w32_strerror (ctx, -1)); _assuan_free (ctx, cmdline); - errno = EIO; + gpg_err_set_errno (EIO); return -1; } si.hStdError = nullfd; @@ -675,7 +675,7 @@ __assuan_spawn (assuan_context_t ctx, pid_t *r_pid, const char *name, if (nullfd != INVALID_HANDLE_VALUE) CloseHandle (nullfd); - errno = EIO; + gpg_err_set_errno (EIO); return -1; } @@ -818,7 +818,7 @@ __assuan_spawn (assuan_context_t ctx, pid_t *r_pid, const char *name, if (!(fdp && *fdp != -1)) close (i); } - errno = 0; + gpg_err_set_errno (0); if (! name) { @@ -948,7 +948,7 @@ __assuan_socketpair (assuan_context_t ctx, int namespace, int style, int protocol, assuan_fd_t filedes[2]) { #if HAVE_W32_SYSTEM - errno = ENOSYS; + gpg_err_set_errno (ENOSYS); return -1; #else return socketpair (namespace, style, protocol, filedes); |