Consistently use #if HAVE_FOO instead of #ifdef HAVE_FOO. The reason is

that AC_CHECK_DECLS([foo]), unlike AC_CHECK_FUNCS([foo]), will always
define HAVE_FOO, so #ifdef HAVE_FOO will always be true even if it is 0.
This commit finally fixes the [bl]e{32,64}{enc,dec} issue on Linux.
This commit is contained in:
Dag-Erling Smørgrav 2014-12-20 00:38:54 +00:00 committed by des
parent b74f5f8588
commit 6ed802ddf3
13 changed files with 32 additions and 32 deletions

View File

@ -36,10 +36,10 @@ AC_PROG_INSTALL
AC_CHECK_HEADERS([endian.h sys/endian.h])
AC_CHECK_DECLS([be32enc, be32dec, le32enc, le32dec,
be64enc, be64dec, le64enc, le64dec], [], [], [[
#ifdef HAVE_SYS_ENDIAN_H
#if HAVE_SYS_ENDIAN_H
#include <sys/endian.h>
#endif
#ifdef HAVE_ENDIAN_H
#if HAVE_ENDIAN_H
#include <endian.h>
#endif
]])
@ -48,7 +48,7 @@ AC_CHECK_FUNCS([strlcat strlcmp strlcpy])
# For tracing allocations in unit tests
AC_CHECK_HEADERS([sys/uio.h sys/ktrace.h], [], [], [[
#include <sys/param.h>
#ifdef HAVE_SYS_UIO_H
#if HAVE_SYS_UIO_H
#include <sys/uio.h>
#endif
]])

View File

@ -30,36 +30,36 @@
#ifndef CRYB_ENDIAN_H_INCLUDED
#define CRYB_ENDIAN_H_INCLUDED
#ifdef HAVE_SYS_ENDIAN_H
#if HAVE_SYS_ENDIAN_H
#include <sys/endian.h>
#endif
#ifdef HAVE_ENDIAN_H
#if HAVE_ENDIAN_H
#include <endian.h>
#endif
#ifndef HAVE_DECL_BE32ENC
#if !HAVE_DECL_BE32ENC
#define be32enc cryb_be32enc
#endif
#ifndef HAVE_DECL_BE32DEC
#if !HAVE_DECL_BE32DEC
#define be32dec cryb_be32dec
#endif
#ifndef HAVE_DECL_BE64ENC
#if !HAVE_DECL_BE64ENC
#define be64enc cryb_be64enc
#endif
#ifndef HAVE_DECL_BE64DEC
#if !HAVE_DECL_BE64DEC
#define be64dec cryb_be64dec
#endif
#ifndef HAVE_DECL_LE32ENC
#if !HAVE_DECL_LE32ENC
#define le32enc cryb_le32enc
#endif
#ifndef HAVE_DECL_LE32DEC
#if !HAVE_DECL_LE32DEC
#define le32dec cryb_le32dec
#endif
#ifndef HAVE_DECL_LE64ENC
#if !HAVE_DECL_LE64ENC
#define le64enc cryb_le64enc
#endif
#ifndef HAVE_DECL_LE64DEC
#if !HAVE_DECL_LE64DEC
#define le64dec cryb_le64dec
#endif

View File

@ -30,7 +30,7 @@
#ifndef CRYB_IMPL_H_INCLUDED
#define CRYB_IMPL_H_INCLUDED
#ifdef HAVE_CONFIG_H
#if HAVE_CONFIG_H
# include "config.h"
#endif

View File

@ -32,7 +32,7 @@
size_t cryb_strlcat(char *, const char *, size_t);
#ifndef HAVE_STRLCAT
#if !HAVE_STRLCAT
#undef strlcat
#define strlcat(arg, ...) cryb_strlcat(arg, __VA_ARGS__)
#endif

View File

@ -32,7 +32,7 @@
int cryb_strlcmp(const char *, const char *, size_t);
#ifndef HAVE_STRLCMP
#if !HAVE_STRLCMP
#undef strlcmp
#define strlcmp(...) cryb_strlcmp(__VA_ARGS__)
#endif

View File

@ -32,7 +32,7 @@
size_t cryb_strlcpy(char *, const char *, size_t);
#ifndef HAVE_STRLCPY
#if !HAVE_STRLCPY
#undef strlcpy
#define strlcpy(arg, ...) cryb_strlcpy(arg, __VA_ARGS__)
#endif

View File

@ -30,11 +30,11 @@
#include "cryb/impl.h"
#ifdef HAVE_SYS_ENDIAN_H
#if HAVE_SYS_ENDIAN_H
#include <sys/endian.h>
#endif
#ifdef HAVE_ENDIAN_H
#if HAVE_ENDIAN_H
#define _BSD_SOURCE
#include <endian.h>
#endif

View File

@ -30,11 +30,11 @@
#include "cryb/impl.h"
#ifdef HAVE_SYS_ENDIAN_H
#if HAVE_SYS_ENDIAN_H
#include <sys/endian.h>
#endif
#ifdef HAVE_ENDIAN_H
#if HAVE_ENDIAN_H
#define _BSD_SOURCE
#include <endian.h>
#endif

View File

@ -30,11 +30,11 @@
#include "cryb/impl.h"
#ifdef HAVE_SYS_ENDIAN_H
#if HAVE_SYS_ENDIAN_H
#include <sys/endian.h>
#endif
#ifdef HAVE_ENDIAN_H
#if HAVE_ENDIAN_H
#define _BSD_SOURCE
#include <endian.h>
#endif

View File

@ -30,11 +30,11 @@
#include "cryb/impl.h"
#ifdef HAVE_SYS_ENDIAN_H
#if HAVE_SYS_ENDIAN_H
#include <sys/endian.h>
#endif
#ifdef HAVE_ENDIAN_H
#if HAVE_ENDIAN_H
#define _BSD_SOURCE
#include <endian.h>
#endif

View File

@ -30,11 +30,11 @@
#include "cryb/impl.h"
#ifdef HAVE_SYS_ENDIAN_H
#if HAVE_SYS_ENDIAN_H
#include <sys/endian.h>
#endif
#ifdef HAVE_ENDIAN_H
#if HAVE_ENDIAN_H
#define _BSD_SOURCE
#include <endian.h>
#endif

View File

@ -30,11 +30,11 @@
#include "cryb/impl.h"
#ifdef HAVE_SYS_ENDIAN_H
#if HAVE_SYS_ENDIAN_H
#include <sys/endian.h>
#endif
#ifdef HAVE_ENDIAN_H
#if HAVE_ENDIAN_H
#define _BSD_SOURCE
#include <endian.h>
#endif

View File

@ -40,9 +40,9 @@
#define MAP_NOSYNC 0
#endif
#ifdef HAVE_UTRACE
#ifdef HAVE_SYS_KTRACE_H
#ifdef HAVE_SYS_UIO_H
#if HAVE_UTRACE
#if HAVE_SYS_KTRACE_H
#if HAVE_SYS_UIO_H
#include <sys/uio.h>
#endif
#include <sys/ktrace.h>