From b89ae8d34dc123987b9696c568726bff9a0e6ecd Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Mon, 4 May 2009 17:02:59 +0200 Subject: [PATCH] Build system: Add the --enable-standards configure option. --- configure.in | 1 + src/collectd.h | 5 +++++ src/standards.h | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 60 insertions(+) create mode 100644 src/standards.h diff --git a/configure.in b/configure.in index 561d1069..4b11554f 100644 --- a/configure.in +++ b/configure.in @@ -3150,6 +3150,7 @@ collectd features:]) # FIXME: Remove these calls to `AC_COLLECTD' and then remove that macro. AC_COLLECTD([debug], [enable], [feature], [debugging]) AC_COLLECTD([daemon], [disable], [feature], [daemon mode]) +AC_COLLECTD([standards], [enable], [feature], [enable strict standards compliance mode]) AC_COLLECTD([getifaddrs],[enable], [feature], [getifaddrs under Linux]) dependency_error="no" diff --git a/src/collectd.h b/src/collectd.h index 18052ba3..5a039199 100644 --- a/src/collectd.h +++ b/src/collectd.h @@ -26,6 +26,11 @@ # include "config.h" #endif +/* Set to C99 and POSIX code */ +#if COLLECT_STANDARDS +# include "standards.h" +#endif /* COLLECT_STANDARDS */ + #include #if HAVE_SYS_TYPES_H # include diff --git a/src/standards.h b/src/standards.h new file mode 100644 index 00000000..a01b4145 --- /dev/null +++ b/src/standards.h @@ -0,0 +1,54 @@ +/** + * collectd - src/collectd.h + * Copyright (C) 2009 Florian octo Forster + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; only version 2 of the License is applicable. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * Authors: + * Florian octo Forster + **/ + +#ifndef COLLECTD_STANDARDS_H +#define COLLECTD_STANDARDS_H 1 + +# ifndef _ISOC99_SOURCE +# define _ISOC99_SOURCE +# endif +# ifndef _POSIX_SOURCE +# define _POSIX_SOURCE +# endif +# ifndef _POSIX_C_SOURCE +# define _POSIX_C_SOURCE 200112L +# endif +# ifndef _XOPEN_SOURCE +# define _XOPEN_SOURCE 600 +# endif +# ifndef _REENTRANT +# define _REENTRANT +# endif + +#if 0 +/* Disable non-standard extensions */ +# ifdef _BSD_SOURCE +# undef _BSD_SOURCE +# endif +# ifdef _SVID_SOURCE +# undef _SVID_SOURCE +# endif +# ifdef _GNU_SOURCE +# undef _GNU_SOURCE +# endif +#endif /* 0 */ + +#endif /* COLLECTD_STANDARDS_H */ -- 2.11.0