diff options
author | Stef Walter <stef@thewalter.net> | 2013-07-23 23:25:48 +0200 |
---|---|---|
committer | Stef Walter <stef@thewalter.net> | 2013-07-24 16:06:04 +0200 |
commit | 89ac8487fbc94405b59cc9dde838df783124b07e (patch) | |
tree | cf0daea87ae6e3a64eb599e361846de2535752bc | |
parent | 027c5cc1a0fd71675f4cf7d3e6b681a2a9454425 (diff) | |
download | p11-kit-89ac8487fbc94405b59cc9dde838df783124b07e.tar.gz |
Don't use _GNU_SOURCE
glibc declares functions completely different if in POSIX or GNU
mode. Nastiness. Stop using _GNU_SOURCE all together.
-rw-r--r-- | common/compat.h | 10 | ||||
-rw-r--r-- | common/message.c | 6 | ||||
-rw-r--r-- | configure.ac | 7 |
3 files changed, 17 insertions, 6 deletions
diff --git a/common/compat.h b/common/compat.h index a78da1f..fae1b7d 100644 --- a/common/compat.h +++ b/common/compat.h @@ -39,6 +39,10 @@ #include <sys/types.h> +#ifdef _GNU_SOURCE +#error Make the crap stop. _GNU_SOURCE is completely unportable and breaks all sorts of behavior +#endif + #if !defined(__cplusplus) && (__GNUC__ > 2) #define GNUC_PRINTF(x, y) __attribute__((__format__(__printf__, x, y))) #else @@ -263,7 +267,7 @@ char * strconcat (const char *first, #endif /* HAVE_STRCONCAT */ -#ifndef HAVE_ASPRINTF +#if defined HAVE_DECL_ASPRINTF && !HAVE_DECL_ASPRINTF int asprintf (char **strp, const char *fmt, @@ -271,14 +275,14 @@ int asprintf (char **strp, #endif /* HAVE_ASPRINTF */ -#ifndef HAVE_VASPRINTF +#if defined HAVE_DECL_VASPRINTF && !HAVE_DECL_VASPRINTF #include <stdarg.h> int vasprintf (char **strp, const char *fmt, va_list ap); -#endif /* HAVE_VASPRINTF */ +#endif /* HAVE_DECL_VASPRINTF */ #ifndef HAVE_GMTIME_R #include <time.h> diff --git a/common/message.c b/common/message.c index 8b54ad1..4358e46 100644 --- a/common/message.c +++ b/common/message.c @@ -37,6 +37,12 @@ #include "config.h" +/* + * Oh god. glibc is nasty. Changes behavior and definitions of POSIX + * functions to completely different signatures depending on defines + */ +#define _POSIX_C_SOURCE 200112L + #include "compat.h" #define P11_DEBUG_FLAG P11_DEBUG_LIB #include "debug.h" diff --git a/configure.ac b/configure.ac index d764944..1b7cdac 100644 --- a/configure.ac +++ b/configure.ac @@ -6,8 +6,6 @@ AC_INIT([p11-kit], [p11-kit], [http://p11-glue.freedesktop.org/p11-kit.html]) -AC_USE_SYSTEM_EXTENSIONS - # ------------------------------------------------------------------------------ # p11-kit libtool versioning # CURRENT : REVISION : AGE @@ -83,6 +81,8 @@ if test "$os_unix" = "yes"; then AC_CHECK_FUNCS([asprintf vasprintf vsnprintf]) AC_CHECK_FUNCS([timegm]) + AC_CHECK_DECLS([asprintf, vasprintf], [], [], [[#include <stdio.h>]]) + # Required functions AC_CHECK_FUNCS([gmtime_r], [AC_DEFINE([HAVE_GMTIME_R], 1, [Whether gmtime_r() is available])], @@ -91,7 +91,8 @@ if test "$os_unix" = "yes"; then # Check if these are declared and/or available to link against AC_CHECK_DECLS([program_invocation_short_name]) AC_MSG_CHECKING([whether program_invocation_short_name is available]) - AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <argp.h>]], + AC_LINK_IFELSE([AC_LANG_PROGRAM([[#define _GNU_SOURCE + #include <errno.h>]], [[program_invocation_short_name = "test";]])], [AC_DEFINE([HAVE_PROGRAM_INVOCATION_SHORT_NAME], [1], [Whether program_invocation_short_name available]) |