aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--INSTALL15
-rw-r--r--include/aio.h7
-rw-r--r--include/assert.h9
-rw-r--r--include/ctype.h2
-rw-r--r--include/dirent.h6
-rw-r--r--include/dlfcn.h6
-rw-r--r--include/endian.h4
-rw-r--r--include/fcntl.h2
-rw-r--r--include/features.h29
-rw-r--r--include/fnmatch.h2
-rw-r--r--include/ftw.h2
-rw-r--r--include/glob.h6
-rw-r--r--include/grp.h2
-rw-r--r--include/limits.h2
-rw-r--r--include/locale.h2
-rw-r--r--include/math.h4
-rw-r--r--include/net/if.h2
-rw-r--r--include/netdb.h6
-rw-r--r--include/netinet/tcp.h2
-rw-r--r--include/pwd.h2
-rw-r--r--include/sched.h2
-rw-r--r--include/search.h7
-rw-r--r--include/setjmp.h7
-rw-r--r--include/signal.h6
-rw-r--r--include/stdio.h6
-rw-r--r--include/stdlib.h13
-rw-r--r--include/string.h6
-rw-r--r--include/sys/ipc.h2
-rw-r--r--include/sys/mman.h2
-rw-r--r--include/sys/resource.h2
-rw-r--r--include/sys/sem.h2
-rw-r--r--include/sys/sendfile.h1
-rw-r--r--include/sys/shm.h2
-rw-r--r--include/sys/stat.h6
-rw-r--r--include/sys/statfs.h2
-rw-r--r--include/sys/statvfs.h6
-rw-r--r--include/sys/time.h6
-rw-r--r--include/sys/types.h2
-rw-r--r--include/sys/uio.h2
-rw-r--r--include/sys/utsname.h2
-rw-r--r--include/sys/wait.h2
-rw-r--r--include/syslog.h2
-rw-r--r--include/termios.h2
-rw-r--r--include/time.h6
-rw-r--r--include/ucontext.h2
-rw-r--r--include/unistd.h13
-rw-r--r--include/wchar.h6
-rw-r--r--include/wctype.h2
48 files changed, 102 insertions, 129 deletions
diff --git a/INSTALL b/INSTALL
index 720c94e..5c923ee 100644
--- a/INSTALL
+++ b/INSTALL
@@ -76,14 +76,9 @@ musl-gcc hello.c
./a.out
To configure autoconf-based program to compile and link against musl,
-you may wish to use:
+set the CC variable to musl-gcc when running configure, as in:
-CC="musl-gcc -D_GNU_SOURCE" ./configure ...
-
-Correctly-written build systems should not need -D_GNU_SOURCE as part
-of $CC, but many programs do not use feature-test macros correctly and
-simply assume the compiler will automatically give them the kitchen
-sink, so the above command is an easy workaround.
+CC=musl-gcc ./configure ...
You will probably also want to use --prefix when building libraries to
ensure that they are installed under the musl prefix and not in the
@@ -140,9 +135,3 @@ dynamic linker (program interpreter) is /lib/ld-musl-$ARCH.so.1. If
you're using static linking only, you might instead check the symbols
and look for anything suspicious that would indicate your old glibc or
uClibc was used.
-
-When building programs against musl, you may still want to ensure the
-appropriate feature test macros get defined, as in:
-
-CC="gcc -D_GNU_SOURCE" ./configure ...
-
diff --git a/include/aio.h b/include/aio.h
index 3e35134..d9330eb 100644
--- a/include/aio.h
+++ b/include/aio.h
@@ -5,12 +5,7 @@
extern "C" {
#endif
-#if __STDC_VERSION__ >= 199901L
-#define __restrict restrict
-#elif !defined(__GNUC__)
-#define __restrict
-#endif
-
+#include <features.h>
#include <signal.h>
#include <time.h>
diff --git a/include/assert.h b/include/assert.h
index 30a43d6..b0dc692 100644
--- a/include/assert.h
+++ b/include/assert.h
@@ -1,11 +1,6 @@
-#undef assert
+#include <features.h>
-#if __STDC_VERSION__ >= 201112L
-#elif defined(__GNUC__)
-#define _Noreturn __attribute__((__noreturn__))
-#else
-#define _Noreturn
-#endif
+#undef assert
#ifdef NDEBUG
#define assert(x) (void)0
diff --git a/include/ctype.h b/include/ctype.h
index 8ceaa9f..8f0d168 100644
--- a/include/ctype.h
+++ b/include/ctype.h
@@ -5,6 +5,8 @@
extern "C" {
#endif
+#include <features.h>
+
int isalnum(int);
int isalpha(int);
int isblank(int);
diff --git a/include/dirent.h b/include/dirent.h
index b626159..726067f 100644
--- a/include/dirent.h
+++ b/include/dirent.h
@@ -5,11 +5,7 @@
extern "C" {
#endif
-#if __STDC_VERSION__ >= 199901L
-#define __restrict restrict
-#elif !defined(__GNUC__)
-#define __restrict
-#endif
+#include <features.h>
#define __NEED_ino_t
#define __NEED_off_t
diff --git a/include/dlfcn.h b/include/dlfcn.h
index 53871ee..46c4e18 100644
--- a/include/dlfcn.h
+++ b/include/dlfcn.h
@@ -5,11 +5,7 @@
extern "C" {
#endif
-#if __STDC_VERSION__ >= 199901L
-#define __restrict restrict
-#elif !defined(__GNUC__)
-#define __restrict
-#endif
+#include <features.h>
#define RTLD_LAZY 1
#define RTLD_NOW 2
diff --git a/include/endian.h b/include/endian.h
index 528cef3..1bd4445 100644
--- a/include/endian.h
+++ b/include/endian.h
@@ -1,9 +1,7 @@
#ifndef _ENDIAN_H
#define _ENDIAN_H
-#if __STDC_VERSION__ >= 199901L || defined(__cplusplus)
-#define __inline inline
-#endif
+#include <features.h>
#define __LITTLE_ENDIAN 1234
#define __BIG_ENDIAN 4321
diff --git a/include/fcntl.h b/include/fcntl.h
index 87ecf59..4123d01 100644
--- a/include/fcntl.h
+++ b/include/fcntl.h
@@ -5,6 +5,8 @@
extern "C" {
#endif
+#include <features.h>
+
#define __NEED_off_t
#define __NEED_pid_t
#define __NEED_mode_t
diff --git a/include/features.h b/include/features.h
index 851afb6..a7919f3 100644
--- a/include/features.h
+++ b/include/features.h
@@ -1 +1,28 @@
-#warning "features.h is bogus"
+#ifndef _FEATURES_H
+#define _FEATURES_H
+
+#if !defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE) \
+ && !defined(_XOPEN_SOURCE) && !defined(_GNU_SOURCE) \
+ && !defined(_BSD_SOURCE) && !defined(__STRICT_ANSI__)
+#define _BSD_SOURCE 1
+#define _XOPEN_SOURCE 700
+#endif
+
+#if __STDC_VERSION__ >= 199901L
+#define __restrict restrict
+#elif !defined(__GNUC__)
+#define __restrict
+#endif
+
+#if __STDC_VERSION__ >= 199901L || defined(__cplusplus)
+#define __inline inline
+#endif
+
+#if __STDC_VERSION__ >= 201112L
+#elif defined(__GNUC__)
+#define _Noreturn __attribute__((__noreturn__))
+#else
+#define _Noreturn
+#endif
+
+#endif
diff --git a/include/fnmatch.h b/include/fnmatch.h
index 0731e23..72345b8 100644
--- a/include/fnmatch.h
+++ b/include/fnmatch.h
@@ -5,6 +5,8 @@
extern "C" {
#endif
+#include <features.h>
+
#define FNM_PATHNAME 0x1
#define FNM_NOESCAPE 0x2
#define FNM_PERIOD 0x4
diff --git a/include/ftw.h b/include/ftw.h
index e7e8fde..f5eb9f6 100644
--- a/include/ftw.h
+++ b/include/ftw.h
@@ -5,6 +5,8 @@
extern "C" {
#endif
+#include <features.h>
+
/* Normally we do not nest header includes. However useless bloat
* like ftw may be treated as a special case. Otherwise we would
* have to deal with duplicating all the stat.h mess. */
diff --git a/include/glob.h b/include/glob.h
index c49a2de..9fbbaa6 100644
--- a/include/glob.h
+++ b/include/glob.h
@@ -5,11 +5,7 @@
extern "C" {
#endif
-#if __STDC_VERSION__ >= 199901L
-#define __restrict restrict
-#elif !defined(__GNUC__)
-#define __restrict
-#endif
+#include <features.h>
#define __NEED_size_t
diff --git a/include/grp.h b/include/grp.h
index 0a55c62..030d7f8 100644
--- a/include/grp.h
+++ b/include/grp.h
@@ -5,6 +5,8 @@
extern "C" {
#endif
+#include <features.h>
+
#define __NEED_size_t
#define __NEED_gid_t
diff --git a/include/limits.h b/include/limits.h
index e354ee7..e12618a 100644
--- a/include/limits.h
+++ b/include/limits.h
@@ -1,6 +1,8 @@
#ifndef _LIMITS_H
#define _LIMITS_H
+#include <features.h>
+
/* Most limits are system-specific */
#include <bits/limits.h>
diff --git a/include/locale.h b/include/locale.h
index 9da4726..c6cc1ec 100644
--- a/include/locale.h
+++ b/include/locale.h
@@ -5,6 +5,8 @@
extern "C" {
#endif
+#include <features.h>
+
#undef NULL
#ifdef __cplusplus
#define NULL 0
diff --git a/include/math.h b/include/math.h
index f808be6..9069140 100644
--- a/include/math.h
+++ b/include/math.h
@@ -5,9 +5,7 @@
extern "C" {
#endif
-#if __STDC_VERSION__ >= 199901L || defined(__cplusplus)
-#define __inline inline
-#endif
+#include <features.h>
#define __NEED_float_t
#define __NEED_double_t
diff --git a/include/net/if.h b/include/net/if.h
index e862c7c..5813976 100644
--- a/include/net/if.h
+++ b/include/net/if.h
@@ -5,6 +5,8 @@
extern "C" {
#endif
+#include <features.h>
+
#define IF_NAMESIZE 16
struct if_nameindex
diff --git a/include/netdb.h b/include/netdb.h
index d915d9d..ff691e0 100644
--- a/include/netdb.h
+++ b/include/netdb.h
@@ -5,11 +5,7 @@
extern "C" {
#endif
-#if __STDC_VERSION__ >= 199901L
-#define __restrict restrict
-#elif !defined(__GNUC__)
-#define __restrict
-#endif
+#include <features.h>
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
#define __NEED_size_t
diff --git a/include/netinet/tcp.h b/include/netinet/tcp.h
index 797ce68..5049dd9 100644
--- a/include/netinet/tcp.h
+++ b/include/netinet/tcp.h
@@ -1,6 +1,8 @@
#ifndef _NETINET_TCP_H
#define _NETINET_TCP_H
+#include <features.h>
+
#define TCP_NODELAY 1
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
#include <sys/types.h>
diff --git a/include/pwd.h b/include/pwd.h
index 37ca520..91fe426 100644
--- a/include/pwd.h
+++ b/include/pwd.h
@@ -5,6 +5,8 @@
extern "C" {
#endif
+#include <features.h>
+
#define __NEED_size_t
#define __NEED_uid_t
#define __NEED_gid_t
diff --git a/include/sched.h b/include/sched.h
index e411c92..9062772 100644
--- a/include/sched.h
+++ b/include/sched.h
@@ -4,6 +4,8 @@
extern "C" {
#endif
+#include <features.h>
+
#define __NEED_struct_timespec
#define __NEED_pid_t
#define __NEED_time_t
diff --git a/include/search.h b/include/search.h
index 680eee7..ebfe08a 100644
--- a/include/search.h
+++ b/include/search.h
@@ -5,12 +5,7 @@
extern "C" {
#endif
-#if __STDC_VERSION__ >= 199901L
-#define __restrict restrict
-#elif !defined(__GNUC__)
-#define __restrict
-#endif
-
+#include <features.h>
#define __NEED_size_t
#include <bits/alltypes.h>
diff --git a/include/setjmp.h b/include/setjmp.h
index e5877b4..abc7423 100644
--- a/include/setjmp.h
+++ b/include/setjmp.h
@@ -5,12 +5,7 @@
extern "C" {
#endif
-#if __STDC_VERSION__ >= 201112L
-#elif defined(__GNUC__)
-#define _Noreturn __attribute__((__noreturn__))
-#else
-#define _Noreturn
-#endif
+#include <features.h>
#include <bits/setjmp.h>
diff --git a/include/signal.h b/include/signal.h
index e0dae19..1014440 100644
--- a/include/signal.h
+++ b/include/signal.h
@@ -5,11 +5,7 @@
extern "C" {
#endif
-#if __STDC_VERSION__ >= 199901L
-#define __restrict restrict
-#elif !defined(__GNUC__)
-#define __restrict
-#endif
+#include <features.h>
#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
|| defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
diff --git a/include/stdio.h b/include/stdio.h
index 7d3130e..9a20937 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -5,11 +5,7 @@
extern "C" {
#endif
-#if __STDC_VERSION__ >= 199901L
-#define __restrict restrict
-#elif !defined(__GNUC__)
-#define __restrict
-#endif
+#include <features.h>
#define __NEED_FILE
#define __NEED_va_list
diff --git a/include/stdlib.h b/include/stdlib.h
index 86cf017..f7c5971 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -5,18 +5,7 @@
extern "C" {
#endif
-#if __STDC_VERSION__ >= 199901L
-#define __restrict restrict
-#elif !defined(__GNUC__)
-#define __restrict
-#endif
-
-#if __STDC_VERSION__ >= 201112L
-#elif defined(__GNUC__)
-#define _Noreturn __attribute__((__noreturn__))
-#else
-#define _Noreturn
-#endif
+#include <features.h>
#undef NULL
#ifdef __cplusplus
diff --git a/include/string.h b/include/string.h
index f96f71e..5587c88 100644
--- a/include/string.h
+++ b/include/string.h
@@ -5,11 +5,7 @@
extern "C" {
#endif
-#if __STDC_VERSION__ >= 199901L
-#define __restrict restrict
-#elif !defined(__GNUC__)
-#define __restrict
-#endif
+#include <features.h>
#undef NULL
#ifdef __cplusplus
diff --git a/include/sys/ipc.h b/include/sys/ipc.h
index 8e2f717..3f896b8 100644
--- a/include/sys/ipc.h
+++ b/include/sys/ipc.h
@@ -4,6 +4,8 @@
extern "C" {
#endif
+#include <features.h>
+
#define __NEED_uid_t
#define __NEED_gid_t
#define __NEED_mode_t
diff --git a/include/sys/mman.h b/include/sys/mman.h
index 5cfafbe..0fa32e6 100644
--- a/include/sys/mman.h
+++ b/include/sys/mman.h
@@ -4,6 +4,8 @@
extern "C" {
#endif
+#include <features.h>
+
#define __NEED_mode_t
#define __NEED_size_t
#define __NEED_off_t
diff --git a/include/sys/resource.h b/include/sys/resource.h
index bf59d1c..9536ba3 100644
--- a/include/sys/resource.h
+++ b/include/sys/resource.h
@@ -5,6 +5,8 @@
extern "C" {
#endif
+#include <features.h>
+
#define __NEED_id_t
#define __NEED_time_t
#define __NEED_struct_timeval
diff --git a/include/sys/sem.h b/include/sys/sem.h
index add3f1c..cc3a3e6 100644
--- a/include/sys/sem.h
+++ b/include/sys/sem.h
@@ -4,6 +4,8 @@
extern "C" {
#endif
+#include <features.h>
+
#define __NEED_size_t
#define __NEED_pid_t
#define __NEED_time_t
diff --git a/include/sys/sendfile.h b/include/sys/sendfile.h
index 1f2b523..e7570d8 100644
--- a/include/sys/sendfile.h
+++ b/include/sys/sendfile.h
@@ -5,6 +5,7 @@
extern "C" {
#endif
+#include <features.h>
#include <unistd.h>
ssize_t sendfile(int, int, off_t *, size_t);
diff --git a/include/sys/shm.h b/include/sys/shm.h
index 34117cc..ce3029f 100644
--- a/include/sys/shm.h
+++ b/include/sys/shm.h
@@ -5,6 +5,8 @@
extern "C" {
#endif
+#include <features.h>
+
#define __NEED_time_t
#define __NEED_size_t
#define __NEED_pid_t
diff --git a/include/sys/stat.h b/include/sys/stat.h
index e16a968..c63c6b8 100644
--- a/include/sys/stat.h
+++ b/include/sys/stat.h
@@ -4,11 +4,7 @@
extern "C" {
#endif
-#if __STDC_VERSION__ >= 199901L
-#define __restrict restrict
-#elif !defined(__GNUC__)
-#define __restrict
-#endif
+#include <features.h>
#define __NEED_dev_t
#define __NEED_ino_t
diff --git a/include/sys/statfs.h b/include/sys/statfs.h
index a5a4db9..d8128a2 100644
--- a/include/sys/statfs.h
+++ b/include/sys/statfs.h
@@ -5,6 +5,8 @@
extern "C" {
#endif
+#include <features.h>
+
#include <sys/statvfs.h>
typedef struct {
diff --git a/include/sys/statvfs.h b/include/sys/statvfs.h
index be41c28..e0839ec 100644
--- a/include/sys/statvfs.h
+++ b/include/sys/statvfs.h
@@ -5,11 +5,7 @@
extern "C" {
#endif
-#if __STDC_VERSION__ >= 199901L
-#define __restrict restrict
-#elif !defined(__GNUC__)
-#define __restrict
-#endif
+#include <features.h>
#define __NEED_fsblkcnt_t
#define __NEED_fsfilcnt_t
diff --git a/include/sys/time.h b/include/sys/time.h
index bf02643..a0ed8e0 100644
--- a/include/sys/time.h
+++ b/include/sys/time.h
@@ -4,11 +4,7 @@
extern "C" {
#endif
-#if __STDC_VERSION__ >= 199901L
-#define __restrict restrict
-#elif !defined(__GNUC__)
-#define __restrict
-#endif
+#include <features.h>
#include <sys/select.h>
diff --git a/include/sys/types.h b/include/sys/types.h
index f5b6487..7378b60 100644
--- a/include/sys/types.h
+++ b/include/sys/types.h
@@ -4,6 +4,8 @@
extern "C" {
#endif
+#include <features.h>
+
#define __NEED_ino_t
#define __NEED_dev_t
#define __NEED_uid_t
diff --git a/include/sys/uio.h b/include/sys/uio.h
index 7a75a54..624ff42 100644
--- a/include/sys/uio.h
+++ b/include/sys/uio.h
@@ -5,6 +5,8 @@
extern "C" {
#endif
+#include <features.h>
+
#define __NEED_size_t
#define __NEED_ssize_t
#define __NEED_struct_iovec
diff --git a/include/sys/utsname.h b/include/sys/utsname.h
index 4c36960..6b9ea97 100644
--- a/include/sys/utsname.h
+++ b/include/sys/utsname.h
@@ -5,6 +5,8 @@
extern "C" {
#endif
+#include <features.h>
+
struct utsname
{
char sysname[65];
diff --git a/include/sys/wait.h b/include/sys/wait.h
index 5e3012b..8bcac8a 100644
--- a/include/sys/wait.h
+++ b/include/sys/wait.h
@@ -4,6 +4,8 @@
extern "C" {
#endif
+#include <features.h>
+
#include <signal.h>
#define __NEED_pid_t
diff --git a/include/syslog.h b/include/syslog.h
index c0fde11..a9468d4 100644
--- a/include/syslog.h
+++ b/include/syslog.h
@@ -5,6 +5,8 @@
extern "C" {
#endif
+#include <features.h>
+
#define LOG_EMERG 0
#define LOG_ALERT 1
#define LOG_CRIT 2
diff --git a/include/termios.h b/include/termios.h
index 1041759..d73c780 100644
--- a/include/termios.h
+++ b/include/termios.h
@@ -5,6 +5,8 @@
extern "C" {
#endif
+#include <features.h>
+
#define __NEED_pid_t
#include <bits/alltypes.h>
diff --git a/include/time.h b/include/time.h
index f24789e..2f4c74f 100644
--- a/include/time.h
+++ b/include/time.h
@@ -5,11 +5,7 @@
extern "C" {
#endif
-#if __STDC_VERSION__ >= 199901L
-#define __restrict restrict
-#elif !defined(__GNUC__)
-#define __restrict
-#endif
+#include <features.h>
#undef NULL
#ifdef __cplusplus
diff --git a/include/ucontext.h b/include/ucontext.h
index 1121761..28d04ea 100644
--- a/include/ucontext.h
+++ b/include/ucontext.h
@@ -4,6 +4,8 @@
extern "C" {
#endif
+#include <features.h>
+
#include <signal.h>
#ifdef _GNU_SOURCE
diff --git a/include/unistd.h b/include/unistd.h
index 20ba6cc..b5206a6 100644
--- a/include/unistd.h
+++ b/include/unistd.h
@@ -5,18 +5,7 @@
extern "C" {
#endif
-#if __STDC_VERSION__ >= 199901L
-#define __restrict restrict
-#elif !defined(__GNUC__)
-#define __restrict
-#endif
-
-#if __STDC_VERSION__ >= 201112L
-#elif defined(__GNUC__)
-#define _Noreturn __attribute__((__noreturn__))
-#else
-#define _Noreturn
-#endif
+#include <features.h>
#define STDIN_FILENO 0
#define STDOUT_FILENO 1
diff --git a/include/wchar.h b/include/wchar.h
index b1c6b7f..35706c7 100644
--- a/include/wchar.h
+++ b/include/wchar.h
@@ -5,11 +5,7 @@
extern "C" {
#endif
-#if __STDC_VERSION__ >= 199901L
-#define __restrict restrict
-#elif !defined(__GNUC__)
-#define __restrict
-#endif
+#include <features.h>
#define __NEED_FILE
#define __NEED_va_list
diff --git a/include/wctype.h b/include/wctype.h
index f7be2cb..abc7d36 100644
--- a/include/wctype.h
+++ b/include/wctype.h
@@ -5,6 +5,8 @@
extern "C" {
#endif
+#include <features.h>
+
#define __NEED_wint_t
#define __NEED_wctrans_t
#define __NEED_wctype_t