common: Remove two JNLIB_ macros (jnlib merge).

* configure.ac: Merge seperate jnlib checks.
(HAVE_JNLIB_LOGGING): Remove.
* common/logging.c, common/simple-pwquery.c (JNLIB_NEED_AFLOCAL):
Rename to GNUPG_COMMON_NEED_AFLOCAL.  Change all tests.
--

Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2015-04-24 16:10:15 +02:00
parent 17bcd08708
commit 575230d91b
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B
24 changed files with 19 additions and 55 deletions

View File

@ -49,8 +49,7 @@
#endif #endif
#include <npth.h> #include <npth.h>
#define JNLIB_NEED_LOG_LOGV #define GNUPG_COMMON_NEED_AFLOCAL
#define JNLIB_NEED_AFLOCAL
#include "agent.h" #include "agent.h"
#include <assuan.h> /* Malloc hooks and socket wrappers. */ #include <assuan.h> /* Malloc hooks and socket wrappers. */

View File

@ -44,7 +44,6 @@
# include <windows.h> /* To initialize the sockets. fixme */ # include <windows.h> /* To initialize the sockets. fixme */
#endif #endif
#define JNLIB_NEED_LOG_LOGV
#include "agent.h" #include "agent.h"
#include "simple-pwquery.h" #include "simple-pwquery.h"
#include "i18n.h" #include "i18n.h"

View File

@ -38,7 +38,6 @@
#include <fcntl.h> /* for setmode() */ #include <fcntl.h> /* for setmode() */
#endif #endif
#define JNLIB_NEED_LOG_LOGV
#include "agent.h" #include "agent.h"
#include "i18n.h" #include "i18n.h"
#include "get-passphrase.h" #include "get-passphrase.h"

View File

@ -37,7 +37,6 @@
#include <locale.h> #include <locale.h>
#endif #endif
#define JNLIB_NEED_LOG_LOGV
#include "i18n.h" #include "i18n.h"
#include "util.h" #include "util.h"
#include "exechelp.h" #include "exechelp.h"

View File

@ -56,7 +56,7 @@
#include <assert.h> #include <assert.h>
#define JNLIB_NEED_AFLOCAL 1 #define GNUPG_COMMON_NEED_AFLOCAL 1
#include "util.h" #include "util.h"
#include "i18n.h" #include "i18n.h"
#include "common-defs.h" #include "common-defs.h"

View File

@ -31,7 +31,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <errno.h> #include <errno.h>
#define JNLIB_NEED_LOG_LOGV
#include "util.h" #include "util.h"
#include "iobuf.h" #include "iobuf.h"
#include "i18n.h" #include "i18n.h"

View File

@ -81,7 +81,7 @@ time_t timegm (struct tm *tm);
/* Include hacks which are mainly required for Slowaris. */ /* Include hacks which are mainly required for Slowaris. */
#ifdef JNLIB_NEED_AFLOCAL #ifdef GNUPG_COMMON_NEED_AFLOCAL
#ifndef HAVE_W32_SYSTEM #ifndef HAVE_W32_SYSTEM
# include <sys/socket.h> # include <sys/socket.h>
# include <sys/un.h> # include <sys/un.h>
@ -115,7 +115,7 @@ time_t timegm (struct tm *tm);
# define SUN_LEN(ptr) ((size_t) (((struct sockaddr_un *) 0)->sun_path) \ # define SUN_LEN(ptr) ((size_t) (((struct sockaddr_un *) 0)->sun_path) \
+ strlen ((ptr)->sun_path)) + strlen ((ptr)->sun_path))
#endif /*SUN_LEN*/ #endif /*SUN_LEN*/
#endif /*JNLIB_NEED_AFLOCAL*/ #endif /*GNUPG_COMMON_NEED_AFLOCAL*/
#endif /*LIBJNLIB_MISCHELP_H*/ #endif /*LIBJNLIB_MISCHELP_H*/

View File

@ -40,7 +40,7 @@
#include <locale.h> #include <locale.h>
#endif #endif
#define JNLIB_NEED_AFLOCAL #define GNUPG_COMMON_NEED_AFLOCAL
#include "../common/mischelp.h" #include "../common/mischelp.h"
#ifdef HAVE_W32_SYSTEM #ifdef HAVE_W32_SYSTEM
#include "../common/w32-afunix.h" #include "../common/w32-afunix.h"
@ -50,10 +50,6 @@
#define SIMPLE_PWQUERY_IMPLEMENTATION 1 #define SIMPLE_PWQUERY_IMPLEMENTATION 1
#include "simple-pwquery.h" #include "simple-pwquery.h"
#if defined(SPWQ_USE_LOGGING) && !defined(HAVE_JNLIB_LOGGING)
# undef SPWQ_USE_LOGGING
#endif
#ifndef _ #ifndef _
#define _(a) (a) #define _(a) (a)
#endif #endif

View File

@ -26,9 +26,7 @@
#include <gcrypt.h> #include <gcrypt.h>
#include "../common/logging.h" #include "../common/logging.h"
/* Try to write error message using the standard log mechanism. The /* Try to write error message using the standard gnupg log mechanism. */
current implementation requires that the HAVE_JNLIB_LOGGING is also
defined. */
#define SPWQ_USE_LOGGING 1 #define SPWQ_USE_LOGGING 1
/* Memory allocation functions used by the implementation. Note, that /* Memory allocation functions used by the implementation. Note, that

View File

@ -527,9 +527,6 @@ AH_BOTTOM([
/* Tell Libgcrypt not to include deprecated definitions. */ /* Tell Libgcrypt not to include deprecated definitions. */
#define GCRYPT_NO_DEPRECATED 1 #define GCRYPT_NO_DEPRECATED 1
/* We use jnlib, so tell other modules about it. */
#define HAVE_JNLIB_LOGGING 1
/* Our HTTP code is used in estream mode. */ /* Our HTTP code is used in estream mode. */
#define HTTP_USE_ESTREAM 1 #define HTTP_USE_ESTREAM 1
@ -1174,7 +1171,8 @@ fi
AC_MSG_NOTICE([checking for header files]) AC_MSG_NOTICE([checking for header files])
AC_HEADER_STDC AC_HEADER_STDC
AC_CHECK_HEADERS([string.h unistd.h langinfo.h termio.h locale.h getopt.h \ AC_CHECK_HEADERS([string.h unistd.h langinfo.h termio.h locale.h getopt.h \
pty.h utmp.h pwd.h inttypes.h signal.h sys/select.h]) pty.h utmp.h pwd.h inttypes.h signal.h sys/select.h \
signal.h])
AC_HEADER_TIME AC_HEADER_TIME
@ -1255,6 +1253,10 @@ AC_CHECK_FUNCS([gettimeofday getrusage getrlimit setrlimit clock_gettime])
AC_CHECK_FUNCS([atexit raise getpagesize strftime nl_langinfo setlocale]) AC_CHECK_FUNCS([atexit raise getpagesize strftime nl_langinfo setlocale])
AC_CHECK_FUNCS([waitpid wait4 sigaction sigprocmask pipe getaddrinfo]) AC_CHECK_FUNCS([waitpid wait4 sigaction sigprocmask pipe getaddrinfo])
AC_CHECK_FUNCS([ttyname rand ftello fsync stat lstat]) AC_CHECK_FUNCS([ttyname rand ftello fsync stat lstat])
AC_CHECK_FUNCS([memicmp stpcpy strsep strlwr strtoul memmove stricmp strtol \
memrchr isascii timegm getrusage setrlimit stat setlocale \
flockfile funlockfile fopencookie funopen getpwnam getpwuid \
getenv inet_pton strpbrk])
if test "$have_android_system" = yes; then if test "$have_android_system" = yes; then
# On Android ttyname is a stub but prints an error message. # On Android ttyname is a stub but prints an error message.
@ -1269,17 +1271,6 @@ if test $ac_cv_func_mmap != yes -a $mmap_needed = yes; then
AC_MSG_ERROR([[Sorry, the current implemenation requires mmap.]]) AC_MSG_ERROR([[Sorry, the current implemenation requires mmap.]])
fi fi
#
# These are needed by the jnlib parts in common.
# Note: We already checked pwd.h.
AC_CHECK_HEADERS([signal.h])
AC_CHECK_FUNCS([memicmp stpcpy strsep strlwr strtoul memmove stricmp strtol \
memrchr isascii timegm getrusage setrlimit stat setlocale \
flockfile funlockfile fopencookie funopen getpwnam getpwuid \
getenv inet_pton strpbrk])
# end jnlib checks.
# #
# W32 specific test # W32 specific test
# #

View File

@ -31,7 +31,6 @@
#include <gpg-error.h> #include <gpg-error.h>
#include <assuan.h> #include <assuan.h>
#define JNLIB_NEED_LOG_LOGV
#include "../common/logging.h" #include "../common/logging.h"
#include "../common/argparse.h" #include "../common/argparse.h"
#include "../common/stringhelp.h" #include "../common/stringhelp.h"

View File

@ -50,8 +50,7 @@
#endif /*HTTP_USE_GNUTLS*/ #endif /*HTTP_USE_GNUTLS*/
#define JNLIB_NEED_LOG_LOGV #define GNUPG_COMMON_NEED_AFLOCAL
#define JNLIB_NEED_AFLOCAL
#include "dirmngr.h" #include "dirmngr.h"
#include <assuan.h> #include <assuan.h>

View File

@ -49,7 +49,6 @@
#endif #endif
#define JNLIB_NEED_LOG_LOGV
#include <gpg-error.h> #include <gpg-error.h>
#include "../common/logging.h" #include "../common/logging.h"
#include "../common/argparse.h" #include "../common/argparse.h"

View File

@ -30,7 +30,6 @@
#include <unistd.h> #include <unistd.h>
#include <errno.h> #include <errno.h>
#define JNLIB_NEED_LOG_LOGV
#include "dirmngr.h" #include "dirmngr.h"
#include <assuan.h> #include <assuan.h>

View File

@ -31,7 +31,6 @@
# include <readline/readline.h> # include <readline/readline.h>
#endif #endif
#define JNLIB_NEED_LOG_LOGV
#include "gpg.h" #include "gpg.h"
#include "options.h" #include "options.h"
#include "packet.h" #include "packet.h"

View File

@ -28,7 +28,6 @@
#include <limits.h> #include <limits.h>
#include <assert.h> #include <assert.h>
#define JNLIB_NEED_LOG_LOGV
#include <gpg-error.h> #include <gpg-error.h>
#include "../common/logging.h" #include "../common/logging.h"
#include "../common/argparse.h" #include "../common/argparse.h"

View File

@ -108,12 +108,10 @@
#define CCID_MAX_BUF (2048+7+10) #define CCID_MAX_BUF (2048+7+10)
/* Depending on how this source is used we either define our error /* Depending on how this source is used we either define our error
output to go to stderr or to the jnlib based logging functions. We output to go to stderr or to the GnuPG based logging functions. We
use the latter when GNUPG_MAJOR_VERSION is defines or when both, use the latter when GNUPG_MAJOR_VERSION or GNUPG_SCD_MAIN_HEADER
GNUPG_SCD_MAIN_HEADER and HAVE_JNLIB_LOGGING are defined. are defined. */
*/ #if defined(GNUPG_MAJOR_VERSION) || defined(GNUPG_SCD_MAIN_HEADER)
#if defined(GNUPG_MAJOR_VERSION) \
|| (defined(GNUPG_SCD_MAIN_HEADER) && defined(HAVE_JNLIB_LOGGING))
#if defined(GNUPG_SCD_MAIN_HEADER) #if defined(GNUPG_SCD_MAIN_HEADER)
# include GNUPG_SCD_MAIN_HEADER # include GNUPG_SCD_MAIN_HEADER

View File

@ -27,7 +27,6 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <unistd.h> #include <unistd.h>
#define JNLIB_NEED_LOG_LOGV
#include "scdaemon.h" #include "scdaemon.h"
#include <gcrypt.h> #include <gcrypt.h>

View File

@ -37,8 +37,7 @@
#include <signal.h> #include <signal.h>
#include <npth.h> #include <npth.h>
#define JNLIB_NEED_LOG_LOGV #define GNUPG_COMMON_NEED_AFLOCAL
#define JNLIB_NEED_AFLOCAL
#include "scdaemon.h" #include "scdaemon.h"
#include <ksba.h> #include <ksba.h>
#include <gcrypt.h> #include <gcrypt.h>

View File

@ -28,8 +28,6 @@
#include <stdarg.h> #include <stdarg.h>
#include <assert.h> #include <assert.h>
#define JNLIB_NEED_LOG_LOGV /* We need log_logv. */
#include "gpgsm.h" #include "gpgsm.h"
#include <gcrypt.h> #include <gcrypt.h>
#include <ksba.h> #include <ksba.h>

View File

@ -40,8 +40,6 @@
#include <regex.h> #include <regex.h>
#include <ctype.h> #include <ctype.h>
#define JNLIB_NEED_LOG_LOGV
#include "util.h" #include "util.h"
#include "i18n.h" #include "i18n.h"
#include "sysutils.h" #include "sysutils.h"

View File

@ -44,7 +44,6 @@
#endif #endif
/* For log_logv(), asctimestamp(), gnupg_get_time (). */ /* For log_logv(), asctimestamp(), gnupg_get_time (). */
#define JNLIB_NEED_LOG_LOGV
#include "util.h" #include "util.h"
#include "i18n.h" #include "i18n.h"
#include "exechelp.h" #include "exechelp.h"

View File

@ -86,7 +86,6 @@
#endif #endif
#include <gpg-error.h> #include <gpg-error.h>
#define JNLIB_NEED_LOG_LOGV
#include "i18n.h" #include "i18n.h"
#include "../common/util.h" #include "../common/util.h"
#include "../common/init.h" #include "../common/init.h"

View File

@ -49,7 +49,7 @@
#define BUGREPORT_LINE "" #define BUGREPORT_LINE ""
#endif #endif
#if !defined(SUN_LEN) || !defined(PF_LOCAL) || !defined(AF_LOCAL) #if !defined(SUN_LEN) || !defined(PF_LOCAL) || !defined(AF_LOCAL)
#define JNLIB_NEED_AFLOCAL #define GNUPG_COMMON_NEED_AFLOCAL
#include "../common/mischelp.h" #include "../common/mischelp.h"
#endif #endif