mirror of
https://git.musl-libc.org/git/musl
synced 2025-01-21 21:52:04 +03:00
default features: make musl usable without feature test macros
the old behavior of exposing nothing except plain ISO C can be obtained by defining __STRICT_ANSI__ or using a compiler option (such as -std=c99) that predefines it. the new default featureset is POSIX with XSI plus _BSD_SOURCE. any explicit feature test macros will inhibit the default. installation docs have also been updated to reflect this change.
This commit is contained in:
parent
9f65796c35
commit
c1a9658bd1
15
INSTALL
15
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 ...
|
||||
|
||||
|
@ -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>
|
||||
|
||||
|
@ -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
|
||||
|
@ -5,6 +5,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <features.h>
|
||||
|
||||
int isalnum(int);
|
||||
int isalpha(int);
|
||||
int isblank(int);
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -5,6 +5,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <features.h>
|
||||
|
||||
#define __NEED_off_t
|
||||
#define __NEED_pid_t
|
||||
#define __NEED_mode_t
|
||||
|
@ -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
|
||||
|
@ -5,6 +5,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <features.h>
|
||||
|
||||
#define FNM_PATHNAME 0x1
|
||||
#define FNM_NOESCAPE 0x2
|
||||
#define FNM_PERIOD 0x4
|
||||
|
@ -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. */
|
||||
|
@ -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
|
||||
|
||||
|
@ -5,6 +5,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <features.h>
|
||||
|
||||
#define __NEED_size_t
|
||||
#define __NEED_gid_t
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
#ifndef _LIMITS_H
|
||||
#define _LIMITS_H
|
||||
|
||||
#include <features.h>
|
||||
|
||||
/* Most limits are system-specific */
|
||||
|
||||
#include <bits/limits.h>
|
||||
|
@ -5,6 +5,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <features.h>
|
||||
|
||||
#undef NULL
|
||||
#ifdef __cplusplus
|
||||
#define NULL 0
|
||||
|
@ -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
|
||||
|
@ -5,6 +5,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <features.h>
|
||||
|
||||
#define IF_NAMESIZE 16
|
||||
|
||||
struct if_nameindex
|
||||
|
@ -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
|
||||
|
@ -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>
|
||||
|
@ -5,6 +5,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <features.h>
|
||||
|
||||
#define __NEED_size_t
|
||||
#define __NEED_uid_t
|
||||
#define __NEED_gid_t
|
||||
|
@ -4,6 +4,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <features.h>
|
||||
|
||||
#define __NEED_struct_timespec
|
||||
#define __NEED_pid_t
|
||||
#define __NEED_time_t
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
||||
|
@ -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) \
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -4,6 +4,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <features.h>
|
||||
|
||||
#define __NEED_uid_t
|
||||
#define __NEED_gid_t
|
||||
#define __NEED_mode_t
|
||||
|
@ -4,6 +4,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <features.h>
|
||||
|
||||
#define __NEED_mode_t
|
||||
#define __NEED_size_t
|
||||
#define __NEED_off_t
|
||||
|
@ -5,6 +5,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <features.h>
|
||||
|
||||
#define __NEED_id_t
|
||||
#define __NEED_time_t
|
||||
#define __NEED_struct_timeval
|
||||
|
@ -4,6 +4,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <features.h>
|
||||
|
||||
#define __NEED_size_t
|
||||
#define __NEED_pid_t
|
||||
#define __NEED_time_t
|
||||
|
@ -5,6 +5,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <features.h>
|
||||
#include <unistd.h>
|
||||
|
||||
ssize_t sendfile(int, int, off_t *, size_t);
|
||||
|
@ -5,6 +5,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <features.h>
|
||||
|
||||
#define __NEED_time_t
|
||||
#define __NEED_size_t
|
||||
#define __NEED_pid_t
|
||||
|
@ -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
|
||||
|
@ -5,6 +5,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <features.h>
|
||||
|
||||
#include <sys/statvfs.h>
|
||||
|
||||
typedef struct {
|
||||
|
@ -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
|
||||
|
@ -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>
|
||||
|
||||
|
@ -4,6 +4,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <features.h>
|
||||
|
||||
#define __NEED_ino_t
|
||||
#define __NEED_dev_t
|
||||
#define __NEED_uid_t
|
||||
|
@ -5,6 +5,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <features.h>
|
||||
|
||||
#define __NEED_size_t
|
||||
#define __NEED_ssize_t
|
||||
#define __NEED_struct_iovec
|
||||
|
@ -5,6 +5,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <features.h>
|
||||
|
||||
struct utsname
|
||||
{
|
||||
char sysname[65];
|
||||
|
@ -4,6 +4,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <features.h>
|
||||
|
||||
#include <signal.h>
|
||||
|
||||
#define __NEED_pid_t
|
||||
|
@ -5,6 +5,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <features.h>
|
||||
|
||||
#define LOG_EMERG 0
|
||||
#define LOG_ALERT 1
|
||||
#define LOG_CRIT 2
|
||||
|
@ -5,6 +5,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <features.h>
|
||||
|
||||
#define __NEED_pid_t
|
||||
|
||||
#include <bits/alltypes.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
|
||||
|
@ -4,6 +4,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <features.h>
|
||||
|
||||
#include <signal.h>
|
||||
|
||||
#ifdef _GNU_SOURCE
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -5,6 +5,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <features.h>
|
||||
|
||||
#define __NEED_wint_t
|
||||
#define __NEED_wctrans_t
|
||||
#define __NEED_wctype_t
|
||||
|
Loading…
Reference in New Issue
Block a user