summaryrefslogtreecommitdiffstats
path: root/configure
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-03-11 01:05:19 +0100
committerwm4 <wm4@nowhere>2013-03-11 01:06:02 +0100
commitb52f3800c2b83ea2f6e48d15a8f154f7dd3530ad (patch)
tree9701e8e415f6139416af367ec3c3df271ee72cb8 /configure
parent28de5a789129928f44647d31f31cffe7ac43b8ce (diff)
downloadmpv-b52f3800c2b83ea2f6e48d15a8f154f7dd3530ad.tar.bz2
mpv-b52f3800c2b83ea2f6e48d15a8f154f7dd3530ad.tar.xz
configure: add _GNU_SOURCE to CFLAGS by default
In theory, projects have to define feature test macros to enable various system functionality in system headers. (This is done so to ensure new identifiers can be added to system headers, without breaking old programs by causing name conflicts.) This includes macros like _GNU_SOURCE, _BSD_SOURCE, _POSIX_C_SOURCE etc. Traditionally, gcc as well as glibc headers implicitly assumed _GNU_SOURCE if no feature test macros were defined by the user. clang did this too to ensure compatibility with gcc centric programs (which in practice includes most Linux programs). However, it appears recent clang versions started to prefer BSD traditional function over the POSIX, which switches the definition of a function used by mp_msg.c: pid_t getpgrp(void); /* POSIX.1 version */ pid_t getpgrp(pid_t pid); /* BSD version */ mp_msg.c expects the POSIX version, while clang gives us the BSD version, resulting in a compilation failure. Solve this by defining _GNU_SOURCE. This requests most features from system headers, and explicitly prefers POSIX definitions over BSD, which should fix the compilation issue.
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure2
1 files changed, 1 insertions, 1 deletions
diff --git a/configure b/configure
index d2beb5fce2..c674a55bf1 100755
--- a/configure
+++ b/configure
@@ -872,7 +872,7 @@ else # if test -z "$_target"
fi
fi
-extra_cflags="-I. $extra_cflags"
+extra_cflags="-I. -D_GNU_SOURCE $extra_cflags"
_timer=timer-linux.c
_getch=getch2.c