dv_types.h is part of the libdv API that has to be included

in application code. Therefore, it may not reference libdv's private
config.h. Of course, config.h was included for a reason, and this patch
tries to cover it up, because at least in the scope of the
Debian package we can reliably guess at the contents of config.h.

Gbp-Pq: Name 0003-zap_config_h.patch
This commit is contained in:
Daniel Kobras 2022-05-14 00:43:58 +08:00 committed by openKylinBot
parent 9136e4d3df
commit 3ef513ad64
1 changed files with 30 additions and 12 deletions

View File

@ -26,10 +26,11 @@
#ifndef DV_TYPES_H
#define DV_TYPES_H
#if HAVE_CONFIG_H
# include <config.h>
#endif
/* The Debian package is always compiled with popt support, but using it
* in an application is optional. Declare HAVE_LIBPOPT before including
* the libdv headers in order to access popt-specific entries in the
* libdv API.
*/
#if HAVE_LIBPOPT
#include <popt.h>
#endif // HAVE_LIBPOPT
@ -38,11 +39,11 @@
#include <inttypes.h>
#include <stdio.h>
#include <time.h>
#if HAVE_ENDIAN_H
/* FIXME Some systems use machine/endian.h instead. We probably ought to
* AC_SUBST the correct value in here. (Or use a namespace-clean dvconfig.h.)
* This quick fix should do for glibc-based systems.
*/
#include <endian.h>
#elif HAVE_MACHINE_ENDIAN_H
#include <machine/endian.h>
#endif
/* please tell me these are defined somewhere standard??? */
#ifndef FALSE
@ -61,16 +62,33 @@
#define CLAMP(a,x,b) (MIN(b,MAX(a,x)))
#endif
/* FIXME These values indicate whether libdv was built with asm optimizations.
* It had better be AC_SUBSTed, but for the purpose of the Debian package, we
* can easily guess the correct value from standard compiler macros.
*/
#if !defined(ARCH_X86) && !defined(ARCH_X86_64)
# if defined (__x86_64)
# define ARCH_X86 0
# define ARCH_X86_64 1
# elif defined(i386)
# define ARCH_X86 1
# define ARCH_X86_64 0
# else
# define ARCH_X86 0
# define ARCH_X86_64 0
# endif
#endif
// For now assume ARCH_X86 means GCC with hints.
#ifdef ARCH_X86
#define HAVE_GCC 1
#define LIBDV_HAVE_GCC 1
#endif
#ifdef ARCH_X86_64
#define HAVE_GCC 1
#define LIBDV_HAVE_GCC 1
#endif
//#define HAVE_GCC 0
//#define LIBDV_HAVE_GCC 0
#if HAVE_GCC
#if LIBDV_HAVE_GCC
#define ALIGN64 __attribute__ ((aligned (64)))
#define ALIGN32 __attribute__ ((aligned (32)))
#define ALIGN8 __attribute__ ((aligned (8)))