summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiego Biurrun <diego@biurrun.de>2011-05-11 17:52:51 +0200
committerDiego Biurrun <diego@biurrun.de>2011-05-12 11:41:59 +0200
commit046f081b46c8479820409cf8f530b988221bd15b (patch)
tree7926931a77448c75214f2af2498bba23524c8e34
parent45faf7fcd335b91e41b0e3ba4e397a9640d8c694 (diff)
configure: Do not unconditionally add -D_POSIX_C_SOURCE to CPPFLAGS.
Adding _POSIX_C_SOURCE to CPPFLAGS globally produces all sorts of problems since it causes certain system functions to be hidden on some (BSD) systems. The solution is to only add the flag on systems that really require it, i.e. glibc-based ones. This change makes BSD systems compile out-of-the-box without the need for adding specific flags manually. It also allows dropping a number of flags set manually on a file-per-file basis, but were only present to work around breakage introduced by the presence of _POSIX_C_SOURCE. Also add _XOPEN_SOURCE to CPPFLAGS for glibc systems. We use XSI extensions in several places already, so it is preferable to define it globally instead of littering source files with individual #defines only needed for glibc.
-rwxr-xr-xconfigure6
-rw-r--r--doc/general.texi8
-rw-r--r--ffmpeg.c3
-rw-r--r--ffplay.c2
-rw-r--r--ffserver.c2
-rw-r--r--libavcodec/libxvidff.c3
-rw-r--r--libavdevice/bktr.c4
-rw-r--r--libavdevice/x11grab.c2
-rw-r--r--libavformat/applehttp.c1
-rw-r--r--libavformat/applehttpproto.c1
-rw-r--r--libavformat/avio.c3
-rw-r--r--libavformat/os_support.c1
-rw-r--r--libavformat/rtpdec.c3
-rw-r--r--libavformat/udp.c2
-rw-r--r--libavutil/ppc/cpu.c2
-rw-r--r--libswscale/utils.c2
16 files changed, 5 insertions, 40 deletions
diff --git a/configure b/configure
index 955a568684..40f30ddbb6 100755
--- a/configure
+++ b/configure
@@ -1664,7 +1664,7 @@ LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
CC_O='-o $@'
-host_cflags='-D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112 -O3 -g -Wall'
+host_cflags='-D_ISOC99_SOURCE -O3 -g -Wall'
host_libs='-lm'
target_path='$(CURDIR)'
@@ -2316,7 +2316,7 @@ if test "$?" != 0; then
die "C compiler test failed."
fi
-add_cppflags -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112
+add_cppflags -D_ISOC99_SOURCE
check_cflags -std=c99
check_cc -D_FILE_OFFSET_BITS=64 <<EOF && add_cppflags -D_FILE_OFFSET_BITS=64
#include <stdlib.h>
@@ -2364,7 +2364,6 @@ case $target_os in
disable symver
oss_indev_extralibs="-lossaudio"
oss_outdev_extralibs="-lossaudio"
- add_cppflags -D_XOPEN_SOURCE=600
;;
openbsd)
enable malloc_aligned
@@ -2457,6 +2456,7 @@ case $target_os in
enable dos_paths
;;
linux)
+ add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
enable dv1394
;;
irix*)
diff --git a/doc/general.texi b/doc/general.texi
index 53482273f9..ce531ccdfb 100644
--- a/doc/general.texi
+++ b/doc/general.texi
@@ -785,14 +785,6 @@ to configure.
BSD make will not build Libav, you need to install and use GNU Make
(@file{gmake}).
-@subsubsection FreeBSD, DragonFly BSD
-
-These systems will not compile out-of-the-box due to broken system headers.
-Passing @code{--extra-cflags=-D__BSD_VISIBLE} to configure will work
-around the problem. This may have unexpected sideeffects, so use it at
-your own risk. If you care about FreeBSD, please make an attempt at
-getting the system headers fixed.
-
@subsection (Open)Solaris
GNU Make is required to build Libav, so you have to invoke (@file{gmake}),
diff --git a/ffmpeg.c b/ffmpeg.c
index 5ab3c7a508..b5ff4cfc30 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -19,9 +19,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-/* needed for usleep() */
-#define _XOPEN_SOURCE 600
-
#include "config.h"
#include <ctype.h>
#include <string.h>
diff --git a/ffplay.c b/ffplay.c
index 07727b667a..e820c603e3 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -19,8 +19,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#define _XOPEN_SOURCE 600
-
#include "config.h"
#include <inttypes.h>
#include <math.h>
diff --git a/ffserver.c b/ffserver.c
index fe030b94c0..b4613af8fe 100644
--- a/ffserver.c
+++ b/ffserver.c
@@ -19,8 +19,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#define _XOPEN_SOURCE 600
-
#include "config.h"
#if !HAVE_CLOSESOCKET
#define closesocket close
diff --git a/libavcodec/libxvidff.c b/libavcodec/libxvidff.c
index 96ce84872b..1e887a2a8c 100644
--- a/libavcodec/libxvidff.c
+++ b/libavcodec/libxvidff.c
@@ -25,9 +25,6 @@
* @author Adam Thayer (krevnik@comcast.net)
*/
-/* needed for mkstemp() */
-#define _XOPEN_SOURCE 600
-
#include <xvid.h>
#include <unistd.h>
#include "avcodec.h"
diff --git a/libavdevice/bktr.c b/libavdevice/bktr.c
index ab70a1b2b7..dad5c834f1 100644
--- a/libavdevice/bktr.c
+++ b/libavdevice/bktr.c
@@ -24,10 +24,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#define _BSD_SOURCE 1
-#define _NETBSD_SOURCE
-#define _XOPEN_SOURCE 600
-
#include "libavformat/avformat.h"
#if HAVE_DEV_BKTR_IOCTL_METEOR_H && HAVE_DEV_BKTR_IOCTL_BT848_H
# include <dev/bktr/ioctl_meteor.h>
diff --git a/libavdevice/x11grab.c b/libavdevice/x11grab.c
index aaad7292c6..0e63d09fea 100644
--- a/libavdevice/x11grab.c
+++ b/libavdevice/x11grab.c
@@ -35,8 +35,6 @@
* and Edouard Gomez <ed.gomez@free.fr>.
*/
-#define _XOPEN_SOURCE 600
-
#include "config.h"
#include "libavformat/avformat.h"
#include <time.h>
diff --git a/libavformat/applehttp.c b/libavformat/applehttp.c
index 822d80bb00..e3b1500044 100644
--- a/libavformat/applehttp.c
+++ b/libavformat/applehttp.c
@@ -25,7 +25,6 @@
* http://tools.ietf.org/html/draft-pantos-http-live-streaming
*/
-#define _XOPEN_SOURCE 600
#include "libavutil/avstring.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/opt.h"
diff --git a/libavformat/applehttpproto.c b/libavformat/applehttpproto.c
index 37b289a1e0..85f3cfcef4 100644
--- a/libavformat/applehttpproto.c
+++ b/libavformat/applehttpproto.c
@@ -25,7 +25,6 @@
* http://tools.ietf.org/html/draft-pantos-http-live-streaming
*/
-#define _XOPEN_SOURCE 600
#include "libavutil/avstring.h"
#include "avformat.h"
#include "internal.h"
diff --git a/libavformat/avio.c b/libavformat/avio.c
index 0702aff007..8881f269f2 100644
--- a/libavformat/avio.c
+++ b/libavformat/avio.c
@@ -19,9 +19,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-/* needed for usleep() */
-#define _XOPEN_SOURCE 600
#include <unistd.h>
+
#include "libavutil/avstring.h"
#include "libavutil/opt.h"
#include "os_support.h"
diff --git a/libavformat/os_support.c b/libavformat/os_support.c
index 05577b7553..a0fcd6c9ba 100644
--- a/libavformat/os_support.c
+++ b/libavformat/os_support.c
@@ -22,7 +22,6 @@
/* needed by inet_aton() */
#define _SVID_SOURCE
-#define _DARWIN_C_SOURCE
#include "config.h"
#include "avformat.h"
diff --git a/libavformat/rtpdec.c b/libavformat/rtpdec.c
index 43305a30c7..4623088c38 100644
--- a/libavformat/rtpdec.c
+++ b/libavformat/rtpdec.c
@@ -19,9 +19,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-/* needed for gethostname() */
-#define _XOPEN_SOURCE 600
-
#include "libavcodec/get_bits.h"
#include "avformat.h"
#include "mpegts.h"
diff --git a/libavformat/udp.c b/libavformat/udp.c
index 62c1c7c107..d6522bf0be 100644
--- a/libavformat/udp.c
+++ b/libavformat/udp.c
@@ -25,7 +25,7 @@
*/
#define _BSD_SOURCE /* Needed for using struct ip_mreq with recent glibc */
-#define _DARWIN_C_SOURCE /* Needed for using IP_MULTICAST_TTL on OS X */
+
#include "avformat.h"
#include "avio_internal.h"
#include "libavutil/parseutils.h"
diff --git a/libavutil/ppc/cpu.c b/libavutil/ppc/cpu.c
index 6b122ed8c4..002571161a 100644
--- a/libavutil/ppc/cpu.c
+++ b/libavutil/ppc/cpu.c
@@ -17,10 +17,8 @@
*/
#ifdef __APPLE__
-#undef _POSIX_C_SOURCE
#include <sys/sysctl.h>
#elif defined(__OpenBSD__)
-#undef _POSIX_C_SOURCE
#include <sys/param.h>
#include <sys/sysctl.h>
#include <machine/cpu.h>
diff --git a/libswscale/utils.c b/libswscale/utils.c
index 818d014159..e9319fa67b 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -18,8 +18,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#define _SVID_SOURCE //needed for MAP_ANONYMOUS
-#define _DARWIN_C_SOURCE // needed for MAP_ANON
#include <inttypes.h>
#include <string.h>
#include <math.h>