From be5ff1d934c6da0b7404ceb0a715d267cfd2213e Mon Sep 17 00:00:00 2001 From: Juan RP Date: Tue, 25 Jan 2011 13:00:23 +0100 Subject: [PATCH] Don't build code with _GNU_SOURCE, use _XOPEN_SOURCE=500 instead. _GNU_SOURCE is only now for xbps_xasprintf() if vasprintf is found, and only for , it's unset immediately once the header is included. --- bin/xbps-bin/main.c | 3 ++- bin/xbps-bin/question.c | 1 + bin/xbps-repo/main.c | 3 ++- bin/xbps-uhelper/main.c | 1 + configure | 5 ++--- lib/Makefile | 6 ++++-- lib/cmpver.c | 1 + lib/fexec.c | 1 + lib/util.c | 8 +++++++- 9 files changed, 21 insertions(+), 8 deletions(-) diff --git a/bin/xbps-bin/main.c b/bin/xbps-bin/main.c index c8c06d94..fc65632f 100644 --- a/bin/xbps-bin/main.c +++ b/bin/xbps-bin/main.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2008-2010 Juan Romero Pardines. + * Copyright (c) 2008-2011 Juan Romero Pardines. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include diff --git a/bin/xbps-bin/question.c b/bin/xbps-bin/question.c index 1ff104fd..80c977db 100644 --- a/bin/xbps-bin/question.c +++ b/bin/xbps-bin/question.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include "defs.h" diff --git a/bin/xbps-repo/main.c b/bin/xbps-repo/main.c index a74b36bf..bd961fcc 100644 --- a/bin/xbps-repo/main.c +++ b/bin/xbps-repo/main.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2008-2010 Juan Romero Pardines. + * Copyright (c) 2008-2011 Juan Romero Pardines. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include diff --git a/bin/xbps-uhelper/main.c b/bin/xbps-uhelper/main.c index b725f1cb..486bc1e9 100644 --- a/bin/xbps-uhelper/main.c +++ b/bin/xbps-uhelper/main.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include diff --git a/configure b/configure index 8abccb8d..859338c4 100755 --- a/configure +++ b/configure @@ -184,9 +184,8 @@ fi case "$OS" in linux) - echo "CPPFLAGS += -D_XOPEN_SOURCE=600 -D_GNU_SOURCE" >>$CONFIG_MK - echo "CPPFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE" >> $CONFIG_MK - echo "CPPFLAGS += -D_LARGE_FILES" >> $CONFIG_MK + echo "CPPFLAGS += -D_XOPEN_SOURCE=500" >>$CONFIG_MK + echo "CPPFLAGS += -D_FILE_OFFSET_BITS=64" >> $CONFIG_MK ;; *) ;; diff --git a/lib/Makefile b/lib/Makefile index ac7d2f48..13acc28b 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -14,6 +14,7 @@ LIBPROP_OBJS += portableproplib/prop_stack.o portableproplib/prop_string.o LIBPROP_OBJS += portableproplib/prop_array_util.o portableproplib/prop_number.o LIBPROP_OBJS += portableproplib/prop_dictionary_util.o LIBPROP_OBJS += portableproplib/prop_data.o +LIBPROP_CPPFLAGS = -D_GNU_SOURCE LIBPROP_CFLAGS = -Wno-old-style-definition -Wno-cast-qual -Wno-unused-parameter ifdef USE_EXTERNAL_PROPLIB @@ -23,7 +24,7 @@ endif # libfetch LIBFETCH_OBJS = fetch/common.o fetch/fetch.o fetch/file.o LIBFETCH_OBJS += fetch/ftp.o fetch/http.o -LIBFETCH_CPPFLAGS = -DFTP_COMBINE_CWDS -DNETBSD -DINET6 -DWITH_SSL +LIBFETCH_CPPFLAGS = -D_GNU_SOURCE -DFTP_COMBINE_CWDS -DNETBSD -DINET6 -DWITH_SSL LIBFETCH_CFLAGS = -Wno-error -Wno-unused-macros -Wno-conversion ifdef HAVE_VISIBILITY LIBFETCH_SHLIBCFLAGS = -fvisibility=hidden @@ -66,7 +67,8 @@ $(LIBFETCH_OBJS): %.o: %.c $(LIBFETCH_INCS) $(LIBFETCH_GEN) $(LIBPROP_OBJS): %.o: %.c @printf " [CC]\t\t$@\n" - ${SILENT}$(CC) $(CPPFLAGS) $(CFLAGS) $(LIBPROP_CFLAGS) -c $< -o $@ + ${SILENT}$(CC) $(CPPFLAGS) $(LIBPROP_CPPFLAGS) \ + $(CFLAGS) $(LIBPROP_CFLAGS) -c $< -o $@ $(OBJS): %.o: %.c @printf " [CC]\t\t$@\n" diff --git a/lib/cmpver.c b/lib/cmpver.c index abd89319..4931abc3 100644 --- a/lib/cmpver.c +++ b/lib/cmpver.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include diff --git a/lib/fexec.c b/lib/fexec.c index bfb11bf7..2c724a5a 100644 --- a/lib/fexec.c +++ b/lib/fexec.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include "xbps_api_impl.h" diff --git a/lib/util.c b/lib/util.c index 4c89befe..2a4a13ba 100644 --- a/lib/util.c +++ b/lib/util.c @@ -23,7 +23,13 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include +#ifdef HAVE_VASPRINTF +# define _GNU_SOURCE /* for vasprintf(3) */ +# include +# undef _GNU_SOURCE +#else +# include +#endif #include #include #include