Skip to content
This repository has been archived by the owner on Sep 23, 2024. It is now read-only.

Commit

Permalink
macos: only define _DARWIN_C_SOURCE in progs that require it
Browse files Browse the repository at this point in the history
  • Loading branch information
jgarzik committed Feb 25, 2024
1 parent 26787ab commit 294fe14
Show file tree
Hide file tree
Showing 13 changed files with 39 additions and 1 deletion.
3 changes: 3 additions & 0 deletions comm/comm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
#ifndef _GNU_SOURCE
#define _GNU_SOURCE /* for setlinebuf(3), fgets_unlocked(3) */
#endif
#ifdef __APPLE__
#define _DARWIN_C_SOURCE 1
#endif

#include <sys/types.h>
#include <limits.h>
Expand Down
1 change: 0 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ AC_CHECK_LIB(argp, argp_parse, ARGP_LIB=-largp)

AC_DEFINE(_ISOC99_SOURCE, 1, [ISOC99 source])
AC_DEFINE(_POSIX_SOURCE, 1, [POSIX source])
AC_DEFINE(_DARWIN_C_SOURCE, 1, [Apple Darwin C source])
AC_DEFINE(_POSIX_C_SOURCE, 200809L, [POSIX C source])
AC_DEFINE(_XOPEN_SOURCE, 700, [X/Open source])
AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1, [X/open extended source])
Expand Down
3 changes: 3 additions & 0 deletions date/date.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
#include "posixutils-config.h"

#define _BSD_SOURCE
#ifdef __APPLE__
#define _DARWIN_C_SOURCE 1
#endif

#include <stdlib.h>
#include <string>
Expand Down
3 changes: 3 additions & 0 deletions df/df.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
#endif
#include "posixutils-config.h"

#ifdef __APPLE__
#define _DARWIN_C_SOURCE 1
#endif
#define __STDC_FORMAT_MACROS 1

#include <sys/stat.h>
Expand Down
4 changes: 4 additions & 0 deletions getconf/getconf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
#endif
#include "posixutils-config.h"

#ifdef __APPLE__
#define _DARWIN_C_SOURCE 1
#endif

#include <unistd.h>
#include <string.h>
#include <stdio.h>
Expand Down
3 changes: 3 additions & 0 deletions grep/grep.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
#ifndef _GNU_SOURCE
#define _GNU_SOURCE /* for strcasestr(3), fgets_unlocked(3) */
#endif
#ifdef __APPLE__
#define _DARWIN_C_SOURCE 1
#endif

#define __STDC_FORMAT_MACROS 1

Expand Down
4 changes: 4 additions & 0 deletions ipcrm/ipcrm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
#endif
#include "posixutils-config.h"

#ifdef __APPLE__
#define _DARWIN_C_SOURCE 1
#endif

#include <sys/types.h>
#include <stdlib.h>
#include <string.h>
Expand Down
3 changes: 3 additions & 0 deletions kill/kill.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#ifdef __APPLE__
#define _DARWIN_C_SOURCE 1
#endif

#include <sys/types.h>
#include <unistd.h>
Expand Down
3 changes: 3 additions & 0 deletions renice/renice.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
#error missing autoconf-generated config.h.
#endif
#include "posixutils-config.h"
#ifdef __APPLE__
#define _DARWIN_C_SOURCE 1
#endif

#include <sys/types.h>
#include <sys/time.h>
Expand Down
3 changes: 3 additions & 0 deletions split/split.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
#ifndef _GNU_SOURCE
#define _GNU_SOURCE /* for O_DIRECTORY, fgets_unlocked(3) */
#endif
#ifdef __APPLE__
#define _DARWIN_C_SOURCE 1
#endif
#define __STDC_FORMAT_MACROS 1

#include <sys/types.h>
Expand Down
4 changes: 4 additions & 0 deletions stty/stty.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
#endif
#include "posixutils-config.h"

#ifdef __APPLE__
#define _DARWIN_C_SOURCE 1
#endif

#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
Expand Down
3 changes: 3 additions & 0 deletions time/time.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
#include "posixutils-config.h"

#define _BSD_SOURCE /* for wait4(2) */
#ifdef __APPLE__
#define _DARWIN_C_SOURCE 1
#endif

#include <sys/types.h>
#include <sys/time.h>
Expand Down
3 changes: 3 additions & 0 deletions what/what.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
#ifndef _GNU_SOURCE
#define _GNU_SOURCE /* for setlinebuf(3), fgets_unlocked(3) */
#endif
#ifdef __APPLE__
#define _DARWIN_C_SOURCE 1
#endif

#include <string.h>
#include <limits.h>
Expand Down

0 comments on commit 294fe14

Please sign in to comment.