[libvirt] PATCH: Fix Windows / mingw32 build

There are a number of problems breaking the windows / mingw build currently. - Use of 'close' without importing unistd.h - Use of non-existant localtime_r - ERROR macro from logging.h clashes with a symbol imported from windows.h So this patch does - Adds the missing unistd.h include - Uses localtime() if localtime_r() is missing (as checked from configure) - Adds a VIR_ prefix onto all logging macros, keeping DEBUG() around because its just used in sooooo many places The use of localtime() on Windows is OK, because the MicroSoft implementation of this uses thread-local storage: http://msdn.microsoft.com/en-us/library/a442x3ye.aspx And all other OS we care about have localtime_r Finally I fix a few compile warnings, so that Mingw can now be built with --enable-compile-warnings=error to detect these problems more quickly in future. configure.in | 3 qemud/qemud.c | 206 ++++++++++++++++++++++++------------------------ qemud/remote.c | 104 ++++++++++++------------ qemud/remote_protocol.c | 4 qemud/rpcgen_fix.pl | 1 src/logging.c | 20 +++- src/logging.h | 57 +++++++------ src/test.c | 5 + tests/nodeinfotest.c | 2 9 files changed, 212 insertions(+), 190 deletions(-) Daniel diff --git a/configure.in b/configure.in --- a/configure.in +++ b/configure.in @@ -73,6 +73,9 @@ AC_SYS_LARGEFILE dnl Availability of various common functions (non-fatal if missing). AC_CHECK_FUNCS([cfmakeraw regexec uname sched_getaffinity getuid getgid]) + +dnl Availablility of threadsafe functions - fallback to non-threadsafe if missing +AC_CHECK_FUNCS([localtime_r]) dnl Availability of various common headers (non-fatal if missing). AC_CHECK_HEADERS([pwd.h paths.h regex.h sys/syslimits.h sys/utsname.h sys/wait.h winsock2.h sched.h termios.h sys/poll.h syslog.h]) diff --git a/qemud/qemud.c b/qemud/qemud.c --- a/qemud/qemud.c +++ b/qemud/qemud.c @@ -171,7 +171,7 @@ remoteCheckCertFile(const char *type, co { struct stat sb; if (stat(file, &sb) < 0) { - ERROR(_("Cannot access %s '%s': %s (%d)"), + VIR_ERROR(_("Cannot access %s '%s': %s (%d)"), type, file, strerror(errno), errno); return -1; } @@ -188,7 +188,7 @@ remoteInitializeGnuTLS (void) err = gnutls_certificate_allocate_credentials (&x509_cred); if (err) { - ERROR(_("gnutls_certificate_allocate_credentials: %s"), + VIR_ERROR(_("gnutls_certificate_allocate_credentials: %s"), gnutls_strerror (err)); return -1; } @@ -201,7 +201,7 @@ remoteInitializeGnuTLS (void) err = gnutls_certificate_set_x509_trust_file (x509_cred, ca_file, GNUTLS_X509_FMT_PEM); if (err < 0) { - ERROR(_("gnutls_certificate_set_x509_trust_file: %s"), + VIR_ERROR(_("gnutls_certificate_set_x509_trust_file: %s"), gnutls_strerror (err)); return -1; } @@ -215,7 +215,7 @@ remoteInitializeGnuTLS (void) err = gnutls_certificate_set_x509_crl_file (x509_cred, crl_file, GNUTLS_X509_FMT_PEM); if (err < 0) { - ERROR(_("gnutls_certificate_set_x509_crl_file: %s"), + VIR_ERROR(_("gnutls_certificate_set_x509_crl_file: %s"), gnutls_strerror (err)); return -1; } @@ -232,7 +232,7 @@ remoteInitializeGnuTLS (void) cert_file, key_file, GNUTLS_X509_FMT_PEM); if (err < 0) { - ERROR(_("gnutls_certificate_set_x509_key_file: %s"), + VIR_ERROR(_("gnutls_certificate_set_x509_key_file: %s"), gnutls_strerror (err)); return -1; } @@ -245,12 +245,12 @@ remoteInitializeGnuTLS (void) */ err = gnutls_dh_params_init (&dh_params); if (err < 0) { - ERROR(_("gnutls_dh_params_init: %s"), gnutls_strerror (err)); + VIR_ERROR(_("gnutls_dh_params_init: %s"), gnutls_strerror (err)); return -1; } err = gnutls_dh_params_generate2 (dh_params, DH_BITS); if (err < 0) { - ERROR(_("gnutls_dh_params_generate2: %s"), gnutls_strerror (err)); + VIR_ERROR(_("gnutls_dh_params_generate2: %s"), gnutls_strerror (err)); return -1; } @@ -271,7 +271,7 @@ qemudDispatchSignalEvent(int watch ATTRI pthread_mutex_lock(&server->lock); if (saferead(server->sigread, &siginfo, sizeof(siginfo)) != sizeof(siginfo)) { - ERROR(_("Failed to read from signal pipe: %s"), strerror(errno)); + VIR_ERROR(_("Failed to read from signal pipe: %s"), strerror(errno)); pthread_mutex_unlock(&server->lock); return; } @@ -280,20 +280,20 @@ qemudDispatchSignalEvent(int watch ATTRI switch (siginfo.si_signo) { case SIGHUP: - INFO0(_("Reloading configuration on SIGHUP")); + VIR_INFO0(_("Reloading configuration on SIGHUP")); if (virStateReload() < 0) - WARN0(_("Error while reloading drivers")); + VIR_WARN0(_("Error while reloading drivers")); break; case SIGINT: case SIGQUIT: case SIGTERM: - WARN(_("Shutting down on signal %d"), siginfo.si_signo); + VIR_WARN(_("Shutting down on signal %d"), siginfo.si_signo); server->shutdown = 1; break; default: - INFO(_("Received unexpected signal %d"), siginfo.si_signo); + VIR_INFO(_("Received unexpected signal %d"), siginfo.si_signo); break; } @@ -312,7 +312,7 @@ int qemudSetCloseExec(int fd) { goto error; return 0; error: - ERROR0(_("Failed to set close-on-exec file descriptor flag")); + VIR_ERROR0(_("Failed to set close-on-exec file descriptor flag")); return -1; } @@ -326,7 +326,7 @@ int qemudSetNonBlock(int fd) { goto error; return 0; error: - ERROR0(_("Failed to set non-blocking file descriptor flag")); + VIR_ERROR0(_("Failed to set non-blocking file descriptor flag")); return -1; } @@ -404,28 +404,28 @@ static int qemudWritePidFile(const char return 0; if ((fd = open(pidFile, O_WRONLY|O_CREAT|O_EXCL, 0644)) < 0) { - ERROR(_("Failed to open pid file '%s' : %s"), - pidFile, strerror(errno)); + VIR_ERROR(_("Failed to open pid file '%s' : %s"), + pidFile, strerror(errno)); return -1; } if (!(fh = fdopen(fd, "w"))) { - ERROR(_("Failed to fdopen pid file '%s' : %s"), - pidFile, strerror(errno)); + VIR_ERROR(_("Failed to fdopen pid file '%s' : %s"), + pidFile, strerror(errno)); close(fd); return -1; } if (fprintf(fh, "%lu\n", (unsigned long)getpid()) < 0) { - ERROR(_("Failed to write to pid file '%s' : %s"), - pidFile, strerror(errno)); + VIR_ERROR(_("Failed to write to pid file '%s' : %s"), + pidFile, strerror(errno)); close(fd); return -1; } if (fclose(fh) == EOF) { - ERROR(_("Failed to close pid file '%s' : %s"), - pidFile, strerror(errno)); + VIR_ERROR(_("Failed to close pid file '%s' : %s"), + pidFile, strerror(errno)); return -1; } @@ -440,7 +440,7 @@ static int qemudListenUnix(struct qemud_ gid_t oldgrp; if (VIR_ALLOC(sock) < 0) { - ERROR("%s", _("Failed to allocate memory for struct qemud_socket")); + VIR_ERROR("%s", _("Failed to allocate memory for struct qemud_socket")); return -1; } @@ -450,8 +450,8 @@ static int qemudListenUnix(struct qemud_ sock->auth = auth; if ((sock->fd = socket(PF_UNIX, SOCK_STREAM, 0)) < 0) { - ERROR(_("Failed to create socket: %s"), - strerror(errno)); + VIR_ERROR(_("Failed to create socket: %s"), + strerror(errno)); goto cleanup; } @@ -472,8 +472,8 @@ static int qemudListenUnix(struct qemud_ setgid(unix_sock_gid); if (bind(sock->fd, (struct sockaddr *)&addr, sizeof(addr)) < 0) { - ERROR(_("Failed to bind socket to '%s': %s"), - path, strerror(errno)); + VIR_ERROR(_("Failed to bind socket to '%s': %s"), + path, strerror(errno)); goto cleanup; } umask(oldmask); @@ -481,8 +481,8 @@ static int qemudListenUnix(struct qemud_ setgid(oldgrp); if (listen(sock->fd, 30) < 0) { - ERROR(_("Failed to listen for connections on '%s': %s"), - path, strerror(errno)); + VIR_ERROR(_("Failed to listen for connections on '%s': %s"), + path, strerror(errno)); goto cleanup; } @@ -492,7 +492,7 @@ static int qemudListenUnix(struct qemud_ VIR_EVENT_HANDLE_HANGUP, qemudDispatchServerEvent, server, NULL)) < 0) { - ERROR0(_("Failed to add server event callback")); + VIR_ERROR0(_("Failed to add server event callback")); goto cleanup; } @@ -521,7 +521,7 @@ remoteMakeSockets (int *fds, int max_fds int e = getaddrinfo (node, service, &hints, &ai); if (e != 0) { - ERROR(_("getaddrinfo: %s\n"), gai_strerror (e)); + VIR_ERROR(_("getaddrinfo: %s\n"), gai_strerror (e)); return -1; } @@ -530,7 +530,7 @@ remoteMakeSockets (int *fds, int max_fds fds[*nfds_r] = socket (runp->ai_family, runp->ai_socktype, runp->ai_protocol); if (fds[*nfds_r] == -1) { - ERROR(_("socket: %s"), strerror (errno)); + VIR_ERROR(_("socket: %s"), strerror (errno)); return -1; } @@ -539,14 +539,14 @@ remoteMakeSockets (int *fds, int max_fds if (bind (fds[*nfds_r], runp->ai_addr, runp->ai_addrlen) == -1) { if (errno != EADDRINUSE) { - ERROR(_("bind: %s"), strerror (errno)); + VIR_ERROR(_("bind: %s"), strerror (errno)); return -1; } close (fds[*nfds_r]); } else { if (listen (fds[*nfds_r], SOMAXCONN) == -1) { - ERROR(_("listen: %s"), strerror (errno)); + VIR_ERROR(_("listen: %s"), strerror (errno)); return -1; } ++*nfds_r; @@ -581,7 +581,7 @@ remoteListenTCP (struct qemud_server *se socklen_t salen = sizeof(sa); if (VIR_ALLOC(sock) < 0) { - ERROR(_("remoteListenTCP: calloc: %s"), strerror (errno)); + VIR_ERROR(_("remoteListenTCP: calloc: %s"), strerror (errno)); goto cleanup; } @@ -611,7 +611,7 @@ remoteListenTCP (struct qemud_server *se goto cleanup; if (listen (sock->fd, 30) < 0) { - ERROR(_("remoteListenTCP: listen: %s"), strerror (errno)); + VIR_ERROR(_("remoteListenTCP: listen: %s"), strerror (errno)); goto cleanup; } @@ -621,7 +621,7 @@ remoteListenTCP (struct qemud_server *se VIR_EVENT_HANDLE_HANGUP, qemudDispatchServerEvent, server, NULL)) < 0) { - ERROR0(_("Failed to add server event callback")); + VIR_ERROR0(_("Failed to add server event callback")); goto cleanup; } @@ -660,7 +660,7 @@ static int qemudInitPaths(struct qemud_s struct passwd *pw; if (!(pw = getpwuid(uid))) { - ERROR(_("Failed to find user record for uid '%d': %s"), + VIR_ERROR(_("Failed to find user record for uid '%d': %s"), uid, strerror(errno)); return -1; } @@ -676,7 +676,7 @@ static int qemudInitPaths(struct qemud_s return 0; snprintf_error: - ERROR("%s", _("Resulting path too long for buffer in qemudInitPaths()")); + VIR_ERROR("%s", _("Resulting path too long for buffer in qemudInitPaths()")); return -1; } @@ -684,7 +684,7 @@ static struct qemud_server *qemudInitial struct qemud_server *server; if (VIR_ALLOC(server) < 0) { - ERROR0(_("Failed to allocate struct qemud_server")); + VIR_ERROR0(_("Failed to allocate struct qemud_server")); return NULL; } @@ -696,7 +696,7 @@ static struct qemud_server *qemudInitial server->sigread = sigread; if (virEventInit() < 0) { - ERROR0(_("Failed to initialize event system")); + VIR_ERROR0(_("Failed to initialize event system")); VIR_FREE(server); return NULL; } @@ -781,8 +781,8 @@ static struct qemud_server *qemudNetwork auth_tcp == REMOTE_AUTH_SASL || auth_tls == REMOTE_AUTH_SASL) { if ((err = sasl_server_init(NULL, "libvirt")) != SASL_OK) { - ERROR(_("Failed to initialize SASL authentication %s"), - sasl_errstring(err, NULL, NULL)); + VIR_ERROR(_("Failed to initialize SASL authentication %s"), + sasl_errstring(err, NULL, NULL)); goto cleanup; } } @@ -795,8 +795,8 @@ static struct qemud_server *qemudNetwork dbus_error_init(&derr); server->sysbus = dbus_bus_get(DBUS_BUS_SYSTEM, &derr); if (!(server->sysbus)) { - ERROR(_("Failed to connect to system bus for PolicyKit auth: %s"), - derr.message); + VIR_ERROR(_("Failed to connect to system bus for PolicyKit auth: %s"), + derr.message); dbus_error_free(&derr); goto cleanup; } @@ -906,7 +906,7 @@ remoteInitializeTLSSession (void) return session; failed: - ERROR(_("remoteInitializeTLSSession: %s"), + VIR_ERROR(_("remoteInitializeTLSSession: %s"), gnutls_strerror (err)); return NULL; } @@ -922,7 +922,7 @@ remoteCheckDN (gnutls_x509_crt_t cert) err = gnutls_x509_crt_get_dn (cert, name, &namesize); if (err != 0) { - ERROR(_("remoteCheckDN: gnutls_x509_cert_get_dn: %s"), + VIR_ERROR(_("remoteCheckDN: gnutls_x509_cert_get_dn: %s"), gnutls_strerror (err)); return 0; } @@ -954,40 +954,40 @@ remoteCheckCertificate (gnutls_session_t time_t now; if ((ret = gnutls_certificate_verify_peers2 (session, &status)) < 0){ - ERROR(_("remoteCheckCertificate: verify failed: %s"), + VIR_ERROR(_("remoteCheckCertificate: verify failed: %s"), gnutls_strerror (ret)); return -1; } if (status != 0) { if (status & GNUTLS_CERT_INVALID) - ERROR0(_("remoteCheckCertificate: " - "the client certificate is not trusted.")); + VIR_ERROR0(_("remoteCheckCertificate: " + "the client certificate is not trusted.")); if (status & GNUTLS_CERT_SIGNER_NOT_FOUND) - ERROR0(_("remoteCheckCertificate: the client " - "certificate has unknown issuer.")); + VIR_ERROR0(_("remoteCheckCertificate: the client " + "certificate has unknown issuer.")); if (status & GNUTLS_CERT_REVOKED) - ERROR0(_("remoteCheckCertificate: " - "the client certificate has been revoked.")); + VIR_ERROR0(_("remoteCheckCertificate: " + "the client certificate has been revoked.")); #ifndef GNUTLS_1_0_COMPAT if (status & GNUTLS_CERT_INSECURE_ALGORITHM) - ERROR0(_("remoteCheckCertificate: the client certificate" - " uses an insecure algorithm.")); + VIR_ERROR0(_("remoteCheckCertificate: the client certificate" + " uses an insecure algorithm.")); #endif return -1; } if (gnutls_certificate_type_get (session) != GNUTLS_CRT_X509) { - ERROR0(_("remoteCheckCertificate: certificate is not X.509")); + VIR_ERROR0(_("remoteCheckCertificate: certificate is not X.509")); return -1; } if (!(certs = gnutls_certificate_get_peers(session, &nCerts))) { - ERROR0(_("remoteCheckCertificate: no peers")); + VIR_ERROR0(_("remoteCheckCertificate: no peers")); return -1; } @@ -997,7 +997,7 @@ remoteCheckCertificate (gnutls_session_t gnutls_x509_crt_t cert; if (gnutls_x509_crt_init (&cert) < 0) { - ERROR0(_("remoteCheckCertificate: gnutls_x509_crt_init failed")); + VIR_ERROR0(_("remoteCheckCertificate: gnutls_x509_crt_init failed")); return -1; } @@ -1007,15 +1007,15 @@ remoteCheckCertificate (gnutls_session_t } if (gnutls_x509_crt_get_expiration_time (cert) < now) { - ERROR0(_("remoteCheckCertificate: " - "the client certificate has expired")); + VIR_ERROR0(_("remoteCheckCertificate: " + "the client certificate has expired")); gnutls_x509_crt_deinit (cert); return -1; } if (gnutls_x509_crt_get_activation_time (cert) > now) { - ERROR0(_("remoteCheckCertificate: the client " - "certificate is not yet activated")); + VIR_ERROR0(_("remoteCheckCertificate: the client " + "certificate is not yet activated")); gnutls_x509_crt_deinit (cert); return -1; } @@ -1023,7 +1023,7 @@ remoteCheckCertificate (gnutls_session_t if (i == 0) { if (!remoteCheckDN (cert)) { /* This is the most common error: make it informative. */ - ERROR0(_("remoteCheckCertificate: client's Distinguished Name is not on the list of allowed clients (tls_allowed_dn_list). Use 'openssl x509 -in clientcert.pem -text' to view the Distinguished Name field in the client certificate, or run this daemon with --verbose option.")); + VIR_ERROR0(_("remoteCheckCertificate: client's Distinguished Name is not on the list of allowed clients (tls_allowed_dn_list). Use 'openssl x509 -in clientcert.pem -text' to view the Distinguished Name field in the client certificate, or run this daemon with --verbose option.")); gnutls_x509_crt_deinit (cert); return -1; } @@ -1039,11 +1039,11 @@ remoteCheckAccess (struct qemud_client * { /* Verify client certificate. */ if (remoteCheckCertificate (client->tlssession) == -1) { - ERROR0(_("remoteCheckCertificate: " - "failed to verify client's certificate")); + VIR_ERROR0(_("remoteCheckCertificate: " + "failed to verify client's certificate")); if (!tls_no_verify_certificate) return -1; - else INFO0(_("remoteCheckCertificate: tls_no_verify_certificate " - "is set so the bad certificate is ignored")); + else VIR_INFO0(_("remoteCheckCertificate: tls_no_verify_certificate " + "is set so the bad certificate is ignored")); } /* Checks have succeeded. Write a '\1' byte back to the client to @@ -1064,8 +1064,8 @@ int qemudGetSocketIdentity(int fd, uid_t unsigned int cr_len = sizeof (cr); if (getsockopt (fd, SOL_SOCKET, SO_PEERCRED, &cr, &cr_len) < 0) { - ERROR(_("Failed to verify client credentials: %s"), - strerror(errno)); + VIR_ERROR(_("Failed to verify client credentials: %s"), + strerror(errno)); return -1; } @@ -1089,18 +1089,18 @@ static int qemudDispatchServer(struct qe if ((fd = accept(sock->fd, (struct sockaddr *)&addr, &addrlen)) < 0) { if (errno == EAGAIN) return 0; - ERROR(_("Failed to accept connection: %s"), strerror(errno)); + VIR_ERROR(_("Failed to accept connection: %s"), strerror(errno)); return -1; } if (server->nclients >= max_clients) { - ERROR0(_("Too many active clients, dropping connection")); + VIR_ERROR0(_("Too many active clients, dropping connection")); close(fd); return -1; } if (VIR_REALLOC_N(server->clients, server->nclients+1) < 0) { - ERROR0(_("Out of memory allocating clients")); + VIR_ERROR0(_("Out of memory allocating clients")); close(fd); return -1; } @@ -1143,7 +1143,7 @@ static int qemudDispatchServer(struct qe /* Client is running as root, so disable auth */ if (uid == 0) { - INFO(_("Turn off polkit auth for privileged client %d"), pid); + VIR_INFO(_("Turn off polkit auth for privileged client %d"), pid); client->auth = REMOTE_AUTH_NONE; } } @@ -1182,7 +1182,7 @@ static int qemudDispatchServer(struct qe if (qemudRegisterClientEvent (server, client, 0) < 0) goto cleanup; } else { - ERROR(_("TLS handshake failed: %s"), + VIR_ERROR(_("TLS handshake failed: %s"), gnutls_strerror (ret)); goto cleanup; } @@ -1288,7 +1288,7 @@ static int qemudClientReadBuf(struct qem if ((ret = read (client->fd, data, len)) <= 0) { if (ret == 0 || errno != EAGAIN) { if (ret != 0) - ERROR(_("read: %s"), strerror (errno)); + VIR_ERROR(_("read: %s"), strerror (errno)); qemudDispatchClientFailure(server, client); } return -1; @@ -1301,7 +1301,7 @@ static int qemudClientReadBuf(struct qem if (ret == 0 || (ret != GNUTLS_E_AGAIN && ret != GNUTLS_E_INTERRUPTED)) { if (ret != 0) - ERROR(_("gnutls_record_recv: %s"), + VIR_ERROR(_("gnutls_record_recv: %s"), gnutls_strerror (ret)); qemudDispatchClientFailure (server, client); } @@ -1461,7 +1461,7 @@ static void qemudDispatchClientRead(stru else if (qemudRegisterClientEvent (server, client, 1) < 0) qemudDispatchClientFailure (server, client); } else if (ret != GNUTLS_E_AGAIN && ret != GNUTLS_E_INTERRUPTED) { - ERROR(_("TLS handshake failed: %s"), + VIR_ERROR(_("TLS handshake failed: %s"), gnutls_strerror (ret)); qemudDispatchClientFailure (server, client); } else { @@ -1485,7 +1485,7 @@ static int qemudClientWriteBuf(struct qe int ret; if (!client->tlssession) { if ((ret = safewrite(client->fd, data, len)) == -1) { - ERROR(_("write: %s"), strerror (errno)); + VIR_ERROR(_("write: %s"), strerror (errno)); qemudDispatchClientFailure(server, client); return -1; } @@ -1495,7 +1495,7 @@ static int qemudClientWriteBuf(struct qe qemudDispatchClientFailure (server, client); else if (ret < 0) { if (ret != GNUTLS_E_INTERRUPTED && ret != GNUTLS_E_AGAIN) { - ERROR(_("gnutls_record_send: %s"), gnutls_strerror (ret)); + VIR_ERROR(_("gnutls_record_send: %s"), gnutls_strerror (ret)); qemudDispatchClientFailure (server, client); } return -1; @@ -1604,7 +1604,7 @@ qemudDispatchClientWrite(struct qemud_se else if (qemudRegisterClientEvent (server, client, 1)) qemudDispatchClientFailure (server, client); } else if (ret != GNUTLS_E_AGAIN && ret != GNUTLS_E_INTERRUPTED) { - ERROR(_("TLS handshake failed: %s"), gnutls_strerror (ret)); + VIR_ERROR(_("TLS handshake failed: %s"), gnutls_strerror (ret)); qemudDispatchClientFailure (server, client); } else { if (qemudRegisterClientEvent (server, client, 1)) @@ -1731,7 +1731,7 @@ static int qemudOneLoop(void) { errors = sig_errors; if (errors) { sig_errors -= errors; - ERROR(_("Signal handler reported %d errors: last error: %s"), + VIR_ERROR(_("Signal handler reported %d errors: last error: %s"), errors, strerror (sig_lasterrno)); return -1; } @@ -1756,7 +1756,7 @@ static int qemudRunLoop(struct qemud_ser server->nworkers = min_workers; if (VIR_ALLOC_N(server->workers, server->nworkers) < 0) { - ERROR0(_("Failed to allocate workers")); + VIR_ERROR0(_("Failed to allocate workers")); return -1; } @@ -1882,13 +1882,13 @@ remoteConfigGetStringList(virConfPtr con switch (p->type) { case VIR_CONF_STRING: if (VIR_ALLOC_N(list, 2) < 0) { - ERROR(_("failed to allocate memory for %s config list"), key); + VIR_ERROR(_("failed to allocate memory for %s config list"), key); return -1; } list[0] = strdup (p->str); list[1] = NULL; if (list[0] == NULL) { - ERROR(_("failed to allocate memory for %s config list value"), + VIR_ERROR(_("failed to allocate memory for %s config list value"), key); VIR_FREE(list); return -1; @@ -1901,13 +1901,13 @@ remoteConfigGetStringList(virConfPtr con for (pp = p->list; pp; pp = pp->next) len++; if (VIR_ALLOC_N(list, 1+len) < 0) { - ERROR(_("failed to allocate memory for %s config list"), key); + VIR_ERROR(_("failed to allocate memory for %s config list"), key); return -1; } for (i = 0, pp = p->list; pp; ++i, pp = pp->next) { if (pp->type != VIR_CONF_STRING) { - ERROR(_("remoteReadConfigFile: %s: %s:" - " must be a string or list of strings\n"), + VIR_ERROR(_("remoteReadConfigFile: %s: %s:" + " must be a string or list of strings\n"), filename, key); VIR_FREE(list); return -1; @@ -1918,8 +1918,8 @@ remoteConfigGetStringList(virConfPtr con for (j = 0 ; j < i ; j++) VIR_FREE(list[j]); VIR_FREE(list); - ERROR(_("failed to allocate memory for %s config list value"), - key); + VIR_ERROR(_("failed to allocate memory for %s config list value"), + key); return -1; } @@ -1929,8 +1929,8 @@ remoteConfigGetStringList(virConfPtr con } default: - ERROR(_("remoteReadConfigFile: %s: %s:" - " must be a string or list of strings\n"), + VIR_ERROR(_("remoteReadConfigFile: %s: %s:" + " must be a string or list of strings\n"), filename, key); return -1; } @@ -1945,7 +1945,7 @@ checkType (virConfValuePtr p, const char const char *key, virConfType required_type) { if (p->type != required_type) { - ERROR(_("remoteReadConfigFile: %s: %s: invalid type:" + VIR_ERROR(_("remoteReadConfigFile: %s: %s: invalid type:" " got %s; expected %s\n"), filename, key, virConfTypeName (p->type), virConfTypeName (required_type)); @@ -1966,7 +1966,7 @@ checkType (virConfValuePtr p, const char goto free_and_fail; \ (var_name) = strdup (p->str); \ if ((var_name) == NULL) { \ - ERROR(_("remoteReadConfigFile: %s\n"),strerror (errno));\ + VIR_ERROR(_("remoteReadConfigFile: %s\n"),strerror (errno)); \ goto free_and_fail; \ } \ } \ @@ -2008,7 +2008,7 @@ static int remoteConfigGetAuth(virConfPt *auth = REMOTE_AUTH_POLKIT; #endif } else { - ERROR(_("remoteReadConfigFile: %s: %s: unsupported auth %s\n"), + VIR_ERROR(_("remoteReadConfigFile: %s: %s: unsupported auth %s\n"), filename, key, p->str); return -1; } @@ -2155,11 +2155,11 @@ remoteReadConfigFile (struct qemud_serve GET_CONF_STR (conf, filename, unix_sock_group); if (unix_sock_group) { if (getuid() != 0) { - WARN0(_("Cannot set group when not running as root")); + VIR_WARN0(_("Cannot set group when not running as root")); } else { struct group *grp = getgrnam(unix_sock_group); if (!grp) { - ERROR(_("Failed to lookup group '%s'"), unix_sock_group); + VIR_ERROR(_("Failed to lookup group '%s'"), unix_sock_group); goto free_and_fail; } unix_sock_gid = grp->gr_gid; @@ -2171,7 +2171,7 @@ remoteReadConfigFile (struct qemud_serve GET_CONF_STR (conf, filename, unix_sock_ro_perms); if (unix_sock_ro_perms) { if (virStrToLong_i (unix_sock_ro_perms, NULL, 8, &unix_sock_ro_mask) != 0) { - ERROR(_("Failed to parse mode '%s'"), unix_sock_ro_perms); + VIR_ERROR(_("Failed to parse mode '%s'"), unix_sock_ro_perms); goto free_and_fail; } free (unix_sock_ro_perms); @@ -2181,7 +2181,7 @@ remoteReadConfigFile (struct qemud_serve GET_CONF_STR (conf, filename, unix_sock_rw_perms); if (unix_sock_rw_perms) { if (virStrToLong_i (unix_sock_rw_perms, NULL, 8, &unix_sock_rw_mask) != 0) { - ERROR(_("Failed to parse mode '%s'"), unix_sock_rw_perms); + VIR_ERROR(_("Failed to parse mode '%s'"), unix_sock_rw_perms); goto free_and_fail; } free (unix_sock_rw_perms); @@ -2374,7 +2374,7 @@ int main(int argc, char **argv) { if (godaemon) { if (qemudGoDaemon() < 0) { - ERROR(_("Failed to fork as daemon: %s"), strerror(errno)); + VIR_ERROR(_("Failed to fork as daemon: %s"), strerror(errno)); goto error1; } } @@ -2395,7 +2395,7 @@ int main(int argc, char **argv) { qemudSetNonBlock(sigpipe[1]) < 0 || qemudSetCloseExec(sigpipe[0]) < 0 || qemudSetCloseExec(sigpipe[1]) < 0) { - ERROR(_("Failed to create pipe: %s"), strerror(errno)); + VIR_ERROR(_("Failed to create pipe: %s"), strerror(errno)); goto error2; } sigwrite = sigpipe[1]; @@ -2427,14 +2427,14 @@ int main(int argc, char **argv) { const char *sockdirname = LOCAL_STATE_DIR "/run/libvirt"; if (chown(sockdirname, -1, unix_sock_gid) < 0) - ERROR(_("Failed to change group ownership of %s"), sockdirname); + VIR_ERROR(_("Failed to change group ownership of %s"), sockdirname); } if (virEventAddHandleImpl(sigpipe[0], VIR_EVENT_HANDLE_READABLE, qemudDispatchSignalEvent, server, NULL) < 0) { - ERROR0(_("Failed to register callback for signal pipe")); + VIR_ERROR0(_("Failed to register callback for signal pipe")); ret = 3; goto error2; } diff --git a/qemud/remote.c b/qemud/remote.c --- a/qemud/remote.c +++ b/qemud/remote.c @@ -2542,7 +2542,7 @@ remoteDispatchAuthSaslInit (struct qemud REMOTE_DEBUG("Initialize SASL auth %d", client->fd); if (client->auth != REMOTE_AUTH_SASL || client->saslconn != NULL) { - ERROR0(_("client tried invalid SASL init request")); + VIR_ERROR0(_("client tried invalid SASL init request")); goto authfail; } @@ -2582,8 +2582,8 @@ remoteDispatchAuthSaslInit (struct qemud VIR_FREE(localAddr); VIR_FREE(remoteAddr); if (err != SASL_OK) { - ERROR(_("sasl context setup failed %d (%s)"), - err, sasl_errstring(err, NULL, NULL)); + VIR_ERROR(_("sasl context setup failed %d (%s)"), + err, sasl_errstring(err, NULL, NULL)); client->saslconn = NULL; goto authfail; } @@ -2595,7 +2595,7 @@ remoteDispatchAuthSaslInit (struct qemud cipher = gnutls_cipher_get(client->tlssession); if (!(ssf = (sasl_ssf_t)gnutls_cipher_get_key_size(cipher))) { - ERROR0(_("cannot TLS get cipher size")); + VIR_ERROR0(_("cannot TLS get cipher size")); sasl_dispose(&client->saslconn); client->saslconn = NULL; goto authfail; @@ -2604,8 +2604,8 @@ remoteDispatchAuthSaslInit (struct qemud err = sasl_setprop(client->saslconn, SASL_SSF_EXTERNAL, &ssf); if (err != SASL_OK) { - ERROR(_("cannot set SASL external SSF %d (%s)"), - err, sasl_errstring(err, NULL, NULL)); + VIR_ERROR(_("cannot set SASL external SSF %d (%s)"), + err, sasl_errstring(err, NULL, NULL)); sasl_dispose(&client->saslconn); client->saslconn = NULL; goto authfail; @@ -2632,8 +2632,8 @@ remoteDispatchAuthSaslInit (struct qemud err = sasl_setprop(client->saslconn, SASL_SEC_PROPS, &secprops); if (err != SASL_OK) { - ERROR(_("cannot set SASL security props %d (%s)"), - err, sasl_errstring(err, NULL, NULL)); + VIR_ERROR(_("cannot set SASL security props %d (%s)"), + err, sasl_errstring(err, NULL, NULL)); sasl_dispose(&client->saslconn); client->saslconn = NULL; goto authfail; @@ -2648,8 +2648,8 @@ remoteDispatchAuthSaslInit (struct qemud NULL, NULL); if (err != SASL_OK) { - ERROR(_("cannot list SASL mechanisms %d (%s)"), - err, sasl_errdetail(client->saslconn)); + VIR_ERROR(_("cannot list SASL mechanisms %d (%s)"), + err, sasl_errdetail(client->saslconn)); sasl_dispose(&client->saslconn); client->saslconn = NULL; goto authfail; @@ -2657,7 +2657,7 @@ remoteDispatchAuthSaslInit (struct qemud REMOTE_DEBUG("Available mechanisms for client: '%s'", mechlist); ret->mechlist = strdup(mechlist); if (!ret->mechlist) { - ERROR0(_("cannot allocate mechlist")); + VIR_ERROR0(_("cannot allocate mechlist")); sasl_dispose(&client->saslconn); client->saslconn = NULL; goto authfail; @@ -2688,8 +2688,8 @@ remoteSASLCheckSSF (struct qemud_client err = sasl_getprop(client->saslconn, SASL_SSF, &val); if (err != SASL_OK) { - ERROR(_("cannot query SASL ssf on connection %d (%s)"), - err, sasl_errstring(err, NULL, NULL)); + VIR_ERROR(_("cannot query SASL ssf on connection %d (%s)"), + err, sasl_errstring(err, NULL, NULL)); remoteDispatchAuthError(rerr); sasl_dispose(&client->saslconn); client->saslconn = NULL; @@ -2698,7 +2698,7 @@ remoteSASLCheckSSF (struct qemud_client ssf = *(const int *)val; REMOTE_DEBUG("negotiated an SSF of %d", ssf); if (ssf < 56) { /* 56 is good for Kerberos */ - ERROR(_("negotiated SSF %d was not strong enough"), ssf); + VIR_ERROR(_("negotiated SSF %d was not strong enough"), ssf); remoteDispatchAuthError(rerr); sasl_dispose(&client->saslconn); client->saslconn = NULL; @@ -2727,15 +2727,15 @@ remoteSASLCheckAccess (struct qemud_serv err = sasl_getprop(client->saslconn, SASL_USERNAME, &val); if (err != SASL_OK) { - ERROR(_("cannot query SASL username on connection %d (%s)"), - err, sasl_errstring(err, NULL, NULL)); + VIR_ERROR(_("cannot query SASL username on connection %d (%s)"), + err, sasl_errstring(err, NULL, NULL)); remoteDispatchAuthError(rerr); sasl_dispose(&client->saslconn); client->saslconn = NULL; return -1; } if (val == NULL) { - ERROR0(_("no client username was found")); + VIR_ERROR0(_("no client username was found")); remoteDispatchAuthError(rerr); sasl_dispose(&client->saslconn); client->saslconn = NULL; @@ -2745,7 +2745,7 @@ remoteSASLCheckAccess (struct qemud_serv client->saslUsername = strdup((const char*)val); if (client->saslUsername == NULL) { - ERROR0(_("out of memory copying username")); + VIR_ERROR0(_("out of memory copying username")); remoteDispatchAuthError(rerr); sasl_dispose(&client->saslconn); client->saslconn = NULL; @@ -2764,7 +2764,7 @@ remoteSASLCheckAccess (struct qemud_serv } /* Denied */ - ERROR(_("SASL client %s not allowed in whitelist"), client->saslUsername); + VIR_ERROR(_("SASL client %s not allowed in whitelist"), client->saslUsername); remoteDispatchAuthError(rerr); sasl_dispose(&client->saslconn); client->saslconn = NULL; @@ -2794,7 +2794,7 @@ remoteDispatchAuthSaslStart (struct qemu REMOTE_DEBUG("Start SASL auth %d", client->fd); if (client->auth != REMOTE_AUTH_SASL || client->saslconn == NULL) { - ERROR0(_("client tried invalid SASL start request")); + VIR_ERROR0(_("client tried invalid SASL start request")); goto authfail; } @@ -2809,14 +2809,14 @@ remoteDispatchAuthSaslStart (struct qemu &serveroutlen); if (err != SASL_OK && err != SASL_CONTINUE) { - ERROR(_("sasl start failed %d (%s)"), - err, sasl_errdetail(client->saslconn)); + VIR_ERROR(_("sasl start failed %d (%s)"), + err, sasl_errdetail(client->saslconn)); sasl_dispose(&client->saslconn); client->saslconn = NULL; goto authfail; } if (serveroutlen > REMOTE_AUTH_SASL_DATA_MAX) { - ERROR(_("sasl start reply data too long %d"), serveroutlen); + VIR_ERROR(_("sasl start reply data too long %d"), serveroutlen); sasl_dispose(&client->saslconn); client->saslconn = NULL; goto authfail; @@ -2881,7 +2881,7 @@ remoteDispatchAuthSaslStep (struct qemud REMOTE_DEBUG("Step SASL auth %d", client->fd); if (client->auth != REMOTE_AUTH_SASL || client->saslconn == NULL) { - ERROR0(_("client tried invalid SASL start request")); + VIR_ERROR0(_("client tried invalid SASL start request")); goto authfail; } @@ -2895,16 +2895,16 @@ remoteDispatchAuthSaslStep (struct qemud &serveroutlen); if (err != SASL_OK && err != SASL_CONTINUE) { - ERROR(_("sasl step failed %d (%s)"), - err, sasl_errdetail(client->saslconn)); + VIR_ERROR(_("sasl step failed %d (%s)"), + err, sasl_errdetail(client->saslconn)); sasl_dispose(&client->saslconn); client->saslconn = NULL; goto authfail; } if (serveroutlen > REMOTE_AUTH_SASL_DATA_MAX) { - ERROR(_("sasl step reply data too long %d"), - serveroutlen); + VIR_ERROR(_("sasl step reply data too long %d"), + serveroutlen); sasl_dispose(&client->saslconn); client->saslconn = NULL; goto authfail; @@ -2959,7 +2959,7 @@ remoteDispatchAuthSaslInit (struct qemud void *args ATTRIBUTE_UNUSED, remote_auth_sasl_init_ret *ret ATTRIBUTE_UNUSED) { - ERROR0(_("client tried unsupported SASL init request")); + VIR_ERROR0(_("client tried unsupported SASL init request")); remoteDispatchAuthError(rerr); return -1; } @@ -2972,7 +2972,7 @@ remoteDispatchAuthSaslStart (struct qemu remote_auth_sasl_start_args *args ATTRIBUTE_UNUSED, remote_auth_sasl_start_ret *ret ATTRIBUTE_UNUSED) { - ERROR0(_("client tried unsupported SASL start request")); + VIR_ERROR0(_("client tried unsupported SASL start request")); remoteDispatchAuthError(rerr); return -1; } @@ -2985,7 +2985,7 @@ remoteDispatchAuthSaslStep (struct qemud remote_auth_sasl_step_args *args ATTRIBUTE_UNUSED, remote_auth_sasl_step_ret *ret ATTRIBUTE_UNUSED) { - ERROR0(_("client tried unsupported SASL step request")); + VIR_ERROR0(_("client tried unsupported SASL step request")); remoteDispatchAuthError(rerr); return -1; } @@ -3021,26 +3021,26 @@ remoteDispatchAuthPolkit (struct qemud_s REMOTE_DEBUG("Start PolicyKit auth %d", client->fd); if (client->auth != REMOTE_AUTH_POLKIT) { - ERROR0(_("client tried invalid PolicyKit init request")); + VIR_ERROR0(_("client tried invalid PolicyKit init request")); goto authfail; } if (qemudGetSocketIdentity(client->fd, &callerUid, &callerPid) < 0) { - ERROR0(_("cannot get peer socket identity")); - goto authfail; - } - - INFO(_("Checking PID %d running as %d"), callerPid, callerUid); + VIR_ERROR0(_("cannot get peer socket identity")); + goto authfail; + } + + VIR_INFO(_("Checking PID %d running as %d"), callerPid, callerUid); dbus_error_init(&err); if (!(pkcaller = polkit_caller_new_from_pid(server->sysbus, callerPid, &err))) { - ERROR(_("Failed to lookup policy kit caller: %s"), err.message); + VIR_ERROR(_("Failed to lookup policy kit caller: %s"), err.message); dbus_error_free(&err); goto authfail; } if (!(pkaction = polkit_action_new())) { - ERROR(_("Failed to create polkit action %s\n"), strerror(errno)); + VIR_ERROR(_("Failed to create polkit action %s\n"), strerror(errno)); polkit_caller_unref(pkcaller); goto authfail; } @@ -3048,9 +3048,9 @@ remoteDispatchAuthPolkit (struct qemud_s if (!(pkcontext = polkit_context_new()) || !polkit_context_init(pkcontext, &pkerr)) { - ERROR(_("Failed to create polkit context %s\n"), - (pkerr ? polkit_error_get_error_message(pkerr) - : strerror(errno))); + VIR_ERROR(_("Failed to create polkit context %s\n"), + (pkerr ? polkit_error_get_error_message(pkerr) + : strerror(errno))); if (pkerr) polkit_error_free(pkerr); polkit_caller_unref(pkcaller); @@ -3066,9 +3066,9 @@ remoteDispatchAuthPolkit (struct qemud_s 0, &pkerr); if (pkerr && polkit_error_is_set(pkerr)) { - ERROR(_("Policy kit failed to check authorization %d %s"), - polkit_error_get_error_code(pkerr), - polkit_error_get_error_message(pkerr)); + VIR_ERROR(_("Policy kit failed to check authorization %d %s"), + polkit_error_get_error_code(pkerr), + polkit_error_get_error_message(pkerr)); goto authfail; } #else @@ -3080,12 +3080,12 @@ remoteDispatchAuthPolkit (struct qemud_s polkit_caller_unref(pkcaller); polkit_action_unref(pkaction); if (pkresult != POLKIT_RESULT_YES) { - ERROR(_("Policy kit denied action %s from pid %d, uid %d, result: %s\n"), - action, callerPid, callerUid, - polkit_result_to_string_representation(pkresult)); - goto authfail; - } - INFO(_("Policy allowed action %s from pid %d, uid %d, result %s"), + VIR_ERROR(_("Policy kit denied action %s from pid %d, uid %d, result: %s\n"), + action, callerPid, callerUid, + polkit_result_to_string_representation(pkresult)); + goto authfail; + } + VIR_INFO(_("Policy allowed action %s from pid %d, uid %d, result %s"), action, callerPid, callerUid, polkit_result_to_string_representation(pkresult)); ret->complete = 1; @@ -3110,7 +3110,7 @@ remoteDispatchAuthPolkit (struct qemud_s void *args ATTRIBUTE_UNUSED, remote_auth_polkit_ret *ret ATTRIBUTE_UNUSED) { - ERROR0(_("client tried unsupported PolicyKit init request")); + VIR_ERROR0(_("client tried unsupported PolicyKit init request")); remoteDispatchAuthError(rerr); return -1; } diff --git a/qemud/remote_protocol.c b/qemud/remote_protocol.c --- a/qemud/remote_protocol.c +++ b/qemud/remote_protocol.c @@ -332,7 +332,7 @@ xdr_remote_node_get_info_ret (XDR *xdrs, return FALSE; if (!xdr_quad_t (xdrs, &objp->memory)) return FALSE; - buf = XDR_INLINE (xdrs, 6 * BYTES_PER_XDR_UNIT); + buf = (int32_t*)XDR_INLINE (xdrs, 6 * BYTES_PER_XDR_UNIT); if (buf == NULL) { if (!xdr_int (xdrs, &objp->cpus)) return FALSE; @@ -361,7 +361,7 @@ xdr_remote_node_get_info_ret (XDR *xdrs, return FALSE; if (!xdr_quad_t (xdrs, &objp->memory)) return FALSE; - buf = XDR_INLINE (xdrs, 6 * BYTES_PER_XDR_UNIT); + buf = (int32_t*)XDR_INLINE (xdrs, 6 * BYTES_PER_XDR_UNIT); if (buf == NULL) { if (!xdr_int (xdrs, &objp->cpus)) return FALSE; diff --git a/qemud/rpcgen_fix.pl b/qemud/rpcgen_fix.pl --- a/qemud/rpcgen_fix.pl +++ b/qemud/rpcgen_fix.pl @@ -68,6 +68,7 @@ while (<>) { # be ignored. Correct both these mistakes. @function = map { s/\bIXDR_PUT_((U_)?)LONG\b/(void)IXDR_PUT_$1INT32/; $_ } + map { s/\bXDR_INLINE\b/(int32_t*)XDR_INLINE/; $_ } @function; print (join ("", @function)); diff --git a/src/logging.c b/src/logging.c --- a/src/logging.c +++ b/src/logging.c @@ -29,6 +29,7 @@ #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> +#include <unistd.h> #if HAVE_SYSLOG_H #include <syslog.h> #endif @@ -483,7 +484,10 @@ void virLogMessage(const char *category, char *str = NULL; char *msg; struct timeval cur_time; - struct tm time_info; +#if HAVE_LOCALTIME_R + struct tm tmdata; +#endif + struct tm *tm; int len, fprio, i, ret; if (!virLogInitialized) @@ -509,17 +513,21 @@ void virLogMessage(const char *category, if (str == NULL) return; gettimeofday(&cur_time, NULL); - localtime_r(&cur_time.tv_sec, &time_info); +#if HAVE_LOCALTIME_R + tm = localtime_r(&cur_time.tv_sec, &tmdata); +#else + tm = localtime(&cur_time.tv_sec); +#endif if ((funcname != NULL) && (priority == VIR_LOG_DEBUG)) { ret = virAsprintf(&msg, "%02d:%02d:%02d.%03d: %s : %s:%lld : %s\n", - time_info.tm_hour, time_info.tm_min, - time_info.tm_sec, (int) cur_time.tv_usec / 1000, + tm->tm_hour, tm->tm_min, + tm->tm_sec, (int) cur_time.tv_usec / 1000, virLogPriorityString(priority), funcname, linenr, str); } else { ret = virAsprintf(&msg, "%02d:%02d:%02d.%03d: %s : %s\n", - time_info.tm_hour, time_info.tm_min, - time_info.tm_sec, (int) cur_time.tv_usec / 1000, + tm->tm_hour, tm->tm_min, + tm->tm_sec, (int) cur_time.tv_usec / 1000, virLogPriorityString(priority), str); } VIR_FREE(str); diff --git a/src/logging.h b/src/logging.h --- a/src/logging.h +++ b/src/logging.h @@ -30,48 +30,53 @@ * defined at runtime of from the libvirt daemon configuration file */ #ifdef ENABLE_DEBUG -#define VIR_DEBUG(category, f, l, fmt,...) \ +#define VIR_DEBUG_INT(category, f, l, fmt,...) \ virLogMessage(category, VIR_LOG_DEBUG, f, l, 0, fmt, __VA_ARGS__) -#define VIR_INFO(category, f, l, fmt,...) \ +#define VIR_INFO_INT(category, f, l, fmt,...) \ virLogMessage(category, VIR_LOG_INFO, f, l, 0, fmt, __VA_ARGS__) -#define VIR_WARN(category, f, l, fmt,...) \ +#define VIR_WARN_INT(category, f, l, fmt,...) \ virLogMessage(category, VIR_LOG_WARN, f, l, 0, fmt, __VA_ARGS__) -#define VIR_ERROR(category, f, l, fmt,...) \ +#define VIR_ERROR_INT(category, f, l, fmt,...) \ virLogMessage(category, VIR_LOG_ERROR, f, l, 0, fmt, __VA_ARGS__) #else -#define VIR_DEBUG(category, f, l, fmt,...) \ +#define VIR_DEBUG_INT(category, f, l, fmt,...) \ do { } while (0) -#define VIR_INFO(category, f, l, fmt,...) \ +#define VIR_INFO_INT(category, f, l, fmt,...) \ do { } while (0) -#define VIR_WARN(category, f, l, fmt,...) \ +#define VIR_WARN_INT(category, f, l, fmt,...) \ do { } while (0) -#define VIR_ERROR(category, f, l, fmt,...) \ +#define VIR_ERROR_INT(category, f, l, fmt,...) \ do { } while (0) -#define VIR_INFO(category, fmt,...) \ +#define VIR_INFO_INT(category, fmt,...) \ do { } while (0) -#define VIR_WARN(category, fmt,...) \ +#define VIR_WARN_INT(category, fmt,...) \ do { } while (0) -#define VIR_ERROR(category, fmt,...) \ +#define VIR_ERROR_INT(category, fmt,...) \ do { } while (0) #endif /* !ENABLE_DEBUG */ +#define VIR_DEBUG(fmt,...) \ + VIR_DEBUG_INT("file." __FILE__, __func__, __LINE__, fmt, __VA_ARGS__) +#define VIR_DEBUG0(msg) \ + VIR_DEBUG_INT("file." __FILE__, __func__, __LINE__, "%s", msg) +#define VIR_INFO(fmt,...) \ + VIR_INFO_INT("file." __FILE__, __func__, __LINE__, fmt, __VA_ARGS__) +#define VIR_INFO0(msg) \ + VIR_INFO_INT("file." __FILE__, __func__, __LINE__, "%s", msg) +#define VIR_WARN(fmt,...) \ + VIR_WARN_INT("file." __FILE__, __func__, __LINE__, fmt, __VA_ARGS__) +#define VIR_WARN0(msg) \ + VIR_WARN_INT("file." __FILE__, __func__, __LINE__, "%s", msg) +#define VIR_ERROR(fmt,...) \ + VIR_ERROR_INT("file." __FILE__, __func__, __LINE__, fmt, __VA_ARGS__) +#define VIR_ERROR0(msg) \ + VIR_ERROR_INT("file." __FILE__, __func__, __LINE__, "%s", msg) + +/* Legacy compat */ #define DEBUG(fmt,...) \ - VIR_DEBUG("file." __FILE__, __func__, __LINE__, fmt, __VA_ARGS__) + VIR_DEBUG_INT("file." __FILE__, __func__, __LINE__, fmt, __VA_ARGS__) #define DEBUG0(msg) \ - VIR_DEBUG("file." __FILE__, __func__, __LINE__, "%s", msg) -#define INFO(fmt,...) \ - VIR_INFO("file." __FILE__, __func__, __LINE__, fmt, __VA_ARGS__) -#define INFO0(msg) \ - VIR_INFO("file." __FILE__, __func__, __LINE__, "%s", msg) -#define WARN(fmt,...) \ - VIR_WARN("file." __FILE__, __func__, __LINE__, fmt, __VA_ARGS__) -#define WARN0(msg) \ - VIR_WARN("file." __FILE__, __func__, __LINE__, "%s", msg) -#define ERROR(fmt,...) \ - VIR_ERROR("file." __FILE__, __func__, __LINE__, fmt, __VA_ARGS__) -#define ERROR0(msg) \ - VIR_ERROR("file." __FILE__, __func__, __LINE__, "%s", msg) - + VIR_DEBUG_INT("file." __FILE__, __func__, __LINE__, "%s", msg) /* * To be made public diff --git a/src/test.c b/src/test.c --- a/src/test.c +++ b/src/test.c @@ -93,6 +93,7 @@ static const virNodeInfo defaultNodeInfo virReportErrorHelper(conn, VIR_FROM_TEST, code, __FILE__, \ __FUNCTION__, __LINE__, fmt) +#ifdef HAVE_THREAD_H static void testDriverLock(testConnPtr driver) { pthread_mutex_lock(&driver->lock); @@ -102,6 +103,10 @@ static void testDriverUnlock(testConnPtr { pthread_mutex_unlock(&driver->lock); } +#else +static void testDriverLock(testConnPtr driver ATTRIBUTE_UNUSED) {} +static void testDriverUnlock(testConnPtr driver ATTRIBUTE_UNUSED) {} +#endif static virCapsPtr testBuildCapabilities(virConnectPtr conn) { diff --git a/tests/nodeinfotest.c b/tests/nodeinfotest.c --- a/tests/nodeinfotest.c +++ b/tests/nodeinfotest.c @@ -13,7 +13,7 @@ #ifndef __linux__ static int -mymain(int argc, char **argv) +mymain(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) { exit (77); /* means 'test skipped' for automake */ } -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

On Tue, Jan 06, 2009 at 12:48:00PM +0000, Daniel P. Berrange wrote:
There are a number of problems breaking the windows / mingw build currently.
- Use of 'close' without importing unistd.h - Use of non-existant localtime_r
oops :-)
- ERROR macro from logging.h clashes with a symbol imported from windows.h
oh, crap, okay we need a namespaced one
So this patch does
- Adds the missing unistd.h include - Uses localtime() if localtime_r() is missing (as checked from configure) - Adds a VIR_ prefix onto all logging macros, keeping DEBUG() around because its just used in sooooo many places
The use of localtime() on Windows is OK, because the MicroSoft implementation of this uses thread-local storage:
http://msdn.microsoft.com/en-us/library/a442x3ye.aspx
And all other OS we care about have localtime_r
Finally I fix a few compile warnings, so that Mingw can now be built with --enable-compile-warnings=error to detect these problems more quickly in future.
Patch looks fine. But I spotted we still use strerror, I though this had to be discarded because it wasn't thread-safe ? +1 Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/

On Tue, Jan 06, 2009 at 03:41:49PM +0100, Daniel Veillard wrote:
On Tue, Jan 06, 2009 at 12:48:00PM +0000, Daniel P. Berrange wrote:
There are a number of problems breaking the windows / mingw build currently.
- Use of 'close' without importing unistd.h - Use of non-existant localtime_r
oops :-)
- ERROR macro from logging.h clashes with a symbol imported from windows.h
oh, crap, okay we need a namespaced one
So this patch does
- Adds the missing unistd.h include - Uses localtime() if localtime_r() is missing (as checked from configure) - Adds a VIR_ prefix onto all logging macros, keeping DEBUG() around because its just used in sooooo many places
The use of localtime() on Windows is OK, because the MicroSoft implementation of this uses thread-local storage:
http://msdn.microsoft.com/en-us/library/a442x3ye.aspx
And all other OS we care about have localtime_r
Finally I fix a few compile warnings, so that Mingw can now be built with --enable-compile-warnings=error to detect these problems more quickly in future.
Patch looks fine. But I spotted we still use strerror, I though this had to be discarded because it wasn't thread-safe ?
I've got a large patch to remove most of those uses coming soon... Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

"Daniel P. Berrange" <berrange@redhat.com> wrote:
There are a number of problems breaking the windows / mingw build currently.
- Use of 'close' without importing unistd.h - Use of non-existant localtime_r - ERROR macro from logging.h clashes with a symbol imported from windows.h
So this patch does
- Adds the missing unistd.h include - Uses localtime() if localtime_r() is missing (as checked from configure)
That all looks fine. However, since there's an LGPLv2+ gnulib module that provides localtime_r (called time_r) you may want to skip that part. Or just go ahead with what you have and I'll undo things when I've confirmed pulling in the new module works as expected.

On Tue, Jan 06, 2009 at 04:38:12PM +0100, Jim Meyering wrote:
"Daniel P. Berrange" <berrange@redhat.com> wrote:
There are a number of problems breaking the windows / mingw build currently.
- Use of 'close' without importing unistd.h - Use of non-existant localtime_r - ERROR macro from logging.h clashes with a symbol imported from windows.h
So this patch does
- Adds the missing unistd.h include - Uses localtime() if localtime_r() is missing (as checked from configure)
That all looks fine. However, since there's an LGPLv2+ gnulib module that provides localtime_r (called time_r) you may want to skip that part. Or just go ahead with what you have and I'll undo things when I've confirmed pulling in the new module works as expected.
I committed everything except the localtime_r() change... Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

"Daniel P. Berrange" <berrange@redhat.com> wrote:
On Tue, Jan 06, 2009 at 04:38:12PM +0100, Jim Meyering wrote:
"Daniel P. Berrange" <berrange@redhat.com> wrote:
There are a number of problems breaking the windows / mingw build currently.
- Use of 'close' without importing unistd.h - Use of non-existant localtime_r - ERROR macro from logging.h clashes with a symbol imported from windows.h
So this patch does
- Adds the missing unistd.h include - Uses localtime() if localtime_r() is missing (as checked from configure)
That all looks fine. However, since there's an LGPLv2+ gnulib module that provides localtime_r (called time_r) you may want to skip that part. Or just go ahead with what you have and I'll undo things when I've confirmed pulling in the new module works as expected.
I committed everything except the localtime_r() change...
Thanks. Here's the change to pull in the time_r module and to update gnulib to the latest. I tested by applying the patch to a clean directory and ensuring that autobuild.sh's mingw build succeeds. It also passed "make distcheck" on a rawhide x86_64 system.
From 73c44e047f2900fac40d2a24185f75cadd46c2f1 Mon Sep 17 00:00:00 2001 From: Jim Meyering <meyering@redhat.com> Date: Tue, 6 Jan 2009 18:28:46 +0100 Subject: [PATCH] update from gnulib; use its time_r module for localtime_r on mingw
* bootstrap (modules): Add time_r. * gnulib/m4/time_h.m4: New file. * gnulib/m4/time_r.m4: New file. * gnulib/lib/time_r.c: New file. * gnulib/tests/test-time.c: New file. * gnulib/lib/time.in.h: New file. * gnulib/lib/Makefile.am: Update. * gnulib/lib/fseeko.c: Likewise. * gnulib/lib/lstat.c: Likewise. * gnulib/lib/netdb.in.h: Likewise. * gnulib/lib/stdint.in.h: Likewise. * gnulib/lib/stdlib.in.h: Likewise. * gnulib/lib/sys_select.in.h: Likewise. * gnulib/lib/sys_stat.in.h: Likewise. * gnulib/lib/sys_time.in.h: Likewise. * gnulib/lib/unistd.in.h: Likewise. * gnulib/lib/wchar.in.h: Likewise. * gnulib/m4/codeset.m4: Likewise. * gnulib/m4/errno_h.m4: Likewise. * gnulib/m4/extensions.m4: Likewise. * gnulib/m4/getaddrinfo.m4: Likewise. * gnulib/m4/gettext.m4: Likewise. * gnulib/m4/glibc2.m4: Likewise. * gnulib/m4/glibc21.m4: Likewise. * gnulib/m4/gnulib-cache.m4: Likewise. * gnulib/m4/gnulib-comp.m4: Likewise. * gnulib/m4/iconv.m4: Likewise. * gnulib/m4/include_next.m4: Likewise. * gnulib/m4/intdiv0.m4: Likewise. * gnulib/m4/intlmacosx.m4: Likewise. * gnulib/m4/intmax.m4: Likewise. * gnulib/m4/inttypes-pri.m4: Likewise. * gnulib/m4/inttypes_h.m4: Likewise. * gnulib/m4/lcmessage.m4: Likewise. * gnulib/m4/lib-link.m4: Likewise. * gnulib/m4/lstat.m4: Likewise. * gnulib/m4/netdb_h.m4: Likewise. * gnulib/m4/nls.m4: Likewise. * gnulib/m4/po.m4: Likewise. * gnulib/m4/printf-posix.m4: Likewise. * gnulib/m4/printf.m4: Likewise. * gnulib/m4/progtest.m4: Likewise. * gnulib/m4/size_max.m4: Likewise. * gnulib/m4/sockets.m4: Likewise. * gnulib/m4/stdint.m4: Likewise. * gnulib/m4/stdint_h.m4: Likewise. * gnulib/m4/sys_ioctl_h.m4: Likewise. * gnulib/m4/threadlib.m4: Likewise. * gnulib/m4/uintmax_t.m4: Likewise. * gnulib/m4/visibility.m4: Likewise. * gnulib/m4/wchar.m4: Likewise. * gnulib/m4/wchar_t.m4: Likewise. * gnulib/m4/wint_t.m4: Likewise. * gnulib/m4/xsize.m4: Likewise. * gnulib/tests/Makefile.am: Likewise. * gnulib/tests/sockets.h: Likewise. * gnulib/tests/.cvsignore: Likewise. * gnulib/tests/.gitignore: Likewise. * tests/.gitignore: Likewise. * docs/examples/.gitignore: Likewise. * gnulib/lib/.cvsignore: Likewise. * gnulib/lib/.gitignore: Likewise. remove files associated with obsolete strpbrk module * gnulib/lib/strpbrk.c: Remove file. * gnulib/m4/strpbrk.m4: Remove file. --- bootstrap | 1 + docs/examples/.gitignore | 1 - gnulib/lib/.cvsignore | 1 + gnulib/lib/.gitignore | 1 + gnulib/lib/Makefile.am | 91 ++++++++++++++++++--- gnulib/lib/fseeko.c | 2 +- gnulib/lib/lstat.c | 6 +- gnulib/lib/netdb.in.h | 20 ++--- gnulib/lib/stdint.in.h | 116 ++++++++++++++++++--------- gnulib/lib/stdlib.in.h | 4 +- gnulib/lib/strpbrk.c | 42 ---------- gnulib/lib/sys_select.in.h | 23 +++++- gnulib/lib/sys_stat.in.h | 12 +++ gnulib/lib/sys_time.in.h | 8 ++ gnulib/lib/time.in.h | 118 +++++++++++++++++++++++++++ gnulib/lib/time_r.c | 47 +++++++++++ gnulib/lib/unistd.in.h | 1 + gnulib/lib/wchar.in.h | 191 ++++++++++++++++++++++++++++++++++++++++++++ gnulib/m4/codeset.m4 | 12 ++-- gnulib/m4/errno_h.m4 | 8 ++- gnulib/m4/extensions.m4 | 14 +++- gnulib/m4/getaddrinfo.m4 | 80 +++++++++++++------ gnulib/m4/gettext.m4 | 36 ++++---- gnulib/m4/glibc2.m4 | 14 ++-- gnulib/m4/glibc21.m4 | 14 ++-- gnulib/m4/gnulib-cache.m4 | 5 +- gnulib/m4/gnulib-comp.m4 | 19 +++- gnulib/m4/iconv.m4 | 30 ++++---- gnulib/m4/include_next.m4 | 68 +++++++++++++--- gnulib/m4/intdiv0.m4 | 8 +- gnulib/m4/intlmacosx.m4 | 8 +- gnulib/m4/intmax.m4 | 12 ++-- gnulib/m4/inttypes-pri.m4 | 10 +- gnulib/m4/inttypes_h.m4 | 12 ++-- gnulib/m4/lcmessage.m4 | 10 +- gnulib/m4/lib-link.m4 | 10 ++- gnulib/m4/lstat.m4 | 20 +++-- gnulib/m4/netdb_h.m4 | 18 ++++- gnulib/m4/nls.m4 | 6 +- gnulib/m4/po.m4 | 6 +- gnulib/m4/printf-posix.m4 | 9 +- gnulib/m4/printf.m4 | 43 +++++++---- gnulib/m4/progtest.m4 | 10 +- gnulib/m4/size_max.m4 | 14 ++-- gnulib/m4/sockets.m4 | 37 +++++++-- gnulib/m4/stdint.m4 | 15 +++- gnulib/m4/stdint_h.m4 | 12 ++-- gnulib/m4/strpbrk.m4 | 18 ---- gnulib/m4/sys_ioctl_h.m4 | 11 ++- gnulib/m4/threadlib.m4 | 23 +++--- gnulib/m4/time_h.m4 | 74 +++++++++++++++++ gnulib/m4/time_r.m4 | 43 ++++++++++ gnulib/m4/uintmax_t.m4 | 8 +- gnulib/m4/visibility.m4 | 10 +- gnulib/m4/wchar.m4 | 34 ++++++++- gnulib/m4/wchar_t.m4 | 10 +- gnulib/m4/wint_t.m4 | 10 +- gnulib/m4/xsize.m4 | 6 +- gnulib/tests/.cvsignore | 1 + gnulib/tests/.gitignore | 1 + gnulib/tests/Makefile.am | 13 +++- gnulib/tests/sockets.h | 4 +- gnulib/tests/test-time.c | 29 +++++++ tests/.gitignore | 1 - 64 files changed, 1164 insertions(+), 377 deletions(-) delete mode 100644 gnulib/lib/strpbrk.c create mode 100644 gnulib/lib/time.in.h create mode 100644 gnulib/lib/time_r.c delete mode 100644 gnulib/m4/strpbrk.m4 create mode 100644 gnulib/m4/time_h.m4 create mode 100644 gnulib/m4/time_r.m4 create mode 100644 gnulib/tests/test-time.c diff --git a/bootstrap b/bootstrap index 22282d6..c5487b2 100755 --- a/bootstrap +++ b/bootstrap @@ -87,6 +87,7 @@ strndup strerror strsep sys_stat +time_r useless-if-before-free vasprintf verify diff --git a/docs/examples/.gitignore b/docs/examples/.gitignore index ad3227c..5f0e251 100644 --- a/docs/examples/.gitignore +++ b/docs/examples/.gitignore @@ -1,4 +1,3 @@ -*.exe .memdump Makefile.in Makefile diff --git a/gnulib/lib/.cvsignore b/gnulib/lib/.cvsignore index 3b403bf..5a82aa0 100644 --- a/gnulib/lib/.cvsignore +++ b/gnulib/lib/.cvsignore @@ -20,5 +20,6 @@ sys_select.h sys_socket.h sys_stat.h sys_time.h +time.h unistd.h wchar.h diff --git a/gnulib/lib/.gitignore b/gnulib/lib/.gitignore index 3b403bf..5a82aa0 100644 --- a/gnulib/lib/.gitignore +++ b/gnulib/lib/.gitignore @@ -20,5 +20,6 @@ sys_select.h sys_socket.h sys_stat.h sys_time.h +time.h unistd.h wchar.h diff --git a/gnulib/lib/Makefile.am b/gnulib/lib/Makefile.am index 47d515d..528142e 100644 --- a/gnulib/lib/Makefile.am +++ b/gnulib/lib/Makefile.am @@ -1,6 +1,6 @@ ## DO NOT EDIT! GENERATED AUTOMATICALLY! ## Process this file with automake to produce Makefile.in. -# Copyright (C) 2002-2008 Free Software Foundation, Inc. +# Copyright (C) 2002-2009 Free Software Foundation, Inc. # # This file is free software, distributed under the terms of the GNU # General Public License. As a special exception to the GNU General @@ -9,7 +9,7 @@ # the same distribution terms as the rest of that program. # # Generated by gnulib-tool. -# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=gnulib/lib --m4-base=gnulib/m4 --doc-base=doc --tests-base=gnulib/tests --aux-dir=build-aux --with-tests --lgpl=2 --libtool --macro-prefix=gl c-ctype close connect getaddrinfo gethostname getpass gettext inet_pton mkstemp mktempd perror physmem poll posix-shell recv send setsockopt socket strerror strndup strsep sys_stat useless-if-before-free vasprintf vc-list-files verify +# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=gnulib/lib --m4-base=gnulib/m4 --doc-base=doc --tests-base=gnulib/tests --aux-dir=build-aux --with-tests --lgpl=2 --libtool --macro-prefix=gl c-ctype close connect getaddrinfo gethostname getpass gettext inet_pton mkstemp mktempd perror physmem poll posix-shell recv send setsockopt socket strerror strndup strsep sys_stat time_r useless-if-before-free vasprintf vc-list-files verify AUTOMAKE_OPTIONS = 1.5 gnits @@ -102,7 +102,7 @@ libgnu_la_SOURCES += c-ctype.h c-ctype.c ## begin gnulib module close -EXTRA_DIST += close.c +EXTRA_DIST += close.c w32sock.h EXTRA_libgnu_la_SOURCES += close.c @@ -356,6 +356,11 @@ netdb.h: netdb.in.h -e 's|@''NEXT_NETDB_H''@|$(NEXT_NETDB_H)|g' \ -e 's|@''HAVE_NETDB_H''@|$(HAVE_NETDB_H)|g' \ -e 's|@''GNULIB_GETADDRINFO''@|$(GNULIB_GETADDRINFO)|g' \ + -e 's|@''HAVE_STRUCT_ADDRINFO''@|$(HAVE_STRUCT_ADDRINFO)|g' \ + -e 's|@''HAVE_DECL_FREEADDRINFO''@|$(HAVE_DECL_FREEADDRINFO)|g' \ + -e 's|@''HAVE_DECL_GAI_STRERROR''@|$(HAVE_DECL_GAI_STRERROR)|g' \ + -e 's|@''HAVE_DECL_GETADDRINFO''@|$(HAVE_DECL_GETADDRINFO)|g' \ + -e 's|@''HAVE_DECL_GETNAMEINFO''@|$(HAVE_DECL_GETNAMEINFO)|g' \ < $(srcdir)/netdb.in.h; \ } > $@-t mv $@-t $@ @@ -538,6 +543,7 @@ stdint.h: stdint.in.h -e 's/@''HAVE_SYS_BITYPES_H''@/$(HAVE_SYS_BITYPES_H)/g' \ -e 's/@''HAVE_LONG_LONG_INT''@/$(HAVE_LONG_LONG_INT)/g' \ -e 's/@''HAVE_UNSIGNED_LONG_LONG_INT''@/$(HAVE_UNSIGNED_LONG_LONG_INT)/g' \ + -e 's/@''APPLE_UNIVERSAL_BUILD''@/$(APPLE_UNIVERSAL_BUILD)/g' \ -e 's/@''BITSIZEOF_PTRDIFF_T''@/$(BITSIZEOF_PTRDIFF_T)/g' \ -e 's/@''PTRDIFF_T_SUFFIX''@/$(PTRDIFF_T_SUFFIX)/g' \ -e 's/@''BITSIZEOF_SIG_ATOMIC_T''@/$(BITSIZEOF_SIG_ATOMIC_T)/g' \ @@ -816,15 +822,6 @@ EXTRA_libgnu_la_SOURCES += strnlen.c ## end gnulib module strnlen -## begin gnulib module strpbrk - - -EXTRA_DIST += strpbrk.c - -EXTRA_libgnu_la_SOURCES += strpbrk.c - -## end gnulib module strpbrk - ## begin gnulib module strsep @@ -966,6 +963,42 @@ EXTRA_libgnu_la_SOURCES += tempname.c ## end gnulib module tempname +## begin gnulib module time + +BUILT_SOURCES += time.h + +# We need the following in order to create <time.h> when the system +# doesn't have one that works with the given compiler. +time.h: time.in.h + rm -f $@-t $@ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ + sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@NEXT_TIME_H''@|$(NEXT_TIME_H)|g' \ + -e 's|@REPLACE_LOCALTIME_R''@|$(REPLACE_LOCALTIME_R)|g' \ + -e 's|@REPLACE_NANOSLEEP''@|$(REPLACE_NANOSLEEP)|g' \ + -e 's|@REPLACE_STRPTIME''@|$(REPLACE_STRPTIME)|g' \ + -e 's|@REPLACE_TIMEGM''@|$(REPLACE_TIMEGM)|g' \ + -e 's|@SYS_TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(SYS_TIME_H_DEFINES_STRUCT_TIMESPEC)|g' \ + -e 's|@TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(TIME_H_DEFINES_STRUCT_TIMESPEC)|g' \ + < $(srcdir)/time.in.h; \ + } > $@-t + mv $@-t $@ +MOSTLYCLEANFILES += time.h time.h-t + +EXTRA_DIST += time.in.h + +## end gnulib module time + +## begin gnulib module time_r + + +EXTRA_DIST += time_r.c + +EXTRA_libgnu_la_SOURCES += time_r.c + +## end gnulib module time_r + ## begin gnulib module unistd BUILT_SOURCES += unistd.h @@ -1084,10 +1117,40 @@ wchar.h: wchar.in.h sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''NEXT_WCHAR_H''@|$(NEXT_WCHAR_H)|g' \ - -e 's/@''HAVE_WCHAR_H''@/$(HAVE_WCHAR_H)/g' \ + -e 's|@''HAVE_WCHAR_H''@|$(HAVE_WCHAR_H)|g' \ + -e 's|@''GNULIB_BTOWC''@|$(GNULIB_BTOWC)|g' \ + -e 's|@''GNULIB_WCTOB''@|$(GNULIB_WCTOB)|g' \ + -e 's|@''GNULIB_MBSINIT''@|$(GNULIB_MBSINIT)|g' \ + -e 's|@''GNULIB_MBRTOWC''@|$(GNULIB_MBRTOWC)|g' \ + -e 's|@''GNULIB_MBRLEN''@|$(GNULIB_MBRLEN)|g' \ + -e 's|@''GNULIB_MBSRTOWCS''@|$(GNULIB_MBSRTOWCS)|g' \ + -e 's|@''GNULIB_MBSNRTOWCS''@|$(GNULIB_MBSNRTOWCS)|g' \ + -e 's|@''GNULIB_WCRTOMB''@|$(GNULIB_WCRTOMB)|g' \ + -e 's|@''GNULIB_WCSRTOMBS''@|$(GNULIB_WCSRTOMBS)|g' \ + -e 's|@''GNULIB_WCSNRTOMBS''@|$(GNULIB_WCSNRTOMBS)|g' \ -e 's|@''GNULIB_WCWIDTH''@|$(GNULIB_WCWIDTH)|g' \ - -e 's/@''HAVE_WINT_T''@/$(HAVE_WINT_T)/g' \ + -e 's|@''HAVE_WINT_T''@|$(HAVE_WINT_T)|g' \ + -e 's|@''HAVE_BTOWC''@|$(HAVE_BTOWC)|g' \ + -e 's|@''HAVE_MBSINIT''@|$(HAVE_MBSINIT)|g' \ + -e 's|@''HAVE_MBRTOWC''@|$(HAVE_MBRTOWC)|g' \ + -e 's|@''HAVE_MBRLEN''@|$(HAVE_MBRLEN)|g' \ + -e 's|@''HAVE_MBSRTOWCS''@|$(HAVE_MBSRTOWCS)|g' \ + -e 's|@''HAVE_MBSNRTOWCS''@|$(HAVE_MBSNRTOWCS)|g' \ + -e 's|@''HAVE_WCRTOMB''@|$(HAVE_WCRTOMB)|g' \ + -e 's|@''HAVE_WCSRTOMBS''@|$(HAVE_WCSRTOMBS)|g' \ + -e 's|@''HAVE_WCSNRTOMBS''@|$(HAVE_WCSNRTOMBS)|g' \ + -e 's|@''HAVE_DECL_WCTOB''@|$(HAVE_DECL_WCTOB)|g' \ -e 's|@''HAVE_DECL_WCWIDTH''@|$(HAVE_DECL_WCWIDTH)|g' \ + -e 's|@''REPLACE_MBSTATE_T''@|$(REPLACE_MBSTATE_T)|g' \ + -e 's|@''REPLACE_BTOWC''@|$(REPLACE_BTOWC)|g' \ + -e 's|@''REPLACE_WCTOB''@|$(REPLACE_WCTOB)|g' \ + -e 's|@''REPLACE_MBSINIT''@|$(REPLACE_MBSINIT)|g' \ + -e 's|@''REPLACE_MBRTOWC''@|$(REPLACE_MBRTOWC)|g' \ + -e 's|@''REPLACE_MBRLEN''@|$(REPLACE_MBRLEN)|g' \ + -e 's|@''REPLACE_MBSRTOWCS''@|$(REPLACE_MBSRTOWCS)|g' \ + -e 's|@''REPLACE_MBSNRTOWCS''@|$(REPLACE_MBSNRTOWCS)|g' \ + -e 's|@''REPLACE_WCRTOMB''@|$(REPLACE_WCRTOMB)|g' \ + -e 's|@''REPLACE_WCSRTOMBS''@|$(REPLACE_WCSRTOMBS)|g' \ -e 's|@''REPLACE_WCWIDTH''@|$(REPLACE_WCWIDTH)|g' \ -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ < $(srcdir)/wchar.in.h; \ diff --git a/gnulib/lib/fseeko.c b/gnulib/lib/fseeko.c index 17e5f16..e11e49a 100644 --- a/gnulib/lib/fseeko.c +++ b/gnulib/lib/fseeko.c @@ -41,7 +41,7 @@ rpl_fseeko (FILE *fp, off_t offset, int whence) #endif /* These tests are based on fpurge.c. */ -#if defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */ +#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ if (fp->_IO_read_end == fp->_IO_read_ptr && fp->_IO_write_ptr == fp->_IO_write_base && fp->_IO_save_base == NULL) diff --git a/gnulib/lib/lstat.c b/gnulib/lib/lstat.c index aa5e8c4..3d1bca8 100644 --- a/gnulib/lib/lstat.c +++ b/gnulib/lib/lstat.c @@ -25,15 +25,15 @@ #include <sys/stat.h> #undef __need_system_sys_stat_h -/* Specification. */ -#include <sys/stat.h> - static inline int orig_lstat (const char *filename, struct stat *buf) { return lstat (filename, buf); } +/* Specification. */ +#include <sys/stat.h> + #include <string.h> #include <errno.h> diff --git a/gnulib/lib/netdb.in.h b/gnulib/lib/netdb.in.h index 9ceb98d..a81e2b4 100644 --- a/gnulib/lib/netdb.in.h +++ b/gnulib/lib/netdb.in.h @@ -36,12 +36,6 @@ #ifndef _GL_NETDB_H #define _GL_NETDB_H -#if @HAVE_NETDB_H@ && HAVE_STRUCT_ADDRINFO - -/* Declarations for a platform that has <netdb.h>. */ - -#else - /* Get netdb.h definitions such as struct hostent for MinGW. */ #include <sys/socket.h> @@ -50,7 +44,7 @@ #if @GNULIB_GETADDRINFO@ -# ifndef HAVE_STRUCT_ADDRINFO +# if !@HAVE_STRUCT_ADDRINFO@ /* Structure to contain information about address of a service provider. */ struct addrinfo @@ -112,7 +106,7 @@ struct addrinfo # endif # ifndef EAI_OVERFLOW -/* Not defined on mingw32. */ +/* Not defined on mingw32 and Haiku. */ # define EAI_OVERFLOW -12 /* Argument buffer overflow. */ # endif # ifndef EAI_ADDRFAMILY @@ -139,7 +133,7 @@ struct addrinfo # endif # endif -# if !HAVE_DECL_GETADDRINFO +# if !@HAVE_DECL_GETADDRINFO@ /* Translate name of a service location and/or a service name to set of socket addresses. For more details, see the POSIX:2001 specification @@ -150,21 +144,21 @@ extern int getaddrinfo (const char *restrict nodename, struct addrinfo **restrict res); # endif -# if !HAVE_DECL_FREEADDRINFO +# if !@HAVE_DECL_FREEADDRINFO@ /* Free `addrinfo' structure AI including associated storage. For more details, see the POSIX:2001 specification <http://www.opengroup.org/susv3xsh/getaddrinfo.html>. */ extern void freeaddrinfo (struct addrinfo *ai); # endif -# if !HAVE_DECL_GAI_STRERROR +# if !@HAVE_DECL_GAI_STRERROR@ /* Convert error return from getaddrinfo() to a string. For more details, see the POSIX:2001 specification <http://www.opengroup.org/susv3xsh/gai_strerror.html>. */ extern const char *gai_strerror (int ecode); # endif -# if !HAVE_DECL_GETNAMEINFO +# if !@HAVE_DECL_GETNAMEINFO@ /* Convert socket address to printable node and service names. For more details, see the POSIX:2001 specification <http://www.opengroup.org/susv3xsh/getnameinfo.html>. */ @@ -184,7 +178,5 @@ extern int getnameinfo(const struct sockaddr *restrict sa, socklen_t salen, #endif /* @GNULIB_GETADDRINFO@ */ -#endif /* HAVE_NETDB_H */ - #endif /* _GL_NETDB_H */ #endif /* _GL_NETDB_H */ diff --git a/gnulib/lib/stdint.in.h b/gnulib/lib/stdint.in.h index 5170dc1..51ac462 100644 --- a/gnulib/lib/stdint.in.h +++ b/gnulib/lib/stdint.in.h @@ -89,15 +89,6 @@ # include <sys/bitypes.h> #endif -#if ! defined __cplusplus || defined __STDC_CONSTANT_MACROS - -/* Get WCHAR_MIN, WCHAR_MAX. */ -# if ! (defined WCHAR_MIN && defined WCHAR_MAX) -# include <wchar.h> -# endif - -#endif - #undef _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H /* Minimum and maximum values for a integer type under the usual assumption. @@ -122,46 +113,58 @@ #undef int8_t #undef uint8_t -#define int8_t signed char -#define uint8_t unsigned char +typedef signed char gl_int8_t; +typedef unsigned char gl_uint8_t; +#define int8_t gl_int8_t +#define uint8_t gl_uint8_t #undef int16_t #undef uint16_t -#define int16_t short int -#define uint16_t unsigned short int +typedef short int gl_int16_t; +typedef unsigned short int gl_uint16_t; +#define int16_t gl_int16_t +#define uint16_t gl_uint16_t #undef int32_t #undef uint32_t -#define int32_t int -#define uint32_t unsigned int +typedef int gl_int32_t; +typedef unsigned int gl_uint32_t; +#define int32_t gl_int32_t +#define uint32_t gl_uint32_t /* Do not undefine int64_t if gnulib is not being used with 64-bit types, since otherwise it breaks platforms like Tandem/NSK. */ #if LONG_MAX >> 31 >> 31 == 1 # undef int64_t -# define int64_t long int +typedef long int gl_int64_t; +# define int64_t gl_int64_t # define GL_INT64_T #elif defined _MSC_VER # undef int64_t -# define int64_t __int64 +typedef __int64 gl_int64_t; +# define int64_t gl_int64_t # define GL_INT64_T #elif @HAVE_LONG_LONG_INT@ # undef int64_t -# define int64_t long long int +typedef long long int gl_int64_t; +# define int64_t gl_int64_t # define GL_INT64_T #endif #if ULONG_MAX >> 31 >> 31 >> 1 == 1 # undef uint64_t -# define uint64_t unsigned long int +typedef unsigned long int gl_uint64_t; +# define uint64_t gl_uint64_t # define GL_UINT64_T #elif defined _MSC_VER # undef uint64_t -# define uint64_t unsigned __int64 +typedef unsigned __int64 gl_uint64_t; +# define uint64_t gl_uint64_t # define GL_UINT64_T #elif @HAVE_UNSIGNED_LONG_LONG_INT@ # undef uint64_t -# define uint64_t unsigned long long int +typedef unsigned long long int gl_uint64_t; +# define uint64_t gl_uint64_t # define GL_UINT64_T #endif @@ -216,12 +219,18 @@ #undef uint_fast32_t #undef int_fast64_t #undef uint_fast64_t -#define int_fast8_t long int -#define uint_fast8_t unsigned int_fast8_t -#define int_fast16_t long int -#define uint_fast16_t unsigned int_fast16_t -#define int_fast32_t long int -#define uint_fast32_t unsigned int_fast32_t +typedef long int gl_int_fast8_t; +typedef unsigned long int gl_uint_fast8_t; +typedef long int gl_int_fast16_t; +typedef unsigned long int gl_uint_fast16_t; +typedef long int gl_int_fast32_t; +typedef unsigned long int gl_uint_fast32_t; +#define int_fast8_t gl_int_fast8_t +#define uint_fast8_t gl_uint_fast8_t +#define int_fast16_t gl_int_fast16_t +#define uint_fast16_t gl_uint_fast16_t +#define int_fast32_t gl_int_fast32_t +#define uint_fast32_t gl_uint_fast32_t #ifdef GL_INT64_T # define int_fast64_t int64_t #endif @@ -233,8 +242,10 @@ #undef intptr_t #undef uintptr_t -#define intptr_t long int -#define uintptr_t unsigned long int +typedef long int gl_intptr_t; +typedef unsigned long int gl_uintptr_t; +#define intptr_t gl_intptr_t +#define uintptr_t gl_uintptr_t /* 7.18.1.5. Greatest-width integer types */ @@ -243,20 +254,24 @@ #undef intmax_t #if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1 -# define intmax_t long long int +typedef long long int gl_intmax_t; +# define intmax_t gl_intmax_t #elif defined GL_INT64_T # define intmax_t int64_t #else -# define intmax_t long int +typedef long int gl_intmax_t; +# define intmax_t gl_intmax_t #endif #undef uintmax_t #if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1 -# define uintmax_t unsigned long long int +typedef unsigned long long int gl_uintmax_t; +# define uintmax_t gl_uintmax_t #elif defined GL_UINT64_T # define uintmax_t uint64_t #else -# define uintmax_t unsigned long int +typedef unsigned long int gl_uintmax_t; +# define uintmax_t gl_uintmax_t #endif /* Verify that intmax_t and uintmax_t have the same size. Too much code @@ -419,10 +434,20 @@ typedef int _verify_intmax_size[2 * (sizeof (intmax_t) == sizeof (uintmax_t)) - /* ptrdiff_t limits */ #undef PTRDIFF_MIN #undef PTRDIFF_MAX -#define PTRDIFF_MIN \ - _STDINT_MIN (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@) -#define PTRDIFF_MAX \ - _STDINT_MAX (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@) +#if @APPLE_UNIVERSAL_BUILD@ +# if _LP64 +# define PTRDIFF_MIN _STDINT_MIN (1, 64, 0l) +# define PTRDIFF_MAX _STDINT_MAX (1, 64, 0l) +# else +# define PTRDIFF_MIN _STDINT_MIN (1, 32, 0) +# define PTRDIFF_MAX _STDINT_MAX (1, 32, 0) +# endif +#else +# define PTRDIFF_MIN \ + _STDINT_MIN (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@) +# define PTRDIFF_MAX \ + _STDINT_MAX (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@) +#endif /* sig_atomic_t limits */ #undef SIG_ATOMIC_MIN @@ -437,9 +462,24 @@ typedef int _verify_intmax_size[2 * (sizeof (intmax_t) == sizeof (uintmax_t)) - /* size_t limit */ #undef SIZE_MAX -#define SIZE_MAX _STDINT_MAX (0, @BITSIZEOF_SIZE_T@, 0@SIZE_T_SUFFIX@) +#if @APPLE_UNIVERSAL_BUILD@ +# if _LP64 +# define SIZE_MAX _STDINT_MAX (0, 64, 0ul) +# else +# define SIZE_MAX _STDINT_MAX (0, 32, 0ul) +# endif +#else +# define SIZE_MAX _STDINT_MAX (0, @BITSIZEOF_SIZE_T@, 0@SIZE_T_SUFFIX@) +#endif /* wchar_t limits */ +/* Get WCHAR_MIN, WCHAR_MAX. + This include is not on the top, above, because on OSF/1 4.0 we have a sequence of nested + includes <wchar.h> -> <stdio.h> -> <getopt.h> -> <stdlib.h>, and the latter includes + <stdint.h> and assumes its types are already defined. */ +#if ! (defined WCHAR_MIN && defined WCHAR_MAX) +# include <wchar.h> +#endif #undef WCHAR_MIN #undef WCHAR_MAX #define WCHAR_MIN \ diff --git a/gnulib/lib/stdlib.in.h b/gnulib/lib/stdlib.in.h index e28c151..baf21a4 100644 --- a/gnulib/lib/stdlib.in.h +++ b/gnulib/lib/stdlib.in.h @@ -52,8 +52,8 @@ struct random_data int32_t *rptr; /* Rear pointer. */ int32_t *state; /* Array of state values. */ int rand_type; /* Type of random number generator. */ - int rand_deg; /* Degree of random number generator. */ - int rand_sep; /* Distance between front and rear. */ + int rand_deg; /* Degree of random number generator. */ + int rand_sep; /* Distance between front and rear. */ int32_t *end_ptr; /* Pointer behind state table. */ }; #endif diff --git a/gnulib/lib/strpbrk.c b/gnulib/lib/strpbrk.c deleted file mode 100644 index b481bd1..0000000 --- a/gnulib/lib/strpbrk.c +++ /dev/null @@ -1,42 +0,0 @@ -/* Copyright (C) 1991, 1994, 2000, 2002-2003, 2006 Free Software - Foundation, Inc. - - NOTE: The canonical source of this file is maintained with the GNU C Library. - Bugs can be reported to bug-glibc@prep.ai.mit.edu. - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2.1, or (at your option) any - later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -#include <config.h> - -#include <stddef.h> -#include <string.h> - -#undef strpbrk - -/* Find the first occurrence in S of any character in ACCEPT. */ -char * -strpbrk (const char *s, const char *accept) -{ - while (*s != '\0') - { - const char *a = accept; - while (*a != '\0') - if (*a++ == *s) - return (char *) s; - ++s; - } - - return NULL; -} diff --git a/gnulib/lib/sys_select.in.h b/gnulib/lib/sys_select.in.h index f427dcc..7c453bf 100644 --- a/gnulib/lib/sys_select.in.h +++ b/gnulib/lib/sys_select.in.h @@ -15,14 +15,28 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef _GL_SYS_SELECT_H - -#if @HAVE_SYS_SELECT_H@ - # if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ # endif +/* On OSF/1, <sys/types.h> and <sys/time.h> include <sys/select.h>. + Simply delegate to the system's header in this case. */ +#if @HAVE_SYS_SELECT_H@ && defined __osf__ && (defined _SYS_TYPES_H_ && !defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TYPES_H) && defined _OSF_SOURCE + +# define _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TYPES_H +# @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@ + +#elif @HAVE_SYS_SELECT_H@ && defined __osf__ && (defined _SYS_TIME_H_ && !defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H) && defined _OSF_SOURCE + +# define _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H +# @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@ + +#else + +#ifndef _GL_SYS_SELECT_H + +#if @HAVE_SYS_SELECT_H@ + /* On many platforms, <sys/select.h> assumes prior inclusion of <sys/types.h>. */ # include <sys/types.h> @@ -76,3 +90,4 @@ extern int rpl_select (int, fd_set *, fd_set *, fd_set *, struct timeval *); #endif /* _GL_SYS_SELECT_H */ #endif /* _GL_SYS_SELECT_H */ +#endif /* OSF/1 */ diff --git a/gnulib/lib/sys_stat.in.h b/gnulib/lib/sys_stat.in.h index 9eac5f4..f46b4d7 100644 --- a/gnulib/lib/sys_stat.in.h +++ b/gnulib/lib/sys_stat.in.h @@ -275,6 +275,12 @@ # define S_IRWXUGO (S_IRWXU | S_IRWXG | S_IRWXO) #endif + +#ifdef __cplusplus +extern "C" { +#endif + + #if @GNULIB_LSTAT@ # if ! @HAVE_LSTAT@ /* mingw does not support symlinks, therefore it does not have lstat. But @@ -341,6 +347,12 @@ extern int lchmod (const char *filename, mode_t mode); lchmod (f, m)) #endif + +#ifdef __cplusplus +} +#endif + + #endif /* _GL_SYS_STAT_H */ #endif /* _GL_SYS_STAT_H */ #endif diff --git a/gnulib/lib/sys_time.in.h b/gnulib/lib/sys_time.in.h index 2b4bfdd..5ee4e7a 100644 --- a/gnulib/lib/sys_time.in.h +++ b/gnulib/lib/sys_time.in.h @@ -39,6 +39,10 @@ # include <time.h> # endif +#ifdef __cplusplus +extern "C" { +#endif + # if ! @HAVE_STRUCT_TIMEVAL@ struct timeval { @@ -53,4 +57,8 @@ struct timeval int gettimeofday (struct timeval *restrict, void *restrict); # endif +#ifdef __cplusplus +} +#endif + #endif /* _GL_SYS_TIME_H */ diff --git a/gnulib/lib/time.in.h b/gnulib/lib/time.in.h new file mode 100644 index 0000000..9c0a882 --- /dev/null +++ b/gnulib/lib/time.in.h @@ -0,0 +1,118 @@ +/* A more-standard <time.h>. + + Copyright (C) 2007-2008 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#if __GNUC__ >= 3 +@PRAGMA_SYSTEM_HEADER@ +#endif + +/* Don't get in the way of glibc when it includes time.h merely to + declare a few standard symbols, rather than to declare all the + symbols. Also, Solaris 8 <time.h> eventually includes itself + recursively; if that is happening, just include the system <time.h> + without adding our own declarations. */ +#if (defined __need_time_t || defined __need_clock_t \ + || defined __need_timespec \ + || defined _GL_TIME_H) + +# @INCLUDE_NEXT@ @NEXT_TIME_H@ + +#else + +# define _GL_TIME_H + +# @INCLUDE_NEXT@ @NEXT_TIME_H@ + +# ifdef __cplusplus +extern "C" { +# endif + +/* Some systems don't define struct timespec (e.g., AIX 4.1, Ultrix 4.3). + Or they define it with the wrong member names or define it in <sys/time.h> + (e.g., FreeBSD circa 1997). */ +# if ! @TIME_H_DEFINES_STRUCT_TIMESPEC@ +# if @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@ +# include <sys/time.h> +# else +# undef timespec +# define timespec rpl_timespec +struct timespec +{ + time_t tv_sec; + long int tv_nsec; +}; +# endif +# endif + +/* Sleep for at least RQTP seconds unless interrupted, If interrupted, + return -1 and store the remaining time into RMTP. See + <http://www.opengroup.org/susv3xsh/nanosleep.html>. */ +# if @REPLACE_NANOSLEEP@ +# define nanosleep rpl_nanosleep +int nanosleep (struct timespec const *__rqtp, struct timespec *__rmtp); +# endif + +/* Convert TIMER to RESULT, assuming local time and UTC respectively. See + <http://www.opengroup.org/susv3xsh/localtime_r.html> and + <http://www.opengroup.org/susv3xsh/gmtime_r.html>. */ +# if @REPLACE_LOCALTIME_R@ +# undef localtime_r +# define localtime_r rpl_localtime_r +# undef gmtime_r +# define gmtime_r rpl_gmtime_r +struct tm *localtime_r (time_t const *restrict __timer, + struct tm *restrict __result); +struct tm *gmtime_r (time_t const *restrict __timer, + struct tm *restrict __result); +# endif + +/* Parse BUF as a time stamp, assuming FORMAT specifies its layout, and store + the resulting broken-down time into TM. See + <http://www.opengroup.org/susv3xsh/strptime.html>. */ +# if @REPLACE_STRPTIME@ +# undef strptime +# define strptime rpl_strptime +char *strptime (char const *restrict __buf, char const *restrict __format, + struct tm *restrict __tm); +# endif + +/* Convert TM to a time_t value, assuming UTC. */ +# if @REPLACE_TIMEGM@ +# undef timegm +# define timegm rpl_timegm +time_t timegm (struct tm *__tm); +# endif + +/* Encourage applications to avoid unsafe functions that can overrun + buffers when given outlandish struct tm values. Portable + applications should use strftime (or even sprintf) instead. */ +# if GNULIB_PORTCHECK +# undef asctime +# define asctime eschew_asctime +# undef asctime_r +# define asctime_r eschew_asctime_r +# undef ctime +# define ctime eschew_ctime +# undef ctime_r +# define ctime_r eschew_ctime_r +# endif + +# ifdef __cplusplus +} +# endif + +#endif diff --git a/gnulib/lib/time_r.c b/gnulib/lib/time_r.c new file mode 100644 index 0000000..7317195 --- /dev/null +++ b/gnulib/lib/time_r.c @@ -0,0 +1,47 @@ +/* Reentrant time functions like localtime_r. + + Copyright (C) 2003, 2006, 2007 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License along + with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Paul Eggert. */ + +#include <config.h> + +#include <time.h> + +#include <string.h> + +static struct tm * +copy_tm_result (struct tm *dest, struct tm const *src) +{ + if (! src) + return 0; + *dest = *src; + return dest; +} + + +struct tm * +gmtime_r (time_t const * restrict t, struct tm * restrict tp) +{ + return copy_tm_result (tp, gmtime (t)); +} + +struct tm * +localtime_r (time_t const * restrict t, struct tm * restrict tp) +{ + return copy_tm_result (tp, localtime (t)); +} diff --git a/gnulib/lib/unistd.in.h b/gnulib/lib/unistd.in.h index 8bc3abf..4b6c4b9 100644 --- a/gnulib/lib/unistd.in.h +++ b/gnulib/lib/unistd.in.h @@ -35,6 +35,7 @@ #endif /* mingw fails to declare _exit in <unistd.h>. */ +/* mingw, BeOS, Haiku declare environ in <stdlib.h>, not in <unistd.h>. */ #include <stdlib.h> #if @GNULIB_WRITE@ && @REPLACE_WRITE@ && @GNULIB_UNISTD_H_SIGPIPE@ diff --git a/gnulib/lib/wchar.in.h b/gnulib/lib/wchar.in.h index 652ca6e..09fc326 100644 --- a/gnulib/lib/wchar.in.h +++ b/gnulib/lib/wchar.in.h @@ -68,6 +68,197 @@ extern "C" { /* Define wint_t. (Also done in wctype.in.h.) */ #if !@HAVE_WINT_T@ && !defined wint_t # define wint_t int +# ifndef WEOF +# define WEOF -1 +# endif +#endif + + +/* Override mbstate_t if it is too small. + On IRIX 6.5, sizeof (mbstate_t) == 1, which is not sufficient for + implementing mbrtowc for encodings like UTF-8. */ +#if !(@HAVE_MBSINIT@ && @HAVE_MBRTOWC@) || @REPLACE_MBSTATE_T@ +typedef int rpl_mbstate_t; +# undef mbstate_t +# define mbstate_t rpl_mbstate_t +# define GNULIB_defined_mbstate_t 1 +#endif + + +/* Convert a single-byte character to a wide character. */ +#if @GNULIB_BTOWC@ +# if @REPLACE_BTOWC@ +# undef btowc +# define btowc rpl_btowc +# endif +# if !@HAVE_BTOWC@ || @REPLACE_BTOWC@ +extern wint_t btowc (int c); +# endif +#elif defined GNULIB_POSIXCHECK +# undef btowc +# define btowc(c) \ + (GL_LINK_WARNING ("btowc is unportable - " \ + "use gnulib module btowc for portability"), \ + btowc (c)) +#endif + + +/* Convert a wide character to a single-byte character. */ +#if @GNULIB_WCTOB@ +# if @REPLACE_WCTOB@ +# undef wctob +# define wctob rpl_wctob +# endif +# if (!defined wctob && !@HAVE_DECL_WCTOB@) || @REPLACE_WCTOB@ +/* wctob is provided by gnulib, or wctob exists but is not declared. */ +extern int wctob (wint_t wc); +# endif +#elif defined GNULIB_POSIXCHECK +# undef wctob +# define wctob(w) \ + (GL_LINK_WARNING ("wctob is unportable - " \ + "use gnulib module wctob for portability"), \ + wctob (w)) +#endif + + +/* Test whether *PS is in the initial state. */ +#if @GNULIB_MBSINIT@ +# if @REPLACE_MBSINIT@ +# undef mbsinit +# define mbsinit rpl_mbsinit +# endif +# if !@HAVE_MBSINIT@ || @REPLACE_MBSINIT@ +extern int mbsinit (const mbstate_t *ps); +# endif +#elif defined GNULIB_POSIXCHECK +# undef mbsinit +# define mbsinit(p) \ + (GL_LINK_WARNING ("mbsinit is unportable - " \ + "use gnulib module mbsinit for portability"), \ + mbsinit (p)) +#endif + + +/* Convert a multibyte character to a wide character. */ +#if @GNULIB_MBRTOWC@ +# if @REPLACE_MBRTOWC@ +# undef mbrtowc +# define mbrtowc rpl_mbrtowc +# endif +# if !@HAVE_MBRTOWC@ || @REPLACE_MBRTOWC@ +extern size_t mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps); +# endif +#elif defined GNULIB_POSIXCHECK +# undef mbrtowc +# define mbrtowc(w,s,n,p) \ + (GL_LINK_WARNING ("mbrtowc is unportable - " \ + "use gnulib module mbrtowc for portability"), \ + mbrtowc (w, s, n, p)) +#endif + + +/* Recognize a multibyte character. */ +#if @GNULIB_MBRLEN@ +# if @REPLACE_MBRLEN@ +# undef mbrlen +# define mbrlen rpl_mbrlen +# endif +# if !@HAVE_MBRLEN@ || @REPLACE_MBRLEN@ +extern size_t mbrlen (const char *s, size_t n, mbstate_t *ps); +# endif +#elif defined GNULIB_POSIXCHECK +# undef mbrlen +# define mbrlen(s,n,p) \ + (GL_LINK_WARNING ("mbrlen is unportable - " \ + "use gnulib module mbrlen for portability"), \ + mbrlen (s, n, p)) +#endif + + +/* Convert a string to a wide string. */ +#if @GNULIB_MBSRTOWCS@ +# if @REPLACE_MBSRTOWCS@ +# undef mbsrtowcs +# define mbsrtowcs rpl_mbsrtowcs +# endif +# if !@HAVE_MBSRTOWCS@ || @REPLACE_MBSRTOWCS@ +extern size_t mbsrtowcs (wchar_t *dest, const char **srcp, size_t len, mbstate_t *ps); +# endif +#elif defined GNULIB_POSIXCHECK +# undef mbsrtowcs +# define mbsrtowcs(d,s,l,p) \ + (GL_LINK_WARNING ("mbsrtowcs is unportable - " \ + "use gnulib module mbsrtowcs for portability"), \ + mbsrtowcs (d, s, l, p)) +#endif + + +/* Convert a string to a wide string. */ +#if @GNULIB_MBSNRTOWCS@ +# if @REPLACE_MBSNRTOWCS@ +# undef mbsnrtowcs +# define mbsnrtowcs rpl_mbsnrtowcs +# endif +# if !@HAVE_MBSNRTOWCS@ || @REPLACE_MBSNRTOWCS@ +extern size_t mbsnrtowcs (wchar_t *dest, const char **srcp, size_t srclen, size_t len, mbstate_t *ps); +# endif +#elif defined GNULIB_POSIXCHECK +# undef mbsnrtowcs +# define mbsnrtowcs(d,s,n,l,p) \ + (GL_LINK_WARNING ("mbsnrtowcs is unportable - " \ + "use gnulib module mbsnrtowcs for portability"), \ + mbsnrtowcs (d, s, n, l, p)) +#endif + + +/* Convert a wide character to a multibyte character. */ +#if @GNULIB_WCRTOMB@ +# if @REPLACE_WCRTOMB@ +# undef wcrtomb +# define wcrtomb rpl_wcrtomb +# endif +# if !@HAVE_WCRTOMB@ || @REPLACE_WCRTOMB@ +extern size_t wcrtomb (char *s, wchar_t wc, mbstate_t *ps); +# endif +#elif defined GNULIB_POSIXCHECK +# undef wcrtomb +# define wcrtomb(s,w,p) \ + (GL_LINK_WARNING ("wcrtomb is unportable - " \ + "use gnulib module wcrtomb for portability"), \ + wcrtomb (s, w, p)) +#endif + + +/* Convert a wide string to a string. */ +#if @GNULIB_WCSRTOMBS@ +# if @REPLACE_WCSRTOMBS@ +# undef wcsrtombs +# define wcsrtombs rpl_wcsrtombs +# endif +# if !@HAVE_WCSRTOMBS@ || @REPLACE_WCSRTOMBS@ +extern size_t wcsrtombs (char *dest, const wchar_t **srcp, size_t len, mbstate_t *ps); +# endif +#elif defined GNULIB_POSIXCHECK +# undef wcsrtombs +# define wcsrtombs(d,s,l,p) \ + (GL_LINK_WARNING ("wcsrtombs is unportable - " \ + "use gnulib module wcsrtombs for portability"), \ + wcsrtombs (d, s, l, p)) +#endif + + +/* Convert a wide string to a string. */ +#if @GNULIB_WCSNRTOMBS@ +# if !@HAVE_WCSNRTOMBS@ +extern size_t wcsnrtombs (char *dest, const wchar_t **srcp, size_t srclen, size_t len, mbstate_t *ps); +# endif +#elif defined GNULIB_POSIXCHECK +# undef wcsnrtombs +# define wcsnrtombs(d,s,n,l,p) \ + (GL_LINK_WARNING ("wcsnrtombs is unportable - " \ + "use gnulib module wcsnrtombs for portability"), \ + wcsnrtombs (d, s, n, l, p)) #endif diff --git a/gnulib/m4/codeset.m4 b/gnulib/m4/codeset.m4 index 223955b..de4181d 100644 --- a/gnulib/m4/codeset.m4 +++ b/gnulib/m4/codeset.m4 @@ -1,5 +1,5 @@ -# codeset.m4 serial 2 (gettext-0.16) -dnl Copyright (C) 2000-2002, 2006 Free Software Foundation, Inc. +# codeset.m4 serial 3 (gettext-0.18) +dnl Copyright (C) 2000-2002, 2006, 2008 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -8,14 +8,14 @@ dnl From Bruno Haible. AC_DEFUN([AM_LANGINFO_CODESET], [ - AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset, + AC_CACHE_CHECK([for nl_langinfo and CODESET], [am_cv_langinfo_codeset], [AC_TRY_LINK([#include <langinfo.h>], [char* cs = nl_langinfo(CODESET); return !cs;], - am_cv_langinfo_codeset=yes, - am_cv_langinfo_codeset=no) + [am_cv_langinfo_codeset=yes], + [am_cv_langinfo_codeset=no]) ]) if test $am_cv_langinfo_codeset = yes; then - AC_DEFINE(HAVE_LANGINFO_CODESET, 1, + AC_DEFINE([HAVE_LANGINFO_CODESET], 1, [Define if you have <langinfo.h> and nl_langinfo(CODESET).]) fi ]) diff --git a/gnulib/m4/errno_h.m4 b/gnulib/m4/errno_h.m4 index b5af078..22c08f0 100644 --- a/gnulib/m4/errno_h.m4 +++ b/gnulib/m4/errno_h.m4 @@ -1,4 +1,4 @@ -# errno_h.m4 serial 1 +# errno_h.m4 serial 2 dnl Copyright (C) 2004, 2006, 2008 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -111,3 +111,9 @@ yes AC_SUBST($1[_VALUE]) fi ]) + +dnl Autoconf >= 2.61 has AC_COMPUTE_INT built-in. +dnl Remove this when we can assume autoconf >= 2.61. +m4_ifdef([AC_COMPUTE_INT], [], [ + AC_DEFUN([AC_COMPUTE_INT], [_AC_COMPUTE_INT([$2],[$1],[$3],[$4])]) +]) diff --git a/gnulib/m4/extensions.m4 b/gnulib/m4/extensions.m4 index 917af94..611fcfd 100644 --- a/gnulib/m4/extensions.m4 +++ b/gnulib/m4/extensions.m4 @@ -1,4 +1,4 @@ -# serial 5 -*- Autoconf -*- +# serial 6 -*- Autoconf -*- # Enable extensions on systems that normally disable them. # Copyright (C) 2003, 2006-2008 Free Software Foundation, Inc. @@ -24,6 +24,8 @@ AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS], [AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl AC_BEFORE([$0], [AC_RUN_IFELSE])dnl + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_CHECK_HEADER([minix/config.h], [MINIX=yes], [MINIX=]) if test "$MINIX" = yes; then AC_DEFINE([_POSIX_SOURCE], [1], @@ -36,6 +38,16 @@ AC_BEFORE([$0], [AC_RUN_IFELSE])dnl [Define to 1 if on MINIX.]) fi + dnl HP-UX 11.11 defines mbstate_t only if _XOPEN_SOURCE is defined to 500, + dnl regardless of whether the flags -Ae or _D_HPUX_SOURCE=1 are already + dnl provided. + case "$host_os" in + hpux*) + AC_DEFINE([_XOPEN_SOURCE], [500], + [Define to 500 only on HP-UX.]) + ;; + esac + AH_VERBATIM([__EXTENSIONS__], [/* Enable extensions on AIX 3, Interix. */ #ifndef _ALL_SOURCE diff --git a/gnulib/m4/getaddrinfo.m4 b/gnulib/m4/getaddrinfo.m4 index c184c6f..9655a42 100644 --- a/gnulib/m4/getaddrinfo.m4 +++ b/gnulib/m4/getaddrinfo.m4 @@ -1,4 +1,4 @@ -# getaddrinfo.m4 serial 16 +# getaddrinfo.m4 serial 19 dnl Copyright (C) 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -9,8 +9,21 @@ AC_DEFUN([gl_GETADDRINFO], AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H AC_REQUIRE([gl_HEADER_NETDB])dnl for HAVE_NETDB_H AC_MSG_NOTICE([checking how to do getaddrinfo, freeaddrinfo and getnameinfo]) + GETADDRINFO_LIB= + gai_saved_LIBS="$LIBS" + + dnl Where is getaddrinfo()? + dnl - On Solaris, it is in libsocket. + dnl - On Haiku, it is in libnetwork. + dnl - On BeOS, it is in libnet. + dnl - On native Windows, it is in ws2_32.dll. + dnl - Otherwise it is in libc. + AC_SEARCH_LIBS(getaddrinfo, [socket network net], + [if test "$ac_cv_search_getaddrinfo" != "none required"; then + GETADDRINFO_LIB="$ac_cv_search_getaddrinfo" + fi]) + LIBS="$gai_saved_LIBS $GETADDRINFO_LIB" - AC_SEARCH_LIBS(getaddrinfo, [nsl socket]) AC_CACHE_CHECK([for getaddrinfo], [gl_cv_func_getaddrinfo], [ AC_TRY_LINK([ #include <sys/types.h> @@ -36,9 +49,11 @@ AC_DEFUN([gl_GETADDRINFO], #endif #include <stddef.h> ], [getaddrinfo(NULL, NULL, NULL, NULL);], gl_cv_w32_getaddrinfo=yes) - LIBS="$am_save_LIBS"]) + LIBS="$am_save_LIBS" + ]) if test "$gl_cv_w32_getaddrinfo" = "yes"; then - LIBS="$LIBS -lws2_32" + GETADDRINFO_LIB="-lws2_32" + LIBS="$gai_saved_LIBS $GETADDRINFO_LIB" else AC_LIBOBJ(getaddrinfo) fi @@ -68,31 +83,19 @@ AC_DEFUN([gl_GETADDRINFO], AC_LIBOBJ(gai_strerror) fi + LIBS="$gai_saved_LIBS" + gl_PREREQ_GETADDRINFO + + AC_SUBST([GETADDRINFO_LIB]) ]) -# Prerequisites of lib/getaddrinfo.c. +# Prerequisites of lib/netdb.in.h and lib/getaddrinfo.c. AC_DEFUN([gl_PREREQ_GETADDRINFO], [ + AC_REQUIRE([gl_NETDB_H_DEFAULTS]) AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H - AC_SEARCH_LIBS(gethostbyname, [inet nsl]) - AC_SEARCH_LIBS(getservbyname, [inet nsl socket xnet]) - AC_CHECK_FUNCS(gethostbyname,, [ - AC_CACHE_CHECK(for gethostbyname in winsock2.h and -lws2_32, - gl_cv_w32_gethostbyname, [ - gl_cv_w32_gethostbyname=no - am_save_LIBS="$LIBS" - LIBS="$LIBS -lws2_32" - AC_TRY_LINK([ -#ifdef HAVE_WINSOCK2_H -#include <winsock2.h> -#endif -#include <stddef.h> -], [gethostbyname(NULL);], gl_cv_w32_gethostbyname=yes) - LIBS="$am_save_LIBS"]) - if test "$gl_cv_w32_gethostbyname" = "yes"; then - LIBS="$LIBS -lws2_32" - fi - ]) + AC_REQUIRE([gl_HOSTENT]) dnl for HOSTENT_LIB + AC_REQUIRE([gl_SERVENT]) dnl for SERVENT_LIB AC_REQUIRE([AC_C_RESTRICT]) AC_REQUIRE([gl_SOCKET_FAMILIES]) AC_REQUIRE([gl_HEADER_SYS_SOCKET]) @@ -104,6 +107,7 @@ AC_DEFUN([gl_PREREQ_GETADDRINFO], [ AC_CHECK_MEMBERS([struct sockaddr.sa_len], , , [#include <sys/socket.h>]) AC_CHECK_HEADERS_ONCE(netinet/in.h) + AC_CHECK_DECLS([getaddrinfo, freeaddrinfo, gai_strerror, getnameinfo],,,[ /* sys/types.h is not needed according to POSIX, but the sys/socket.h in i386-unknown-freebsd4.10 and @@ -119,6 +123,19 @@ AC_DEFUN([gl_PREREQ_GETADDRINFO], [ #include <ws2tcpip.h> #endif ]) + if test $ac_cv_have_decl_getaddrinfo = no; then + HAVE_DECL_GETADDRINFO=0 + fi + if test $ac_cv_have_decl_freeaddrinfo = no; then + HAVE_DECL_FREEADDRINFO=0 + fi + if test $ac_cv_have_decl_gai_strerror = no; then + HAVE_DECL_GAI_STRERROR=0 + fi + if test $ac_cv_have_decl_getnameinfo = no; then + HAVE_DECL_GETNAMEINFO=0 + fi + AC_CHECK_TYPES([struct addrinfo],,,[ #include <sys/types.h> #ifdef HAVE_SYS_SOCKET_H @@ -131,4 +148,19 @@ AC_DEFUN([gl_PREREQ_GETADDRINFO], [ #include <ws2tcpip.h> #endif ]) + if test $ac_cv_type_struct_addrinfo = no; then + HAVE_STRUCT_ADDRINFO=0 + fi + + dnl Append $HOSTENT_LIB to GETADDRINFO_LIB, avoiding gratuitous duplicates. + case " $GETADDRINFO_LIB " in + *" $HOSTENT_LIB "*) ;; + *) GETADDRINFO_LIB="$GETADDRINFO_LIB $HOSTENT_LIB" ;; + esac + + dnl Append $SERVENT_LIB to GETADDRINFO_LIB, avoiding gratuitous duplicates. + case " $GETADDRINFO_LIB " in + *" $SERVENT_LIB "*) ;; + *) GETADDRINFO_LIB="$GETADDRINFO_LIB $SERVENT_LIB" ;; + esac ]) diff --git a/gnulib/m4/gettext.m4 b/gnulib/m4/gettext.m4 index c9ae1f7..c488563 100644 --- a/gnulib/m4/gettext.m4 +++ b/gnulib/m4/gettext.m4 @@ -1,5 +1,5 @@ -# gettext.m4 serial 60 (gettext-0.17) -dnl Copyright (C) 1995-2007 Free Software Foundation, Inc. +# gettext.m4 serial 61 (gettext-0.18) +dnl Copyright (C) 1995-2008 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -127,7 +127,7 @@ AC_DEFUN([AM_GNU_GETTEXT], [ --with-included-gettext use the GNU gettext library included here], nls_cv_force_use_gnu_gettext=$withval, nls_cv_force_use_gnu_gettext=no) - AC_MSG_RESULT($nls_cv_force_use_gnu_gettext) + AC_MSG_RESULT([$nls_cv_force_use_gnu_gettext]) nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" if test "$nls_cv_force_use_gnu_gettext" != "yes"; then @@ -267,7 +267,7 @@ return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_a if test "$gt_use_preinstalled_gnugettext" = "yes" \ || test "$nls_cv_use_gnu_gettext" = "yes"; then - AC_DEFINE(ENABLE_NLS, 1, + AC_DEFINE([ENABLE_NLS], 1, [Define to 1 if translation of program messages to the user's native language is requested.]) else @@ -301,9 +301,9 @@ return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_a fi dnl For backward compatibility. Some packages may be using this. - AC_DEFINE(HAVE_GETTEXT, 1, + AC_DEFINE([HAVE_GETTEXT], 1, [Define if the GNU gettext() function is already present or preinstalled.]) - AC_DEFINE(HAVE_DCGETTEXT, 1, + AC_DEFINE([HAVE_DCGETTEXT], 1, [Define if the GNU dcgettext() function is already present or preinstalled.]) fi @@ -319,9 +319,9 @@ return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_a fi dnl Make all variables we use known to autoconf. - AC_SUBST(BUILD_INCLUDED_LIBINTL) - AC_SUBST(USE_INCLUDED_LIBINTL) - AC_SUBST(CATOBJEXT) + AC_SUBST([BUILD_INCLUDED_LIBINTL]) + AC_SUBST([USE_INCLUDED_LIBINTL]) + AC_SUBST([CATOBJEXT]) dnl For backward compatibility. Some configure.ins may be using this. nls_cv_header_intl= @@ -329,36 +329,36 @@ return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_a dnl For backward compatibility. Some Makefiles may be using this. DATADIRNAME=share - AC_SUBST(DATADIRNAME) + AC_SUBST([DATADIRNAME]) dnl For backward compatibility. Some Makefiles may be using this. INSTOBJEXT=.mo - AC_SUBST(INSTOBJEXT) + AC_SUBST([INSTOBJEXT]) dnl For backward compatibility. Some Makefiles may be using this. GENCAT=gencat - AC_SUBST(GENCAT) + AC_SUBST([GENCAT]) dnl For backward compatibility. Some Makefiles may be using this. INTLOBJS= if test "$USE_INCLUDED_LIBINTL" = yes; then INTLOBJS="\$(GETTOBJS)" fi - AC_SUBST(INTLOBJS) + AC_SUBST([INTLOBJS]) dnl Enable libtool support if the surrounding package wishes it. INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix - AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX) + AC_SUBST([INTL_LIBTOOL_SUFFIX_PREFIX]) ]) dnl For backward compatibility. Some Makefiles may be using this. INTLLIBS="$LIBINTL" - AC_SUBST(INTLLIBS) + AC_SUBST([INTLLIBS]) dnl Make all documented variables known to autoconf. - AC_SUBST(LIBINTL) - AC_SUBST(LTLIBINTL) - AC_SUBST(POSUB) + AC_SUBST([LIBINTL]) + AC_SUBST([LTLIBINTL]) + AC_SUBST([POSUB]) ]) diff --git a/gnulib/m4/glibc2.m4 b/gnulib/m4/glibc2.m4 index e8f5bfe..fe58a0f 100644 --- a/gnulib/m4/glibc2.m4 +++ b/gnulib/m4/glibc2.m4 @@ -1,5 +1,5 @@ -# glibc2.m4 serial 1 -dnl Copyright (C) 2000-2002, 2004 Free Software Foundation, Inc. +# glibc2.m4 serial 2 +dnl Copyright (C) 2000-2002, 2004, 2008 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -9,8 +9,8 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gt_GLIBC2], [ - AC_CACHE_CHECK(whether we are using the GNU C Library 2 or newer, - ac_cv_gnu_library_2, + AC_CACHE_CHECK([whether we are using the GNU C Library 2 or newer], + [ac_cv_gnu_library_2], [AC_EGREP_CPP([Lucky GNU user], [ #include <features.h> @@ -20,11 +20,11 @@ AC_DEFUN([gt_GLIBC2], #endif #endif ], - ac_cv_gnu_library_2=yes, - ac_cv_gnu_library_2=no) + [ac_cv_gnu_library_2=yes], + [ac_cv_gnu_library_2=no]) ] ) - AC_SUBST(GLIBC2) + AC_SUBST([GLIBC2]) GLIBC2="$ac_cv_gnu_library_2" ] ) diff --git a/gnulib/m4/glibc21.m4 b/gnulib/m4/glibc21.m4 index d95fd98..93fbf47 100644 --- a/gnulib/m4/glibc21.m4 +++ b/gnulib/m4/glibc21.m4 @@ -1,5 +1,5 @@ -# glibc21.m4 serial 3 -dnl Copyright (C) 2000-2002, 2004 Free Software Foundation, Inc. +# glibc21.m4 serial 4 +dnl Copyright (C) 2000-2002, 2004, 2008 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -9,8 +9,8 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_GLIBC21], [ - AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer, - ac_cv_gnu_library_2_1, + AC_CACHE_CHECK([whether we are using the GNU C Library 2.1 or newer], + [ac_cv_gnu_library_2_1], [AC_EGREP_CPP([Lucky GNU user], [ #include <features.h> @@ -20,11 +20,11 @@ AC_DEFUN([gl_GLIBC21], #endif #endif ], - ac_cv_gnu_library_2_1=yes, - ac_cv_gnu_library_2_1=no) + [ac_cv_gnu_library_2_1=yes], + [ac_cv_gnu_library_2_1=no]) ] ) - AC_SUBST(GLIBC21) + AC_SUBST([GLIBC21]) GLIBC21="$ac_cv_gnu_library_2_1" ] ) diff --git a/gnulib/m4/gnulib-cache.m4 b/gnulib/m4/gnulib-cache.m4 index d635f85..9eb6064 100644 --- a/gnulib/m4/gnulib-cache.m4 +++ b/gnulib/m4/gnulib-cache.m4 @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2008 Free Software Foundation, Inc. +# Copyright (C) 2002-2009 Free Software Foundation, Inc. # # This file is free software, distributed under the terms of the GNU # General Public License. As a special exception to the GNU General @@ -15,7 +15,7 @@ # Specification in the form of a command-line invocation: -# gnulib-tool --import --dir=. --lib=libgnu --source-base=gnulib/lib --m4-base=gnulib/m4 --doc-base=doc --tests-base=gnulib/tests --aux-dir=build-aux --with-tests --lgpl=2 --libtool --macro-prefix=gl c-ctype close connect getaddrinfo gethostname getpass gettext inet_pton mkstemp mktempd perror physmem poll posix-shell recv send setsockopt socket strerror strndup strsep sys_stat useless-if-before-free vasprintf vc-list-files verify +# gnulib-tool --import --dir=. --lib=libgnu --source-base=gnulib/lib --m4-base=gnulib/m4 --doc-base=doc --tests-base=gnulib/tests --aux-dir=build-aux --with-tests --lgpl=2 --libtool --macro-prefix=gl c-ctype close connect getaddrinfo gethostname getpass gettext inet_pton mkstemp mktempd perror physmem poll posix-shell recv send setsockopt socket strerror strndup strsep sys_stat time_r useless-if-before-free vasprintf vc-list-files verify # Specification in the form of a few gnulib-tool.m4 macro invocations: gl_LOCAL_DIR([]) @@ -42,6 +42,7 @@ gl_MODULES([ strndup strsep sys_stat + time_r useless-if-before-free vasprintf vc-list-files diff --git a/gnulib/m4/gnulib-comp.m4 b/gnulib/m4/gnulib-comp.m4 index 895ab2a..072b9f0 100644 --- a/gnulib/m4/gnulib-comp.m4 +++ b/gnulib/m4/gnulib-comp.m4 @@ -1,5 +1,5 @@ # DO NOT EDIT! GENERATED AUTOMATICALLY! -# Copyright (C) 2002-2008 Free Software Foundation, Inc. +# Copyright (C) 2002-2009 Free Software Foundation, Inc. # # This file is free software, distributed under the terms of the GNU # General Public License. As a special exception to the GNU General @@ -77,6 +77,7 @@ AC_SUBST([LTALLOCA]) AC_SUBST([LIBINTL]) AC_SUBST([LTLIBINTL]) gl_FUNC_GETTIMEOFDAY + gl_HOSTENT gl_INET_NTOP gl_ARPA_INET_MODULE_INDICATOR([inet_ntop]) gl_INET_PTON @@ -89,6 +90,7 @@ AC_SUBST([LTALLOCA]) gl_STDLIB_MODULE_INDICATOR([malloc-posix]) gl_FUNC_MKSTEMP gl_STDLIB_MODULE_INDICATOR([mkstemp]) + gl_MULTIARCH gl_HEADER_NETDB gl_HEADER_NETINET_IN AC_PROG_MKDIR_P @@ -109,6 +111,7 @@ AC_SUBST([LTALLOCA]) AC_LIBOBJ([send]) fi gl_SYS_SOCKET_MODULE_INDICATOR([send]) + gl_SERVENT AC_REQUIRE([gl_HEADER_SYS_SOCKET]) if test "$ac_cv_header_winsock2_h" = yes; then AC_LIBOBJ([setsockopt]) @@ -136,8 +139,6 @@ AC_SUBST([LTALLOCA]) gl_STRING_MODULE_INDICATOR([strndup]) gl_FUNC_STRNLEN gl_STRING_MODULE_INDICATOR([strnlen]) - gl_FUNC_STRPBRK - gl_STRING_MODULE_INDICATOR([strpbrk]) gl_FUNC_STRSEP gl_STRING_MODULE_INDICATOR([strsep]) gl_HEADER_SYS_SELECT @@ -150,6 +151,8 @@ AC_SUBST([LTALLOCA]) gl_HEADER_SYS_TIME_H AC_PROG_MKDIR_P gl_FUNC_GEN_TEMPNAME + gl_HEADER_TIME_H + gl_TIME_R gl_UNISTD_H gl_FUNC_VASNPRINTF gl_FUNC_VASPRINTF @@ -384,7 +387,6 @@ AC_DEFUN([gl_FILE_LIST], [ lib/string.in.h lib/strndup.c lib/strnlen.c - lib/strpbrk.c lib/strsep.c lib/sys_select.in.h lib/sys_socket.in.h @@ -392,6 +394,8 @@ AC_DEFUN([gl_FILE_LIST], [ lib/sys_time.in.h lib/tempname.c lib/tempname.h + lib/time.in.h + lib/time_r.c lib/unistd.in.h lib/vasnprintf.c lib/vasnprintf.h @@ -419,6 +423,7 @@ AC_DEFUN([gl_FILE_LIST], [ m4/glibc2.m4 m4/glibc21.m4 m4/gnulib-common.m4 + m4/hostent.m4 m4/iconv.m4 m4/include_next.m4 m4/inet_ntop.m4 @@ -441,6 +446,7 @@ AC_DEFUN([gl_FILE_LIST], [ m4/lstat.m4 m4/malloc.m4 m4/mkstemp.m4 + m4/multiarch.m4 m4/netdb_h.m4 m4/netinet_in_h.m4 m4/nls.m4 @@ -454,6 +460,7 @@ AC_DEFUN([gl_FILE_LIST], [ m4/printf.m4 m4/progtest.m4 m4/realloc.m4 + m4/servent.m4 m4/size_max.m4 m4/snprintf.m4 m4/sockets.m4 @@ -469,7 +476,6 @@ AC_DEFUN([gl_FILE_LIST], [ m4/string_h.m4 m4/strndup.m4 m4/strnlen.m4 - m4/strpbrk.m4 m4/strsep.m4 m4/sys_ioctl_h.m4 m4/sys_select_h.m4 @@ -478,6 +484,8 @@ AC_DEFUN([gl_FILE_LIST], [ m4/sys_time_h.m4 m4/tempname.m4 m4/threadlib.m4 + m4/time_h.m4 + m4/time_r.m4 m4/uintmax_t.m4 m4/unistd_h.m4 m4/vasnprintf.m4 @@ -518,6 +526,7 @@ AC_DEFUN([gl_FILE_LIST], [ tests/test-sys_socket.c tests/test-sys_stat.c tests/test-sys_time.c + tests/test-time.c tests/test-unistd.c tests/test-vasnprintf.c tests/test-vasprintf.c diff --git a/gnulib/m4/iconv.m4 b/gnulib/m4/iconv.m4 index 66bc76f..848b2f8 100644 --- a/gnulib/m4/iconv.m4 +++ b/gnulib/m4/iconv.m4 @@ -1,5 +1,5 @@ -# iconv.m4 serial AM6 (gettext-0.17) -dnl Copyright (C) 2000-2002, 2007 Free Software Foundation, Inc. +# iconv.m4 serial AM6 (gettext-0.18) +dnl Copyright (C) 2000-2002, 2007-2008 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -34,7 +34,7 @@ AC_DEFUN([AM_ICONV_LINK], am_save_CPPFLAGS="$CPPFLAGS" AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV]) - AC_CACHE_CHECK([for iconv], am_cv_func_iconv, [ + AC_CACHE_CHECK([for iconv], [am_cv_func_iconv], [ am_cv_func_iconv="no, consider installing GNU libiconv" am_cv_lib_iconv=no AC_TRY_LINK([#include <stdlib.h> @@ -42,7 +42,7 @@ AC_DEFUN([AM_ICONV_LINK], [iconv_t cd = iconv_open("",""); iconv(cd,NULL,NULL,NULL,NULL); iconv_close(cd);], - am_cv_func_iconv=yes) + [am_cv_func_iconv=yes]) if test "$am_cv_func_iconv" != yes; then am_save_LIBS="$LIBS" LIBS="$LIBS $LIBICONV" @@ -51,13 +51,13 @@ AC_DEFUN([AM_ICONV_LINK], [iconv_t cd = iconv_open("",""); iconv(cd,NULL,NULL,NULL,NULL); iconv_close(cd);], - am_cv_lib_iconv=yes - am_cv_func_iconv=yes) + [am_cv_lib_iconv=yes] + [am_cv_func_iconv=yes]) LIBS="$am_save_LIBS" fi ]) if test "$am_cv_func_iconv" = yes; then - AC_CACHE_CHECK([for working iconv], am_cv_func_iconv_works, [ + AC_CACHE_CHECK([for working iconv], [am_cv_func_iconv_works], [ dnl This tests against bugs in AIX 5.1 and HP-UX 11.11. am_save_LIBS="$LIBS" if test $am_cv_lib_iconv = yes; then @@ -134,7 +134,7 @@ int main () am_func_iconv=no am_cv_lib_iconv=no fi if test "$am_func_iconv" = yes; then - AC_DEFINE(HAVE_ICONV, 1, + AC_DEFINE([HAVE_ICONV], 1, [Define if you have the iconv() function and it works.]) fi if test "$am_cv_lib_iconv" = yes; then @@ -147,8 +147,8 @@ int main () LIBICONV= LTLIBICONV= fi - AC_SUBST(LIBICONV) - AC_SUBST(LTLIBICONV) + AC_SUBST([LIBICONV]) + AC_SUBST([LTLIBICONV]) ]) AC_DEFUN([AM_ICONV], @@ -156,7 +156,7 @@ AC_DEFUN([AM_ICONV], AM_ICONV_LINK if test "$am_cv_func_iconv" = yes; then AC_MSG_CHECKING([for iconv declaration]) - AC_CACHE_VAL(am_cv_proto_iconv, [ + AC_CACHE_VAL([am_cv_proto_iconv], [ AC_TRY_COMPILE([ #include <stdlib.h> #include <iconv.h> @@ -169,12 +169,12 @@ size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, si #else size_t iconv(); #endif -], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const") +], [], [am_cv_proto_iconv_arg1=""], [am_cv_proto_iconv_arg1="const"]) am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"]) am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` - AC_MSG_RESULT([$]{ac_t:- - }[$]am_cv_proto_iconv) - AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1, + AC_MSG_RESULT([${ac_t:- + }$am_cv_proto_iconv]) + AC_DEFINE_UNQUOTED([ICONV_CONST], [$am_cv_proto_iconv_arg1], [Define as const if the declaration of iconv() needs const.]) fi ]) diff --git a/gnulib/m4/include_next.m4 b/gnulib/m4/include_next.m4 index b6e4d3a..062753c 100644 --- a/gnulib/m4/include_next.m4 +++ b/gnulib/m4/include_next.m4 @@ -1,4 +1,4 @@ -# include_next.m4 serial 8 +# include_next.m4 serial 10 dnl Copyright (C) 2006-2008 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -11,6 +11,10 @@ dnl dnl INCLUDE_NEXT expands to 'include_next' if the compiler supports it, or to dnl 'include' otherwise. dnl +dnl INCLUDE_NEXT_AS_FIRST_DIRECTIVE expands to 'include_next' if the compiler +dnl supports it in the special case that it is the first include directive in +dnl the given file, or to 'include' otherwise. +dnl dnl PRAGMA_SYSTEM_HEADER can be used in files that contain #include_next, dnl so as to avoid GCC warnings when the gcc option -pedantic is used. dnl '#pragma GCC system_header' has the same effect as if the file was found @@ -26,12 +30,26 @@ AC_DEFUN([gl_INCLUDE_NEXT], AC_LANG_PREPROC_REQUIRE() AC_CACHE_CHECK([whether the preprocessor supports include_next], [gl_cv_have_include_next], - [rm -rf conftestd1 conftestd2 - mkdir conftestd1 conftestd2 + [rm -rf conftestd1a conftestd1b conftestd2 + mkdir conftestd1a conftestd1b conftestd2 dnl The include of <stdio.h> is because IBM C 9.0 on AIX 6.1 supports dnl include_next when used as first preprocessor directive in a file, - dnl but not when preceded by another include directive. - cat <<EOF > conftestd1/conftest.h + dnl but not when preceded by another include directive. Additionally, + dnl with this same compiler, include_next is a no-op when used in a + dnl header file that was included by specifying its absolute file name. + dnl Despite these two bugs, include_next is used in the compiler's + dnl <math.h>. By virtue of the second bug, we need to use include_next + dnl as well in this case. + cat <<EOF > conftestd1a/conftest.h +#define DEFINED_IN_CONFTESTD1 +#include_next <conftest.h> +#ifdef DEFINED_IN_CONFTESTD2 +int foo; +#else +#error "include_next doesn't work" +#endif +EOF + cat <<EOF > conftestd1b/conftest.h #define DEFINED_IN_CONFTESTD1 #include <stdio.h> #include_next <conftest.h> @@ -47,24 +65,36 @@ EOF #endif #define DEFINED_IN_CONFTESTD2 EOF - save_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS -Iconftestd1 -Iconftestd2" + gl_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$gl_save_CPPFLAGS -Iconftestd1b -Iconftestd2" AC_COMPILE_IFELSE([#include <conftest.h>], [gl_cv_have_include_next=yes], - [gl_cv_have_include_next=no]) - CPPFLAGS="$save_CPPFLAGS" - rm -rf conftestd1 conftestd2 + [CPPFLAGS="$gl_save_CPPFLAGS -Iconftestd1a -Iconftestd2" + AC_COMPILE_IFELSE([#include <conftest.h>], + [gl_cv_have_include_next=buggy], + [gl_cv_have_include_next=no]) + ]) + CPPFLAGS="$gl_save_CPPFLAGS" + rm -rf conftestd1a conftestd1b conftestd2 ]) PRAGMA_SYSTEM_HEADER= if test $gl_cv_have_include_next = yes; then INCLUDE_NEXT=include_next + INCLUDE_NEXT_AS_FIRST_DIRECTIVE=include_next if test -n "$GCC"; then PRAGMA_SYSTEM_HEADER='#pragma GCC system_header' fi else - INCLUDE_NEXT=include + if test $gl_cv_have_include_next = buggy; then + INCLUDE_NEXT=include + INCLUDE_NEXT_AS_FIRST_DIRECTIVE=include_next + else + INCLUDE_NEXT=include + INCLUDE_NEXT_AS_FIRST_DIRECTIVE=include + fi fi AC_SUBST([INCLUDE_NEXT]) + AC_SUBST([INCLUDE_NEXT_AS_FIRST_DIRECTIVE]) AC_SUBST([PRAGMA_SYSTEM_HEADER]) ]) @@ -87,6 +117,7 @@ EOF AC_DEFUN([gl_CHECK_NEXT_HEADERS], [ AC_REQUIRE([gl_INCLUDE_NEXT]) + AC_REQUIRE([AC_CANONICAL_HOST]) AC_CHECK_HEADERS_ONCE([$1]) m4_foreach_w([gl_HEADER_NAME], [$1], @@ -105,11 +136,22 @@ AC_DEFUN([gl_CHECK_NEXT_HEADERS], [AC_LANG_SOURCE( [[#include <]]m4_dquote(m4_defn([gl_HEADER_NAME]))[[>]] )]) - dnl eval is necessary to expand ac_cpp. + dnl AIX "xlc -E" and "cc -E" omit #line directives for header files + dnl that contain only a #include of other header files and no + dnl non-comment tokens of their own. This leads to a failure to + dnl detect the absolute name of <dirent.h>, <signal.h>, <poll.h> + dnl and others. The workaround is to force preservation of comments + dnl through option -C. This ensures all necessary #line directives + dnl are present. GCC supports option -C as well. + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac + dnl eval is necessary to expand gl_absname_cpp. dnl Ultrix and Pyramid sh refuse to redirect output of eval, dnl so use subshell. AS_VAR_SET([gl_next_header], - ['"'`(eval "$ac_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD | + ['"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD | sed -n '\#/]m4_quote(m4_defn([gl_HEADER_NAME]))[#{ s#.*"\(.*/]m4_quote(m4_defn([gl_HEADER_NAME]))[\)".*#\1# s#^/[^/]#// diff --git a/gnulib/m4/intdiv0.m4 b/gnulib/m4/intdiv0.m4 index 8c8a670..29e6e0a 100644 --- a/gnulib/m4/intdiv0.m4 +++ b/gnulib/m4/intdiv0.m4 @@ -1,5 +1,5 @@ -# intdiv0.m4 serial 2 (gettext-0.17) -dnl Copyright (C) 2002, 2007 Free Software Foundation, Inc. +# intdiv0.m4 serial 3 (gettext-0.18) +dnl Copyright (C) 2002, 2007-2008 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -61,7 +61,7 @@ int main () nan = y / y; exit (1); } -], gt_cv_int_divbyzero_sigfpe=yes, gt_cv_int_divbyzero_sigfpe=no, +], [gt_cv_int_divbyzero_sigfpe=yes], [gt_cv_int_divbyzero_sigfpe=no], [ # Guess based on the CPU. changequote(,)dnl @@ -79,6 +79,6 @@ changequote([,])dnl *yes) value=1;; *) value=0;; esac - AC_DEFINE_UNQUOTED(INTDIV0_RAISES_SIGFPE, $value, + AC_DEFINE_UNQUOTED([INTDIV0_RAISES_SIGFPE], [$value], [Define if integer division by zero raises signal SIGFPE.]) ]) diff --git a/gnulib/m4/intlmacosx.m4 b/gnulib/m4/intlmacosx.m4 index d3f0d90..b77527d 100644 --- a/gnulib/m4/intlmacosx.m4 +++ b/gnulib/m4/intlmacosx.m4 @@ -1,5 +1,5 @@ -# intlmacosx.m4 serial 1 (gettext-0.17) -dnl Copyright (C) 2004-2007 Free Software Foundation, Inc. +# intlmacosx.m4 serial 2 (gettext-0.18) +dnl Copyright (C) 2004-2008 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -19,7 +19,7 @@ AC_DEFUN([gt_INTL_MACOSX], [ dnl Check for API introduced in MacOS X 10.2. AC_CACHE_CHECK([for CFPreferencesCopyAppValue], - gt_cv_func_CFPreferencesCopyAppValue, + [gt_cv_func_CFPreferencesCopyAppValue], [gt_save_LIBS="$LIBS" LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" AC_TRY_LINK([#include <CoreFoundation/CFPreferences.h>], @@ -32,7 +32,7 @@ AC_DEFUN([gt_INTL_MACOSX], [Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in the CoreFoundation framework.]) fi dnl Check for API introduced in MacOS X 10.3. - AC_CACHE_CHECK([for CFLocaleCopyCurrent], gt_cv_func_CFLocaleCopyCurrent, + AC_CACHE_CHECK([for CFLocaleCopyCurrent], [gt_cv_func_CFLocaleCopyCurrent], [gt_save_LIBS="$LIBS" LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" AC_TRY_LINK([#include <CoreFoundation/CFLocale.h>], [CFLocaleCopyCurrent();], diff --git a/gnulib/m4/intmax.m4 b/gnulib/m4/intmax.m4 index ce7a8a4..d713db2 100644 --- a/gnulib/m4/intmax.m4 +++ b/gnulib/m4/intmax.m4 @@ -1,5 +1,5 @@ -# intmax.m4 serial 3 (gettext-0.16) -dnl Copyright (C) 2002-2005 Free Software Foundation, Inc. +# intmax.m4 serial 4 (gettext-0.18) +dnl Copyright (C) 2002-2005, 2008 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -12,7 +12,7 @@ AC_DEFUN([gt_TYPE_INTMAX_T], [ AC_REQUIRE([gl_AC_HEADER_INTTYPES_H]) AC_REQUIRE([gl_AC_HEADER_STDINT_H]) - AC_CACHE_CHECK(for intmax_t, gt_cv_c_intmax_t, + AC_CACHE_CHECK([for intmax_t], [gt_cv_c_intmax_t], [AC_TRY_COMPILE([ #include <stddef.h> #include <stdlib.h> @@ -24,10 +24,10 @@ AC_DEFUN([gt_TYPE_INTMAX_T], #endif ], [intmax_t x = -1; return !x;], - gt_cv_c_intmax_t=yes, - gt_cv_c_intmax_t=no)]) + [gt_cv_c_intmax_t=yes], + [gt_cv_c_intmax_t=no])]) if test $gt_cv_c_intmax_t = yes; then - AC_DEFINE(HAVE_INTMAX_T, 1, + AC_DEFINE([HAVE_INTMAX_T], 1, [Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>.]) fi ]) diff --git a/gnulib/m4/inttypes-pri.m4 b/gnulib/m4/inttypes-pri.m4 index 7c7f894..66650eb 100644 --- a/gnulib/m4/inttypes-pri.m4 +++ b/gnulib/m4/inttypes-pri.m4 @@ -1,5 +1,5 @@ -# inttypes-pri.m4 serial 4 (gettext-0.16) -dnl Copyright (C) 1997-2002, 2006 Free Software Foundation, Inc. +# inttypes-pri.m4 serial 5 (gettext-0.18) +dnl Copyright (C) 1997-2002, 2006, 2008 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -16,17 +16,17 @@ AC_DEFUN([gt_INTTYPES_PRI], AC_CHECK_HEADERS([inttypes.h]) if test $ac_cv_header_inttypes_h = yes; then AC_CACHE_CHECK([whether the inttypes.h PRIxNN macros are broken], - gt_cv_inttypes_pri_broken, + [gt_cv_inttypes_pri_broken], [ AC_TRY_COMPILE([#include <inttypes.h> #ifdef PRId32 char *p = PRId32; #endif -], [], gt_cv_inttypes_pri_broken=no, gt_cv_inttypes_pri_broken=yes) +], [], [gt_cv_inttypes_pri_broken=no], [gt_cv_inttypes_pri_broken=yes]) ]) fi if test "$gt_cv_inttypes_pri_broken" = yes; then - AC_DEFINE_UNQUOTED(PRI_MACROS_BROKEN, 1, + AC_DEFINE_UNQUOTED([PRI_MACROS_BROKEN], 1, [Define if <inttypes.h> exists and defines unusable PRI* macros.]) PRI_MACROS_BROKEN=1 else diff --git a/gnulib/m4/inttypes_h.m4 b/gnulib/m4/inttypes_h.m4 index edc8ecb..cf482d2 100644 --- a/gnulib/m4/inttypes_h.m4 +++ b/gnulib/m4/inttypes_h.m4 @@ -1,5 +1,5 @@ -# inttypes_h.m4 serial 7 -dnl Copyright (C) 1997-2004, 2006 Free Software Foundation, Inc. +# inttypes_h.m4 serial 8 +dnl Copyright (C) 1997-2004, 2006, 2008 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -11,15 +11,15 @@ dnl From Paul Eggert. AC_DEFUN([gl_AC_HEADER_INTTYPES_H], [ - AC_CACHE_CHECK([for inttypes.h], gl_cv_header_inttypes_h, + AC_CACHE_CHECK([for inttypes.h], [gl_cv_header_inttypes_h], [AC_TRY_COMPILE( [#include <sys/types.h> #include <inttypes.h>], [uintmax_t i = (uintmax_t) -1; return !i;], - gl_cv_header_inttypes_h=yes, - gl_cv_header_inttypes_h=no)]) + [gl_cv_header_inttypes_h=yes], + [gl_cv_header_inttypes_h=no])]) if test $gl_cv_header_inttypes_h = yes; then - AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H_WITH_UINTMAX, 1, + AC_DEFINE_UNQUOTED([HAVE_INTTYPES_H_WITH_UINTMAX], 1, [Define if <inttypes.h> exists, doesn't clash with <sys/types.h>, and declares uintmax_t. ]) fi diff --git a/gnulib/m4/lcmessage.m4 b/gnulib/m4/lcmessage.m4 index 19aa77e..b7c4730 100644 --- a/gnulib/m4/lcmessage.m4 +++ b/gnulib/m4/lcmessage.m4 @@ -1,5 +1,5 @@ -# lcmessage.m4 serial 4 (gettext-0.14.2) -dnl Copyright (C) 1995-2002, 2004-2005 Free Software Foundation, Inc. +# lcmessage.m4 serial 5 (gettext-0.18) +dnl Copyright (C) 1995-2002, 2004-2005, 2008 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -20,11 +20,11 @@ dnl Ulrich Drepper <drepper@cygnus.com>, 1995. AC_DEFUN([gt_LC_MESSAGES], [ - AC_CACHE_CHECK([for LC_MESSAGES], gt_cv_val_LC_MESSAGES, + AC_CACHE_CHECK([for LC_MESSAGES], [gt_cv_val_LC_MESSAGES], [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES], - gt_cv_val_LC_MESSAGES=yes, gt_cv_val_LC_MESSAGES=no)]) + [gt_cv_val_LC_MESSAGES=yes], [gt_cv_val_LC_MESSAGES=no])]) if test $gt_cv_val_LC_MESSAGES = yes; then - AC_DEFINE(HAVE_LC_MESSAGES, 1, + AC_DEFINE([HAVE_LC_MESSAGES], 1, [Define if your <locale.h> file defines LC_MESSAGES.]) fi ]) diff --git a/gnulib/m4/lib-link.m4 b/gnulib/m4/lib-link.m4 index 7e07a42..e29eead 100644 --- a/gnulib/m4/lib-link.m4 +++ b/gnulib/m4/lib-link.m4 @@ -1,4 +1,4 @@ -# lib-link.m4 serial 16 (gettext-0.18) +# lib-link.m4 serial 17 (gettext-0.18) dnl Copyright (C) 2001-2008 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -446,12 +446,16 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], case "$found_dir" in */$acl_libdirstem | */$acl_libdirstem/) basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` - LIB[]NAME[]_PREFIX="$basedir" + if test "$name" = '$1'; then + LIB[]NAME[]_PREFIX="$basedir" + fi additional_includedir="$basedir/include" ;; */$acl_libdirstem2 | */$acl_libdirstem2/) basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'` - LIB[]NAME[]_PREFIX="$basedir" + if test "$name" = '$1'; then + LIB[]NAME[]_PREFIX="$basedir" + fi additional_includedir="$basedir/include" ;; esac diff --git a/gnulib/m4/lstat.m4 b/gnulib/m4/lstat.m4 index 9ac109f..fc222e2 100644 --- a/gnulib/m4/lstat.m4 +++ b/gnulib/m4/lstat.m4 @@ -1,4 +1,4 @@ -#serial 17 +#serial 18 # Copyright (C) 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007, 2008 # Free Software Foundation, Inc. @@ -12,12 +12,16 @@ dnl From Jim Meyering. AC_DEFUN([gl_FUNC_LSTAT], [ AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) - AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK - dnl Note: AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK does AC_LIBOBJ(lstat). - if test $ac_cv_func_lstat_dereferences_slashed_symlink = no; then - REPLACE_LSTAT=1 + dnl If lstat does not exist, the replacement <sys/stat.h> does + dnl "#define lstat stat", and lstat.c does not need to be compiled. + AC_CHECK_FUNCS_ONCE([lstat]) + if test $ac_cv_func_lstat = yes; then + AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK + dnl Note: AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK does AC_LIBOBJ(lstat). + if test $ac_cv_func_lstat_dereferences_slashed_symlink = no; then + REPLACE_LSTAT=1 + fi + # Prerequisites of lib/lstat.c. + AC_REQUIRE([AC_C_INLINE]) fi - # Prerequisites of lib/lstat.c. - AC_REQUIRE([AC_C_INLINE]) - : ]) diff --git a/gnulib/m4/netdb_h.m4 b/gnulib/m4/netdb_h.m4 index bbe166f..5a12251 100644 --- a/gnulib/m4/netdb_h.m4 +++ b/gnulib/m4/netdb_h.m4 @@ -1,4 +1,4 @@ -# netdb_h.m4 serial 3 +# netdb_h.m4 serial 5 dnl Copyright (C) 2008 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -9,8 +9,14 @@ AC_DEFUN([gl_HEADER_NETDB], AC_REQUIRE([gl_NETDB_H_DEFAULTS]) gl_CHECK_NEXT_HEADERS([netdb.h]) if test $ac_cv_header_netdb_h = yes; then - AC_CHECK_TYPES([struct addrinfo], [NETDB_H=''], [NETDB_H='netdb.h'], - [[#include <netdb.h>]]) + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[ + #include <netdb.h> + struct addrinfo a; + int b = EAI_OVERFLOW; + int c = AI_NUMERICSERV; + ]])], + [NETDB_H=''], [NETDB_H='netdb.h']) HAVE_NETDB_H=1 else NETDB_H='netdb.h' @@ -30,4 +36,10 @@ AC_DEFUN([gl_NETDB_MODULE_INDICATOR], AC_DEFUN([gl_NETDB_H_DEFAULTS], [ GNULIB_GETADDRINFO=0; AC_SUBST([GNULIB_GETADDRINFO]) + dnl Assume proper GNU behavior unless another module says otherwise. + HAVE_STRUCT_ADDRINFO=1; AC_SUBST([HAVE_STRUCT_ADDRINFO]) + HAVE_DECL_FREEADDRINFO=1; AC_SUBST([HAVE_DECL_FREEADDRINFO]) + HAVE_DECL_GAI_STRERROR=1; AC_SUBST([HAVE_DECL_GAI_STRERROR]) + HAVE_DECL_GETADDRINFO=1; AC_SUBST([HAVE_DECL_GETADDRINFO]) + HAVE_DECL_GETNAMEINFO=1; AC_SUBST([HAVE_DECL_GETNAMEINFO]) ]) diff --git a/gnulib/m4/nls.m4 b/gnulib/m4/nls.m4 index 7967cc2..5f155f0 100644 --- a/gnulib/m4/nls.m4 +++ b/gnulib/m4/nls.m4 @@ -1,5 +1,5 @@ -# nls.m4 serial 3 (gettext-0.15) -dnl Copyright (C) 1995-2003, 2005-2006 Free Software Foundation, Inc. +# nls.m4 serial 4 (gettext-0.18) +dnl Copyright (C) 1995-2003, 2005-2006, 2008 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -27,5 +27,5 @@ AC_DEFUN([AM_NLS], [ --disable-nls do not use Native Language Support], USE_NLS=$enableval, USE_NLS=yes) AC_MSG_RESULT($USE_NLS) - AC_SUBST(USE_NLS) + AC_SUBST([USE_NLS]) ]) diff --git a/gnulib/m4/po.m4 b/gnulib/m4/po.m4 index 0734762..818143e 100644 --- a/gnulib/m4/po.m4 +++ b/gnulib/m4/po.m4 @@ -1,5 +1,5 @@ -# po.m4 serial 15 (gettext-0.17) -dnl Copyright (C) 1995-2007 Free Software Foundation, Inc. +# po.m4 serial 16 (gettext-0.18) +dnl Copyright (C) 1995-2008 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -41,7 +41,7 @@ AC_DEFUN([AM_PO_SUBDIRS], [$ac_dir/$ac_word --statistics /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1 && (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)], :) - AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) + AC_PATH_PROG([GMSGFMT], [gmsgfmt], [$MSGFMT]) dnl Test whether it is GNU msgfmt >= 0.15. changequote(,)dnl diff --git a/gnulib/m4/printf-posix.m4 b/gnulib/m4/printf-posix.m4 index 14ba612..8933ee3 100644 --- a/gnulib/m4/printf-posix.m4 +++ b/gnulib/m4/printf-posix.m4 @@ -1,4 +1,4 @@ -# printf-posix.m4 serial 3 (gettext-0.17) +# printf-posix.m4 serial 4 (gettext-0.18) dnl Copyright (C) 2003, 2007 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -31,13 +31,14 @@ int main () #if defined __NetBSD__ || defined __BEOS__ || defined _MSC_VER || defined __MINGW32__ || defined __CYGWIN__ notposix #endif - ], gt_cv_func_printf_posix="guessing no", - gt_cv_func_printf_posix="guessing yes") + ], + [gt_cv_func_printf_posix="guessing no"], + [gt_cv_func_printf_posix="guessing yes"]) ]) ]) case $gt_cv_func_printf_posix in *yes) - AC_DEFINE(HAVE_POSIX_PRINTF, 1, + AC_DEFINE([HAVE_POSIX_PRINTF], 1, [Define if your printf() function supports format strings with positions.]) ;; esac diff --git a/gnulib/m4/printf.m4 b/gnulib/m4/printf.m4 index d544edd..474a635 100644 --- a/gnulib/m4/printf.m4 +++ b/gnulib/m4/printf.m4 @@ -1,4 +1,4 @@ -# printf.m4 serial 23 +# printf.m4 serial 25 dnl Copyright (C) 2003, 2007-2008 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -811,12 +811,15 @@ dnl Result is gl_cv_func_printf_enomem. AC_DEFUN([gl_PRINTF_ENOMEM], [ AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([gl_MULTIARCH]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CACHE_CHECK([whether printf survives out-of-memory conditions], [gl_cv_func_printf_enomem], [ + gl_cv_func_printf_enomem="guessing no" if test "$cross_compiling" = no; then - AC_LANG_CONFTEST([AC_LANG_SOURCE([ + if test $APPLE_UNIVERSAL_BUILD = 0; then + AC_LANG_CONFTEST([AC_LANG_SOURCE([ ]GL_NOCRASH[ changequote(,)dnl #include <stdio.h> @@ -865,22 +868,29 @@ int main() } changequote([,])dnl ])]) - if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then - (./conftest - result=$? - if test $result != 0 && test $result != 77; then result=1; fi - exit $result - ) >/dev/null 2>/dev/null - case $? in - 0) gl_cv_func_printf_enomem="yes" ;; - 77) gl_cv_func_printf_enomem="guessing no" ;; - *) gl_cv_func_printf_enomem="no" ;; - esac + if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then + (./conftest + result=$? + if test $result != 0 && test $result != 77; then result=1; fi + exit $result + ) >/dev/null 2>/dev/null + case $? in + 0) gl_cv_func_printf_enomem="yes" ;; + 77) gl_cv_func_printf_enomem="guessing no" ;; + *) gl_cv_func_printf_enomem="no" ;; + esac + else + gl_cv_func_printf_enomem="guessing no" + fi + rm -fr conftest* else + dnl A universal build on Apple MacOS X platforms. + dnl The result would be 'no' in 32-bit mode and 'yes' in 64-bit mode. + dnl But we need a configuration result that is valid in both modes. gl_cv_func_printf_enomem="guessing no" fi - rm -fr conftest* - else + fi + if test "$gl_cv_func_printf_enomem" = "guessing no"; then changequote(,)dnl case "$host_os" in # Guess yes on glibc systems. @@ -901,6 +911,8 @@ changequote(,)dnl osf*) gl_cv_func_printf_enomem="guessing yes";; # Guess yes on BeOS. beos*) gl_cv_func_printf_enomem="guessing yes";; + # Guess yes on Haiku. + haiku*) gl_cv_func_printf_enomem="guessing yes";; # If we don't know, assume the worst. *) gl_cv_func_printf_enomem="guessing no";; esac @@ -1305,5 +1317,6 @@ dnl OSF/1 5.1 # . # # # # . . . . # . . . . dnl OSF/1 4.0d # . # # # # . . . . # . . # # # # # # dnl NetBSD 4.0 . ? ? ? ? ? . . ? ? ? ? ? . . . ? ? ? dnl NetBSD 3.0 . . . . # # . # # ? # . # . . . . . . +dnl Haiku . . . # # # . . . . . . ? . . . . . . dnl BeOS # # . # # # . # . ? . # ? . . . . . . dnl mingw # # # # # # . # # . # # ? . # # # . . diff --git a/gnulib/m4/progtest.m4 b/gnulib/m4/progtest.m4 index a56365c..9b55f75 100644 --- a/gnulib/m4/progtest.m4 +++ b/gnulib/m4/progtest.m4 @@ -1,5 +1,5 @@ -# progtest.m4 serial 4 (gettext-0.14.2) -dnl Copyright (C) 1996-2003, 2005 Free Software Foundation, Inc. +# progtest.m4 serial 5 (gettext-0.18) +dnl Copyright (C) 1996-2003, 2005, 2008 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -55,7 +55,7 @@ rm -f conf$$.file # Extract the first word of "$2", so it can be a program name with args. set dummy $2; ac_word=[$]2 AC_MSG_CHECKING([for $ac_word]) -AC_CACHE_VAL(ac_cv_path_$1, +AC_CACHE_VAL([ac_cv_path_$1], [case "[$]$1" in [[\\/]]* | ?:[[\\/]]*) ac_cv_path_$1="[$]$1" # Let the user override the test with a path. @@ -84,9 +84,9 @@ ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" esac])dnl $1="$ac_cv_path_$1" if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then - AC_MSG_RESULT([$]$1) + AC_MSG_RESULT([$][$1]) else - AC_MSG_RESULT(no) + AC_MSG_RESULT([no]) fi AC_SUBST($1)dnl ]) diff --git a/gnulib/m4/size_max.m4 b/gnulib/m4/size_max.m4 index 6cb4868..e0e7b3f 100644 --- a/gnulib/m4/size_max.m4 +++ b/gnulib/m4/size_max.m4 @@ -1,5 +1,5 @@ -# size_max.m4 serial 6 -dnl Copyright (C) 2003, 2005-2006 Free Software Foundation, Inc. +# size_max.m4 serial 7 +dnl Copyright (C) 2003, 2005-2006, 2008 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -8,7 +8,7 @@ dnl From Bruno Haible. AC_DEFUN([gl_SIZE_MAX], [ - AC_CHECK_HEADERS(stdint.h) + AC_CHECK_HEADERS([stdint.h]) dnl First test whether the system already has SIZE_MAX. AC_MSG_CHECKING([for SIZE_MAX]) AC_CACHE_VAL([gl_cv_size_max], [ @@ -21,16 +21,16 @@ AC_DEFUN([gl_SIZE_MAX], #ifdef SIZE_MAX Found it #endif -], gl_cv_size_max=yes) +], [gl_cv_size_max=yes]) if test -z "$gl_cv_size_max"; then dnl Define it ourselves. Here we assume that the type 'size_t' is not wider dnl than the type 'unsigned long'. Try hard to find a definition that can dnl be used in a preprocessor #if, i.e. doesn't contain a cast. AC_COMPUTE_INT([size_t_bits_minus_1], [sizeof (size_t) * CHAR_BIT - 1], [#include <stddef.h> -#include <limits.h>], size_t_bits_minus_1=) +#include <limits.h>], [size_t_bits_minus_1=]) AC_COMPUTE_INT([fits_in_uint], [sizeof (size_t) <= sizeof (unsigned int)], - [#include <stddef.h>], fits_in_uint=) + [#include <stddef.h>], [fits_in_uint=]) if test -n "$size_t_bits_minus_1" && test -n "$fits_in_uint"; then if test $fits_in_uint = 1; then dnl Even though SIZE_MAX fits in an unsigned int, it must be of type @@ -38,7 +38,7 @@ Found it AC_TRY_COMPILE([#include <stddef.h> extern size_t foo; extern unsigned long foo; - ], [], fits_in_uint=0) + ], [], [fits_in_uint=0]) fi dnl We cannot use 'expr' to simplify this expression, because 'expr' dnl works only with 'long' integers in the host environment, while we diff --git a/gnulib/m4/sockets.m4 b/gnulib/m4/sockets.m4 index c7bd664..124e777 100644 --- a/gnulib/m4/sockets.m4 +++ b/gnulib/m4/sockets.m4 @@ -1,4 +1,4 @@ -# sockets.m4 serial 2 +# sockets.m4 serial 3 dnl Copyright (C) 2008 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -32,8 +32,10 @@ AC_DEFUN([gl_SOCKETS], else dnl Unix API. dnl Solaris has most socket functions in libsocket. - AC_CACHE_CHECK([whether setsockopt requires -lsocket], [gl_cv_lib_socket], [ - gl_cv_lib_socket=no + dnl Haiku has most socket functions in libnetwork. + dnl BeOS has most socket functions in libnet. + AC_CACHE_CHECK([for library containing setsockopt], [gl_cv_lib_socket], [ + gl_cv_lib_socket= AC_TRY_LINK([extern #ifdef __cplusplus "C" @@ -41,18 +43,39 @@ AC_DEFUN([gl_SOCKETS], char setsockopt();], [setsockopt();], [], [gl_save_LIBS="$LIBS" - LIBS="$LIBS -lsocket" + LIBS="$gl_save_LIBS -lsocket" AC_TRY_LINK([extern #ifdef __cplusplus "C" #endif char setsockopt();], [setsockopt();], - [gl_cv_lib_socket=yes]) + [gl_cv_lib_socket="-lsocket"]) + if test -z "$gl_cv_lib_socket"; then + LIBS="$gl_save_LIBS -lnetwork" + AC_TRY_LINK([extern +#ifdef __cplusplus +"C" +#endif +char setsockopt();], [setsockopt();], + [gl_cv_lib_socket="-lnetwork"]) + if test -z "$gl_cv_lib_socket"; then + LIBS="$gl_save_LIBS -lnet" + AC_TRY_LINK([extern +#ifdef __cplusplus +"C" +#endif +char setsockopt();], [setsockopt();], + [gl_cv_lib_socket="-lnet"]) + fi + fi LIBS="$gl_save_LIBS" ]) + if test -z "$gl_cv_lib_socket"; then + gl_cv_lib_socket="none needed" + fi ]) - if test $gl_cv_lib_socket = yes; then - LIBSOCKET='-lsocket' + if test "$gl_cv_lib_socket" != "none needed"; then + LIBSOCKET="$gl_cv_lib_socket" fi fi AC_SUBST([LIBSOCKET]) diff --git a/gnulib/m4/stdint.m4 b/gnulib/m4/stdint.m4 index b255692..e507a02 100644 --- a/gnulib/m4/stdint.m4 +++ b/gnulib/m4/stdint.m4 @@ -1,4 +1,4 @@ -# stdint.m4 serial 31 +# stdint.m4 serial 32 dnl Copyright (C) 2001-2008 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -373,13 +373,22 @@ dnl Compute HAVE_SIGNED_t, BITSIZEOF_t and t_SUFFIX, for all the types t dnl of interest to stdint.in.h. AC_DEFUN([gl_STDINT_TYPE_PROPERTIES], [ - gl_STDINT_BITSIZEOF([ptrdiff_t sig_atomic_t size_t wchar_t wint_t], + AC_REQUIRE([gl_MULTIARCH]) + if test $APPLE_UNIVERSAL_BUILD = 0; then + gl_STDINT_BITSIZEOF([ptrdiff_t size_t], + [gl_STDINT_INCLUDES]) + fi + gl_STDINT_BITSIZEOF([sig_atomic_t wchar_t wint_t], [gl_STDINT_INCLUDES]) gl_CHECK_TYPES_SIGNED([sig_atomic_t wchar_t wint_t], [gl_STDINT_INCLUDES]) gl_cv_type_ptrdiff_t_signed=yes gl_cv_type_size_t_signed=no - gl_INTEGER_TYPE_SUFFIX([ptrdiff_t sig_atomic_t size_t wchar_t wint_t], + if test $APPLE_UNIVERSAL_BUILD = 0; then + gl_INTEGER_TYPE_SUFFIX([ptrdiff_t size_t], + [gl_STDINT_INCLUDES]) + fi + gl_INTEGER_TYPE_SUFFIX([sig_atomic_t wchar_t wint_t], [gl_STDINT_INCLUDES]) ]) diff --git a/gnulib/m4/stdint_h.m4 b/gnulib/m4/stdint_h.m4 index db9a8ac..2c8e649 100644 --- a/gnulib/m4/stdint_h.m4 +++ b/gnulib/m4/stdint_h.m4 @@ -1,5 +1,5 @@ -# stdint_h.m4 serial 6 -dnl Copyright (C) 1997-2004, 2006 Free Software Foundation, Inc. +# stdint_h.m4 serial 7 +dnl Copyright (C) 1997-2004, 2006, 2008 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -11,15 +11,15 @@ dnl From Paul Eggert. AC_DEFUN([gl_AC_HEADER_STDINT_H], [ - AC_CACHE_CHECK([for stdint.h], gl_cv_header_stdint_h, + AC_CACHE_CHECK([for stdint.h], [gl_cv_header_stdint_h], [AC_TRY_COMPILE( [#include <sys/types.h> #include <stdint.h>], [uintmax_t i = (uintmax_t) -1; return !i;], - gl_cv_header_stdint_h=yes, - gl_cv_header_stdint_h=no)]) + [gl_cv_header_stdint_h=yes], + [gl_cv_header_stdint_h=no])]) if test $gl_cv_header_stdint_h = yes; then - AC_DEFINE_UNQUOTED(HAVE_STDINT_H_WITH_UINTMAX, 1, + AC_DEFINE_UNQUOTED([HAVE_STDINT_H_WITH_UINTMAX], 1, [Define if <stdint.h> exists, doesn't clash with <sys/types.h>, and declares uintmax_t. ]) fi diff --git a/gnulib/m4/strpbrk.m4 b/gnulib/m4/strpbrk.m4 deleted file mode 100644 index 0398d45..0000000 --- a/gnulib/m4/strpbrk.m4 +++ /dev/null @@ -1,18 +0,0 @@ -# strpbrk.m4 serial 4 -dnl Copyright (C) 2002-2003, 2007 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -AC_DEFUN([gl_FUNC_STRPBRK], -[ - AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) - AC_REPLACE_FUNCS(strpbrk) - if test $ac_cv_func_strpbrk = no; then - HAVE_STRPBRK=0 - gl_PREREQ_STRPBRK - fi -]) - -# Prerequisites of lib/strpbrk.c. -AC_DEFUN([gl_PREREQ_STRPBRK], [:]) diff --git a/gnulib/m4/sys_ioctl_h.m4 b/gnulib/m4/sys_ioctl_h.m4 index 5488039..e0396de 100644 --- a/gnulib/m4/sys_ioctl_h.m4 +++ b/gnulib/m4/sys_ioctl_h.m4 @@ -1,4 +1,4 @@ -# sys_ioctl_h.m4 serial 1 +# sys_ioctl_h.m4 serial 2 dnl Copyright (C) 2008 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -19,10 +19,13 @@ AC_DEFUN([gl_SYS_IOCTL_H], dnl header file, such as <unistd.h> or <stropts.h>, is needed for that. AC_CACHE_CHECK([whether <sys/ioctl.h> declares ioctl], [gl_cv_decl_ioctl_in_sys_ioctl_h], - [AC_CHECK_DECL([ioctl], + [dnl We cannot use AC_CHECK_DECL because it produces its own messages. + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [AC_INCLUDES_DEFAULT([#include <sys/ioctl.h>])], + [(void) ioctl;])], [gl_cv_decl_ioctl_in_sys_ioctl_h=yes], - [gl_cv_decl_ioctl_in_sys_ioctl_h=no], - [#include <sys/ioctl.h>]) + [gl_cv_decl_ioctl_in_sys_ioctl_h=no]) ]) if test $gl_cv_decl_ioctl_in_sys_ioctl_h != yes; then SYS_IOCTL_H='sys/ioctl.h' diff --git a/gnulib/m4/threadlib.m4 b/gnulib/m4/threadlib.m4 index 3a8655e..51caf57 100644 --- a/gnulib/m4/threadlib.m4 +++ b/gnulib/m4/threadlib.m4 @@ -1,4 +1,4 @@ -# threadlib.m4 serial 1 (gettext-0.18) +# threadlib.m4 serial 2 (gettext-0.18) dnl Copyright (C) 2005-2008 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -104,7 +104,8 @@ AC_DEFUN([gl_THREADLIB_BODY], if test "$gl_use_threads" = yes || test "$gl_use_threads" = posix; then # On OSF/1, the compiler needs the flag -pthread or -D_REENTRANT so that # it groks <pthread.h>. It's added above, in gl_THREADLIB_EARLY_BODY. - AC_CHECK_HEADER(pthread.h, gl_have_pthread_h=yes, gl_have_pthread_h=no) + AC_CHECK_HEADER([pthread.h], + [gl_have_pthread_h=yes], [gl_have_pthread_h=no]) if test "$gl_have_pthread_h" = yes; then # Other possible tests: # -lpthreads (FSU threads, PCthreads) @@ -122,7 +123,7 @@ AC_DEFUN([gl_THREADLIB_BODY], if test -n "$gl_have_pthread"; then # The program links fine without libpthread. But it may actually # need to link with libpthread in order to create multiple threads. - AC_CHECK_LIB(pthread, pthread_kill, + AC_CHECK_LIB([pthread], [pthread_kill], [LIBMULTITHREAD=-lpthread LTLIBMULTITHREAD=-lpthread # On Solaris and HP-UX, most pthread functions exist also in libc. # Therefore pthread_in_use() needs to actually try to create a @@ -136,13 +137,13 @@ AC_DEFUN([gl_THREADLIB_BODY], ]) else # Some library is needed. Try libpthread and libc_r. - AC_CHECK_LIB(pthread, pthread_kill, + AC_CHECK_LIB([pthread], [pthread_kill], [gl_have_pthread=yes LIBTHREAD=-lpthread LTLIBTHREAD=-lpthread LIBMULTITHREAD=-lpthread LTLIBMULTITHREAD=-lpthread]) if test -z "$gl_have_pthread"; then # For FreeBSD 4. - AC_CHECK_LIB(c_r, pthread_kill, + AC_CHECK_LIB([c_r], [pthread_kill], [gl_have_pthread=yes LIBTHREAD=-lc_r LTLIBTHREAD=-lc_r LIBMULTITHREAD=-lc_r LTLIBMULTITHREAD=-lc_r]) @@ -192,11 +193,11 @@ AC_DEFUN([gl_THREADLIB_BODY], fi if test "$gl_use_threads" = pth; then gl_save_CPPFLAGS="$CPPFLAGS" - AC_LIB_LINKFLAGS(pth) + AC_LIB_LINKFLAGS([pth]) gl_have_pth= gl_save_LIBS="$LIBS" LIBS="$LIBS -lpth" - AC_TRY_LINK([#include <pth.h>], [pth_self();], gl_have_pth=yes) + AC_TRY_LINK([#include <pth.h>], [pth_self();], [gl_have_pth=yes]) LIBS="$gl_save_LIBS" if test -n "$gl_have_pth"; then gl_threads_api=pth @@ -234,10 +235,10 @@ AC_DEFUN([gl_THREADLIB_BODY], fi AC_MSG_CHECKING([for multithread API to use]) AC_MSG_RESULT([$gl_threads_api]) - AC_SUBST(LIBTHREAD) - AC_SUBST(LTLIBTHREAD) - AC_SUBST(LIBMULTITHREAD) - AC_SUBST(LTLIBMULTITHREAD) + AC_SUBST([LIBTHREAD]) + AC_SUBST([LTLIBTHREAD]) + AC_SUBST([LIBMULTITHREAD]) + AC_SUBST([LTLIBMULTITHREAD]) ]) AC_DEFUN([gl_THREADLIB], diff --git a/gnulib/m4/time_h.m4 b/gnulib/m4/time_h.m4 new file mode 100644 index 0000000..d42a635 --- /dev/null +++ b/gnulib/m4/time_h.m4 @@ -0,0 +1,74 @@ +# Configure a more-standard replacement for <time.h>. + +# Copyright (C) 2000, 2001, 2003, 2004, 2005, 2006, 2007 Free Software +# Foundation, Inc. + +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# Written by Paul Eggert and Jim Meyering. + +AC_DEFUN([gl_HEADER_TIME_H], +[ + dnl Use AC_REQUIRE here, so that the default behavior below is expanded + dnl once only, before all statements that occur in other macros. + AC_REQUIRE([gl_HEADER_TIME_H_BODY]) +]) + +AC_DEFUN([gl_HEADER_TIME_H_BODY], +[ + AC_REQUIRE([AC_C_RESTRICT]) + AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS]) + gl_CHECK_NEXT_HEADERS([time.h]) + AC_REQUIRE([gl_CHECK_TYPE_STRUCT_TIMESPEC]) +]) + +AC_DEFUN([gl_HEADER_TIME_H_DEFAULTS], +[ + dnl If another module says to replace or to not replace, do that. + dnl Otherwise, replace only if someone compiles with -DGNULIB_PORTCHECK; + dnl this lets maintainers check for portability. + REPLACE_LOCALTIME_R=GNULIB_PORTCHECK; AC_SUBST([REPLACE_LOCALTIME_R]) + REPLACE_NANOSLEEP=GNULIB_PORTCHECK; AC_SUBST([REPLACE_NANOSLEEP]) + REPLACE_STRPTIME=GNULIB_PORTCHECK; AC_SUBST([REPLACE_STRPTIME]) + REPLACE_TIMEGM=GNULIB_PORTCHECK; AC_SUBST([REPLACE_TIMEGM]) +]) + +dnl Define HAVE_STRUCT_TIMESPEC if `struct timespec' is declared +dnl in time.h or sys/time.h. + +AC_DEFUN([gl_CHECK_TYPE_STRUCT_TIMESPEC], +[ + AC_CHECK_HEADERS_ONCE([sys/time.h]) + AC_CACHE_CHECK([for struct timespec in <time.h>], + [gl_cv_sys_struct_timespec_in_time_h], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include <time.h> + ]], + [[static struct timespec x; x.tv_sec = x.tv_nsec;]])], + [gl_cv_sys_struct_timespec_in_time_h=yes], + [gl_cv_sys_struct_timespec_in_time_h=no])]) + + TIME_H_DEFINES_STRUCT_TIMESPEC=0 + SYS_TIME_H_DEFINES_STRUCT_TIMESPEC=0 + if test $gl_cv_sys_struct_timespec_in_time_h = yes; then + TIME_H_DEFINES_STRUCT_TIMESPEC=1 + else + AC_CACHE_CHECK([for struct timespec in <sys/time.h>], + [gl_cv_sys_struct_timespec_in_sys_time_h], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include <sys/time.h> + ]], + [[static struct timespec x; x.tv_sec = x.tv_nsec;]])], + [gl_cv_sys_struct_timespec_in_sys_time_h=yes], + [gl_cv_sys_struct_timespec_in_sys_time_h=no])]) + if test $gl_cv_sys_struct_timespec_in_sys_time_h = yes; then + SYS_TIME_H_DEFINES_STRUCT_TIMESPEC=1 + fi + fi + AC_SUBST([TIME_H_DEFINES_STRUCT_TIMESPEC]) + AC_SUBST([SYS_TIME_H_DEFINES_STRUCT_TIMESPEC]) +]) diff --git a/gnulib/m4/time_r.m4 b/gnulib/m4/time_r.m4 new file mode 100644 index 0000000..c871b56 --- /dev/null +++ b/gnulib/m4/time_r.m4 @@ -0,0 +1,43 @@ +dnl Reentrant time functions like localtime_r. + +dnl Copyright (C) 2003, 2006, 2007, 2008 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl Written by Paul Eggert. + +AC_DEFUN([gl_TIME_R], +[ + dnl Persuade glibc and Solaris <time.h> to declare localtime_r. + AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) + + AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS]) + AC_REQUIRE([AC_C_RESTRICT]) + + AC_CACHE_CHECK([whether localtime_r is compatible with its POSIX signature], + [gl_cv_time_r_posix], + [AC_TRY_COMPILE( + [#include <time.h>], + [/* We don't need to append 'restrict's to the argument types, + even though the POSIX signature has the 'restrict's, + since C99 says they can't affect type compatibility. */ + struct tm * (*ptr) (time_t const *, struct tm *) = localtime_r; + if (ptr) return 0; + /* Check the return type is a pointer. On HP-UX 10 it is 'int'. */ + *localtime_r (0, 0);], + [gl_cv_time_r_posix=yes], + [gl_cv_time_r_posix=no])]) + if test $gl_cv_time_r_posix = yes; then + REPLACE_LOCALTIME_R=0 + else + REPLACE_LOCALTIME_R=1 + AC_LIBOBJ([time_r]) + gl_PREREQ_TIME_R + fi +]) + +# Prerequisites of lib/time_r.c. +AC_DEFUN([gl_PREREQ_TIME_R], [ + : +]) diff --git a/gnulib/m4/uintmax_t.m4 b/gnulib/m4/uintmax_t.m4 index 641c489..cde46d2 100644 --- a/gnulib/m4/uintmax_t.m4 +++ b/gnulib/m4/uintmax_t.m4 @@ -1,5 +1,5 @@ -# uintmax_t.m4 serial 10 -dnl Copyright (C) 1997-2004, 2007 Free Software Foundation, Inc. +# uintmax_t.m4 serial 11 +dnl Copyright (C) 1997-2004, 2007-2008 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -20,11 +20,11 @@ AC_DEFUN([gl_AC_TYPE_UINTMAX_T], test $ac_cv_type_unsigned_long_long_int = yes \ && ac_type='unsigned long long' \ || ac_type='unsigned long' - AC_DEFINE_UNQUOTED(uintmax_t, $ac_type, + AC_DEFINE_UNQUOTED([uintmax_t], [$ac_type], [Define to unsigned long or unsigned long long if <stdint.h> and <inttypes.h> don't define.]) else - AC_DEFINE(HAVE_UINTMAX_T, 1, + AC_DEFINE([HAVE_UINTMAX_T], 1, [Define if you have the 'uintmax_t' type in <stdint.h> or <inttypes.h>.]) fi ]) diff --git a/gnulib/m4/visibility.m4 b/gnulib/m4/visibility.m4 index 2ff6330..70bca56 100644 --- a/gnulib/m4/visibility.m4 +++ b/gnulib/m4/visibility.m4 @@ -1,5 +1,5 @@ -# visibility.m4 serial 1 (gettext-0.15) -dnl Copyright (C) 2005 Free Software Foundation, Inc. +# visibility.m4 serial 2 (gettext-0.18) +dnl Copyright (C) 2005, 2008 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -27,7 +27,7 @@ AC_DEFUN([gl_VISIBILITY], HAVE_VISIBILITY=0 if test -n "$GCC"; then AC_MSG_CHECKING([for simple visibility declarations]) - AC_CACHE_VAL(gl_cv_cc_visibility, [ + AC_CACHE_VAL([gl_cv_cc_visibility], [ gl_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -fvisibility=hidden" AC_TRY_COMPILE( @@ -36,8 +36,8 @@ AC_DEFUN([gl_VISIBILITY], extern __attribute__((__visibility__("hidden"))) int hiddenfunc (void); extern __attribute__((__visibility__("default"))) int exportedfunc (void);], [], - gl_cv_cc_visibility=yes, - gl_cv_cc_visibility=no) + [gl_cv_cc_visibility=yes], + [gl_cv_cc_visibility=no]) CFLAGS="$gl_save_CFLAGS"]) AC_MSG_RESULT([$gl_cv_cc_visibility]) if test $gl_cv_cc_visibility = yes; then diff --git a/gnulib/m4/wchar.m4 b/gnulib/m4/wchar.m4 index 5c923fa..ba8ee6a 100644 --- a/gnulib/m4/wchar.m4 +++ b/gnulib/m4/wchar.m4 @@ -7,7 +7,7 @@ dnl with or without modifications, as long as this notice is preserved. dnl Written by Eric Blake. -# wchar.m4 serial 6 +# wchar.m4 serial 22 AC_DEFUN([gl_WCHAR_H], [ @@ -61,9 +61,39 @@ AC_DEFUN([gl_WCHAR_MODULE_INDICATOR], AC_DEFUN([gl_WCHAR_H_DEFAULTS], [ - GNULIB_WCWIDTH=0; AC_SUBST([GNULIB_WCWIDTH]) + GNULIB_BTOWC=0; AC_SUBST([GNULIB_BTOWC]) + GNULIB_WCTOB=0; AC_SUBST([GNULIB_WCTOB]) + GNULIB_MBSINIT=0; AC_SUBST([GNULIB_MBSINIT]) + GNULIB_MBRTOWC=0; AC_SUBST([GNULIB_MBRTOWC]) + GNULIB_MBRLEN=0; AC_SUBST([GNULIB_MBRLEN]) + GNULIB_MBSRTOWCS=0; AC_SUBST([GNULIB_MBSRTOWCS]) + GNULIB_MBSNRTOWCS=0; AC_SUBST([GNULIB_MBSNRTOWCS]) + GNULIB_WCRTOMB=0; AC_SUBST([GNULIB_WCRTOMB]) + GNULIB_WCSRTOMBS=0; AC_SUBST([GNULIB_WCSRTOMBS]) + GNULIB_WCSNRTOMBS=0; AC_SUBST([GNULIB_WCSNRTOMBS]) + GNULIB_WCWIDTH=0; AC_SUBST([GNULIB_WCWIDTH]) dnl Assume proper GNU behavior unless another module says otherwise. + HAVE_BTOWC=1; AC_SUBST([HAVE_BTOWC]) + HAVE_MBSINIT=1; AC_SUBST([HAVE_MBSINIT]) + HAVE_MBRTOWC=1; AC_SUBST([HAVE_MBRTOWC]) + HAVE_MBRLEN=1; AC_SUBST([HAVE_MBRLEN]) + HAVE_MBSRTOWCS=1; AC_SUBST([HAVE_MBSRTOWCS]) + HAVE_MBSNRTOWCS=1; AC_SUBST([HAVE_MBSNRTOWCS]) + HAVE_WCRTOMB=1; AC_SUBST([HAVE_WCRTOMB]) + HAVE_WCSRTOMBS=1; AC_SUBST([HAVE_WCSRTOMBS]) + HAVE_WCSNRTOMBS=1; AC_SUBST([HAVE_WCSNRTOMBS]) + HAVE_DECL_WCTOB=1; AC_SUBST([HAVE_DECL_WCTOB]) HAVE_DECL_WCWIDTH=1; AC_SUBST([HAVE_DECL_WCWIDTH]) + REPLACE_MBSTATE_T=0; AC_SUBST([REPLACE_MBSTATE_T]) + REPLACE_BTOWC=0; AC_SUBST([REPLACE_BTOWC]) + REPLACE_WCTOB=0; AC_SUBST([REPLACE_WCTOB]) + REPLACE_MBSINIT=0; AC_SUBST([REPLACE_MBSINIT]) + REPLACE_MBRTOWC=0; AC_SUBST([REPLACE_MBRTOWC]) + REPLACE_MBRLEN=0; AC_SUBST([REPLACE_MBRLEN]) + REPLACE_MBSRTOWCS=0; AC_SUBST([REPLACE_MBSRTOWCS]) + REPLACE_MBSNRTOWCS=0;AC_SUBST([REPLACE_MBSNRTOWCS]) + REPLACE_WCRTOMB=0; AC_SUBST([REPLACE_WCRTOMB]) + REPLACE_WCSRTOMBS=0; AC_SUBST([REPLACE_WCSRTOMBS]) REPLACE_WCWIDTH=0; AC_SUBST([REPLACE_WCWIDTH]) WCHAR_H=''; AC_SUBST([WCHAR_H]) ]) diff --git a/gnulib/m4/wchar_t.m4 b/gnulib/m4/wchar_t.m4 index cde2129..3c81564 100644 --- a/gnulib/m4/wchar_t.m4 +++ b/gnulib/m4/wchar_t.m4 @@ -1,5 +1,5 @@ -# wchar_t.m4 serial 1 (gettext-0.12) -dnl Copyright (C) 2002-2003 Free Software Foundation, Inc. +# wchar_t.m4 serial 2 (gettext-0.18) +dnl Copyright (C) 2002-2003, 2008 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -10,11 +10,11 @@ dnl Prerequisite: AC_PROG_CC AC_DEFUN([gt_TYPE_WCHAR_T], [ - AC_CACHE_CHECK([for wchar_t], gt_cv_c_wchar_t, + AC_CACHE_CHECK([for wchar_t], [gt_cv_c_wchar_t], [AC_TRY_COMPILE([#include <stddef.h> wchar_t foo = (wchar_t)'\0';], , - gt_cv_c_wchar_t=yes, gt_cv_c_wchar_t=no)]) + [gt_cv_c_wchar_t=yes], [gt_cv_c_wchar_t=no])]) if test $gt_cv_c_wchar_t = yes; then - AC_DEFINE(HAVE_WCHAR_T, 1, [Define if you have the 'wchar_t' type.]) + AC_DEFINE([HAVE_WCHAR_T], 1, [Define if you have the 'wchar_t' type.]) fi ]) diff --git a/gnulib/m4/wint_t.m4 b/gnulib/m4/wint_t.m4 index af5ed93..0026a13 100644 --- a/gnulib/m4/wint_t.m4 +++ b/gnulib/m4/wint_t.m4 @@ -1,5 +1,5 @@ -# wint_t.m4 serial 2 (gettext-0.17) -dnl Copyright (C) 2003, 2007 Free Software Foundation, Inc. +# wint_t.m4 serial 3 (gettext-0.18) +dnl Copyright (C) 2003, 2007-2008 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -10,7 +10,7 @@ dnl Prerequisite: AC_PROG_CC AC_DEFUN([gt_TYPE_WINT_T], [ - AC_CACHE_CHECK([for wint_t], gt_cv_c_wint_t, + AC_CACHE_CHECK([for wint_t], [gt_cv_c_wint_t], [AC_TRY_COMPILE([ /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before <wchar.h>. @@ -21,8 +21,8 @@ AC_DEFUN([gt_TYPE_WINT_T], #include <time.h> #include <wchar.h> wint_t foo = (wchar_t)'\0';], , - gt_cv_c_wint_t=yes, gt_cv_c_wint_t=no)]) + [gt_cv_c_wint_t=yes], [gt_cv_c_wint_t=no])]) if test $gt_cv_c_wint_t = yes; then - AC_DEFINE(HAVE_WINT_T, 1, [Define if you have the 'wint_t' type.]) + AC_DEFINE([HAVE_WINT_T], 1, [Define if you have the 'wint_t' type.]) fi ]) diff --git a/gnulib/m4/xsize.m4 b/gnulib/m4/xsize.m4 index 85bb721..631893c 100644 --- a/gnulib/m4/xsize.m4 +++ b/gnulib/m4/xsize.m4 @@ -1,5 +1,5 @@ -# xsize.m4 serial 3 -dnl Copyright (C) 2003-2004 Free Software Foundation, Inc. +# xsize.m4 serial 4 +dnl Copyright (C) 2003-2004, 2008 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -9,5 +9,5 @@ AC_DEFUN([gl_XSIZE], dnl Prerequisites of lib/xsize.h. AC_REQUIRE([gl_SIZE_MAX]) AC_REQUIRE([AC_C_INLINE]) - AC_CHECK_HEADERS(stdint.h) + AC_CHECK_HEADERS([stdint.h]) ]) diff --git a/gnulib/tests/.cvsignore b/gnulib/tests/.cvsignore index 04eb4a0..b38a37b 100644 --- a/gnulib/tests/.cvsignore +++ b/gnulib/tests/.cvsignore @@ -36,3 +36,4 @@ test-unistd test-vasnprintf test-vasprintf test-wchar +test-time diff --git a/gnulib/tests/.gitignore b/gnulib/tests/.gitignore index 04eb4a0..b38a37b 100644 --- a/gnulib/tests/.gitignore +++ b/gnulib/tests/.gitignore @@ -36,3 +36,4 @@ test-unistd test-vasnprintf test-vasprintf test-wchar +test-time diff --git a/gnulib/tests/Makefile.am b/gnulib/tests/Makefile.am index 36195f6..4273d6c 100644 --- a/gnulib/tests/Makefile.am +++ b/gnulib/tests/Makefile.am @@ -1,6 +1,6 @@ ## DO NOT EDIT! GENERATED AUTOMATICALLY! ## Process this file with automake to produce Makefile.in. -# Copyright (C) 2002-2008 Free Software Foundation, Inc. +# Copyright (C) 2002-2009 Free Software Foundation, Inc. # # This file is free software, distributed under the terms of the GNU # General Public License. As a special exception to the GNU General @@ -109,7 +109,7 @@ EXTRA_DIST += test-fseeko.c test-fseeko.sh TESTS += test-getaddrinfo check_PROGRAMS += test-getaddrinfo -test_getaddrinfo_LDADD = $(LDADD) @LIBINTL@ +test_getaddrinfo_LDADD = $(LDADD) @GETADDRINFO_LIB@ @LIBINTL@ EXTRA_DIST += test-getaddrinfo.c @@ -361,6 +361,15 @@ EXTRA_DIST += test-sys_time.c ## end gnulib module sys_time-tests +## begin gnulib module time-tests + +TESTS += test-time +check_PROGRAMS += test-time + +EXTRA_DIST += test-time.c + +## end gnulib module time-tests + ## begin gnulib module unistd-tests TESTS += test-unistd diff --git a/gnulib/tests/sockets.h b/gnulib/tests/sockets.h index 3ab16a0..33348db 100644 --- a/gnulib/tests/sockets.h +++ b/gnulib/tests/sockets.h @@ -20,9 +20,9 @@ #ifndef SOCKETS_H # define SOCKETS_H 1 -#define SOCKETS_1_0 0x100 +#define SOCKETS_1_0 0x100 /* don't use - does not work on Windows XP */ #define SOCKETS_1_1 0x101 -#define SOCKETS_2_0 0x200 +#define SOCKETS_2_0 0x200 /* don't use - does not work on Windows XP */ #define SOCKETS_2_1 0x201 #define SOCKETS_2_2 0x202 diff --git a/gnulib/tests/test-time.c b/gnulib/tests/test-time.c new file mode 100644 index 0000000..9238ac4 --- /dev/null +++ b/gnulib/tests/test-time.c @@ -0,0 +1,29 @@ +/* Test of <time.h> substitute. + Copyright (C) 2007 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2007. */ + +#include <config.h> + +#include <time.h> + +struct timespec a; + +int +main () +{ + return 0; +} diff --git a/tests/.gitignore b/tests/.gitignore index e45c3dc..679cc20 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -2,7 +2,6 @@ Makefile Makefile.in .deps .libs -xmlrpctest sexpr2xmltest xml2sexprtest virshtest -- 1.6.1.121.g866a4a

Jim Meyering <jim@meyering.net> wrote:
"Daniel P. Berrange" <berrange@redhat.com> wrote:
On Tue, Jan 06, 2009 at 04:38:12PM +0100, Jim Meyering wrote:
"Daniel P. Berrange" <berrange@redhat.com> wrote:
There are a number of problems breaking the windows / mingw build currently.
- Use of 'close' without importing unistd.h - Use of non-existant localtime_r - ERROR macro from logging.h clashes with a symbol imported from windows.h
So this patch does
- Adds the missing unistd.h include - Uses localtime() if localtime_r() is missing (as checked from configure)
That all looks fine. However, since there's an LGPLv2+ gnulib module that provides localtime_r (called time_r) you may want to skip that part. Or just go ahead with what you have and I'll undo things when I've confirmed pulling in the new module works as expected.
I committed everything except the localtime_r() change...
Thanks. Here's the change to pull in the time_r module and to update gnulib to the latest.
I tested by applying the patch to a clean directory and ensuring that autobuild.sh's mingw build succeeds. It also passed "make distcheck" on a rawhide x86_64 system.
Daniel Berrange ACK'd this privately, so I've just committed it.
participants (3)
-
Daniel P. Berrange
-
Daniel Veillard
-
Jim Meyering