projects/pwm

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 Jul 28 08:20:38 2017 +0200 (2017-07-28)
parents bec6f94453ec
children 60c8ab006e55
files Makefile compat.h
line diff
     1.1 --- a/Makefile	Fri Jul 28 08:11:30 2017 +0200
     1.2 +++ b/Makefile	Fri Jul 28 08:20:38 2017 +0200
     1.3 @@ -136,6 +136,11 @@
     1.4  XCPPFLAGS =	-DPACKAGE=\"$(PACKAGE)\" \
     1.5  		-DVERSION=\"$(VERSION)\"
     1.6  LDLIBS =	-lpws -lnettle
     1.7 +ifeq ($(HAVE_ASPRINTF),1)
     1.8 +  XCPPFLAGS +=	-DHAVE_ASPRINTF
     1.9 +else
    1.10 +  OBJS +=	compat/asprintf.o
    1.11 +endif
    1.12  ifeq ($(HAVE_ERR_H),1)
    1.13    XCPPFLAGS +=	-DHAVE_ERR_H
    1.14  else
     2.1 --- a/compat.h	Fri Jul 28 08:11:30 2017 +0200
     2.2 +++ b/compat.h	Fri Jul 28 08:20:38 2017 +0200
     2.3 @@ -1,5 +1,5 @@
     2.4  /*
     2.5 - * Copyright (C) 2016 Guido Berhoerster <guido+pwm@berhoerster.name>
     2.6 + * Copyright (C) 2017 Guido Berhoerster <guido+pwm@berhoerster.name>
     2.7   *
     2.8   * Permission is hereby granted, free of charge, to any person obtaining
     2.9   * a copy of this software and associated documentation files (the
    2.10 @@ -25,7 +25,7 @@
    2.11  #define	COMPAT_H
    2.12  
    2.13  /* for glibc asprintf, getline */
    2.14 -#define	_BSD_SOURCE
    2.15 +#define	_GNU_SOURCE
    2.16  
    2.17  #ifndef	HAVE_ASPRINTF
    2.18  #include "compat/asprintf.h"