Skip to content

Commit

Permalink
Remove all _xxx_SOURCE macros from source, do it in configure.
Browse files Browse the repository at this point in the history
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
  • Loading branch information
David Woodhouse authored and David Woodhouse committed Nov 5, 2011
1 parent e8f6d53 commit dcc7437
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 11 deletions.
1 change: 0 additions & 1 deletion auth.c
Expand Up @@ -23,7 +23,6 @@
* Boston, MA 02110-1301 USA
*/

#define _GNU_SOURCE
#include <stdio.h>
#include <netdb.h>
#include <unistd.h>
Expand Down
23 changes: 23 additions & 0 deletions configure.ac
Expand Up @@ -2,6 +2,7 @@
AC_INIT(openconnect, 3.13)
PKG_PROG_PKG_CONFIG
AC_LANG_C
AC_CANONICAL_TARGET
AM_MAINTAINER_MODE([enable])
AM_INIT_AUTOMAKE([foreign])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
Expand Down Expand Up @@ -49,6 +50,28 @@ if test "$USE_NLS" = "yes"; then
fi
AM_CONDITIONAL(USE_NLS, [test "$USE_NLS" = "yes"])

case $target_os in
*linux*)
AC_MSG_NOTICE([Applying feature macros for Linux build])
AC_DEFINE(_POSIX_C_SOURCE, 200112L)
# For strcasecmp()
AC_DEFINE(_BSD_SOURCE)
# For asprintf()
AC_DEFINE(_GNU_SOURCE)
;;
*netbsd*)
AC_MSG_NOTICE([Applying feature macros for NetBSD build])
AC_DEFINE(_POSIX_C_SOURCE, 200112L)
AC_DEFINE(_NETBSD_SOURCE)
;;
*)
# On FreeBSD the only way to get vsyslog() visible is to define
# *nothing*, which makes absolutely everything visible.
# On Darwin enabling _POSIX_C_SOURCE breaks <sys/mount.h> because
# u_long and other types don't get defined. OpenBSD is similar.
;;
esac

AS_COMPILER_FLAGS(CFLAGS,
"-Wall
-Wextra
Expand Down
1 change: 0 additions & 1 deletion cstp.c
Expand Up @@ -23,7 +23,6 @@
* Boston, MA 02110-1301 USA
*/

#define _BSD_SOURCE
#include <netdb.h>
#include <unistd.h>
#include <fcntl.h>
Expand Down
1 change: 0 additions & 1 deletion dtls.c
Expand Up @@ -22,7 +22,6 @@
* Boston, MA 02110-1301 USA
*/

#define _BSD_SOURCE
#include <errno.h>
#include <sys/types.h>
#include <sys/socket.h>
Expand Down
1 change: 0 additions & 1 deletion http.c
Expand Up @@ -23,7 +23,6 @@
* Boston, MA 02110-1301 USA
*/

#define _GNU_SOURCE
#include <netdb.h>
#include <unistd.h>
#include <fcntl.h>
Expand Down
3 changes: 0 additions & 3 deletions main.c
Expand Up @@ -23,8 +23,6 @@
* Boston, MA 02110-1301 USA
*/

#define _BSD_SOURCE
#define _POSIX_SOURCE
#include <stdio.h>
#ifdef ANDROID
#include <android/log.h>
Expand All @@ -49,7 +47,6 @@
#include LIBPROXY_HDR
#endif

#define _GNU_SOURCE
#include <getopt.h>

#include "openconnect-internal.h"
Expand Down
1 change: 0 additions & 1 deletion mainloop.c
Expand Up @@ -22,7 +22,6 @@
* Boston, MA 02110-1301 USA
*/

#define _POSIX_SOURCE
#include <errno.h>
#include <poll.h>
#include <limits.h>
Expand Down
1 change: 0 additions & 1 deletion ssl.c
Expand Up @@ -22,7 +22,6 @@
* Boston, MA 02110-1301 USA
*/

#define _GNU_SOURCE
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
Expand Down
2 changes: 0 additions & 2 deletions tun.c
Expand Up @@ -22,8 +22,6 @@
* Boston, MA 02110-1301 USA
*/

#define _BSD_SOURCE
#define _POSIX_SOURCE
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/socket.h>
Expand Down

0 comments on commit dcc7437

Please sign in to comment.