]> git.sesse.net Git - vlc/commitdiff
* configure.ac: Added a compiler check for __attribute__((__packed__)).
authorSam Hocevar <sam@videolan.org>
Tue, 1 Jul 2003 17:14:58 +0000 (17:14 +0000)
committerSam Hocevar <sam@videolan.org>
Tue, 1 Jul 2003 17:14:58 +0000 (17:14 +0000)
configure.ac
include/codecs.h
modules/mux/ogg.c

index 4d3408c1b3c8fda8d7881449f10830428403dd19..4ab8042821dd0e227faff53501cba4722fc35576 100644 (file)
@@ -1,5 +1,5 @@
 dnl Autoconf settings for vlc
-dnl $Id: configure.ac,v 1.18 2003/07/01 15:06:36 sam Exp $
+dnl $Id: configure.ac,v 1.19 2003/07/01 17:14:58 sam Exp $
 
 AC_INIT(vlc,0.6.0)
 
@@ -719,6 +719,16 @@ if test "${ac_cv_c_attribute_format}" != "no"; then
     AC_DEFINE(HAVE_ATTRIBUTE_FORMAT, 1, Support for __attribute__((format())) with function pointers)
 fi
 
+dnl Check for __attribute__(())
+AC_CACHE_CHECK([for __attribute__((packed))],
+  [ac_cv_c_attribute_packed],
+  [ac_cv_c_attribute_packed=no
+   AC_TRY_COMPILE(, [struct __attribute__((__packed__)) foo { int a; } b;],
+                    [ac_cv_c_attribute_packed=yes])])
+if test "${ac_cv_c_attribute_packed}" = "no"; then
+  AC_DEFINE(HAVE_ATTRIBUTE_PACKED, 1, Support for __attribute__((packed)) for structs)
+fi
+
 dnl
 dnl  Check the CPU
 dnl
index e6a65376ca9e67570caf5a689d9bdf010e7af982..2b487c28582fe076406798f4ff3eb39081dbe89a 100644 (file)
@@ -2,7 +2,7 @@
  * codecs.h: codec related structures needed by the demuxers and decoders
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: codecs.h,v 1.3 2002/12/03 17:00:15 fenrir Exp $
+ * $Id: codecs.h,v 1.4 2003/07/01 17:14:58 sam Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *
 
 #ifndef _WAVEFORMATEX_
 #define _WAVEFORMATEX_
-typedef struct __attribute__((__packed__)) _WAVEFORMATEX {
+typedef struct
+#ifdef HAVE_ATTRIBUTE_PACKED
+    __attribute__((__packed__))
+#endif
+_WAVEFORMATEX {
     uint16_t   wFormatTag;
     uint16_t   nChannels;
     uint32_t   nSamplesPerSec;
@@ -41,7 +45,10 @@ typedef struct __attribute__((__packed__)) _WAVEFORMATEX {
 
 #if !defined(_BITMAPINFOHEADER_) && !defined(WIN32)
 #define _BITMAPINFOHEADER_
-typedef struct __attribute__((__packed__))
+typedef struct
+#ifdef HAVE_ATTRIBUTE_PACKED
+    __attribute__((__packed__))
+#endif
 {
     uint32_t   biSize;
     uint32_t   biWidth;
index 8d4b115267d7e30fc563cbb22f589543bcddabde..fa34f69ea2300426c6b8efe137a21dae655a4819 100644 (file)
@@ -2,7 +2,7 @@
  * ogg.c
  *****************************************************************************
  * Copyright (C) 2001, 2002 VideoLAN
- * $Id: ogg.c,v 1.7 2003/06/29 20:58:16 gbazin Exp $
+ * $Id: ogg.c,v 1.8 2003/07/01 17:14:58 sam Exp $
  *
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  *          Gildas Bazin <gbazin@netcourrier.com>
@@ -69,20 +69,29 @@ vlc_module_end();
 
 #define PACKET_IS_SYNCPOINT      0x08
 
-typedef struct __attribute__((__packed__))
+typedef struct
+#ifdef HAVE_ATTRIBUTE_PACKED
+    __attribute__((__packed__))
+#endif
 {
     int32_t i_width;
     int32_t i_height;
 } ogg_stream_header_video_t;
 
-typedef struct __attribute__((__packed__))
+typedef struct
+#ifdef HAVE_ATTRIBUTE_PACKED
+    __attribute__((__packed__))
+#endif
 {
     int16_t i_channels;
     int16_t i_block_align;
     int32_t i_avgbytespersec;
 } ogg_stream_header_audio_t;
 
-typedef struct __attribute__((__packed__))
+typedef struct
+#ifdef HAVE_ATTRIBUTE_PACKED
+    __attribute__((__packed__))
+#endif
 {
     uint8_t i_packet_type;