This commit does the following things to fix compilation on FreeBSD:
1. Add required typedefs to linux/types-compat.h.
2. Remove unnecessary include linux/ioctl.h and replace linux/types.h
with linux/types-compat.h. Both files do not exist on FreeBSD.
3. Check the header including makedev macro. FreeBSD does not have
sys/sysmacros.h, and including it unconditionally causes error.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1259>
* Boston, MA 02110-1301, USA.
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "gstv4l2codecdevice.h"
#include "linux/media.h"
#include <gudev/gudev.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
+
+#if HAVE_MAKEDEV_IN_MKDEV
+#include <sys/mkdev.h>
+#elif HAVE_MAKEDEV_IN_SYSMACROS
#include <sys/sysmacros.h>
+#elif HAVE_MAKEDEV_IN_TYPES
+#include <sys/types.h>
+#endif
#include <unistd.h>
#define GST_CAT_DEFAULT gstv4l2codecs_debug
#include <stdint.h>
#define __user
#endif
-#include <linux/ioctl.h>
-#include <linux/types.h>
+#include "linux/types-compat.h"
struct media_device_info {
char driver[16];
# endif
#endif
+typedef gint8 __s8;
typedef guint8 __u8;
+typedef gint16 __s16;
typedef guint16 __u16;
typedef gint32 __s32;
typedef guint32 __u32;
if get_option('v4l2codecs').enabled() and not have_v4l2
error('V4L2i CODECs is requested but kernel headers were not found')
endif
+
+ # Find makedev in various header files. Different operating systems put the
+ # macro in different header files.
+ foreach name: ['mkdev', 'sysmacros', 'types']
+ have_makedev = cc.has_header_symbol('sys/@0@.h'.format(name), 'makedev')
+ cdata.set10('HAVE_MAKEDEV_IN_' + name.to_upper(), have_makedev)
+ endforeach
endif