changeset 8:25e227eba3da

Fix asprintf compatibility code Ensure compat/asprintf.o is built on platforms not providing asprintf. Define the _GNU_SOURCE feature macro for the glib asprintf prototype.
author Guido Berhoerster <guido+pwm@berhoerster.name>
date Fri, 28 Jul 2017 08:20:38 +0200
parents bec6f94453ec
children 60c8ab006e55
files Makefile compat.h
diffstat 2 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Fri Jul 28 08:11:30 2017 +0200
+++ b/Makefile	Fri Jul 28 08:20:38 2017 +0200
@@ -136,6 +136,11 @@
 XCPPFLAGS =	-DPACKAGE=\"$(PACKAGE)\" \
 		-DVERSION=\"$(VERSION)\"
 LDLIBS =	-lpws -lnettle
+ifeq ($(HAVE_ASPRINTF),1)
+  XCPPFLAGS +=	-DHAVE_ASPRINTF
+else
+  OBJS +=	compat/asprintf.o
+endif
 ifeq ($(HAVE_ERR_H),1)
   XCPPFLAGS +=	-DHAVE_ERR_H
 else
--- a/compat.h	Fri Jul 28 08:11:30 2017 +0200
+++ b/compat.h	Fri Jul 28 08:20:38 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 Guido Berhoerster <guido+pwm@berhoerster.name>
+ * Copyright (C) 2017 Guido Berhoerster <guido+pwm@berhoerster.name>
  *
  * Permission is hereby granted, free of charge, to any person obtaining
  * a copy of this software and associated documentation files (the
@@ -25,7 +25,7 @@
 #define	COMPAT_H
 
 /* for glibc asprintf, getline */
-#define	_BSD_SOURCE
+#define	_GNU_SOURCE
 
 #ifndef	HAVE_ASPRINTF
 #include "compat/asprintf.h"