[FFmpeg-devel] [PATCH 1/4] Uniformly define _XOPEN_SOURCE to 600.

Diego 'Flameeyes' Pettenò flameeyes
Sun Sep 28 13:59:29 CEST 2008


Some source files define _XOPEN_SOURCE to have access to extended
functions like gethostname() or mkstemp(); some files define it to
500, others to 600.

The feature_tests.h header from Sun systems (Solaris/OpenSolaris) will
abort the build if _XOPEN_SOURCE is defined to 500, and C99 is
requested (as well as POSIX.1-2001), and will only accept it to be
defined to 600.

Instead of leaving it up to the source files to define _XOPEN_SOURCE,
require it together with POSIX.1-2001 in the compilation flags, so
that it's uniformly enabled.
---

 configure            |    2 +-
 ffmpeg.c             |    3 ---
 ffserver.c           |    2 --
 libavcodec/utils.c   |    3 ---
 libavformat/rtpdec.c |    3 ---
 5 files changed, 1 insertions(+), 12 deletions(-)

diff --git a/configure b/configure
index fa20647..f1c3c69 100755
--- a/configure
+++ b/configure
@@ -978,7 +978,7 @@ enable stripping
 vhook="default"
 
 # build settings
-add_cflags -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112
+add_cflags -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
 SHFLAGS='-shared -Wl,-soname,$$(@F)'
 VHOOKSHFLAGS='$(SHFLAGS)'
 FFSERVERLDFLAGS=-Wl,-E
diff --git a/ffmpeg.c b/ffmpeg.c
index c7ea0f0..0dac35c 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 500
-
 #include "config.h"
 #include <ctype.h>
 #include <string.h>
diff --git a/ffserver.c b/ffserver.c
index c91bd64..5374326 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"
 #ifndef HAVE_CLOSESOCKET
 #define closesocket close
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index cf00d25..51afb51 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -25,9 +25,6 @@
  * utils.
  */
 
-/* needed for mkstemp() */
-#define _XOPEN_SOURCE 500
-
 #include "libavutil/integer.h"
 #include "libavutil/crc.h"
 #include "avcodec.h"
diff --git a/libavformat/rtpdec.c b/libavformat/rtpdec.c
index 9fb06ee..74217d4 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 500
-
 #include "libavcodec/bitstream.h"
 #include "avformat.h"
 #include "mpegts.h"






More information about the ffmpeg-devel mailing list